Documentation ¶
Overview ¶
Package streaming implements a client for the Luno Streaming API.
Example:
c, err := streaming.Dial(keyID, keySecret, "XBTZAR") if err != nil { log.Fatal(err) } defer c.Close() for { seq, bids, asks := c.OrderBookSnapshot() log.Printf("%d: %v %v\n", seq, bids[0], asks[0]) time.Sleep(time.Minute) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func Dial ¶
func Dial(keyID, keySecret, pair string, opts ...DialOption) (*Conn, error)
Dial initiates a connection to the streaming service and starts processing data for the given market pair. The connection will automatically reconnect on error.
func (*Conn) OrderBookSnapshot ¶
OrderBookSnapshot returns the latest order book.
type CreateUpdate ¶
type DeleteUpdate ¶
type DeleteUpdate struct {
OrderID string `json:"order_id"`
}
type DialOption ¶
type DialOption func(*Conn)
func WithUpdateCallback ¶
func WithUpdateCallback(fn UpdateCallback) DialOption
WithUpdateCallback returns an options which sets a callback function for streaming updates. Each update will first be applied to the order book, and then passed to the callback function.
type TradeUpdate ¶
type Update ¶
type Update struct { Sequence int64 `json:"sequence,string"` TradeUpdates []*TradeUpdate `json:"trade_updates"` CreateUpdate *CreateUpdate `json:"create_update"` DeleteUpdate *DeleteUpdate `json:"delete_update"` Timestamp int64 `json:"timestamp"` }
type UpdateCallback ¶
type UpdateCallback func(Update)
Click to show internal directories.
Click to hide internal directories.