Versions in this module Expand all Collapse all v0 v0.0.1 May 4, 2024 Changes in this version + const BNB + const BinanceTestBaseURL + const BinanceUSBaseURL + const BinanceUSWebSocketURL + const DefaultDepthLimit + const FutureTestBaseURL + const FuturesWebSocketTestURL + const FuturesWebSocketURL + const WebSocketTestURL + const WebSocketURL + var SupportedIntervals = map[types.Interval]int + func StringBatch(data []string, num int) [][]string + type AccountConfigUpdateEvent struct + AccountConfig struct{ ... } + MarginModeConfig struct{ ... } + Transaction int64 + type AccountUpdate struct + Balances []FuturesStreamBalance + EventReasonType AccountUpdateEventReasonType + Positions []FuturesStreamPosition + type AccountUpdateEvent struct + AccountUpdate AccountUpdate + Transaction int64 + type AccountUpdateEventReasonType string + const AccountUpdateEventReasonAdminDeposit + const AccountUpdateEventReasonAdminWithdraw + const AccountUpdateEventReasonAssetTransfer + const AccountUpdateEventReasonDeposit + const AccountUpdateEventReasonFundingFee + const AccountUpdateEventReasonMarginTransfer + const AccountUpdateEventReasonMarginTypeChange + const AccountUpdateEventReasonOrder + const AccountUpdateEventReasonWithdraw + type AggTradeEvent struct + Dummy bool + FirstTradeId int64 + IsMaker bool + LastTradeId int64 + OrderTradeTime int64 + Price fixedpoint.Value + Quantity fixedpoint.Value + Symbol string + func (e *AggTradeEvent) Trade() types.Trade + type Balance struct + Asset string + Free fixedpoint.Value + Locked fixedpoint.Value + type BalanceUpdateEvent struct + Asset string + ClearTime types.MillisecondTimestamp + Delta fixedpoint.Value + func (e *BalanceUpdateEvent) SlackAttachment() slack.Attachment + type BookTickerEvent struct + Buy fixedpoint.Value + BuySize fixedpoint.Value + Sell fixedpoint.Value + SellSize fixedpoint.Value + Symbol string + UpdateID int64 + func (k *BookTickerEvent) BookTicker() types.BookTicker + type BorrowRepayType interface + type ContinuousKLineEvent struct + KLine KLine + Symbol string + type DepthEntry struct + PriceLevel fixedpoint.Value + Quantity fixedpoint.Value + type DepthEvent struct + Asks types.PriceVolumeSlice + Bids types.PriceVolumeSlice + FinalUpdateID int64 + FirstUpdateID int64 + Symbol string + func (e *DepthEvent) OrderBook() (book types.SliceOrderBook, err error) + func (e *DepthEvent) String() (o string) + type EventBase struct + Event string + Time types.MillisecondTimestamp + type EventType = string + const EventTypeAggTrade + const EventTypeBalanceUpdate + const EventTypeBookTicker + const EventTypeDepthUpdate + const EventTypeExecutionReport + const EventTypeForceOrder + const EventTypeKLine + const EventTypeListenKeyExpired + const EventTypeOutboundAccountInfo + const EventTypeOutboundAccountPosition + const EventTypePartialDepth + const EventTypeTrade + type Exchange struct + func New(key, secret string) *Exchange + func (e *Exchange) BorrowMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error + func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err error) + func (e *Exchange) CancelReplace(ctx context.Context, cancelReplaceMode types.CancelReplaceModeType, ...) (*types.Order, error) + func (e *Exchange) DefaultFeeRates() types.ExchangeFee + func (e *Exchange) GetFuturesClient() *binanceapi.FuturesRestClient + func (e *Exchange) IsSupportedInterval(interval types.Interval) bool + func (e *Exchange) Name() types.ExchangeName + func (e *Exchange) NewStream() types.Stream + func (e *Exchange) PlatformFeeCurrency() string + func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) + func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error) + func (e *Exchange) QueryAveragePrice(ctx context.Context, symbol string) (fixedpoint.Value, error) + func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error) + func (e *Exchange) QueryCrossMarginAccount(ctx context.Context) (*types.Account, error) + func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, until time.Time) (allDeposits []types.Deposit, err error) + func (e *Exchange) QueryDepth(ctx context.Context, symbol string) (snapshot types.SliceOrderBook, finalUpdateID int64, err error) + func (e *Exchange) QueryFundingRateHistory(ctx context.Context, symbol string) (*types.FundingRate, error) + func (e *Exchange) QueryFuturesAccount(ctx context.Context) (*types.Account, error) + func (e *Exchange) QueryFuturesIncomeHistory(ctx context.Context, symbol string, incomeType binanceapi.FuturesIncomeType, ...) ([]binanceapi.FuturesIncome, error) + func (e *Exchange) QueryFuturesKLines(ctx context.Context, symbol string, interval types.Interval, ...) ([]types.KLine, error) + func (e *Exchange) QueryFuturesPositionRisks(ctx context.Context, symbol string) error + func (e *Exchange) QueryHistoricalTrades(ctx context.Context, symbol string, limit uint64) ([]types.Trade, error) + func (e *Exchange) QueryInterestHistory(ctx context.Context, asset string, startTime, endTime *time.Time) ([]types.MarginInterest, error) + func (e *Exchange) QueryIsolatedMarginAccount(ctx context.Context) (*types.Account, error) + func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, ...) ([]types.KLine, error) + func (e *Exchange) QueryLiquidationHistory(ctx context.Context, startTime, endTime *time.Time) ([]types.MarginLiquidation, error) + func (e *Exchange) QueryLoanHistory(ctx context.Context, asset string, startTime, endTime *time.Time) ([]types.MarginLoan, error) + func (e *Exchange) QueryMarginAssetMaxBorrowable(ctx context.Context, asset string) (amount fixedpoint.Value, err error) + func (e *Exchange) QueryMarginBorrowHistory(ctx context.Context, asset string) error + func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) + func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error) + func (e *Exchange) QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error) + func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]types.Trade, error) + func (e *Exchange) QueryPositionRisk(ctx context.Context, symbol string) (*types.PositionRisk, error) + func (e *Exchange) QueryPremiumIndex(ctx context.Context, symbol string) (*types.PremiumIndex, error) + func (e *Exchange) QueryRepayHistory(ctx context.Context, asset string, startTime, endTime *time.Time) ([]types.MarginRepay, error) + func (e *Exchange) QueryRewards(ctx context.Context, startTime time.Time) ([]types.Reward, error) + func (e *Exchange) QuerySpotAccount(ctx context.Context) (*types.Account, error) + func (e *Exchange) QueryTicker(ctx context.Context, symbol string) (*types.Ticker, error) + func (e *Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[string]types.Ticker, error) + func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) ([]types.Trade, error) + func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since, until time.Time) (withdraws []types.Withdraw, err error) + func (e *Exchange) RepayMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error + func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error) + func (e *Exchange) SupportedInterval() map[types.Interval]int + func (e *Exchange) TransferFuturesAccountAsset(ctx context.Context, asset string, amount fixedpoint.Value, ...) error + func (e *Exchange) TransferMarginAccountAsset(ctx context.Context, asset string, amount fixedpoint.Value, ...) error + func (e *Exchange) Withdraw(ctx context.Context, asset string, amount fixedpoint.Value, address string, ...) error + type ExecutionReportEvent struct + ClientOrderID string + CommissionAmount fixedpoint.Value + CommissionAsset string + CumulativeFilledQuantity fixedpoint.Value + CumulativeQuoteAssetTransactedQuantity fixedpoint.Value + CurrentExecutionType string + CurrentOrderStatus string + IcebergQuantity fixedpoint.Value + Ignore bool + Ignored int64 + IsMaker bool + IsOnBook bool + LastExecutedPrice fixedpoint.Value + LastExecutedQuantity fixedpoint.Value + LastQuoteAssetTransactedQuantity fixedpoint.Value + OrderCreationTime int64 + OrderID int64 + OrderPrice fixedpoint.Value + OrderQuantity fixedpoint.Value + OrderType string + OriginalClientOrderID string + QuoteOrderQuantity fixedpoint.Value + Side string + StopPrice fixedpoint.Value + Symbol string + TimeInForce string + TradeID int64 + TrailingTime types.MillisecondTimestamp + TransactionTime int64 + WorkingTime types.MillisecondTimestamp + func (e *ExecutionReportEvent) Order() (*types.Order, error) + func (e *ExecutionReportEvent) Trade() (*types.Trade, error) + type ForceOrderEvent struct + Order ForceOrderEventInner + func (e *ForceOrderEvent) LiquidationInfo() types.LiquidationInfo + type ForceOrderEventInner struct + AveragePrice fixedpoint.Value + LastFilledAccQuantity fixedpoint.Value + LastFilledQuantity fixedpoint.Value + OrderStatus string + OrderType string + Price fixedpoint.Value + Quantity fixedpoint.Value + Side string + Symbol string + TimeInForce string + TradeTime types.MillisecondTimestamp + type FuturesStreamBalance struct + Asset string + BalanceChange fixedpoint.Value + CrossWalletBalance fixedpoint.Value + WalletBalance fixedpoint.Value + type FuturesStreamPosition struct + AccumulatedRealizedPnL fixedpoint.Value + EntryPrice fixedpoint.Value + IsolatedWallet fixedpoint.Value + MarginType string + PositionAmount fixedpoint.Value + PositionSide string + Symbol string + UnrealizedPnL fixedpoint.Value + type KLine struct + Close fixedpoint.Value + Closed bool + EndTime int64 + High fixedpoint.Value + Interval string + LastTradeID int + Low fixedpoint.Value + NumberOfTrades int64 + Open fixedpoint.Value + QuoteVolume fixedpoint.Value + StartTime int64 + Symbol string + TakerBuyBaseAssetVolume fixedpoint.Value + TakerBuyQuoteAssetVolume fixedpoint.Value + Volume fixedpoint.Value + func (k *KLine) KLine() types.KLine + type KLineEvent struct + KLine KLine + Symbol string + type ListenKeyExpired struct + type MarginCallEvent struct + CrossWalletBalance fixedpoint.Value + P []struct{ ... } + type MarkPriceUpdateEvent struct + EstimatedPrice fixedpoint.Value + FundingRate fixedpoint.Value + IndexPrice fixedpoint.Value + MarkPrice fixedpoint.Value + NextFundingTime int64 + Symbol string + type MarketTradeEvent struct + BuyerOrderId int64 + Dummy bool + IsMaker bool + OrderTradeTime int64 + Price fixedpoint.Value + Quantity fixedpoint.Value + SellerOrderId int64 + Symbol string + TradeId int64 + func (e *MarketTradeEvent) Trade() types.Trade + type OrderTrade struct + AskNotional string + AveragePrice fixedpoint.Value + BidsNotional string + ClientOrderID string + CommissionAmount fixedpoint.Value + CommissionAsset string + CurrentExecutionType string + CurrentOrderStatus string + IsMaker bool + IsReduceOnly bool + LastFilledPrice fixedpoint.Value + OrderFilledAccumulatedQuantity fixedpoint.Value + OrderId int64 + OrderLastFilledQuantity fixedpoint.Value + OrderTradeTime types.MillisecondTimestamp + OrderType string + OriginalOrderType string + OriginalPrice fixedpoint.Value + OriginalQuantity fixedpoint.Value + PositionSide string + RealizedProfit string + Side string + StopPrice fixedpoint.Value + StopPriceWorkingType string + Symbol string + TimeInForce string + TradeId int64 + type OrderTradeUpdateEvent struct + OrderTrade OrderTrade + Transaction int64 + func (e *OrderTradeUpdateEvent) OrderFutures() (*types.Order, error) + func (e *OrderTradeUpdateEvent) TradeFutures() (*types.Trade, error) + type OutboundAccountInfoEvent struct + Balances []Balance + BuyerCommissionRate int + CanDeposit bool + CanTrade bool + CanWithdraw bool + LastAccountUpdateTime int + MakerCommissionRate int + Permissions []string + SellerCommissionRate int + TakerCommissionRate int + type OutboundAccountPositionEvent struct + Balances []Balance + LastAccountUpdateTime int + type PartialDepthEvent struct + type ResultEvent struct + ID int + Result interface{} + type Stream struct + func NewStream(ex *Exchange, client *binance.Client, futuresClient *futures.Client) *Stream + func (s *Stream) EmitAccountConfigUpdateEvent(e *AccountConfigUpdateEvent) + func (s *Stream) EmitAccountUpdateEvent(e *AccountUpdateEvent) + func (s *Stream) EmitAggTradeEvent(e *AggTradeEvent) + func (s *Stream) EmitBalanceUpdateEvent(event *BalanceUpdateEvent) + func (s *Stream) EmitBookTickerEvent(event *BookTickerEvent) + func (s *Stream) EmitContinuousKLineClosedEvent(e *ContinuousKLineEvent) + func (s *Stream) EmitContinuousKLineEvent(e *ContinuousKLineEvent) + func (s *Stream) EmitDepthEvent(e *DepthEvent) + func (s *Stream) EmitExecutionReportEvent(event *ExecutionReportEvent) + func (s *Stream) EmitForceOrderEvent(e *ForceOrderEvent) + func (s *Stream) EmitKLineClosedEvent(e *KLineEvent) + func (s *Stream) EmitKLineEvent(e *KLineEvent) + func (s *Stream) EmitListenKeyExpired(e *ListenKeyExpired) + func (s *Stream) EmitMarginCallEvent(e *MarginCallEvent) + func (s *Stream) EmitMarkPriceUpdateEvent(e *MarkPriceUpdateEvent) + func (s *Stream) EmitMarketTradeEvent(e *MarketTradeEvent) + func (s *Stream) EmitOrderTradeUpdateEvent(e *OrderTradeUpdateEvent) + func (s *Stream) EmitOutboundAccountInfoEvent(event *OutboundAccountInfoEvent) + func (s *Stream) EmitOutboundAccountPositionEvent(event *OutboundAccountPositionEvent) + func (s *Stream) OnAccountConfigUpdateEvent(cb func(e *AccountConfigUpdateEvent)) + func (s *Stream) OnAccountUpdateEvent(cb func(e *AccountUpdateEvent)) + func (s *Stream) OnAggTradeEvent(cb func(e *AggTradeEvent)) + func (s *Stream) OnBalanceUpdateEvent(cb func(event *BalanceUpdateEvent)) + func (s *Stream) OnBookTickerEvent(cb func(event *BookTickerEvent)) + func (s *Stream) OnContinuousKLineClosedEvent(cb func(e *ContinuousKLineEvent)) + func (s *Stream) OnContinuousKLineEvent(cb func(e *ContinuousKLineEvent)) + func (s *Stream) OnDepthEvent(cb func(e *DepthEvent)) + func (s *Stream) OnExecutionReportEvent(cb func(event *ExecutionReportEvent)) + func (s *Stream) OnForceOrderEvent(cb func(e *ForceOrderEvent)) + func (s *Stream) OnKLineClosedEvent(cb func(e *KLineEvent)) + func (s *Stream) OnKLineEvent(cb func(e *KLineEvent)) + func (s *Stream) OnListenKeyExpired(cb func(e *ListenKeyExpired)) + func (s *Stream) OnMarginCallEvent(cb func(e *MarginCallEvent)) + func (s *Stream) OnMarkPriceUpdateEvent(cb func(e *MarkPriceUpdateEvent)) + func (s *Stream) OnMarketTradeEvent(cb func(e *MarketTradeEvent)) + func (s *Stream) OnOrderTradeUpdateEvent(cb func(e *OrderTradeUpdateEvent)) + func (s *Stream) OnOutboundAccountInfoEvent(cb func(event *OutboundAccountInfoEvent)) + func (s *Stream) OnOutboundAccountPositionEvent(cb func(event *OutboundAccountPositionEvent)) + type StreamEventHub interface + OnAccountConfigUpdateEvent func(cb func(e *AccountConfigUpdateEvent)) + OnAccountUpdateEvent func(cb func(e *AccountUpdateEvent)) + OnAggTradeEvent func(cb func(e *AggTradeEvent)) + OnBalanceUpdateEvent func(cb func(event *BalanceUpdateEvent)) + OnBookTickerEvent func(cb func(event *BookTickerEvent)) + OnContinuousKLineClosedEvent func(cb func(e *ContinuousKLineEvent)) + OnContinuousKLineEvent func(cb func(e *ContinuousKLineEvent)) + OnDepthEvent func(cb func(e *DepthEvent)) + OnExecutionReportEvent func(cb func(event *ExecutionReportEvent)) + OnForceOrderEvent func(cb func(e *ForceOrderEvent)) + OnKLineClosedEvent func(cb func(e *KLineEvent)) + OnKLineEvent func(cb func(e *KLineEvent)) + OnListenKeyExpired func(cb func(e *ListenKeyExpired)) + OnMarginCallEvent func(cb func(e *MarginCallEvent)) + OnMarkPriceUpdateEvent func(cb func(e *MarkPriceUpdateEvent)) + OnMarketTradeEvent func(cb func(e *MarketTradeEvent)) + OnOrderTradeUpdateEvent func(cb func(e *OrderTradeUpdateEvent)) + OnOutboundAccountInfoEvent func(cb func(event *OutboundAccountInfoEvent)) + OnOutboundAccountPositionEvent func(cb func(event *OutboundAccountPositionEvent)) + type WebSocketCommand struct + ID int + Method string + Params []string