binance

package
v0.0.0-...-8d88297 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: AGPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const BNB = "BNB"
View Source
const BinanceTestBaseURL = "https://testnet.binance.vision"
View Source
const BinanceUSBaseURL = "https://api.binance.us"
View Source
const BinanceUSWebSocketURL = "wss://stream.binance.us:9443"
View Source
const FutureTestBaseURL = "https://testnet.binancefuture.com"
View Source
const FuturesWebSocketTestURL = "wss://stream.binancefuture.com"
View Source
const FuturesWebSocketURL = "wss://fstream.binance.com"
View Source
const WebSocketTestURL = "wss://testnet.binance.vision"
View Source
const WebSocketURL = "wss://stream.binance.com:9443"

Variables

View Source
var SupportedIntervals = map[types.Interval]int{
	types.Interval1s:  1,
	types.Interval1m:  1 * 60,
	types.Interval5m:  5 * 60,
	types.Interval15m: 15 * 60,
	types.Interval30m: 30 * 60,
	types.Interval1h:  60 * 60,
	types.Interval2h:  60 * 60 * 2,
	types.Interval4h:  60 * 60 * 4,
	types.Interval6h:  60 * 60 * 6,
	types.Interval12h: 60 * 60 * 12,
	types.Interval1d:  60 * 60 * 24,
	types.Interval3d:  60 * 60 * 24 * 3,
	types.Interval1w:  60 * 60 * 24 * 7,
}

in seconds

Functions

func IsBookTicker

func IsBookTicker(val *fastjson.Value) bool

IsBookTicker document ref :https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams use key recognition because there's no identify in the content.

Types

type AccountConfig

type AccountConfig struct {
	Symbol   string           `json:"s"`
	Leverage fixedpoint.Value `json:"l"`
}

type AccountConfigUpdateEvent

type AccountConfigUpdateEvent struct {
	EventBase
	Transaction int64 `json:"T"`

	AccountConfig AccountConfig `json:"ac"`
}

type AccountUpdate

type AccountUpdate struct {
	EventReasonType string                     `json:"m"`
	Balances        []*futures.Balance         `json:"B,omitempty"`
	Positions       []*futures.AccountPosition `json:"P,omitempty"`
}

type AccountUpdateEvent

type AccountUpdateEvent struct {
	EventBase
	Transaction int64 `json:"T"`

	AccountUpdate AccountUpdate `json:"a"`
}

type AggTradeEvent

type AggTradeEvent struct {
	EventBase
	Symbol         string           `json:"s"`
	Quantity       fixedpoint.Value `json:"q"`
	Price          fixedpoint.Value `json:"p"`
	FirstTradeId   int64            `json:"f"`
	LastTradeId    int64            `json:"l"`
	OrderTradeTime int64            `json:"T"`
	IsMaker        bool             `json:"m"`
	Dummy          bool             `json:"M"`
}

func (*AggTradeEvent) Trade

func (e *AggTradeEvent) Trade() types.Trade

type Balance

type Balance struct {
	Asset  string           `json:"a"`
	Free   fixedpoint.Value `json:"f"`
	Locked fixedpoint.Value `json:"l"`
}

outboundAccountInfo

{
  "e": "outboundAccountInfo",   // KLineEvent type
  "E": 1499405658849,           // KLineEvent time
  "m": 0,                       // Maker commission rate (bips)
  "t": 0,                       // Taker commission rate (bips)
  "b": 0,                       // Buyer commission rate (bips)
  "s": 0,                       // Seller commission rate (bips)
  "T": true,                    // Can trade?
  "W": true,                    // Can withdraw?
  "D": true,                    // Can deposit?
  "u": 1499405658848,           // Time of last account update
  "B": [                        // AccountBalances array
    {
      "a": "LTC",               // Asset
      "f": "17366.18538083",    // Free amount
      "l": "0.00000000"         // Locked amount
    },
    {
      "a": "BTC",
      "f": "10537.85314051",
      "l": "2.19464093"
    },
    {
      "a": "ETH",
      "f": "17902.35190619",
      "l": "0.00000000"
    },
    {
      "a": "BNC",
      "f": "1114503.29769312",
      "l": "0.00000000"
    },
    {
      "a": "NEO",
      "f": "0.00000000",
      "l": "0.00000000"
    }
  ],
  "P": [                       // Account Permissions
        "SPOT"
  ]
}

type BalanceUpdateEvent

type BalanceUpdateEvent struct {
	EventBase

	Asset     string `json:"a"`
	Delta     string `json:"d"`
	ClearTime int64  `json:"T"`
}

balanceUpdate

{
  "e": "balanceUpdate",         //KLineEvent Type
  "E": 1573200697110,           //KLineEvent Time
  "a": "BTC",                   //Asset
  "d": "100.00000000",          //Balance Delta
  "T": 1573200697068            //Clear Time
}

type BookTickerEvent

type BookTickerEvent struct {
	EventBase
	Symbol   string           `json:"s"`
	Buy      fixedpoint.Value `json:"b"`
	BuySize  fixedpoint.Value `json:"B"`
	Sell     fixedpoint.Value `json:"a"`
	SellSize fixedpoint.Value `json:"A"`
}

func (*BookTickerEvent) BookTicker

func (k *BookTickerEvent) BookTicker() types.BookTicker

type ContinuousKLineEvent

type ContinuousKLineEvent struct {
	EventBase
	Symbol string `json:"ps"`

	KLine KLine `json:"k,omitempty"`
	// contains filtered or unexported fields
}

type DepthEntry

type DepthEntry struct {
	PriceLevel fixedpoint.Value
	Quantity   fixedpoint.Value
}

type DepthEvent

type DepthEvent struct {
	EventBase

	Symbol        string `json:"s"`
	FirstUpdateID int64  `json:"U"`
	FinalUpdateID int64  `json:"u"`

	Bids types.PriceVolumeSlice `json:"b"`
	Asks types.PriceVolumeSlice `json:"a"`
}

func (*DepthEvent) OrderBook

func (e *DepthEvent) OrderBook() (book types.SliceOrderBook, err error)

func (*DepthEvent) String

func (e *DepthEvent) String() (o string)

type EventBase

type EventBase struct {
	Event string `json:"e"` // event
	Time  int64  `json:"E"`
}

type Exchange

type Exchange struct {
	types.MarginSettings
	types.FuturesSettings

	FClient *futures.Client // USDT-M Futures
	// contains filtered or unexported fields
}

func New

func New(key, secret string) *Exchange

func (*Exchange) BorrowMarginAsset

func (e *Exchange) BorrowMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error

func (*Exchange) CancelOrders

func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err error)

func (*Exchange) DefaultFeeRates

func (e *Exchange) DefaultFeeRates() types.ExchangeFee

DefaultFeeRates returns the Binance VIP 0 fee schedule See also https://www.binance.com/en/fee/schedule

func (*Exchange) IsSupportedInterval

func (e *Exchange) IsSupportedInterval(interval types.Interval) bool

func (*Exchange) Name

func (e *Exchange) Name() types.ExchangeName

func (*Exchange) NewStream

func (e *Exchange) NewStream() types.Stream

func (*Exchange) PlatformFeeCurrency

func (e *Exchange) PlatformFeeCurrency() string

func (*Exchange) QueryAccount

func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error)

func (*Exchange) QueryAccountBalances

func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error)

func (*Exchange) QueryAveragePrice

func (e *Exchange) QueryAveragePrice(ctx context.Context, symbol string) (fixedpoint.Value, error)

func (*Exchange) QueryClosedOrders

func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error)

func (*Exchange) QueryCrossMarginAccount

func (e *Exchange) QueryCrossMarginAccount(ctx context.Context) (*types.Account, error)

func (*Exchange) QueryDepositHistory

func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, until time.Time) (allDeposits []types.Deposit, err error)

func (*Exchange) QueryDepth

func (e *Exchange) QueryDepth(ctx context.Context, symbol string) (snapshot types.SliceOrderBook, finalUpdateID int64, err error)

QueryDepth query the order book depth of a symbol

func (*Exchange) QueryFundingRateHistory

func (e *Exchange) QueryFundingRateHistory(ctx context.Context, symbol string) (*types.FundingRate, error)

func (*Exchange) QueryFuturesAccount

func (e *Exchange) QueryFuturesAccount(ctx context.Context) (*types.Account, error)

QueryFuturesAccount gets the futures account balances from Binance Balance.Available = Wallet Balance(in Binance UI) - Used Margin Balance.Locked = Used Margin

func (*Exchange) QueryFuturesKLines

func (e *Exchange) QueryFuturesKLines(ctx context.Context, symbol string, interval types.Interval, options types.KLineQueryOptions) ([]types.KLine, error)

func (*Exchange) QueryInterestHistory

func (e *Exchange) QueryInterestHistory(ctx context.Context, asset string, startTime, endTime *time.Time) ([]types.MarginInterest, error)

func (*Exchange) QueryIsolatedMarginAccount

func (e *Exchange) QueryIsolatedMarginAccount(ctx context.Context) (*types.Account, error)

func (*Exchange) QueryKLines

func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, options types.KLineQueryOptions) ([]types.KLine, error)

QueryKLines queries the Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time. Binance uses inclusive start time query range, eg: https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1m&startTime=1620172860000 the above query will return a kline with startTime = 1620172860000 and, https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1m&startTime=1620172860000&endTime=1620172920000 the above query will return a kline with startTime = 1620172860000, and a kline with endTime = 1620172860000

the endTime of a binance kline, is the (startTime + interval time - 1 millisecond), e.g., millisecond unix timestamp: 1620172860000 and 1620172919999

func (*Exchange) QueryLiquidationHistory

func (e *Exchange) QueryLiquidationHistory(ctx context.Context, startTime, endTime *time.Time) ([]types.MarginLiquidation, error)

func (*Exchange) QueryLoanHistory

func (e *Exchange) QueryLoanHistory(ctx context.Context, asset string, startTime, endTime *time.Time) ([]types.MarginLoan, error)

func (*Exchange) QueryMarginAssetMaxBorrowable

func (e *Exchange) QueryMarginAssetMaxBorrowable(ctx context.Context, asset string) (amount fixedpoint.Value, err error)

func (*Exchange) QueryMarginBorrowHistory

func (e *Exchange) QueryMarginBorrowHistory(ctx context.Context, asset string) error

func (*Exchange) QueryMarkets

func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error)

func (*Exchange) QueryOpenOrders

func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error)

func (*Exchange) QueryOrder

func (e *Exchange) QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error)

func (*Exchange) QueryOrderTrades

func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]types.Trade, error)

func (*Exchange) QueryPositions

func (e *Exchange) QueryPositions(ctx context.Context, symbol string) ([]*types.Positions, error)

func (*Exchange) QueryPremiumIndex

func (e *Exchange) QueryPremiumIndex(ctx context.Context, symbol string) (*types.PremiumIndex, error)

QueryPremiumIndex is only for futures

func (*Exchange) QueryRepayHistory

func (e *Exchange) QueryRepayHistory(ctx context.Context, asset string, startTime, endTime *time.Time) ([]types.MarginRepay, error)

func (*Exchange) QueryRewards

func (e *Exchange) QueryRewards(ctx context.Context, startTime time.Time) ([]types.Reward, error)

func (*Exchange) QuerySpotAccount

func (e *Exchange) QuerySpotAccount(ctx context.Context) (*types.Account, error)

func (*Exchange) QueryTicker

func (e *Exchange) QueryTicker(ctx context.Context, symbol string) (*types.Ticker, error)

func (*Exchange) QueryTickers

func (e *Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[string]types.Ticker, error)

func (*Exchange) QueryTrades

func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) ([]types.Trade, error)

func (*Exchange) QueryWithdrawHistory

func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since, until time.Time) (withdraws []types.Withdraw, err error)

func (*Exchange) RepayMarginAsset

func (e *Exchange) RepayMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error

func (*Exchange) SubmitOrder

func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error)

func (*Exchange) SupportedInterval

func (e *Exchange) SupportedInterval() map[types.Interval]int

func (*Exchange) Withdraw

func (e *Exchange) Withdraw(ctx context.Context, asset string, amount fixedpoint.Value, address string, options *types.WithdrawalOptions) error

type ExecutionReportEvent

type ExecutionReportEvent struct {
	EventBase

	Symbol string `json:"s"`
	Side   string `json:"S"`

	ClientOrderID         string `json:"c"`
	OriginalClientOrderID string `json:"C"`

	OrderType         string `json:"o"`
	OrderCreationTime int64  `json:"O"`

	TimeInForce     string           `json:"f"`
	IcebergQuantity fixedpoint.Value `json:"F"`

	OrderQuantity      fixedpoint.Value `json:"q"`
	QuoteOrderQuantity fixedpoint.Value `json:"Q"`

	OrderPrice fixedpoint.Value `json:"p"`
	StopPrice  fixedpoint.Value `json:"P"`

	IsOnBook bool `json:"w"`

	IsMaker bool `json:"m"`
	Ignore  bool `json:"M"`

	CommissionAmount fixedpoint.Value `json:"n"`
	CommissionAsset  string           `json:"N"`

	CurrentExecutionType string `json:"x"`
	CurrentOrderStatus   string `json:"X"`

	OrderID int64 `json:"i"`
	Ignored int64 `json:"I"`

	TradeID         int64 `json:"t"`
	TransactionTime int64 `json:"T"`

	LastExecutedQuantity fixedpoint.Value `json:"l"`
	LastExecutedPrice    fixedpoint.Value `json:"L"`

	CumulativeFilledQuantity               fixedpoint.Value `json:"z"`
	CumulativeQuoteAssetTransactedQuantity fixedpoint.Value `json:"Z"`

	LastQuoteAssetTransactedQuantity fixedpoint.Value `json:"Y"`
}

executionReport

{
  "e": "executionReport",        // Event type
  "E": 1499405658658,            // Event time
  "s": "ETHBTC",                 // Symbol
  "c": "mUvoqJxFIILMdfAW5iGSOW", // Client order ID
  "S": "BUY",                    // Side
  "o": "LIMIT",                  // Order type
  "f": "GTC",                    // Time in force
  "q": "1.00000000",             // Order quantity
  "p": "0.10264410",             // Order price
  "P": "0.00000000",             // Stop price
  "F": "0.00000000",             // Iceberg quantity
  "g": -1,                       // OrderListId
  "C": null,                     // Original client order ID; This is the ID of the order being canceled
  "x": "NEW",                    // Current execution type
  "X": "NEW",                    // Current order status
  "r": "NONE",                   // Order reject reason; will be an error code.
  "i": 4293153,                  // Order ID
  "l": "0.00000000",             // Last executed quantity
  "z": "0.00000000",             // Cumulative filled quantity
  "L": "0.00000000",             // Last executed price
  "n": "0",                      // Commission amount
  "N": null,                     // Commission asset
  "T": 1499405658657,            // Transaction time
  "t": -1,                       // Trade ID
  "I": 8641984,                  // Ignore
  "w": true,                     // Is the order on the book?
  "m": false,                    // Is this trade the maker side?
  "M": false,                    // Ignore
  "O": 1499405658657,            // Order creation time
  "Z": "0.00000000",             // Cumulative quote asset transacted quantity
  "Y": "0.00000000",             // Last quote asset transacted quantity (i.e. lastPrice * lastQty)
  "Q": "0.00000000"              // Quote Order Quantity
}

func (*ExecutionReportEvent) Order

func (e *ExecutionReportEvent) Order() (*types.Order, error)

func (*ExecutionReportEvent) Trade

func (e *ExecutionReportEvent) Trade() (*types.Trade, error)

type KLine

type KLine struct {
	StartTime int64 `json:"t"`
	EndTime   int64 `json:"T"`

	Symbol   string `json:"s"`
	Interval string `json:"i"`

	Open  fixedpoint.Value `json:"o"`
	Close fixedpoint.Value `json:"c"`
	High  fixedpoint.Value `json:"h"`
	Low   fixedpoint.Value `json:"l"`

	Volume      fixedpoint.Value `json:"v"` // base asset volume (like 10 BTC)
	QuoteVolume fixedpoint.Value `json:"q"` // quote asset volume

	TakerBuyBaseAssetVolume  fixedpoint.Value `json:"V"` // taker buy base asset volume (like 10 BTC)
	TakerBuyQuoteAssetVolume fixedpoint.Value `json:"Q"` // taker buy quote asset volume (like 1000USDT)

	LastTradeID    int   `json:"L"`
	NumberOfTrades int64 `json:"n"`
	Closed         bool  `json:"x"`
}

func (*KLine) KLine

func (k *KLine) KLine() types.KLine

type KLineEvent

type KLineEvent struct {
	EventBase
	Symbol string `json:"s"`
	KLine  KLine  `json:"k,omitempty"`
}

type ListenKeyExpired

type ListenKeyExpired struct {
	EventBase
}

type MarkPriceUpdateEvent

type MarkPriceUpdateEvent struct {
	EventBase

	Symbol string `json:"s"`

	MarkPrice      fixedpoint.Value `json:"p"`
	IndexPrice     fixedpoint.Value `json:"i"`
	EstimatedPrice fixedpoint.Value `json:"P"`

	FundingRate     fixedpoint.Value `json:"r"`
	NextFundingTime int64            `json:"T"`
}

type MarketTradeEvent

type MarketTradeEvent struct {
	EventBase
	Symbol   string           `json:"s"`
	Quantity fixedpoint.Value `json:"q"`
	Price    fixedpoint.Value `json:"p"`

	BuyerOrderId  int64 `json:"b"`
	SellerOrderId int64 `json:"a"`

	OrderTradeTime int64 `json:"T"`
	TradeId        int64 `json:"t"`

	IsMaker bool `json:"m"`
	Dummy   bool `json:"M"`
}

func (*MarketTradeEvent) Trade

func (e *MarketTradeEvent) Trade() types.Trade

type OrderTrade

type OrderTrade struct {
	Symbol           string           `json:"s"`
	ClientOrderID    string           `json:"c"`
	Side             string           `json:"S"`
	OrderType        string           `json:"o"`
	TimeInForce      string           `json:"f"`
	OriginalQuantity fixedpoint.Value `json:"q"`
	OriginalPrice    fixedpoint.Value `json:"p"`

	AveragePrice         fixedpoint.Value `json:"ap"`
	StopPrice            fixedpoint.Value `json:"sp"`
	CurrentExecutionType string           `json:"x"`
	CurrentOrderStatus   string           `json:"X"`

	OrderId                        int64            `json:"i"`
	OrderLastFilledQuantity        fixedpoint.Value `json:"l"`
	OrderFilledAccumulatedQuantity fixedpoint.Value `json:"z"`
	LastFilledPrice                fixedpoint.Value `json:"L"`

	CommissionAmount fixedpoint.Value `json:"n"`
	CommissionAsset  string           `json:"N"`

	OrderTradeTime int64 `json:"T"`
	TradeId        int64 `json:"t"`

	BidsNotional string `json:"b"`
	AskNotional  string `json:"a"`

	IsMaker      bool `json:"m"`
	IsReduceOnly bool ` json:"r"`

	StopPriceWorkingType string `json:"wt"`
	OriginalOrderType    string `json:"ot"`
	PositionSide         string `json:"ps"`
	RealizedProfit       string `json:"rp"`
}

Similar to the ExecutionReportEvent's fields. But with totally different json key. e.g., Stop price. So that, we can not merge them.

type OrderTradeUpdateEvent

type OrderTradeUpdateEvent struct {
	EventBase
	Transaction int64      `json:"T"`
	OrderTrade  OrderTrade `json:"o"`
}

func (*OrderTradeUpdateEvent) OrderFutures

func (e *OrderTradeUpdateEvent) OrderFutures() (*types.Order, error)

func (*OrderTradeUpdateEvent) TradeFutures

func (e *OrderTradeUpdateEvent) TradeFutures() (*types.Trade, error)

type OutboundAccountInfoEvent

type OutboundAccountInfoEvent struct {
	EventBase

	MakerCommissionRate  int `json:"m"`
	TakerCommissionRate  int `json:"t"`
	BuyerCommissionRate  int `json:"b"`
	SellerCommissionRate int `json:"s"`

	CanTrade    bool `json:"T"`
	CanWithdraw bool `json:"W"`
	CanDeposit  bool `json:"D"`

	LastAccountUpdateTime int `json:"u"`

	Balances    []Balance `json:"B,omitempty"`
	Permissions []string  `json:"P,omitempty"`
}

type OutboundAccountPositionEvent

type OutboundAccountPositionEvent struct {
	EventBase

	LastAccountUpdateTime int       `json:"u"`
	Balances              []Balance `json:"B,omitempty"`
}

type ResultEvent

type ResultEvent struct {
	Result interface{} `json:"result,omitempty"`
	ID     int         `json:"id"`
}

type Stream

type Stream struct {
	types.MarginSettings
	types.FuturesSettings
	types.StandardStream
	// contains filtered or unexported fields
}

func NewStream

func NewStream(ex *Exchange, client *binance.Client, futuresClient *futures.Client) *Stream

func (*Stream) EmitAccountConfigUpdateEvent

func (s *Stream) EmitAccountConfigUpdateEvent(e *AccountConfigUpdateEvent)

func (*Stream) EmitAccountUpdateEvent

func (s *Stream) EmitAccountUpdateEvent(e *AccountUpdateEvent)

func (*Stream) EmitAggTradeEvent

func (s *Stream) EmitAggTradeEvent(e *AggTradeEvent)

func (*Stream) EmitBalanceUpdateEvent

func (s *Stream) EmitBalanceUpdateEvent(event *BalanceUpdateEvent)

func (*Stream) EmitBookTickerEvent

func (s *Stream) EmitBookTickerEvent(event *BookTickerEvent)

func (*Stream) EmitContinuousKLineClosedEvent

func (s *Stream) EmitContinuousKLineClosedEvent(e *ContinuousKLineEvent)

func (*Stream) EmitContinuousKLineEvent

func (s *Stream) EmitContinuousKLineEvent(e *ContinuousKLineEvent)

func (*Stream) EmitDepthEvent

func (s *Stream) EmitDepthEvent(e *DepthEvent)

func (*Stream) EmitExecutionReportEvent

func (s *Stream) EmitExecutionReportEvent(event *ExecutionReportEvent)

func (*Stream) EmitKLineClosedEvent

func (s *Stream) EmitKLineClosedEvent(e *KLineEvent)

func (*Stream) EmitKLineEvent

func (s *Stream) EmitKLineEvent(e *KLineEvent)

func (*Stream) EmitListenKeyExpired

func (s *Stream) EmitListenKeyExpired(e *ListenKeyExpired)

func (*Stream) EmitMarkPriceUpdateEvent

func (s *Stream) EmitMarkPriceUpdateEvent(e *MarkPriceUpdateEvent)

func (*Stream) EmitMarketTradeEvent

func (s *Stream) EmitMarketTradeEvent(e *MarketTradeEvent)

func (*Stream) EmitOrderTradeUpdateEvent

func (s *Stream) EmitOrderTradeUpdateEvent(e *OrderTradeUpdateEvent)

func (*Stream) EmitOutboundAccountInfoEvent

func (s *Stream) EmitOutboundAccountInfoEvent(event *OutboundAccountInfoEvent)

func (*Stream) EmitOutboundAccountPositionEvent

func (s *Stream) EmitOutboundAccountPositionEvent(event *OutboundAccountPositionEvent)

func (*Stream) OnAccountConfigUpdateEvent

func (s *Stream) OnAccountConfigUpdateEvent(cb func(e *AccountConfigUpdateEvent))

func (*Stream) OnAccountUpdateEvent

func (s *Stream) OnAccountUpdateEvent(cb func(e *AccountUpdateEvent))

func (*Stream) OnAggTradeEvent

func (s *Stream) OnAggTradeEvent(cb func(e *AggTradeEvent))

func (*Stream) OnBalanceUpdateEvent

func (s *Stream) OnBalanceUpdateEvent(cb func(event *BalanceUpdateEvent))

func (*Stream) OnBookTickerEvent

func (s *Stream) OnBookTickerEvent(cb func(event *BookTickerEvent))

func (*Stream) OnContinuousKLineClosedEvent

func (s *Stream) OnContinuousKLineClosedEvent(cb func(e *ContinuousKLineEvent))

func (*Stream) OnContinuousKLineEvent

func (s *Stream) OnContinuousKLineEvent(cb func(e *ContinuousKLineEvent))

func (*Stream) OnDepthEvent

func (s *Stream) OnDepthEvent(cb func(e *DepthEvent))

func (*Stream) OnExecutionReportEvent

func (s *Stream) OnExecutionReportEvent(cb func(event *ExecutionReportEvent))

func (*Stream) OnKLineClosedEvent

func (s *Stream) OnKLineClosedEvent(cb func(e *KLineEvent))

func (*Stream) OnKLineEvent

func (s *Stream) OnKLineEvent(cb func(e *KLineEvent))

func (*Stream) OnListenKeyExpired

func (s *Stream) OnListenKeyExpired(cb func(e *ListenKeyExpired))

func (*Stream) OnMarkPriceUpdateEvent

func (s *Stream) OnMarkPriceUpdateEvent(cb func(e *MarkPriceUpdateEvent))

func (*Stream) OnMarketTradeEvent

func (s *Stream) OnMarketTradeEvent(cb func(e *MarketTradeEvent))

func (*Stream) OnOrderTradeUpdateEvent

func (s *Stream) OnOrderTradeUpdateEvent(cb func(e *OrderTradeUpdateEvent))

func (*Stream) OnOutboundAccountInfoEvent

func (s *Stream) OnOutboundAccountInfoEvent(cb func(event *OutboundAccountInfoEvent))

func (*Stream) OnOutboundAccountPositionEvent

func (s *Stream) OnOutboundAccountPositionEvent(cb func(event *OutboundAccountPositionEvent))

type StreamEventHub

type StreamEventHub interface {
	OnDepthEvent(cb func(e *DepthEvent))

	OnKLineEvent(cb func(e *KLineEvent))

	OnKLineClosedEvent(cb func(e *KLineEvent))

	OnMarkPriceUpdateEvent(cb func(e *MarkPriceUpdateEvent))

	OnMarketTradeEvent(cb func(e *MarketTradeEvent))

	OnAggTradeEvent(cb func(e *AggTradeEvent))

	OnContinuousKLineEvent(cb func(e *ContinuousKLineEvent))

	OnContinuousKLineClosedEvent(cb func(e *ContinuousKLineEvent))

	OnBalanceUpdateEvent(cb func(event *BalanceUpdateEvent))

	OnOutboundAccountInfoEvent(cb func(event *OutboundAccountInfoEvent))

	OnOutboundAccountPositionEvent(cb func(event *OutboundAccountPositionEvent))

	OnExecutionReportEvent(cb func(event *ExecutionReportEvent))

	OnBookTickerEvent(cb func(event *BookTickerEvent))

	OnOrderTradeUpdateEvent(cb func(e *OrderTradeUpdateEvent))

	OnAccountUpdateEvent(cb func(e *AccountUpdateEvent))

	OnAccountConfigUpdateEvent(cb func(e *AccountConfigUpdateEvent))

	OnListenKeyExpired(cb func(e *ListenKeyExpired))
}

type WebSocketCommand

type WebSocketCommand struct {
	// request ID is required
	ID     int      `json:"id"`
	Method string   `json:"method"`
	Params []string `json:"params"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL