-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12bd2a3
commit 283c635
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
} |