Documentation ¶
Index ¶
- Constants
- func GetDueTimestamp(timestamp int64) (flag int, dueTimestamp map[string]int64)
- type Binance
- type BinanceWebsocket
- type Future
- func (future *Future) CancelOrder(order *FutureOrder) ([]byte, error)
- func (future *Future) DoRequest(httpMethod, uri, reqBody string, response interface{}) ([]byte, error)
- func (future *Future) GetAccount() (*FutureAccount, []byte, error)
- func (future *Future) GetContract(pair Pair, contractType string) (*FutureContract, error)
- func (future *Future) GetDepth(pair Pair, contractType string, size int) (*FutureDepth, []byte, error)
- func (future *Future) GetIndex(pair Pair) (float64, []byte, error)
- func (future *Future) GetKlineRecords(contractType string, pair Pair, period, size, since int) ([]*FutureKline, []byte, error)
- func (future *Future) GetLimit(pair Pair, contractType string) (float64, float64, error)
- func (future *Future) GetMark(pair Pair, contractType string) (float64, []byte, error)
- func (future *Future) GetOrder(order *FutureOrder) ([]byte, error)
- func (future *Future) GetOrders(pair Pair, contractType string) ([]*FutureOrder, []byte, error)
- func (future *Future) GetPairFlow(pair Pair) ([]*FutureAccountItem, []byte, error)
- func (future *Future) GetTicker(pair Pair, contractType string) (*FutureTicker, []byte, error)
- func (future *Future) GetTrades(pair Pair, contractType string) ([]*Trade, []byte, error)
- func (future *Future) KeepAlive()
- func (future *Future) PlaceOrder(order *FutureOrder) ([]byte, error)
- type Margin
- func (margin *Margin) CancelOrder(order *Order) ([]byte, error)
- func (margin *Margin) GetAccount(pair Pair) (*MarginAccount, []byte, error)
- func (margin *Margin) GetDepth(pair Pair, size int) (*Depth, []byte, error)
- func (margin *Margin) GetExchangeRule(pair Pair) (*Rule, []byte, error)
- func (margin *Margin) GetKlineRecords(pair Pair, period, size, since int) ([]*Kline, []byte, error)
- func (margin *Margin) GetLoan(loan *Loan) ([]byte, error)
- func (margin *Margin) GetOrder(order *Order) ([]byte, error)
- func (margin *Margin) GetOrders(pair Pair) ([]*Order, []byte, error)
- func (margin *Margin) GetTicker(pair Pair) (*Ticker, []byte, error)
- func (margin *Margin) GetUnFinishOrders(pair Pair) ([]*Order, []byte, error)
- func (margin *Margin) KeepAlive()
- func (margin *Margin) PlaceLoan(loan *Loan) ([]byte, error)
- func (margin *Margin) PlaceOrder(order *Order) ([]byte, error)
- func (margin *Margin) ReturnLoan(loan *Loan) ([]byte, error)
- type Spot
- func (spot *Spot) CancelOrder(order *Order) ([]byte, error)
- func (spot *Spot) GetAccount() (*Account, []byte, error)
- func (spot *Spot) GetDepth(pair Pair, size int) (*Depth, []byte, error)
- func (spot *Spot) GetExchangeRule(pair Pair) (*Rule, []byte, error)
- func (spot *Spot) GetKlineRecords(pair Pair, period, size, since int) ([]*Kline, []byte, error)
- func (spot *Spot) GetOrder(order *Order) ([]byte, error)
- func (spot *Spot) GetOrders(pair Pair) ([]*Order, error)
- func (spot *Spot) GetTicker(pair Pair) (*Ticker, []byte, error)
- func (spot *Spot) GetTrades(pair Pair, since int64) ([]*Trade, error)
- func (spot *Spot) GetUnFinishOrders(pair Pair) ([]*Order, []byte, error)
- func (spot *Spot) KeepAlive()
- func (spot *Spot) PlaceOrder(order *Order) ([]byte, error)
- type Swap
- func (swap *Swap) AddMargin(pair Pair, openType FutureType, marginAmount float64) ([]byte, error)
- func (swap *Swap) CancelOrder(order *SwapOrder) ([]byte, error)
- func (swap *Swap) DoRequest(httpMethod, uri, reqBody string, response interface{}, settleMode int64) ([]byte, error)
- func (swap *Swap) GetAccount() (*SwapAccount, []byte, error)
- func (swap *Swap) GetAccountFlow() ([]*SwapAccountItem, []byte, error)
- func (swap *Swap) GetContract(pair Pair) *SwapContract
- func (swap *Swap) GetDepth(pair Pair, size int) (*SwapDepth, []byte, error)
- func (swap *Swap) GetFundingFee(pair Pair) (float64, error)
- func (swap *Swap) GetFundingFees(pair Pair) ([][]interface{}, []byte, error)
- func (swap *Swap) GetKline(pair Pair, period, size, since int) ([]*SwapKline, []byte, error)
- func (swap *Swap) GetLimit(pair Pair) (float64, float64, error)
- func (swap *Swap) GetMark(pair Pair) (float64, error)
- func (swap *Swap) GetOpenAmount(pair Pair) (float64, int64, []byte, error)
- func (swap *Swap) GetOrder(order *SwapOrder) ([]byte, error)
- func (swap *Swap) GetOrders(pair Pair) ([]*SwapOrder, []byte, error)
- func (swap *Swap) GetPairFlow(pair Pair) ([]*SwapAccountItem, []byte, error)
- func (swap *Swap) GetPosition(pair Pair, openType FutureType) (*SwapPosition, []byte, error)
- func (swap *Swap) GetTicker(pair Pair) (*SwapTicker, []byte, error)
- func (swap *Swap) GetUnFinishOrders(pair Pair) ([]*SwapOrder, []byte, error)
- func (swap *Swap) KeepAlive()
- func (swap *Swap) PlaceOrder(order *SwapOrder) ([]byte, error)
- func (swap *Swap) ReduceMargin(pair Pair, openType FutureType, marginAmount float64) ([]byte, error)
Constants ¶
View Source
const ( ENDPOINT = "https://api.binance.com" API_V1 = "/api/v1/" API_V3 = "/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 = "api/v1/time" )
View Source
const ( FUTURE_ENDPOINT = "https://dapi.binance.com" FUTURE_KEEP_ALIVE_URI = "/dapi/v1/ping" FUTURE_TICKER_URI = "/dapi/v1/ticker/24hr?" FUTURE_EXCHANGE_INFO_URI = "/dapi/v1/exchangeInfo" FUTURE_DEPTH_URI = "/dapi/v1/depth?" FUTURE_KLINE_URI = "/dapi/v1/continuousKlines?" FUTURE_TRADE_URI = "/dapi/v1/trades?" FUTURE_INCOME_URI = "/dapi/v1/income?" FUTURE_ACCOUNT_URI = "/dapi/v1/account?" FUTURE_POSITION_URI = "/dapi/v1/positionRisk?" FUTURE_PLACE_ORDER_URI = "/dapi/v1/order?" FUTURE_CANCEL_ORDER_URI = "/dapi/v1/order?" FUTURE_GET_ORDER_URI = "/dapi/v1/order?" FUTURE_GET_ORDERS_URI = "/dapi/v1/allOrders?" )
View Source
const ( SWAP_COUNTER_ENDPOINT = "https://fapi.binance.com" SWAP_COUNTER_DEPTH_URI = "/fapi/v1/depth?" SWAP_COUNTER_KLINE_URI = "/fapi/v1/klines?" SWAP_COUNTER_TICKER_URI = "/fapi/v1/ticker/24hr?" SWAP_COUNTER_PLACE_ORDER_URI = "/fapi/v1/order?" SWAP_COUNTER_GET_ORDER_URI = "/fapi/v1/order?" SWAP_COUNTER_CANCEL_ORDER_URI = "/fapi/v1/order?" SWAP_COUNTER_INCOME_URI = "/fapi/v1/income?" SWAP_BASIS_ENDPOINT = "https://dapi.binance.com" SWAP_BASIS_DEPTH_URI = "/dapi/v1/depth?" SWAP_BASIS_KLINE_URI = "/dapi/v1/klines?" SWAP_BASIS_TICKER_URI = "/dapi/v1/ticker/24hr?" SWAP_BASIS_PLACE_ORDER_URI = "/dapi/v1/order?" SWAP_BASIS_GET_ORDER_URI = "/dapi/v1/order?" SWAP_BASIS_CANCEL_ORDER_URI = "/dapi/v1/order?" SWAP_BASIS_INCOME_URI = "/dapi/v1/income?" SWAP_ACCOUNT_URI = "/fapi/v1/account?" SWAP_GET_ORDERS_URI = "/fapi/v1/allOrders?" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Binance ¶
type Binance struct { Spot *Spot Margin *Margin Swap *Swap Future *Future // contains filtered or unexported fields }
func (*Binance) ExchangeInfo ¶
func (*Binance) GetExchangeName ¶
type BinanceWebsocket ¶
type BinanceWebsocket struct {
// contains filtered or unexported fields
}
func (*BinanceWebsocket) Close ¶
func (this *BinanceWebsocket) Close()
func (*BinanceWebsocket) Init ¶
func (this *BinanceWebsocket) Init()
func (*BinanceWebsocket) Start ¶
func (this *BinanceWebsocket) Start()
func (*BinanceWebsocket) Subscribe ¶
func (this *BinanceWebsocket) Subscribe(channel string) error
type Future ¶
type Future struct { *Binance Locker sync.Locker Contracts FutureContracts LastTimestamp int64 // contains filtered or unexported fields }
func (*Future) CancelOrder ¶
func (*Future) GetAccount ¶
func (*Future) GetContract ¶
func (*Future) GetKlineRecords ¶
func (*Future) GetPairFlow ¶
func (*Future) PlaceOrder ¶
type Margin ¶
type Margin struct {
*Binance
}
func (*Margin) CancelOrder ¶
func (*Margin) GetAccount ¶
func (*Margin) GetExchangeRule ¶
func (*Margin) GetKlineRecords ¶
func (*Margin) GetUnFinishOrders ¶
func (*Margin) PlaceOrder ¶
private api
func (*Margin) ReturnLoan ¶
type Spot ¶
type Spot struct {
*Binance
}
func (*Spot) CancelOrder ¶
func (*Spot) GetExchangeRule ¶
func (*Spot) GetKlineRecords ¶
func (*Spot) GetUnFinishOrders ¶
func (*Spot) PlaceOrder ¶
type Swap ¶
type Swap struct { *Binance sync.Locker LastKeepLiveTime time.Time // 上一次keep live时间。 // contains filtered or unexported fields }
func (*Swap) CancelOrder ¶
func (*Swap) GetAccount ¶
func (*Swap) GetAccountFlow ¶
func (*Swap) GetContract ¶
func (swap *Swap) GetContract(pair Pair) *SwapContract
func (*Swap) GetFundingFee ¶
func (*Swap) GetFundingFees ¶
func (*Swap) GetOpenAmount ¶
func (*Swap) GetPairFlow ¶
func (*Swap) GetPosition ¶
func (*Swap) GetUnFinishOrders ¶
func (*Swap) PlaceOrder ¶
Click to show internal directories.
Click to hide internal directories.