Documentation
¶
Index ¶
- func ExtractSymbol(symbol string) string
- func ExtractSymbolWithQuote(symbol, quote string) string
- func FormatSymbol(symbol string) string
- func FormatSymbolWithQuote(symbol, quote string) string
- func NewMarginAdapter(ctx context.Context, opts Options) (exchanges.Exchange, error)
- type Adapter
- func (a *Adapter) CancelAllOrders(ctx context.Context, symbol string) (retErr error)
- func (a *Adapter) CancelOrder(ctx context.Context, orderID, symbol string) (retErr error)
- func (a *Adapter) Close() error
- func (a *Adapter) ExtractSymbol(symbol string) string
- func (a *Adapter) FetchAccount(ctx context.Context) (_ *exchanges.Account, retErr error)
- func (a *Adapter) FetchAllFundingRates(ctx context.Context) ([]exchanges.FundingRate, error)
- func (a *Adapter) FetchBalance(ctx context.Context) (decimal.Decimal, error)
- func (a *Adapter) FetchFeeRate(ctx context.Context, symbol string) (_ *exchanges.FeeRate, retErr error)
- func (a *Adapter) FetchFundingRate(ctx context.Context, symbol string) (*exchanges.FundingRate, error)
- func (a *Adapter) FetchKlines(ctx context.Context, symbol string, interval exchanges.Interval, ...) (_ []exchanges.Kline, retErr error)
- func (a *Adapter) FetchOpenOrders(ctx context.Context, symbol string) (_ []exchanges.Order, retErr error)
- func (a *Adapter) FetchOrder(ctx context.Context, orderID, symbol string) (_ *exchanges.Order, retErr error)
- func (a *Adapter) FetchOrderBook(ctx context.Context, symbol string, limit int) (_ *exchanges.OrderBook, retErr error)
- func (a *Adapter) FetchPositions(ctx context.Context) ([]exchanges.Position, error)
- func (a *Adapter) FetchSymbolDetails(ctx context.Context, symbol string) (*exchanges.SymbolDetails, error)
- func (a *Adapter) FetchTicker(ctx context.Context, symbol string) (_ *exchanges.Ticker, retErr error)
- func (a *Adapter) FetchTrades(ctx context.Context, symbol string, limit int) (_ []exchanges.Trade, retErr error)
- func (a *Adapter) FormatSymbol(symbol string) string
- func (a *Adapter) GetLocalOrderBook(symbol string, depth int) *exchanges.OrderBook
- func (a *Adapter) ModifyOrder(ctx context.Context, orderID, symbol string, ...) (_ *exchanges.Order, retErr error)
- func (a *Adapter) PlaceOrder(ctx context.Context, params *exchanges.OrderParams) (_ *exchanges.Order, retErr error)
- func (a *Adapter) RefreshSymbolDetails(ctx context.Context) error
- func (a *Adapter) SetLeverage(ctx context.Context, symbol string, leverage int) (retErr error)
- func (a *Adapter) StopWatchKlines(ctx context.Context, symbol string, interval exchanges.Interval) error
- func (a *Adapter) StopWatchOrderBook(ctx context.Context, symbol string) error
- func (a *Adapter) StopWatchOrders(ctx context.Context) error
- func (a *Adapter) StopWatchPositions(ctx context.Context) error
- func (a *Adapter) StopWatchTicker(ctx context.Context, symbol string) error
- func (a *Adapter) StopWatchTrades(ctx context.Context, symbol string) error
- func (a *Adapter) SubscribeAllMiniTicker(ctx context.Context, callback func([]*perp.WsMiniTickerEvent)) error
- func (a *Adapter) WatchKlines(ctx context.Context, symbol string, interval exchanges.Interval, ...) error
- func (a *Adapter) WatchOrderBook(ctx context.Context, symbol string, cb exchanges.OrderBookCallback) error
- func (a *Adapter) WatchOrders(ctx context.Context, callback exchanges.OrderUpdateCallback) error
- func (a *Adapter) WatchPositions(ctx context.Context, callback exchanges.PositionUpdateCallback) error
- func (a *Adapter) WatchTicker(ctx context.Context, symbol string, callback exchanges.TickerCallback) error
- func (a *Adapter) WatchTrades(ctx context.Context, symbol string, callback exchanges.TradeCallback) error
- func (a *Adapter) WsAccountConnected(ctx context.Context) error
- func (a *Adapter) WsMarketConnected(ctx context.Context) error
- func (a *Adapter) WsOrderConnected(ctx context.Context) error
- type MarginAdapter
- func (a *MarginAdapter) Borrow(ctx context.Context, asset string, amount float64, isIsolated bool, ...) (string, error)
- func (a *MarginAdapter) CancelOrder(ctx context.Context, orderID, symbol string) error
- func (a *MarginAdapter) ExtractSymbol(symbol string) string
- func (a *MarginAdapter) FetchAccount(ctx context.Context) (*exchanges.Account, error)
- func (a *MarginAdapter) FetchOrder(ctx context.Context, orderID, symbol string) (*exchanges.Order, error)
- func (a *MarginAdapter) FormatSymbol(symbol string) string
- func (a *MarginAdapter) GetIsolatedMarginAccount(ctx context.Context, symbols string) (*exchanges.IsolatedMarginAccount, error)
- func (a *MarginAdapter) GetLocalOrderBook(symbol string, depth int) *exchanges.OrderBook
- func (a *MarginAdapter) GetMarginAccount(ctx context.Context) (*exchanges.MarginAccount, error)
- func (a *MarginAdapter) GetMarketType() exchanges.MarketType
- func (a *MarginAdapter) PlaceOrder(ctx context.Context, params *exchanges.OrderParams) (*exchanges.Order, error)
- func (a *MarginAdapter) Repay(ctx context.Context, asset string, amount float64, isIsolated bool, ...) (string, error)
- func (a *MarginAdapter) StopWatchKlines(ctx context.Context, symbol string, interval exchanges.Interval) error
- func (a *MarginAdapter) StopWatchOrderBook(ctx context.Context, symbol string) error
- func (a *MarginAdapter) StopWatchOrders(ctx context.Context) error
- func (a *MarginAdapter) StopWatchPositions(ctx context.Context) error
- func (a *MarginAdapter) StopWatchTicker(ctx context.Context, symbol string) error
- func (a *MarginAdapter) StopWatchTrades(ctx context.Context, symbol string) error
- func (a *MarginAdapter) WatchKlines(ctx context.Context, symbol string, interval exchanges.Interval, ...) error
- func (a *MarginAdapter) WatchOrderBook(ctx context.Context, symbol string, cb exchanges.OrderBookCallback) error
- func (a *MarginAdapter) WatchOrders(ctx context.Context, callback exchanges.OrderUpdateCallback) error
- func (a *MarginAdapter) WatchPositions(ctx context.Context, cb exchanges.PositionUpdateCallback) error
- func (a *MarginAdapter) WatchTicker(ctx context.Context, symbol string, cb exchanges.TickerCallback) error
- func (a *MarginAdapter) WatchTrades(ctx context.Context, symbol string, cb exchanges.TradeCallback) error
- type Options
- type PerpOrderBook
- func (ob *PerpOrderBook) ApplySnapshot(snap *perp.DepthResponse) error
- func (ob *PerpOrderBook) GetBestAsk() (decimal.Decimal, decimal.Decimal)
- func (ob *PerpOrderBook) GetBestBid() (decimal.Decimal, decimal.Decimal)
- func (ob *PerpOrderBook) GetDepth(limit int) ([]exchanges.Level, []exchanges.Level)
- func (ob *PerpOrderBook) IsInitialized() bool
- func (ob *PerpOrderBook) ProcessUpdate(event *perp.WsDepthEvent) error
- func (ob *PerpOrderBook) Reset()
- func (ob *PerpOrderBook) Timestamp() int64
- func (ob *PerpOrderBook) WaitReady(ctx context.Context, timeout time.Duration) bool
- type SpotAdapter
- func (a *SpotAdapter) CancelAllOrders(ctx context.Context, symbol string) error
- func (a *SpotAdapter) CancelOrder(ctx context.Context, orderID, symbol string) error
- func (a *SpotAdapter) Close() error
- func (a *SpotAdapter) ExtractSymbol(symbol string) string
- func (a *SpotAdapter) FetchAccount(ctx context.Context) (*exchanges.Account, error)
- func (a *SpotAdapter) FetchBalance(ctx context.Context) (decimal.Decimal, error)
- func (a *SpotAdapter) FetchFeeRate(ctx context.Context, symbol string) (*exchanges.FeeRate, error)
- func (a *SpotAdapter) FetchKlines(ctx context.Context, symbol string, interval exchanges.Interval, ...) ([]exchanges.Kline, error)
- func (a *SpotAdapter) FetchOpenOrders(ctx context.Context, symbol string) ([]exchanges.Order, error)
- func (a *SpotAdapter) FetchOrder(ctx context.Context, orderID, symbol string) (*exchanges.Order, error)
- func (a *SpotAdapter) FetchOrderBook(ctx context.Context, symbol string, limit int) (*exchanges.OrderBook, error)
- func (a *SpotAdapter) FetchSpotBalances(ctx context.Context) ([]exchanges.SpotBalance, error)
- func (a *SpotAdapter) FetchSymbolDetails(ctx context.Context, symbol string) (*exchanges.SymbolDetails, error)
- func (a *SpotAdapter) FetchTicker(ctx context.Context, symbol string) (*exchanges.Ticker, error)
- func (a *SpotAdapter) FetchTrades(ctx context.Context, symbol string, limit int) ([]exchanges.Trade, error)
- func (a *SpotAdapter) FormatSymbol(symbol string) string
- func (a *SpotAdapter) GetLocalOrderBook(symbol string, depth int) *exchanges.OrderBook
- func (a *SpotAdapter) ModifyOrder(ctx context.Context, orderID, symbol string, ...) (*exchanges.Order, error)
- func (a *SpotAdapter) PlaceOrder(ctx context.Context, params *exchanges.OrderParams) (*exchanges.Order, error)
- func (a *SpotAdapter) RefreshSymbolDetails(ctx context.Context) error
- func (a *SpotAdapter) StopWatchKlines(ctx context.Context, symbol string, interval exchanges.Interval) error
- func (a *SpotAdapter) StopWatchOrderBook(ctx context.Context, symbol string) error
- func (a *SpotAdapter) StopWatchOrders(ctx context.Context) error
- func (a *SpotAdapter) StopWatchPositions(ctx context.Context) error
- func (a *SpotAdapter) StopWatchTicker(ctx context.Context, symbol string) error
- func (a *SpotAdapter) StopWatchTrades(ctx context.Context, symbol string) error
- func (a *SpotAdapter) SubscribeAllMiniTicker(ctx context.Context, callback func([]*spot.WsMiniTickerEvent)) error
- func (a *SpotAdapter) TransferAsset(ctx context.Context, params *exchanges.TransferParams) error
- func (a *SpotAdapter) WatchKlines(ctx context.Context, symbol string, interval exchanges.Interval, ...) error
- func (a *SpotAdapter) WatchOrderBook(ctx context.Context, symbol string, cb exchanges.OrderBookCallback) error
- func (a *SpotAdapter) WatchOrders(ctx context.Context, callback exchanges.OrderUpdateCallback) error
- func (a *SpotAdapter) WatchPositions(ctx context.Context, cb exchanges.PositionUpdateCallback) error
- func (a *SpotAdapter) WatchTicker(ctx context.Context, symbol string, callback exchanges.TickerCallback) error
- func (a *SpotAdapter) WatchTrades(ctx context.Context, symbol string, callback exchanges.TradeCallback) error
- func (a *SpotAdapter) WithCredentials(apiKey, secretKey string) exchanges.Exchange
- func (a *SpotAdapter) WsAccountConnected(ctx context.Context) error
- func (a *SpotAdapter) WsMarketConnected(ctx context.Context) error
- func (a *SpotAdapter) WsOrderConnected(ctx context.Context) error
- type SpotOrderBook
- func (ob *SpotOrderBook) ApplySnapshot(snap *spot.DepthResponse) error
- func (ob *SpotOrderBook) GetBestAsk() (decimal.Decimal, decimal.Decimal)
- func (ob *SpotOrderBook) GetBestBid() (decimal.Decimal, decimal.Decimal)
- func (ob *SpotOrderBook) GetDepth(limit int) ([]exchanges.Level, []exchanges.Level)
- func (ob *SpotOrderBook) IsInitialized() bool
- func (ob *SpotOrderBook) ProcessUpdate(event *spot.WsDepthEvent) error
- func (ob *SpotOrderBook) Reset()
- func (ob *SpotOrderBook) Timestamp() int64
- func (ob *SpotOrderBook) WaitReady(ctx context.Context, timeout time.Duration) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractSymbol ¶
ExtractSymbol extracts base currency from exchange-specific format (e.g., BTCUSDT → BTC) Kept for backward compatibility and SDK-level usage.
func ExtractSymbolWithQuote ¶ added in v0.1.2
ExtractSymbolWithQuote extracts base currency by trimming configurable quote (e.g., BTCUSDC → BTC)
func FormatSymbol ¶
FormatSymbol converts base currency to exchange-specific format (e.g., BTC → btcusdt) Kept for backward compatibility and SDK-level usage.
func FormatSymbolWithQuote ¶ added in v0.1.2
FormatSymbolWithQuote converts base currency with configurable quote (e.g., BTC + USDC → btcusdc)
Types ¶
type Adapter ¶
type Adapter struct {
*exchanges.BaseAdapter
// contains filtered or unexported fields
}
Adapter Binance 交易所适配器
func NewAdapter ¶
NewAdapter 创建 Binance 适配器
func (*Adapter) CancelAllOrders ¶
func (*Adapter) CancelOrder ¶
func (*Adapter) ExtractSymbol ¶
func (*Adapter) FetchAccount ¶
GetAccount 获取账户信息
func (*Adapter) FetchAllFundingRates ¶
GetAllFundingRates retrieves funding rates for all perpetual symbols
func (*Adapter) FetchBalance ¶
func (*Adapter) FetchFeeRate ¶
func (*Adapter) FetchFundingRate ¶
func (a *Adapter) FetchFundingRate(ctx context.Context, symbol string) (*exchanges.FundingRate, error)
GetFundingRate retrieves funding rate for a symbol
func (*Adapter) FetchKlines ¶
func (*Adapter) FetchOpenOrders ¶
func (*Adapter) FetchOrder ¶
func (*Adapter) FetchOrderBook ¶
func (*Adapter) FetchPositions ¶
func (*Adapter) FetchSymbolDetails ¶
func (*Adapter) FetchTicker ¶
func (*Adapter) FetchTrades ¶
func (*Adapter) FormatSymbol ¶
func (*Adapter) GetLocalOrderBook ¶
GetLocalOrderBook retrieves locally maintained order book
func (*Adapter) ModifyOrder ¶
func (*Adapter) PlaceOrder ¶
func (*Adapter) RefreshSymbolDetails ¶
func (*Adapter) SetLeverage ¶
func (*Adapter) StopWatchKlines ¶
func (*Adapter) StopWatchOrderBook ¶
func (*Adapter) StopWatchPositions ¶
func (*Adapter) StopWatchTicker ¶
func (*Adapter) StopWatchTrades ¶
func (*Adapter) SubscribeAllMiniTicker ¶
func (*Adapter) WatchKlines ¶
func (*Adapter) WatchOrderBook ¶
func (a *Adapter) WatchOrderBook(ctx context.Context, symbol string, cb exchanges.OrderBookCallback) error
WatchOrderBook subscribes to orderbook updates and waits for the book to be ready.
func (*Adapter) WatchOrders ¶
func (*Adapter) WatchPositions ¶
func (*Adapter) WatchTicker ¶
func (*Adapter) WatchTrades ¶
func (*Adapter) WsAccountConnected ¶
type MarginAdapter ¶
type MarginAdapter struct {
*SpotAdapter // Reuse Spot Market Data and basic logic
// contains filtered or unexported fields
}
MarginAdapter implements MarginExtension and Adapter for Binance Margin
func (*MarginAdapter) CancelOrder ¶
func (a *MarginAdapter) CancelOrder(ctx context.Context, orderID, symbol string) error
Override CancelOrder
func (*MarginAdapter) ExtractSymbol ¶
func (a *MarginAdapter) ExtractSymbol(symbol string) string
func (*MarginAdapter) FetchAccount ¶
Override GetAccount to Generic Account
func (*MarginAdapter) FetchOrder ¶
func (a *MarginAdapter) FetchOrder(ctx context.Context, orderID, symbol string) (*exchanges.Order, error)
Override GetOrder
func (*MarginAdapter) FormatSymbol ¶
func (a *MarginAdapter) FormatSymbol(symbol string) string
func (*MarginAdapter) GetIsolatedMarginAccount ¶
func (a *MarginAdapter) GetIsolatedMarginAccount(ctx context.Context, symbols string) (*exchanges.IsolatedMarginAccount, error)
GetIsolatedMarginAccount implements MarginExtension
func (*MarginAdapter) GetLocalOrderBook ¶
func (a *MarginAdapter) GetLocalOrderBook(symbol string, depth int) *exchanges.OrderBook
func (*MarginAdapter) GetMarginAccount ¶
func (a *MarginAdapter) GetMarginAccount(ctx context.Context) (*exchanges.MarginAccount, error)
GetMarginAccount implements MarginExtension
func (*MarginAdapter) GetMarketType ¶
func (a *MarginAdapter) GetMarketType() exchanges.MarketType
func (*MarginAdapter) PlaceOrder ¶
func (a *MarginAdapter) PlaceOrder(ctx context.Context, params *exchanges.OrderParams) (*exchanges.Order, error)
Override PlaceOrder
func (*MarginAdapter) StopWatchKlines ¶
func (*MarginAdapter) StopWatchOrderBook ¶
func (a *MarginAdapter) StopWatchOrderBook(ctx context.Context, symbol string) error
func (*MarginAdapter) StopWatchOrders ¶
func (a *MarginAdapter) StopWatchOrders(ctx context.Context) error
func (*MarginAdapter) StopWatchPositions ¶
func (a *MarginAdapter) StopWatchPositions(ctx context.Context) error
func (*MarginAdapter) StopWatchTicker ¶
func (a *MarginAdapter) StopWatchTicker(ctx context.Context, symbol string) error
func (*MarginAdapter) StopWatchTrades ¶
func (a *MarginAdapter) StopWatchTrades(ctx context.Context, symbol string) error
func (*MarginAdapter) WatchKlines ¶
func (a *MarginAdapter) WatchKlines(ctx context.Context, symbol string, interval exchanges.Interval, cb exchanges.KlineCallback) error
func (*MarginAdapter) WatchOrderBook ¶
func (a *MarginAdapter) WatchOrderBook(ctx context.Context, symbol string, cb exchanges.OrderBookCallback) error
func (*MarginAdapter) WatchOrders ¶
func (a *MarginAdapter) WatchOrders(ctx context.Context, callback exchanges.OrderUpdateCallback) error
Override SubscribeOrderUpdate
func (*MarginAdapter) WatchPositions ¶
func (a *MarginAdapter) WatchPositions(ctx context.Context, cb exchanges.PositionUpdateCallback) error
func (*MarginAdapter) WatchTicker ¶
func (a *MarginAdapter) WatchTicker(ctx context.Context, symbol string, cb exchanges.TickerCallback) error
func (*MarginAdapter) WatchTrades ¶
func (a *MarginAdapter) WatchTrades(ctx context.Context, symbol string, cb exchanges.TradeCallback) error
type Options ¶
type Options struct {
APIKey string
SecretKey string
QuoteCurrency exchanges.QuoteCurrency // "USDT" (default for CEX) or "USDC"
Logger exchanges.Logger
}
Options configures a Binance adapter.
type PerpOrderBook ¶
PerpOrderBook maintains a local orderbook replica for Binance Futures
func NewPerpOrderBook ¶
func NewPerpOrderBook(symbol string) *PerpOrderBook
func (*PerpOrderBook) ApplySnapshot ¶
func (ob *PerpOrderBook) ApplySnapshot(snap *perp.DepthResponse) error
func (*PerpOrderBook) GetBestAsk ¶
func (ob *PerpOrderBook) GetBestAsk() (decimal.Decimal, decimal.Decimal)
func (*PerpOrderBook) GetBestBid ¶
func (ob *PerpOrderBook) GetBestBid() (decimal.Decimal, decimal.Decimal)
func (*PerpOrderBook) IsInitialized ¶
func (ob *PerpOrderBook) IsInitialized() bool
func (*PerpOrderBook) ProcessUpdate ¶
func (ob *PerpOrderBook) ProcessUpdate(event *perp.WsDepthEvent) error
func (*PerpOrderBook) Reset ¶
func (ob *PerpOrderBook) Reset()
func (*PerpOrderBook) Timestamp ¶
func (ob *PerpOrderBook) Timestamp() int64
type SpotAdapter ¶
type SpotAdapter struct {
*exchanges.BaseAdapter
// contains filtered or unexported fields
}
SpotAdapter implements exchanges.Exchange for Binance Spot markets
func NewSpotAdapter ¶
func NewSpotAdapter(ctx context.Context, opts Options) (*SpotAdapter, error)
NewSpotAdapter creates a new Binance Spot adapter instance
func (*SpotAdapter) CancelAllOrders ¶
func (a *SpotAdapter) CancelAllOrders(ctx context.Context, symbol string) error
func (*SpotAdapter) CancelOrder ¶
func (a *SpotAdapter) CancelOrder(ctx context.Context, orderID, symbol string) error
func (*SpotAdapter) Close ¶
func (a *SpotAdapter) Close() error
func (*SpotAdapter) ExtractSymbol ¶
func (a *SpotAdapter) ExtractSymbol(symbol string) string
func (*SpotAdapter) FetchAccount ¶
func (*SpotAdapter) FetchBalance ¶
func (*SpotAdapter) FetchFeeRate ¶
func (*SpotAdapter) FetchKlines ¶
func (*SpotAdapter) FetchOpenOrders ¶
func (*SpotAdapter) FetchOrder ¶
func (*SpotAdapter) FetchOrderBook ¶
func (*SpotAdapter) FetchSpotBalances ¶
func (a *SpotAdapter) FetchSpotBalances(ctx context.Context) ([]exchanges.SpotBalance, error)
func (*SpotAdapter) FetchSymbolDetails ¶
func (a *SpotAdapter) FetchSymbolDetails(ctx context.Context, symbol string) (*exchanges.SymbolDetails, error)
func (*SpotAdapter) FetchTicker ¶
func (*SpotAdapter) FetchTrades ¶
func (*SpotAdapter) FormatSymbol ¶
func (a *SpotAdapter) FormatSymbol(symbol string) string
func (*SpotAdapter) GetLocalOrderBook ¶
func (a *SpotAdapter) GetLocalOrderBook(symbol string, depth int) *exchanges.OrderBook
GetLocalOrderBook retrieves locally maintained order book
func (*SpotAdapter) ModifyOrder ¶
func (a *SpotAdapter) ModifyOrder(ctx context.Context, orderID, symbol string, params *exchanges.ModifyOrderParams) (*exchanges.Order, error)
func (*SpotAdapter) PlaceOrder ¶
func (a *SpotAdapter) PlaceOrder(ctx context.Context, params *exchanges.OrderParams) (*exchanges.Order, error)
func (*SpotAdapter) RefreshSymbolDetails ¶
func (a *SpotAdapter) RefreshSymbolDetails(ctx context.Context) error
func (*SpotAdapter) StopWatchKlines ¶
func (*SpotAdapter) StopWatchOrderBook ¶
func (a *SpotAdapter) StopWatchOrderBook(ctx context.Context, symbol string) error
func (*SpotAdapter) StopWatchOrders ¶
func (a *SpotAdapter) StopWatchOrders(ctx context.Context) error
Unsubscribe methods
func (*SpotAdapter) StopWatchPositions ¶
func (a *SpotAdapter) StopWatchPositions(ctx context.Context) error
func (*SpotAdapter) StopWatchTicker ¶
func (a *SpotAdapter) StopWatchTicker(ctx context.Context, symbol string) error
func (*SpotAdapter) StopWatchTrades ¶
func (a *SpotAdapter) StopWatchTrades(ctx context.Context, symbol string) error
func (*SpotAdapter) SubscribeAllMiniTicker ¶
func (a *SpotAdapter) SubscribeAllMiniTicker(ctx context.Context, callback func([]*spot.WsMiniTickerEvent)) error
func (*SpotAdapter) TransferAsset ¶
func (a *SpotAdapter) TransferAsset(ctx context.Context, params *exchanges.TransferParams) error
func (*SpotAdapter) WatchKlines ¶
func (a *SpotAdapter) WatchKlines(ctx context.Context, symbol string, interval exchanges.Interval, callback exchanges.KlineCallback) error
func (*SpotAdapter) WatchOrderBook ¶
func (a *SpotAdapter) WatchOrderBook(ctx context.Context, symbol string, cb exchanges.OrderBookCallback) error
WatchOrderBook subscribes to orderbook updates and waits for the book to be ready.
func (*SpotAdapter) WatchOrders ¶
func (a *SpotAdapter) WatchOrders(ctx context.Context, callback exchanges.OrderUpdateCallback) error
func (*SpotAdapter) WatchPositions ¶
func (a *SpotAdapter) WatchPositions(ctx context.Context, cb exchanges.PositionUpdateCallback) error
func (*SpotAdapter) WatchTicker ¶
func (a *SpotAdapter) WatchTicker(ctx context.Context, symbol string, callback exchanges.TickerCallback) error
func (*SpotAdapter) WatchTrades ¶
func (a *SpotAdapter) WatchTrades(ctx context.Context, symbol string, callback exchanges.TradeCallback) error
func (*SpotAdapter) WithCredentials ¶
func (a *SpotAdapter) WithCredentials(apiKey, secretKey string) exchanges.Exchange
func (*SpotAdapter) WsAccountConnected ¶
func (a *SpotAdapter) WsAccountConnected(ctx context.Context) error
func (*SpotAdapter) WsMarketConnected ¶
func (a *SpotAdapter) WsMarketConnected(ctx context.Context) error
func (*SpotAdapter) WsOrderConnected ¶
func (a *SpotAdapter) WsOrderConnected(ctx context.Context) error
type SpotOrderBook ¶
SpotOrderBook maintains a local orderbook replica for Binance Spot
func NewSpotOrderBook ¶
func NewSpotOrderBook(symbol string) *SpotOrderBook
func (*SpotOrderBook) ApplySnapshot ¶
func (ob *SpotOrderBook) ApplySnapshot(snap *spot.DepthResponse) error
func (*SpotOrderBook) GetBestAsk ¶
func (ob *SpotOrderBook) GetBestAsk() (decimal.Decimal, decimal.Decimal)
func (*SpotOrderBook) GetBestBid ¶
func (ob *SpotOrderBook) GetBestBid() (decimal.Decimal, decimal.Decimal)
func (*SpotOrderBook) IsInitialized ¶
func (ob *SpotOrderBook) IsInitialized() bool
func (*SpotOrderBook) ProcessUpdate ¶
func (ob *SpotOrderBook) ProcessUpdate(event *spot.WsDepthEvent) error
func (*SpotOrderBook) Reset ¶
func (ob *SpotOrderBook) Reset()
func (*SpotOrderBook) Timestamp ¶
func (ob *SpotOrderBook) Timestamp() int64