Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountEvent ¶
type AccountEvent struct {
EventType string `json:"e"` // "e": "outboundAccountInfo"
EventTime int64 `json:"E"` // "E": 1499405658658,
Balances []EventAssetBalance `json:"B"`
}
type BlockHeightEvent ¶
type BlockHeightEvent struct {
BlockHeight int64 `json:"h"` // "h": 1499405658658,
}
type EventAssetBalance ¶
type EventAssetBalance struct {
Asset string `json:"a"` // "a": "LTC", // Asset
Free types.Fixed8 `json:"f"` // "f": "17366.18538083", // Free amount
Frozen types.Fixed8 `json:"r"` // "r": "0.00000000" // Frozen amount
Locked types.Fixed8 `json:"l"` // "l": "0.00000000" // Locked amount
}
EventAssetBalance record structure as send to the user
type KlineEvent ¶
type KlineEvent struct {
EventType string `json:"e"` // "e": "executionReport"
EventTime int64 `json:"E"` // "E": 1499405658658,
Symbol string `json:"s"` // "s": "ETH_BTC",
Kline KlineRecordEvent `json:"k"`
}
type KlineInterval ¶
type KlineInterval string
const ( OneMinuteInterval KlineInterval = "1m" FiveMinutesInterval KlineInterval = "5m" FifteenMinuteInterval KlineInterval = "15m" ThirtMinutesInterval KlineInterval = "30m" OneHourInterval KlineInterval = "1h" TwoHoursInterval KlineInterval = "2h" FourHoursInterval KlineInterval = "4h" SixHoursInterval KlineInterval = "6h" EightHoursInterval KlineInterval = "8h" TwelveHoursInterval KlineInterval = "12h" OneDayInterval KlineInterval = "1d" ThreeDaysInterval KlineInterval = "3d" OneWeekInterval KlineInterval = "1w" OneMonthInterval KlineInterval = "1M" )
type KlineRecordEvent ¶
type KlineRecordEvent struct {
Timestamp int64 `json:"-"`
Symbol string `json:"s"` //"BNBBTC", // Symbol
OpenTime int64 `json:"t"` //123400000, // Kline start time
CloseTime int64 `json:"T"` //123460000, // Kline close time
Interval string `json:"i"` //"1m", // Interval
FirstTradeID string `json:"f"` //100, // First trade ID
LastTradeID string `json:"L"` //200, // Last trade ID
OpenPrice types.Fixed8 `json:"o"` //"0.0010", // Open price
ClosePrice types.Fixed8 `json:"c"` //"0.0020", // Close price
HighPrice types.Fixed8 `json:"h"` //"0.0025", // High price
LowPrice types.Fixed8 `json:"l"` //"0.0015", // Low price
Volume types.Double `json:"v"` //"1000", // Base asset volume
QuoteAssetVolume types.Double `json:"q"` //"1.0000", // Quote asset volume
NumberOfTrades int64 `json:"n"` //100, // Number of trades
Closed bool `json:"x"` //Is this kline closed?
}
KlineRecordEvent record structure as received from the kafka messages stream
type MarketDeltaEvent ¶
type MarketDeltaEvent struct {
EventType string `json:"e"` // "e": "depthUpdate",
EventTime int64 `json:"E"` // "E": 123456789,
Symbol string `json:"s"` // "s": "ETH_BTC",
Bids [][]types.Fixed8 `json:"b"` // "b": [ [ "0.0024", "10" ] ]
Asks [][]types.Fixed8 `json:"a"` // "a": [ [ "0.0024", "10" ] ]
}
type MarketDepthEvent ¶
type MiniTickerEvent ¶
type MiniTickerEvent struct {
EventType string `json:"e"` // "e": "24hrMiniTicker",
EventTime int64 `json:"E"` // "E": 123456789,
Symbol string `json:"s"` // "s": "BNBBTC", // Symbol
LastPrice types.Fixed8 `json:"c"` // "c": "0.0025", // Current day's close price
OpenPrice types.Fixed8 `json:"o"` // "o": "0.0010", // Open price
HighPrice types.Fixed8 `json:"h"` // "h": "0.0025", // High price
LowPrice types.Fixed8 `json:"l"` // "l": "0.0010", // Low price
Volume types.Double `json:"v"` // "v": "10000", // Total traded base asset volume
QuoteVolume types.Double `json:"q"` // "q": "18", // Total traded quote asset volume
}
type OrderEvent ¶
type OrderEvent struct {
EventType string `json:"e"` // "e": "executionReport"
EventTime int64 `json:"E"` // "E": 1499405658658,
Symbol string `json:"s"` // "s": "ETH_BTC",
Side int8 `json:"S"` //"S": "BUY",
OrderType int8 `json:"o"` //"o": "LIMIT", always to `LIMIT`, `will be published`
TimeInForce int8 `json:"f"` //"f": "GTC",
OrderQty types.Fixed8 `json:"q"` //"q": "1.00000000", `will be published`
OrderPrice types.Fixed8 `json:"p"` //"p": "0.10264410", `will be published`
CurrentExecutionType string `json:"x"` //"x": "NEW", always `NEW` for now `will be published`
CurrentOrderStatus string `json:"X"` //"X": "Ack", "Canceled", "Expired", "IocNoFill", "PartialFill", "FullyFill", "FailedBlocking", "FailedMatching", "Unknown"
OrderID string `json:"i"` //"i": "917E1846D6B3C40B97465CCF52818471E2C1027C-466",
LastExecutedQty types.Fixed8 `json:"l"` // "l": "0.00000000",
LastExecutedPrice types.Fixed8 `json:"L"` // "L": "0.00000000",
CommulativeFilledQty types.Fixed8 `json:"z"` // "z": "0.00000000",
CommissionAmount string `json:"n"` // "n": "0",
TransactionTime int64 `json:"T"` //"T": 1499405658657, `this will be the BLockheight`
TradeID string `json:"t"` //"t": -1, `will be published`
OrderCreationTime int64 `json:"O"` //"O": 1499405658657, `will be published`
}
type TickerEvent ¶
type TickerEvent struct {
EventType string `json:"e"` // "e": "24hrTicker",
EventTime int64 `json:"E"` // "E": 123456789,
Symbol string `json:"s"` // "s": "BNBBTC", // Symbol
PriceChange types.Fixed8 `json:"p"` // "p": "0.0015", // Price change
PriceChangePercent types.Fixed8 `json:"P"` // "P": "250.00", // Price change percent
WeightedAvgPrice types.Fixed8 `json:"w"` // "w": "0.0018", // Weighted average price
PrevClosePrice types.Fixed8 `json:"x"` // "x": "0.0009", // Previous day's close price
LastPrice types.Fixed8 `json:"c"` // "c": "0.0025", // Current day's close price
LastQuantity types.Fixed8 `json:"Q"` // "Q": "10", // Close trade's quantity
BidPrice types.Fixed8 `json:"b"` // "b": "0.0024", // Best bid price
BidQuantity types.Fixed8 `json:"B"` // "B": "10", // Best bid quantity
AskPrice types.Fixed8 `json:"a"` // "a": "0.0026", // Best ask price
AskQuantity types.Fixed8 `json:"A"` // "A": "100", // Best ask quantity
OpenPrice types.Fixed8 `json:"o"` // "o": "0.0010", // Open price
HighPrice types.Fixed8 `json:"h"` // "h": "0.0025", // High price
LowPrice types.Fixed8 `json:"l"` // "l": "0.0010", // Low price
Volume types.Double `json:"v"` // "v": "10000", // Total traded base asset volume
QuoteVolume types.Double `json:"q"` // "q": "18", // Total traded quote asset volume
OpenTime int64 `json:"O"` // "O": 0, // Statistics open time
CloseTime int64 `json:"C"` // "C": 86400000, // Statistics close time
FirstID string `json:"F"` // "F": 0, // First trade ID
LastID string `json:"L"` // "L": 18150, // Last trade Id
Count int64 `json:"n"` // "n": 18151 // Total number of trades
}
type TradeEvent ¶
type TradeEvent struct {
EventType string `json:"e"` // "e": "trade",
EventTime int64 `json:"E"` // "E": 123456789,
Symbol string `json:"s"` // "s": "ETH_BTC",
TradeID string `json:"t"` // "t": 4293153,
Price types.Fixed8 `json:"p"` // "p": "0.001",
Qty types.Fixed8 `json:"q"` // "q": "88",
BuyerOrderID string `json:"b"` // "f": "50",
SellerOrderID string `json:"a"` // "q": "100",
TradeTime int64 `json:"T"` // "p": 123456785
SellerAddress string `json:"sa"` // "sa": 0x4092678e4e78230f46a1534c0fbc8fa39780892b
BuyerAddress string `json:"ba"` // "ba": 0x4092778e4e78230f46a1534c0fbc8fa39780892c
}
type WSClient ¶
type WSClient interface {
SubscribeAccountEvent(userAddr string, quit chan struct{}, onReceive func(event *AccountEvent), onError func(err error), onClose func()) error
SubscribeBlockHeightEvent(quit chan struct{}, onReceive func(event *BlockHeightEvent), onError func(err error), onClose func()) error
SubscribeKlineEvent(baseAssetSymbol, quoteAssetSymbol string, interval KlineInterval, quit chan struct{}, onReceive func(event *KlineEvent), onError func(err error), onClose func()) error
SubscribeMarketDiffEvent(baseAssetSymbol, quoteAssetSymbol string, quit chan struct{}, onReceive func(event *MarketDeltaEvent), onError func(err error), onClose func()) error
SubscribeMarketDepthEvent(baseAssetSymbol, quoteAssetSymbol string, quit chan struct{}, onReceive func(event *MarketDepthEvent), onError func(err error), onClose func()) error
SubscribeOrderEvent(userAddr string, quit chan struct{}, onReceive func(event []*OrderEvent), onError func(err error), onClose func()) error
SubscribeTickerEvent(baseAssetSymbol, quoteAssetSymbol string, quit chan struct{}, onReceive func(event *TickerEvent), onError func(err error), onClose func()) error
SubscribeAllTickerEvent(quit chan struct{}, onReceive func(event []*TickerEvent), onError func(err error), onClose func()) error
SubscribeMiniTickerEvent(baseAssetSymbol, quoteAssetSymbol string, quit chan struct{}, onReceive func(event *MiniTickerEvent), onError func(err error), onClose func()) error
SubscribeAllMiniTickersEvent(quit chan struct{}, onReceive func(events []*MiniTickerEvent), onError func(err error), onClose func()) error
SubscribeTradeEvent(baseAssetSymbol, quoteAssetSymbol string, quit chan struct{}, onReceive func(events []*TradeEvent), onError func(err error), onClose func()) error
}
func NewClient ¶
func NewClient(c basic.BasicClient) WSClient
Click to show internal directories.
Click to hide internal directories.