Documentation
¶
Index ¶
- Constants
- type AccountResponse
- type AssetDetail
- type BaseResponse
- type Binance
- func (bn *Binance) AllTicker(SymPair map[string]q.D) (*sync.Map, error)
- func (bn *Binance) AssetDetail() (sf map[string]AssetDetail, err error)
- func (bn *Binance) Balances() (available, frozen *sync.Map, err error)
- func (bn *Binance) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)
- func (bn *Binance) ExWithdrawFee() (sf map[string]ExWithdraw, err error)
- func (bn *Binance) Fee() float64
- func (bn *Binance) GetAccount() (*Account, error)
- func (bn *Binance) GetAttr() (a q.Attr)
- func (bn *Binance) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)
- func (bn *Binance) GetExchangeInfo() (*ExchangeInfo, error)
- func (bn *Binance) GetKlineRecords(currency CurrencyPair, period KlinePeriod, size int, ...) ([]Kline, error)
- func (bn *Binance) GetOneOrder(orderId string, currencyPair CurrencyPair) (*q.Order, error)
- func (bn *Binance) GetOrderHistorys(currency CurrencyPair, optional ...OptionalParameter) ([]q.Order, error)
- func (bn *Binance) GetTicker(currency CurrencyPair) (*Ticker, error)
- func (bn *Binance) GetTradeSymbol(currencyPair CurrencyPair) (*TradeSymbol, error)
- func (bn *Binance) GetTrades(currencyPair CurrencyPair, since int64) ([]q.Trade, error)
- func (bn *Binance) GetUnfinishedOrders(currencyPair CurrencyPair) ([]q.Order, error)
- func (bn *Binance) LimitBuy(amount, price string, currencyPair CurrencyPair, ...) (*q.Order, error)
- func (bn *Binance) LimitSell(amount, price string, currencyPair CurrencyPair, ...) (*q.Order, error)
- func (bn *Binance) MarketBuy(amount, price string, currencyPair CurrencyPair) (*q.Order, error)
- func (bn *Binance) MarketSell(amount, price string, currencyPair CurrencyPair) (*q.Order, error)
- func (bn *Binance) OneTicker(d q.D) (ticker q.Bbo, err error)
- func (bn *Binance) PairArray() (map[string]q.D, map[q.D]q.P, error)
- func (bn *Binance) Ping() bool
- func (bn *Binance) PlaceOrders(places [3]q.Order) (orders [3]q.Order, err error)
- func (bn *Binance) String() string
- func (bn *Binance) Test() bool
- func (bn *Binance) TradeFee() (map[string]TradeFee, error)
- func (bn *Binance) WithdrawFee() (sf []NetworkWithdraw, err error)
- type BookTicker
- type ExWithdraw
- type ExchangeInfo
- type Filter
- type Futures
- func (bs *Futures) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)
- func (bs *Futures) GetContractValue(currencyPair CurrencyPair) (float64, error)
- func (bs *Futures) GetDeliveryTime() (int, int, int, int)
- func (bs *Futures) GetExchangeInfo()
- func (bs *Futures) GetFee() (float64, error)
- func (bs *Futures) GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)
- func (bs *Futures) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)
- func (bs *Futures) GetFutureIndex(currencyPair CurrencyPair) (float64, error)
- func (bs *Futures) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)
- func (bs *Futures) GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)
- func (bs *Futures) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
- func (bs *Futures) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)
- func (bs *Futures) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)
- func (bs *Futures) GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)
- func (bs *Futures) GetKlineRecords(contractType string, currency CurrencyPair, period KlinePeriod, size int, ...) ([]FutureKline, error)
- func (bs *Futures) GetTrades(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error)
- func (bs *Futures) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
- func (bs *Futures) LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, ...) (*FutureOrder, error)
- func (bs *Futures) MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)
- func (bs *Futures) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, ...) (string, error)
- func (bs *Futures) PlaceFutureOrder2(currencyPair CurrencyPair, contractType, price, amount string, ...) (string, error)
- func (bs *Futures) SetBaseUri(uri string)
- func (bs *Futures) String() string
- type FuturesWs
- func (s *FuturesWs) DepthCallback(f func(depth *exws.Depth))
- func (s *FuturesWs) SubscribeDepth(pair cons.CurrencyPair, contractType string) error
- func (s *FuturesWs) SubscribeTicker(pair cons.CurrencyPair, contractType string) error
- func (s *FuturesWs) SubscribeTrade(pair cons.CurrencyPair, contractType string) error
- func (s *FuturesWs) TickerCallback(f func(ticker *exws.FutureTicker))
- func (s *FuturesWs) TradeCallback(f func(trade *q.Trade, contract string))
- type OrderInfoResponse
- type PositionRiskResponse
- type RateLimit
- type SpotWs
- func (s *SpotWs) BBOCallback(f func(ticker *q.Bbo))
- func (s *SpotWs) DepthCallback(f func(depth *exws.Depth))
- func (s *SpotWs) SubscribeBBO(sm []string) (err error)
- func (s *SpotWs) SubscribeDepth(pair cons.CurrencyPair) error
- func (s *SpotWs) SubscribeTicker(pair cons.CurrencyPair) error
- func (s *SpotWs) SubscribeTrade(pair cons.CurrencyPair) error
- func (s *SpotWs) TickerCallback(f func(ticker *exws.Ticker))
- func (s *SpotWs) TradeCallback(f func(trade *q.Trade))
- type Swap
- func (bs *Swap) FutureCancelAllOrders(currencyPair CurrencyPair, contractType string) (bool, error)
- func (bs *Swap) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)
- func (bs *Swap) FutureCancelOrders(currencyPair CurrencyPair, contractType string, orderIdList []string) (bool, error)
- func (bs *Swap) GetContractValue(currencyPair CurrencyPair) (float64, error)
- func (bs *Swap) GetDeliveryTime() (int, int, int, int)
- func (bs *Swap) GetFee() (float64, error)
- func (bs *Swap) GetFutureDepth(currency CurrencyPair, contractType string, size int) (*Depth, error)
- func (bs *Swap) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)
- func (bs *Swap) GetFutureIndex(currencyPair CurrencyPair) (float64, error)
- func (bs *Swap) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)
- func (bs *Swap) GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)
- func (bs *Swap) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
- func (bs *Swap) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)
- func (bs *Swap) GetFutureTicker(currency CurrencyPair, contractType string) (*Ticker, error)
- func (bs *Swap) GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)
- func (bs *Swap) GetKlineRecords(contractType string, currency CurrencyPair, period KlinePeriod, size int, ...) ([]FutureKline, error)
- func (bs *Swap) GetServerTime() (int64, error)
- func (bs *Swap) GetTrades(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error)
- func (bs *Swap) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
- func (bs *Swap) LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, ...) (*FutureOrder, error)
- func (bs *Swap) MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)
- func (bs *Swap) Ping() bool
- func (bs *Swap) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, ...) (string, error)
- func (bs *Swap) PlaceFutureOrder2(currencyPair CurrencyPair, contractType, price, amount string, ...) (*FutureOrder, error)
- func (bs *Swap) SetBaseUri(uri string)
- func (bs *Swap) String() string
- func (bs *Swap) Transfer(currency Currency, transferType int, amount float64) (int64, error)
- type SymbolInfo
- type TradeSymbol
- type Wallet
- func (w *Wallet) GetAccount() (*Account, error)
- func (w *Wallet) GetDepositHistory(currency *Currency) ([]DepositWithdrawHistory, error)
- func (w *Wallet) GetWithDrawHistory(currency *Currency) ([]DepositWithdrawHistory, error)
- func (w *Wallet) Transfer(param TransferParameter) error
- func (w *Wallet) Withdrawal(param WithdrawParameter) (withdrawId string, err error)
Constants ¶
View Source
const ( GlobalApiBaseUrl = "https://api.binance.com" UsApiBaseUrl = "https://api.binance.us" JeApiBaseUrl = "https://api.binance.je" ApiV3 = GlobalApiBaseUrl + "/api/v3/" TickerUri = "ticker/24hr?symbol=%s" TickersUri = "ticker/allBookTickers" FeeUrl = GlobalApiBaseUrl + "/sapi/v1/asset/tradeFee" ExWithdrawUrl = GlobalApiBaseUrl + "/sapi/v1/asset/assetDetail" NetworkWithdrawUrl = GlobalApiBaseUrl + "/sapi/v1/capital/config/getall" DepthUri = "depth?symbol=%s&limit=%d" AccountUri = "account?" OrderUri = "order" UnfinishedOrdersInfo = "openOrders?" KlineUri = "klines" ServerTimeUrl = "time" FutureUsdWsBaseUrl = "wss://fstream.binance.com/ws" FutureCoinWsBaseUrl = "wss://dstream.binance.com/ws" TestnetSpotApiBaseUrl = GlobalApiBaseUrl TestnetSpotWsBaseUrl = "wss://stream.testnet.binance.vision/ws" TestnetSpotStreamBaseUrl = "wss://stream.testnet.binance.vision/stream" TestnetFutureUsdBaseUrl = "https://testnet.binancefuture.com" TestnetFutureUsdWsBaseUrl = "wss://fstream.binance.com/ws" TestnetFutureCoinWsBaseUrl = "wss://dstream.binance.com/ws" )
View Source
const MaxChannelSymbols = 358
View Source
const MaxSymbolChannels = 2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountResponse ¶
type AccountResponse struct {
FeeTier int `json:"feeTier"`
CanTrade bool `json:"canTrade"`
Assets []struct {
Asset string `json:"asset"`
WalletBalance float64 `json:"walletBalance,string"`
MarginBalance float64 `json:"marginBalance,string"`
UnrealizedProfit float64 `json:"unrealizedProfit,string"`
MaintMargin float64 `json:"maintMargin,string"`
} `json:"assets"`
}
type AssetDetail ¶
type AssetDetail struct {
Coin string `json:"coin"`
DepositAllEnable bool `json:"depositAllEnable"`
Free string `json:"free"`
Freeze string `json:"freeze"`
Ipoable string `json:"ipoable"`
Ipoing string `json:"ipoing"`
IsLegalMoney bool `json:"isLegalMoney"`
Locked string `json:"locked"`
Name string `json:"name"`
NetworkList []NetworkWithdraw `json:"networkList"`
}
type BaseResponse ¶
type Binance ¶
type Binance struct {
*ExchangeInfo
// contains filtered or unexported fields
}
func NewWithConfig ¶
func NewWithConfig(config *APIConfig) *Binance
func (*Binance) AssetDetail ¶
func (bn *Binance) AssetDetail() (sf map[string]AssetDetail, err error)
func (*Binance) CancelOrder ¶
func (*Binance) ExWithdrawFee ¶
func (bn *Binance) ExWithdrawFee() (sf map[string]ExWithdraw, err error)
func (*Binance) Fee ¶
*
- Level 30d Trade BNB Balance Maker / Taker Maker / TakerBNB 25% off VIP 0 < 50 BTC or ≥ 0 BNB 0.1000% / 0.1000% 0.0750% / 0.0750% VIP 1 ≥ 50 BTC and ≥ 50 BNB 0.0900% / 0.1000% 0.0675% / 0.0750% VIP 2 ≥ 500 BTC and ≥ 200 BNB 0.0800% / 0.1000% 0.0600% / 0.0750% VIP 3 ≥ 1500 BTC and ≥ 500 BNB 0.0700% / 0.1000% 0.0525% / 0.0750%
func (*Binance) GetAccount ¶
func (*Binance) GetExchangeInfo ¶
func (bn *Binance) GetExchangeInfo() (*ExchangeInfo, error)
func (*Binance) GetKlineRecords ¶
func (*Binance) GetOneOrder ¶
func (*Binance) GetOrderHistorys ¶
func (*Binance) GetTradeSymbol ¶
func (bn *Binance) GetTradeSymbol(currencyPair CurrencyPair) (*TradeSymbol, error)
func (*Binance) GetUnfinishedOrders ¶
func (*Binance) MarketSell ¶
func (*Binance) PlaceOrders ¶
func (*Binance) WithdrawFee ¶
type BookTicker ¶
type ExWithdraw ¶
type ExchangeInfo ¶
type ExchangeInfo struct {
Timezone string `json:"timezone"`
ServerTime int `json:"serverTime"`
ExchangeFilters []any `json:"exchangeFilters,omitempty"`
RateLimits []RateLimit `json:"rateLimits"`
Symbols []TradeSymbol `json:"symbols"`
}
type Filter ¶
type Filter struct {
FilterType string `json:"filterType"`
MaxPrice float64 `json:"maxPrice,string"`
MinPrice float64 `json:"minPrice,string"`
TickSize float64 `json:"tickSize,string"`
MultiplierUp float64 `json:"multiplierUp,string"`
MultiplierDown float64 `json:"multiplierDown,string"`
AvgPriceMins int `json:"avgPriceMins"`
MinQty float64 `json:"minQty,string"`
MaxQty float64 `json:"maxQty,string"`
StepSize float64 `json:"stepSize,string"`
MinNotional float64 `json:"minNotional,string"`
ApplyToMarket bool `json:"applyToMarket"`
Limit int `json:"limit"`
MaxNumAlgoOrders int `json:"maxNumAlgoOrders"`
MaxNumIcebergOrders int `json:"maxNumIcebergOrders"`
MaxNumOrders int `json:"maxNumOrders"`
}
type Futures ¶
type Futures struct {
// contains filtered or unexported fields
}
func NewBinanceFutures ¶
func NewBinanceFutures(config *APIConfig) *Futures
func (*Futures) FutureCancelOrder ¶
func (*Futures) GetContractValue ¶
func (*Futures) GetExchangeInfo ¶
func (bs *Futures) GetExchangeInfo()
func (*Futures) GetFutureDepth ¶
func (*Futures) GetFutureEstimatedPrice ¶
func (*Futures) GetFutureIndex ¶
func (*Futures) GetFutureOrder ¶
func (*Futures) GetFutureOrderHistory ¶
func (*Futures) GetFutureOrders ¶
func (*Futures) GetFuturePosition ¶
func (*Futures) GetFutureTicker ¶
func (*Futures) GetFutureUserinfo ¶
func (*Futures) GetKlineRecords ¶
func (*Futures) GetUnfinishFutureOrders ¶
func (*Futures) LimitFuturesOrder ¶
func (*Futures) MarketFuturesOrder ¶
func (*Futures) PlaceFutureOrder ¶
func (*Futures) PlaceFutureOrder2 ¶
func (*Futures) SetBaseUri ¶
type FuturesWs ¶
type FuturesWs struct {
// contains filtered or unexported fields
}
func NewFuturesWs ¶
func NewFuturesWs() *FuturesWs
func (*FuturesWs) DepthCallback ¶
func (*FuturesWs) SubscribeDepth ¶
func (s *FuturesWs) SubscribeDepth(pair cons.CurrencyPair, contractType string) error
func (*FuturesWs) SubscribeTicker ¶
func (s *FuturesWs) SubscribeTicker(pair cons.CurrencyPair, contractType string) error
func (*FuturesWs) SubscribeTrade ¶
func (s *FuturesWs) SubscribeTrade(pair cons.CurrencyPair, contractType string) error
func (*FuturesWs) TickerCallback ¶
func (s *FuturesWs) TickerCallback(f func(ticker *exws.FutureTicker))
type OrderInfoResponse ¶
type OrderInfoResponse struct {
BaseResponse
Symbol string `json:"symbol"`
Pair string `json:"pair"`
ClientOrderId string `json:"clientOrderId"`
OrderId int64 `json:"orderId"`
AvgPrice float64 `json:"avgPrice,string"`
ExecutedQty float64 `json:"executedQty,string"`
OrigQty float64 `json:"origQty,string"`
Price float64 `json:"price,string"`
Side string `json:"side"`
PositionSide string `json:"positionSide"`
Status string `json:"status"`
Type string `json:"type"`
Time int64 `json:"time"`
UpdateTime int64 `json:"updateTime"`
}
type PositionRiskResponse ¶
type PositionRiskResponse struct {
Symbol string `json:"symbol"`
PositionAmt float64 `json:"positionAmt,string"`
EntryPrice float64 `json:"entryPrice,string"`
UnRealizedProfit float64 `json:"unRealizedProfit,string"`
LiquidationPrice float64 `json:"liquidationPrice,string"`
Leverage float64 `json:"leverage,string"`
MarginType string `json:"marginType"`
PositionSide string `json:"positionSide"`
}
type SpotWs ¶
type SpotWs struct {
// contains filtered or unexported fields
}
func (*SpotWs) BBOCallback ¶
func (*SpotWs) DepthCallback ¶
func (*SpotWs) SubscribeBBO ¶
func (*SpotWs) SubscribeDepth ¶
func (s *SpotWs) SubscribeDepth(pair cons.CurrencyPair) error
func (*SpotWs) SubscribeTicker ¶
func (s *SpotWs) SubscribeTicker(pair cons.CurrencyPair) error
func (*SpotWs) SubscribeTrade ¶
func (s *SpotWs) SubscribeTrade(pair cons.CurrencyPair) error
TODO: test
func (*SpotWs) TickerCallback ¶
func (*SpotWs) TradeCallback ¶
type Swap ¶
type Swap struct {
Binance
// contains filtered or unexported fields
}
func NewBinanceSwap ¶
func NewBinanceSwap(config *APIConfig) *Swap
func (*Swap) FutureCancelAllOrders ¶
func (*Swap) FutureCancelOrder ¶
func (*Swap) FutureCancelOrders ¶
func (*Swap) GetContractValue ¶
func (*Swap) GetFutureDepth ¶
func (*Swap) GetFutureEstimatedPrice ¶
func (*Swap) GetFutureIndex ¶
func (*Swap) GetFutureOrder ¶
func (*Swap) GetFutureOrderHistory ¶
func (*Swap) GetFutureOrders ¶
func (*Swap) GetFuturePosition ¶
func (*Swap) GetFutureTicker ¶
func (*Swap) GetFutureUserinfo ¶
func (*Swap) GetKlineRecords ¶
func (*Swap) GetServerTime ¶
func (*Swap) GetUnfinishFutureOrders ¶
func (*Swap) LimitFuturesOrder ¶
func (*Swap) MarketFuturesOrder ¶
func (*Swap) PlaceFutureOrder ¶
func (*Swap) PlaceFutureOrder2 ¶
func (*Swap) SetBaseUri ¶
type SymbolInfo ¶
type TradeSymbol ¶
type TradeSymbol struct {
Symbol string `json:"symbol"`
Status string `json:"status"`
BaseAsset string `json:"baseAsset"`
BaseAssetPrecision int `json:"baseAssetPrecision"`
QuoteAsset string `json:"quoteAsset"`
QuotePrecision int `json:"quotePrecision"`
QuoteAssetPrecision int `json:"quoteAssetPrecision"`
BaseCommissionPrecision int `json:"baseCommissionPrecision"`
QuoteCommissionPrecision int `json:"quoteCommissionPrecision"`
Filters []Filter `json:"filters"`
IcebergAllowed bool `json:"icebergAllowed"`
IsMarginTradingAllowed bool `json:"isMarginTradingAllowed"`
IsSpotTradingAllowed bool `json:"isSpotTradingAllowed"`
OcoAllowed bool `json:"ocoAllowed"`
QuoteOrderQtyMarketAllowed bool `json:"quoteOrderQtyMarketAllowed"`
OrderTypes []string `json:"orderTypes"`
}
func (TradeSymbol) GetBaseStep ¶
func (ts TradeSymbol) GetBaseStep() float64
func (TradeSymbol) GetBaseStepN ¶
func (ts TradeSymbol) GetBaseStepN() int
func (TradeSymbol) GetMinBase ¶
func (ts TradeSymbol) GetMinBase() float64
func (TradeSymbol) GetMinPrice ¶
func (ts TradeSymbol) GetMinPrice() float64
func (TradeSymbol) GetMinQuote ¶
func (ts TradeSymbol) GetMinQuote() float64
func (TradeSymbol) GetPriceStep ¶
func (ts TradeSymbol) GetPriceStep() float64
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) GetAccount ¶
func (*Wallet) GetDepositHistory ¶
func (*Wallet) GetWithDrawHistory ¶
func (*Wallet) Withdrawal ¶
Click to show internal directories.
Click to hide internal directories.