Skip to content

Commit

Permalink
feat: stream
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed Aug 29, 2023
1 parent 12bd2a3 commit 283c635
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions stream/request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package stream

import (
"encoding/json"

"github.com/brokeyourbike/clearbank-api-client-go"
)

type SubscriptionRequest struct {
Type string `json:"Type"`
Version uint64 `json:"Version"`
Payload struct {
CurrencyPair string `json:"CurrencyPair"`
} `json:"Payload"`
}

func NewSubscriptionRequest(symbol string) SubscriptionRequest {
req := SubscriptionRequest{Type: "SubscriptionRequest", Version: 1}
req.Payload.CurrencyPair = symbol
return req
}

type MarketMessage struct {
Type string `json:"Type"`
Version uint64 `json:"Version"`
Payload json.RawMessage `json:"Payload"`
}

type HeartbeatPayload struct {
Time clearbank.Time `json:"Time"`
}

type MarketDataPayload struct {
Symbol string `json:"Symbol"`
Currency string `json:"Currency"`
ValueDate clearbank.Time `json:"ValueDate"`
Type string `json:"Type"`
SendingTime string `json:"SendingTime"`
Entries []struct {
Size float64 `json:"Size"`
Price float64 `json:"Price"`
} `json:"Entries"`
}

0 comments on commit 283c635

Please sign in to comment.