Documentation ¶
Index ¶
- Constants
- type AggTrade
- type Binance
- func (bn *Binance) CancelOrder(orderId string, currencyPair common.TradingPair) (bool, error)
- func (bn *Binance) GetAccount() (*common.Account, error)
- func (bn *Binance) GetDepth(size int, currencyPair common.TradingPair) (*common.Depth, error)
- func (bn *Binance) GetExchangeInfo() (*ExchangeInfo, error)
- func (bn *Binance) GetExchangeName() string
- func (bn *Binance) GetKlineRecords(currency common.TradingPair, period, size, since int) ([]common.Kline, error)
- func (bn *Binance) GetOneOrder(orderId string, currencyPair common.TradingPair) (*common.Order, error)
- func (bn *Binance) GetOrderHistorys(currency common.TradingPair, currentPage, pageSize int) ([]common.Order, error)
- func (bn *Binance) GetTicker(currency common.TradingPair) (*common.Ticker, error)
- func (bn *Binance) GetTradeSymbol(currencyPair common.TradingPair) (*TradeSymbol, error)
- func (bn *Binance) GetTrades(currencyPair common.TradingPair, since int64) ([]common.Trade, error)
- func (bn *Binance) GetUnfinishOrders(currencyPair common.TradingPair) ([]common.Order, error)
- func (bn *Binance) LimitBuy(amount, price string, currencyPair common.TradingPair, ...) (*common.Order, error)
- func (bn *Binance) LimitSell(amount, price string, currencyPair common.TradingPair, ...) (*common.Order, error)
- func (bn *Binance) MarketBuy(amount, price string, currencyPair common.TradingPair) (*common.Order, error)
- func (bn *Binance) MarketSell(amount, price string, currencyPair common.TradingPair) (*common.Order, error)
- func (bn *Binance) Ping() bool
- type BinanceSwap
- func (bs *BinanceSwap) FutureCancelAllOrders(currencyPair common.TradingPair, contractType string) (bool, error)
- func (bs *BinanceSwap) FutureCancelOrder(currencyPair common.TradingPair, contractType, orderId string) (bool, error)
- func (bs *BinanceSwap) FutureCancelOrders(currencyPair common.TradingPair, contractType string, orderIdList []string) (bool, error)
- func (bs *BinanceSwap) GetContractValue(currencyPair common.TradingPair) (float64, error)
- func (bs *BinanceSwap) GetDeliveryTime() (int, int, int, int)
- func (bs *BinanceSwap) GetExchangeName() string
- func (bs *BinanceSwap) GetFee() (float64, error)
- func (bs *BinanceSwap) GetFutureDepth(currency common.TradingPair, contractType string, size int) (*common.Depth, error)
- func (bs *BinanceSwap) GetFutureEstimatedPrice(currencyPair common.TradingPair) (float64, error)
- func (bs *BinanceSwap) GetFutureIndex(currencyPair common.TradingPair) (float64, error)
- func (bs *BinanceSwap) GetFutureOrder(orderId string, currencyPair common.TradingPair, contractType string) (*common.FutureOrder, error)
- func (bs *BinanceSwap) GetFutureOrders(orderIds []string, currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
- func (bs *BinanceSwap) GetFuturePosition(currencyPair common.TradingPair, contractType string) ([]common.FuturePosition, error)
- func (bs *BinanceSwap) GetFutureTicker(currency common.TradingPair, contractType string) (*common.Ticker, error)
- func (bs *BinanceSwap) GetFutureUserinfo(currencyPair ...common.TradingPair) (*common.FutureAccount, error)
- func (bs *BinanceSwap) GetKlineRecords(contractType string, currency common.TradingPair, period, size, since int) ([]common.FutureKline, error)
- func (bs *BinanceSwap) GetServerTime() (int64, error)
- func (bs *BinanceSwap) GetTrades(contractType string, currencyPair common.TradingPair, since int64) ([]common.Trade, error)
- func (bs *BinanceSwap) GetUnfinishFutureOrders(currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
- func (bs *BinanceSwap) LimitFuturesOrder(currencyPair common.TradingPair, contractType, price, amount string, ...) (*common.FutureOrder, error)
- func (bs *BinanceSwap) MarketFuturesOrder(currencyPair common.TradingPair, contractType, amount string, openType int) (*common.FutureOrder, error)
- func (bs *BinanceSwap) Ping() bool
- func (bs *BinanceSwap) PlaceFutureOrder(currencyPair common.TradingPair, contractType, price, amount string, ...) (string, error)
- func (bs *BinanceSwap) PlaceFutureOrder2(currencyPair common.TradingPair, contractType, price, amount string, ...) (*common.FutureOrder, error)
- func (bs *BinanceSwap) Transfer(currency common.Currency, transferType int, amount float64) (int64, error)
- type BinanceWs
- func (bnWs *BinanceWs) Close()
- func (bnWs *BinanceWs) ProxyUrl(proxyUrl string)
- func (bnWs *BinanceWs) SetBaseUrl(baseURL string)
- func (bnWs *BinanceWs) SetCallbacks(tickerCallback func(*common.Ticker), depthCallback func(*common.Depth), ...)
- func (bnWs *BinanceWs) SetCombinedBaseURL(combinedBaseURL string)
- func (bnWs *BinanceWs) Subscribe(endpoint string, handle func(msg []byte) error) *net.WsConn
- func (bnWs *BinanceWs) SubscribeAggTrade(pair common.TradingPair, tradeCallback func(*common.Trade)) error
- func (bnWs *BinanceWs) SubscribeDepth(pair common.TradingPair, size int) error
- func (bnWs *BinanceWs) SubscribeDiffDepth(pair common.TradingPair, depthCallback func(*common.Depth)) error
- func (bnWs *BinanceWs) SubscribeKline(pair common.TradingPair, period int) error
- func (bnWs *BinanceWs) SubscribeTicker(pair common.TradingPair) error
- func (bnWs *BinanceWs) SubscribeTrade(pair common.TradingPair) error
- type DiffDepth
- type ExchangeInfo
- type Filter
- type RateLimit
- type RawTrade
- type TradeSymbol
Constants ¶
View Source
const ( BINANCE_API_BASE_URL = "https://api.binance.com" BINANCE_API_VERSION = "/api/v3" TICKER_URI = "/ticker/24hr?symbol=%s" TICKERS_URI = "/ticker/allBookTickers" DEPTH_URI = "/depth?symbol=%s&limit=%d" ACCOUNT_URI = "/account?" ORDER_URI = "/order" UNFINISHED_ORDERS_INFO = "/openOrders?" KLINE_URI = "/klines" SERVER_TIME_URL = "/time" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binance ¶
type Binance struct { *ExchangeInfo // contains filtered or unexported fields }
func (*Binance) CancelOrder ¶
func (*Binance) GetExchangeInfo ¶
func (bn *Binance) GetExchangeInfo() (*ExchangeInfo, error)
func (*Binance) GetExchangeName ¶
func (*Binance) GetKlineRecords ¶
func (*Binance) GetOneOrder ¶
func (*Binance) GetOrderHistorys ¶
func (*Binance) GetTradeSymbol ¶
func (bn *Binance) GetTradeSymbol(currencyPair common.TradingPair) (*TradeSymbol, error)
func (*Binance) GetUnfinishOrders ¶
func (*Binance) LimitBuy ¶
func (bn *Binance) LimitBuy(amount, price string, currencyPair common.TradingPair, opt ...common.LimitOrderOptionalParameter) (*common.Order, error)
func (*Binance) LimitSell ¶
func (bn *Binance) LimitSell(amount, price string, currencyPair common.TradingPair, opt ...common.LimitOrderOptionalParameter) (*common.Order, error)
func (*Binance) MarketSell ¶
type BinanceSwap ¶
type BinanceSwap struct {
Binance
}
func NewBinanceSwap ¶
func NewBinanceSwap(config *common.APIConfig) *BinanceSwap
func (*BinanceSwap) FutureCancelAllOrders ¶
func (bs *BinanceSwap) FutureCancelAllOrders(currencyPair common.TradingPair, contractType string) (bool, error)
func (*BinanceSwap) FutureCancelOrder ¶
func (bs *BinanceSwap) FutureCancelOrder(currencyPair common.TradingPair, contractType, orderId string) (bool, error)
*
- 取消订单
- @param symbol btc_usd:比特币 ltc_usd :莱特币
- @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
- @param orderId 订单ID
func (*BinanceSwap) FutureCancelOrders ¶
func (bs *BinanceSwap) FutureCancelOrders(currencyPair common.TradingPair, contractType string, orderIdList []string) (bool, error)
func (*BinanceSwap) GetContractValue ¶
func (bs *BinanceSwap) GetContractValue(currencyPair common.TradingPair) (float64, error)
*
*获取每张合约价值
func (*BinanceSwap) GetDeliveryTime ¶
func (bs *BinanceSwap) GetDeliveryTime() (int, int, int, int)
*
*获取交割时间 星期(0,1,2,3,4,5,6),小时,分,秒
func (*BinanceSwap) GetExchangeName ¶
func (bs *BinanceSwap) GetExchangeName() string
func (*BinanceSwap) GetFutureDepth ¶
func (bs *BinanceSwap) GetFutureDepth(currency common.TradingPair, contractType string, size int) (*common.Depth, error)
func (*BinanceSwap) GetFutureEstimatedPrice ¶
func (bs *BinanceSwap) GetFutureEstimatedPrice(currencyPair common.TradingPair) (float64, error)
*
*获取交割预估价
func (*BinanceSwap) GetFutureIndex ¶
func (bs *BinanceSwap) GetFutureIndex(currencyPair common.TradingPair) (float64, error)
*
- 期货指数
- @param currencyPair btc_usd:比特币 ltc_usd :莱特币
func (*BinanceSwap) GetFutureOrder ¶
func (bs *BinanceSwap) GetFutureOrder(orderId string, currencyPair common.TradingPair, contractType string) (*common.FutureOrder, error)
*
*获取单个订单信息
func (*BinanceSwap) GetFutureOrders ¶
func (bs *BinanceSwap) GetFutureOrders(orderIds []string, currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
*
*获取订单信息
func (*BinanceSwap) GetFuturePosition ¶
func (bs *BinanceSwap) GetFuturePosition(currencyPair common.TradingPair, contractType string) ([]common.FuturePosition, error)
*
- 用户持仓查询
- @param symbol btc_usd:比特币 ltc_usd :莱特币
- @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
- @return
func (*BinanceSwap) GetFutureTicker ¶
func (bs *BinanceSwap) GetFutureTicker(currency common.TradingPair, contractType string) (*common.Ticker, error)
*
- 期货行情
- @param currency_pair btc_usd:比特币 ltc_usd :莱特币
- @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
func (*BinanceSwap) GetFutureUserinfo ¶
func (bs *BinanceSwap) GetFutureUserinfo(currencyPair ...common.TradingPair) (*common.FutureAccount, error)
*
*全仓账户
func (*BinanceSwap) GetKlineRecords ¶
func (bs *BinanceSwap) GetKlineRecords(contractType string, currency common.TradingPair, period, size, since int) ([]common.FutureKline, error)
*
- 获取K线数据
func (*BinanceSwap) GetServerTime ¶
func (bs *BinanceSwap) GetServerTime() (int64, error)
func (*BinanceSwap) GetTrades ¶
func (bs *BinanceSwap) GetTrades(contractType string, currencyPair common.TradingPair, since int64) ([]common.Trade, error)
func (*BinanceSwap) GetUnfinishFutureOrders ¶
func (bs *BinanceSwap) GetUnfinishFutureOrders(currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
*
*获取未完成订单信息
func (*BinanceSwap) LimitFuturesOrder ¶
func (bs *BinanceSwap) LimitFuturesOrder(currencyPair common.TradingPair, contractType, price, amount string, openType int, opt ...common.LimitOrderOptionalParameter) (*common.FutureOrder, error)
func (*BinanceSwap) MarketFuturesOrder ¶
func (bs *BinanceSwap) MarketFuturesOrder(currencyPair common.TradingPair, contractType, amount string, openType int) (*common.FutureOrder, error)
func (*BinanceSwap) Ping ¶
func (bs *BinanceSwap) Ping() bool
func (*BinanceSwap) PlaceFutureOrder ¶
func (bs *BinanceSwap) PlaceFutureOrder(currencyPair common.TradingPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)
func (*BinanceSwap) PlaceFutureOrder2 ¶
func (bs *BinanceSwap) PlaceFutureOrder2(currencyPair common.TradingPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (*common.FutureOrder, error)
*
- @deprecated
- 期货下单
- @param currencyPair btc_usd:比特币 ltc_usd :莱特币
- @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
- @param price 价格
- @param amount 委托数量
- @param openType 1:开多 2:开空 3:平多 4:平空
- @param matchPrice 是否为对手价 0:不是 1:是 ,当取值为1时,price无效
type BinanceWs ¶
type BinanceWs struct {
// contains filtered or unexported fields
}
func NewBinanceWs ¶
func NewBinanceWs() *BinanceWs
func (*BinanceWs) SetBaseUrl ¶
func (*BinanceWs) SetCallbacks ¶
func (*BinanceWs) SetCombinedBaseURL ¶
func (*BinanceWs) SubscribeAggTrade ¶
func (*BinanceWs) SubscribeDepth ¶
func (bnWs *BinanceWs) SubscribeDepth(pair common.TradingPair, size int) error
func (*BinanceWs) SubscribeDiffDepth ¶
func (*BinanceWs) SubscribeKline ¶
func (bnWs *BinanceWs) SubscribeKline(pair common.TradingPair, period int) error
func (*BinanceWs) SubscribeTicker ¶
func (bnWs *BinanceWs) SubscribeTicker(pair common.TradingPair) error
func (*BinanceWs) SubscribeTrade ¶
func (bnWs *BinanceWs) SubscribeTrade(pair common.TradingPair) error
type ExchangeInfo ¶
type ExchangeInfo struct { Timezone string `json:"timezone"` ServerTime int `json:"serverTime"` ExchangeFilters []interface{} `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 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"` 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) GetAmountPrecision ¶
func (ts TradeSymbol) GetAmountPrecision() int
func (TradeSymbol) GetMinAmount ¶
func (ts TradeSymbol) GetMinAmount() float64
func (TradeSymbol) GetMinPrice ¶
func (ts TradeSymbol) GetMinPrice() float64
func (TradeSymbol) GetMinValue ¶
func (ts TradeSymbol) GetMinValue() float64
func (TradeSymbol) GetPricePrecision ¶
func (ts TradeSymbol) GetPricePrecision() int
Click to show internal directories.
Click to hide internal directories.