Documentation ¶
Overview ¶
Package binance is a Golang SDK for binance APIs.
Index ¶
- Constants
- Variables
- func IsAPIError(e error) bool
- func WsAggTradeServe(symbol string, handler WsAggTradeHandler) (chan struct{}, error)
- func WsDepthServe(symbol string, handler WsDepthHandler) (chan struct{}, error)
- func WsKlineServe(symbol string, interval string, handler WsKlineHandler) (chan struct{}, error)
- func WsUserAccountServe(listenKey string, handler WsUserAccountHandler) (chan struct{}, error)
- func WsUserDataServe(listenKey string, handler WsHandler) (chan struct{}, error)
- func WsUserTradesServe(listenKey string, handler WsUserTradeHandler) (chan struct{}, error)
- type APIError
- type Account
- type AggTrade
- type AggTradesService
- func (s *AggTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*AggTrade, err error)
- func (s *AggTradesService) EndTime(endTime int64) *AggTradesService
- func (s *AggTradesService) FromID(fromID int64) *AggTradesService
- func (s *AggTradesService) Limit(limit int) *AggTradesService
- func (s *AggTradesService) StartTime(startTime int64) *AggTradesService
- func (s *AggTradesService) Symbol(symbol string) *AggTradesService
- type Ask
- type Balance
- type BalanceUpdate
- type Bid
- type BookTicker
- type CancelOrderResponse
- type CancelOrderService
- func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CancelOrderResponse, err error)
- func (s *CancelOrderService) NewClientOrderID(newClientOrderID string) *CancelOrderService
- func (s *CancelOrderService) OrderID(orderID int64) *CancelOrderService
- func (s *CancelOrderService) OrigClientOrderID(origClientOrderID string) *CancelOrderService
- func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService
- type Client
- func (c *Client) NewAggTradesService() *AggTradesService
- func (c *Client) NewCancelOrderService() *CancelOrderService
- func (c *Client) NewCloseUserStreamService() *CloseUserStreamService
- func (c *Client) NewCreateDepositAddressService() *DepositAddressService
- func (c *Client) NewCreateOrderService() *CreateOrderService
- func (c *Client) NewCreateWithdrawService() *CreateWithdrawService
- func (c *Client) NewDepthService() *DepthService
- func (c *Client) NewExchangeInfoService() *ExchangeInfoService
- func (c *Client) NewGetAccountService() *GetAccountService
- func (c *Client) NewGetOrderService() *GetOrderService
- func (c *Client) NewKeepaliveUserStreamService() *KeepaliveUserStreamService
- func (c *Client) NewKlinesService() *KlinesService
- func (c *Client) NewListBookTickersService() *ListBookTickersService
- func (c *Client) NewListDepositsService() *ListDepositsService
- func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
- func (c *Client) NewListOrdersService() *ListOrdersService
- func (c *Client) NewListPricesService() *ListPricesService
- func (c *Client) NewListProductService() *ListProductService
- func (c *Client) NewListTradesService() *ListTradesService
- func (c *Client) NewListWithdrawsService() *ListWithdrawsService
- func (c *Client) NewPingService() *PingService
- func (c *Client) NewPriceChangeStatsService() *PriceChangeStatsService
- func (c *Client) NewServerTimeService() *ServerTimeService
- func (c *Client) NewStartUserStreamService() *StartUserStreamService
- func (c *Client) NewSymbolPriceService() *SymbolPriceService
- type CloseUserStreamService
- type CreateOrderResponse
- type CreateOrderService
- func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOrderResponse, err error)
- func (s *CreateOrderService) IcebergQuantity(icebergQuantity string) *CreateOrderService
- func (s *CreateOrderService) NewClientOrderID(newClientOrderID string) *CreateOrderService
- func (s *CreateOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateOrderService
- func (s *CreateOrderService) Price(price string) *CreateOrderService
- func (s *CreateOrderService) Quantity(quantity string) *CreateOrderService
- func (s *CreateOrderService) Side(side SideType) *CreateOrderService
- func (s *CreateOrderService) StopPrice(stopPrice string) *CreateOrderService
- func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
- func (s *CreateOrderService) Test(ctx context.Context, opts ...RequestOption) (err error)
- func (s *CreateOrderService) TimeInForce(timeInForce TimeInForce) *CreateOrderService
- func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService
- type CreateWithdrawService
- func (s *CreateWithdrawService) Address(address string) *CreateWithdrawService
- func (s *CreateWithdrawService) Amount(amount string) *CreateWithdrawService
- func (s *CreateWithdrawService) Asset(asset string) *CreateWithdrawService
- func (s *CreateWithdrawService) Do(ctx context.Context) (err error)
- func (s *CreateWithdrawService) Name(name string) *CreateWithdrawService
- type Deposit
- type DepositAddressResponse
- type DepositAddressService
- type DepositHistoryResponse
- type DepthResponse
- type DepthService
- type ExchangeInfo
- type ExchangeInfoService
- type GetAccountService
- type GetOrderService
- func (s *GetOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
- func (s *GetOrderService) OrderID(orderID int64) *GetOrderService
- func (s *GetOrderService) OrigClientOrderID(origClientOrderID string) *GetOrderService
- func (s *GetOrderService) Symbol(symbol string) *GetOrderService
- type KeepaliveUserStreamService
- type Kline
- type KlinesService
- func (s *KlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)
- func (s *KlinesService) EndTime(endTime int64) *KlinesService
- func (s *KlinesService) Interval(interval string) *KlinesService
- func (s *KlinesService) Limit(limit int) *KlinesService
- func (s *KlinesService) StartTime(startTime int64) *KlinesService
- func (s *KlinesService) Symbol(symbol string) *KlinesService
- type ListBookTickersService
- type ListDepositsService
- func (s *ListDepositsService) Asset(asset string) *ListDepositsService
- func (s *ListDepositsService) Do(ctx context.Context, opts ...RequestOption) (deposits []*Deposit, err error)
- func (s *ListDepositsService) EndTime(endTime int64) *ListDepositsService
- func (s *ListDepositsService) StartTime(startTime int64) *ListDepositsService
- func (s *ListDepositsService) Status(status int) *ListDepositsService
- type ListOpenOrdersService
- type ListOrdersService
- func (s *ListOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)
- func (s *ListOrdersService) Limit(limit int) *ListOrdersService
- func (s *ListOrdersService) OrderID(orderID int64) *ListOrdersService
- func (s *ListOrdersService) Symbol(symbol string) *ListOrdersService
- type ListPricesService
- type ListProductService
- type ListTradesService
- func (s *ListTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*Trade, err error)
- func (s *ListTradesService) FromID(fromID int64) *ListTradesService
- func (s *ListTradesService) Limit(limit int) *ListTradesService
- func (s *ListTradesService) Symbol(symbol string) *ListTradesService
- type ListWithdrawsService
- func (s *ListWithdrawsService) Asset(asset string) *ListWithdrawsService
- func (s *ListWithdrawsService) Do(ctx context.Context) (withdraws []*Withdraw, err error)
- func (s *ListWithdrawsService) EndTime(endTime int64) *ListWithdrawsService
- func (s *ListWithdrawsService) StartTime(startTime int64) *ListWithdrawsService
- func (s *ListWithdrawsService) Status(status int) *ListWithdrawsService
- type NewOrderRespType
- type Order
- type OrderType
- type PingService
- type PriceChangeStats
- type PriceChangeStatsService
- type Product
- type ProductList
- type RequestOption
- type ServerTimeService
- type SideType
- type StartUserStreamService
- type SymbolFilter
- type SymbolNotionalFilter
- type SymbolPrice
- type SymbolPriceFilter
- type SymbolPriceService
- type SymbolSizeFilter
- type SymbolUnit
- type TimeInForce
- type Trade
- type Withdraw
- type WithdrawHistoryResponse
- type WsAggTradeEvent
- type WsAggTradeHandler
- type WsDepthEvent
- type WsDepthHandler
- type WsHandler
- type WsKline
- type WsKlineEvent
- type WsKlineHandler
- type WsUserAccountEvent
- type WsUserAccountHandler
- type WsUserEventType
- type WsUserTradeEvent
- type WsUserTradeHandler
Constants ¶
const ( SideTypeBuy SideType = "BUY" SideTypeSell SideType = "SELL" OrderTypeLimit OrderType = "LIMIT" OrderTypeMarket OrderType = "MARKET" TimeInForceGTC TimeInForce = "GTC" // Good Till Canceled TimeInForceIOC TimeInForce = "IOC" // Immediate Or Cancel ? NewOrderRespTypeAck NewOrderRespType = "ACK" NewOrderRespTypeResult NewOrderRespType = "RESULT" NewOrderRespTypeFull NewOrderRespType = "FULL" )
Global enums
Variables ¶
var TimestampOffsetMilliseconds int64
Functions ¶
func WsAggTradeServe ¶
func WsAggTradeServe(symbol string, handler WsAggTradeHandler) (chan struct{}, error)
WsAggTradeServe serve websocket aggregate handler with a symbol
func WsDepthServe ¶
func WsDepthServe(symbol string, handler WsDepthHandler) (chan struct{}, error)
WsDepthServe serve websocket depth handler with a symbol
func WsKlineServe ¶
func WsKlineServe(symbol string, interval string, handler WsKlineHandler) (chan struct{}, error)
WsKlineServe serve websocket kline handler with a symbol and interval like 15m, 30s
func WsUserAccountServe ¶
func WsUserAccountServe(listenKey string, handler WsUserAccountHandler) (chan struct{}, error)
func WsUserDataServe ¶
WsUserDataServe serve user data handler with listen key
func WsUserTradesServe ¶
func WsUserTradesServe(listenKey string, handler WsUserTradeHandler) (chan struct{}, error)
Types ¶
type Account ¶
type Account struct { MakerCommission int64 `json:"makerCommission"` TakerCommission int64 `json:"takerCommission"` BuyerCommission int64 `json:"buyerCommission"` SellerCommission int64 `json:"sellerCommission"` CanTrade bool `json:"canTrade"` CanWithdraw bool `json:"canWithdraw"` CanDeposit bool `json:"canDeposit"` Balances []Balance `json:"balances"` }
Account define account info
type AggTrade ¶
type AggTrade struct { AggTradeID int64 `json:"a"` Price string `json:"p"` Quantity string `json:"q"` FirstTradeID int64 `json:"f"` LastTradeID int64 `json:"l"` Timestamp int64 `json:"T"` IsBuyerMaker bool `json:"m"` IsBestPriceMatch bool `json:"M"` }
AggTrade define aggregate trade info
type AggTradesService ¶
type AggTradesService struct {
// contains filtered or unexported fields
}
AggTradesService list aggregate trades
func (*AggTradesService) Do ¶
func (s *AggTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*AggTrade, err error)
Do send request
func (*AggTradesService) EndTime ¶
func (s *AggTradesService) EndTime(endTime int64) *AggTradesService
EndTime set endTime
func (*AggTradesService) FromID ¶
func (s *AggTradesService) FromID(fromID int64) *AggTradesService
FromID set fromID
func (*AggTradesService) Limit ¶
func (s *AggTradesService) Limit(limit int) *AggTradesService
Limit set limit
func (*AggTradesService) StartTime ¶
func (s *AggTradesService) StartTime(startTime int64) *AggTradesService
StartTime set startTime
func (*AggTradesService) Symbol ¶
func (s *AggTradesService) Symbol(symbol string) *AggTradesService
Symbol set symbol
type Balance ¶
type Balance struct { Asset string `json:"asset"` Free string `json:"free"` Locked string `json:"locked"` }
Balance define user balance of your account
type BalanceUpdate ¶
type BookTicker ¶
type BookTicker struct { Symbol string `json:"symbol"` BidPrice string `json:"bidPrice"` BidQuantity string `json:"bidQty"` AskPrice string `json:"askPrice"` AskQuantity string `json:"askQty"` }
BookTicker define book ticker info
type CancelOrderResponse ¶
type CancelOrderResponse struct { Symbol string `json:"symbol"` OrigClientOrderID string `json:"origClientOrderId"` OrderID int64 `json:"orderId"` ClientOrderID string `json:"clientOrderId"` }
CancelOrderResponse define response of canceling order
type CancelOrderService ¶
type CancelOrderService struct {
// contains filtered or unexported fields
}
CancelOrderService cancel an order
func (*CancelOrderService) Do ¶
func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CancelOrderResponse, err error)
Do send request
func (*CancelOrderService) NewClientOrderID ¶
func (s *CancelOrderService) NewClientOrderID(newClientOrderID string) *CancelOrderService
NewClientOrderID set newClientOrderID
func (*CancelOrderService) OrderID ¶
func (s *CancelOrderService) OrderID(orderID int64) *CancelOrderService
OrderID set orderID
func (*CancelOrderService) OrigClientOrderID ¶
func (s *CancelOrderService) OrigClientOrderID(origClientOrderID string) *CancelOrderService
OrigClientOrderID set origClientOrderID
func (*CancelOrderService) Symbol ¶
func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService
Symbol set symbol
type Client ¶
type Client struct { APIKey string SecretKey string BaseURL string UserAgent string HTTPClient *http.Client Debug bool Logger *log.Logger // contains filtered or unexported fields }
Client define API client
func NewClient ¶
NewClient initialize an API client instance with API key and secret key. You should always call this function before using this SDK. Services will be created by the form client.NewXXXService().
func (*Client) NewAggTradesService ¶
func (c *Client) NewAggTradesService() *AggTradesService
NewAggTradesService init aggregate trades service
func (*Client) NewCancelOrderService ¶
func (c *Client) NewCancelOrderService() *CancelOrderService
NewCancelOrderService init cancel order service
func (*Client) NewCloseUserStreamService ¶
func (c *Client) NewCloseUserStreamService() *CloseUserStreamService
NewCloseUserStreamService init closing user stream service
func (*Client) NewCreateDepositAddressService ¶
func (c *Client) NewCreateDepositAddressService() *DepositAddressService
func (*Client) NewCreateOrderService ¶
func (c *Client) NewCreateOrderService() *CreateOrderService
NewCreateOrderService init creating order service
func (*Client) NewCreateWithdrawService ¶
func (c *Client) NewCreateWithdrawService() *CreateWithdrawService
NewCreateWithdrawService init creating withdraw service
func (*Client) NewDepthService ¶
func (c *Client) NewDepthService() *DepthService
NewDepthService init depth service
func (*Client) NewExchangeInfoService ¶
func (c *Client) NewExchangeInfoService() *ExchangeInfoService
func (*Client) NewGetAccountService ¶
func (c *Client) NewGetAccountService() *GetAccountService
NewGetAccountService init getting account service
func (*Client) NewGetOrderService ¶
func (c *Client) NewGetOrderService() *GetOrderService
NewGetOrderService init get order service
func (*Client) NewKeepaliveUserStreamService ¶
func (c *Client) NewKeepaliveUserStreamService() *KeepaliveUserStreamService
NewKeepaliveUserStreamService init keep alive user stream service
func (*Client) NewKlinesService ¶
func (c *Client) NewKlinesService() *KlinesService
NewKlinesService init klines service
func (*Client) NewListBookTickersService ¶
func (c *Client) NewListBookTickersService() *ListBookTickersService
NewListBookTickersService init listing booking tickers service
func (*Client) NewListDepositsService ¶
func (c *Client) NewListDepositsService() *ListDepositsService
NewListDepositsService init listing deposits service
func (*Client) NewListOpenOrdersService ¶
func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
NewListOpenOrdersService init list open orders service
func (*Client) NewListOrdersService ¶
func (c *Client) NewListOrdersService() *ListOrdersService
NewListOrdersService init listing orders service
func (*Client) NewListPricesService ¶
func (c *Client) NewListPricesService() *ListPricesService
NewListPricesService init listing prices service
func (*Client) NewListProductService ¶
func (c *Client) NewListProductService() *ListProductService
func (*Client) NewListTradesService ¶
func (c *Client) NewListTradesService() *ListTradesService
NewListTradesService init listing trades service
func (*Client) NewListWithdrawsService ¶
func (c *Client) NewListWithdrawsService() *ListWithdrawsService
NewListWithdrawsService init listing withdraw service
func (*Client) NewPingService ¶
func (c *Client) NewPingService() *PingService
NewPingService init ping service
func (*Client) NewPriceChangeStatsService ¶
func (c *Client) NewPriceChangeStatsService() *PriceChangeStatsService
NewPriceChangeStatsService init prices change stats service
func (*Client) NewServerTimeService ¶
func (c *Client) NewServerTimeService() *ServerTimeService
NewServerTimeService init server time service
func (*Client) NewStartUserStreamService ¶
func (c *Client) NewStartUserStreamService() *StartUserStreamService
NewStartUserStreamService init starting user stream service
func (*Client) NewSymbolPriceService ¶
func (c *Client) NewSymbolPriceService() *SymbolPriceService
type CloseUserStreamService ¶
type CloseUserStreamService struct {
// contains filtered or unexported fields
}
CloseUserStreamService delete listen key
func (*CloseUserStreamService) Do ¶
func (s *CloseUserStreamService) Do(ctx context.Context, opts ...RequestOption) (err error)
Do send request
func (*CloseUserStreamService) ListenKey ¶
func (s *CloseUserStreamService) ListenKey(listenKey string) *CloseUserStreamService
ListenKey set listen key
type CreateOrderResponse ¶
type CreateOrderResponse struct { Symbol string `json:"symbol"` OrderID int64 `json:"orderId"` ClientOrderID string `json:"clientOrderId"` TransactTime int64 `json:"transactTime"` Price string `json:"price"` OrigQty string `json:"origQty"` ExecutedQty string `json:"executedQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Side string `json:"side"` }
CreateOrderResponse define create order response
type CreateOrderService ¶
type CreateOrderService struct {
// contains filtered or unexported fields
}
CreateOrderService create order
func (*CreateOrderService) Do ¶
func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOrderResponse, err error)
Do send request
func (*CreateOrderService) IcebergQuantity ¶
func (s *CreateOrderService) IcebergQuantity(icebergQuantity string) *CreateOrderService
IcebergQuantity set icebergQuantity
func (*CreateOrderService) NewClientOrderID ¶
func (s *CreateOrderService) NewClientOrderID(newClientOrderID string) *CreateOrderService
NewClientOrderID set newClientOrderID
func (*CreateOrderService) NewOrderRespType ¶
func (s *CreateOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateOrderService
NewOrderRespType set newOrderRespType
func (*CreateOrderService) Price ¶
func (s *CreateOrderService) Price(price string) *CreateOrderService
Price set price
func (*CreateOrderService) Quantity ¶
func (s *CreateOrderService) Quantity(quantity string) *CreateOrderService
Quantity set quantity
func (*CreateOrderService) Side ¶
func (s *CreateOrderService) Side(side SideType) *CreateOrderService
Side set side
func (*CreateOrderService) StopPrice ¶
func (s *CreateOrderService) StopPrice(stopPrice string) *CreateOrderService
StopPrice set stopPrice
func (*CreateOrderService) Symbol ¶
func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
Symbol set symbol
func (*CreateOrderService) Test ¶
func (s *CreateOrderService) Test(ctx context.Context, opts ...RequestOption) (err error)
Test send test api to check if the request is valid
func (*CreateOrderService) TimeInForce ¶
func (s *CreateOrderService) TimeInForce(timeInForce TimeInForce) *CreateOrderService
TimeInForce set timeInForce
func (*CreateOrderService) Type ¶
func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService
Type set type
type CreateWithdrawService ¶
type CreateWithdrawService struct {
// contains filtered or unexported fields
}
CreateWithdrawService create withdraw
func (*CreateWithdrawService) Address ¶
func (s *CreateWithdrawService) Address(address string) *CreateWithdrawService
Address set address
func (*CreateWithdrawService) Amount ¶
func (s *CreateWithdrawService) Amount(amount string) *CreateWithdrawService
Amount set amount
func (*CreateWithdrawService) Asset ¶
func (s *CreateWithdrawService) Asset(asset string) *CreateWithdrawService
Asset set asset
func (*CreateWithdrawService) Do ¶
func (s *CreateWithdrawService) Do(ctx context.Context) (err error)
Do send request
func (*CreateWithdrawService) Name ¶
func (s *CreateWithdrawService) Name(name string) *CreateWithdrawService
Name set name
type Deposit ¶
type Deposit struct { InsertTime int64 `json:"insertTime"` Amount float64 `json:"amount"` Asset string `json:"asset"` Status int `json:"status"` }
Deposit define deposit info
type DepositAddressResponse ¶
type DepositAddressResponse struct { Success bool `json:"success"` Address string `json:"address"` AddressTag string `json:"addressTag"` Asset string `json:"asset"` }
DepositHistoryResponse define deposit history
type DepositAddressService ¶
type DepositAddressService struct {
// contains filtered or unexported fields
}
ListDepositsService list deposits
func (*DepositAddressService) Asset ¶
func (s *DepositAddressService) Asset(asset string) *DepositAddressService
Asset set asset
func (*DepositAddressService) Do ¶
func (s *DepositAddressService) Do(ctx context.Context, opts ...RequestOption) (res *DepositAddressResponse, err error)
Do send request
func (*DepositAddressService) Timestamp ¶
func (s *DepositAddressService) Timestamp(startTime int64) *DepositAddressService
StartTime set timetsamp
type DepositHistoryResponse ¶
type DepositHistoryResponse struct { Success bool `json:"success"` Deposits []*Deposit `json:"depositList"` }
DepositHistoryResponse define deposit history
type DepthResponse ¶
type DepthResponse struct { LastUpdateID int64 `json:"lastUpdateId"` Bids []Bid `json:"bids"` Asks []Ask `json:"asks"` }
DepthResponse define depth info with bids and asks
type DepthService ¶
type DepthService struct {
// contains filtered or unexported fields
}
DepthService show depth info
func (*DepthService) Do ¶
func (s *DepthService) Do(ctx context.Context, opts ...RequestOption) (res *DepthResponse, err error)
Do send request
func (*DepthService) Symbol ¶
func (s *DepthService) Symbol(symbol string) *DepthService
Symbol set symbol
type ExchangeInfo ¶
type ExchangeInfo struct { Timezone string `json:"timezone"` ServerTime int64 `json:"serverTime"` Symbols []SymbolUnit `json:"symbols"` }
type ExchangeInfoService ¶
type ExchangeInfoService struct {
// contains filtered or unexported fields
}
func (*ExchangeInfoService) Do ¶
func (s *ExchangeInfoService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeInfo, err error)
Do send request
type GetAccountService ¶
type GetAccountService struct {
// contains filtered or unexported fields
}
GetAccountService get account info
func (*GetAccountService) Do ¶
func (s *GetAccountService) Do(ctx context.Context, opts ...RequestOption) (res *Account, err error)
Do send request
type GetOrderService ¶
type GetOrderService struct {
// contains filtered or unexported fields
}
GetOrderService get an order
func (*GetOrderService) Do ¶
func (s *GetOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
Do send request
func (*GetOrderService) OrderID ¶
func (s *GetOrderService) OrderID(orderID int64) *GetOrderService
OrderID set orderID
func (*GetOrderService) OrigClientOrderID ¶
func (s *GetOrderService) OrigClientOrderID(origClientOrderID string) *GetOrderService
OrigClientOrderID set origClientOrderID
func (*GetOrderService) Symbol ¶
func (s *GetOrderService) Symbol(symbol string) *GetOrderService
Symbol set symbol
type KeepaliveUserStreamService ¶
type KeepaliveUserStreamService struct {
// contains filtered or unexported fields
}
KeepaliveUserStreamService update listen key
func (*KeepaliveUserStreamService) Do ¶
func (s *KeepaliveUserStreamService) Do(ctx context.Context, opts ...RequestOption) (err error)
Do send request
func (*KeepaliveUserStreamService) ListenKey ¶
func (s *KeepaliveUserStreamService) ListenKey(listenKey string) *KeepaliveUserStreamService
ListenKey set listen key
type Kline ¶
type Kline struct { OpenTime int64 `json:"openTime"` Open string `json:"open"` High string `json:"high"` Low string `json:"low"` Close string `json:"close"` Volume string `json:"volume"` CloseTime int64 `json:"closeTime"` QuoteAssetVolume string `json:"quoteAssetVolume"` TradeNum int64 `json:"tradeNum"` TakerBuyBaseAssetVolume string `json:"takerBuyBaseAssetVolume"` TakerBuyQuoteAssetVolume string `json:"takerBuyQuoteAssetVolume"` }
Kline define kline info
type KlinesService ¶
type KlinesService struct {
// contains filtered or unexported fields
}
KlinesService list klines
func (*KlinesService) Do ¶
func (s *KlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)
Do send request
func (*KlinesService) EndTime ¶
func (s *KlinesService) EndTime(endTime int64) *KlinesService
EndTime set endTime
func (*KlinesService) Interval ¶
func (s *KlinesService) Interval(interval string) *KlinesService
Interval set interval
func (*KlinesService) Limit ¶
func (s *KlinesService) Limit(limit int) *KlinesService
Limit set limit
func (*KlinesService) StartTime ¶
func (s *KlinesService) StartTime(startTime int64) *KlinesService
StartTime set startTime
func (*KlinesService) Symbol ¶
func (s *KlinesService) Symbol(symbol string) *KlinesService
Symbol set symbol
type ListBookTickersService ¶
type ListBookTickersService struct {
// contains filtered or unexported fields
}
ListBookTickersService list all book tickers
func (*ListBookTickersService) Do ¶
func (s *ListBookTickersService) Do(ctx context.Context, opts ...RequestOption) (res []*BookTicker, err error)
Do send request
type ListDepositsService ¶
type ListDepositsService struct {
// contains filtered or unexported fields
}
ListDepositsService list deposits
func (*ListDepositsService) Asset ¶
func (s *ListDepositsService) Asset(asset string) *ListDepositsService
Asset set asset
func (*ListDepositsService) Do ¶
func (s *ListDepositsService) Do(ctx context.Context, opts ...RequestOption) (deposits []*Deposit, err error)
Do send request
func (*ListDepositsService) EndTime ¶
func (s *ListDepositsService) EndTime(endTime int64) *ListDepositsService
EndTime set endTime
func (*ListDepositsService) StartTime ¶
func (s *ListDepositsService) StartTime(startTime int64) *ListDepositsService
StartTime set startTime
func (*ListDepositsService) Status ¶
func (s *ListDepositsService) Status(status int) *ListDepositsService
Status set status
type ListOpenOrdersService ¶
type ListOpenOrdersService struct {
// contains filtered or unexported fields
}
ListOpenOrdersService list opened orders
func (*ListOpenOrdersService) Do ¶
func (s *ListOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)
Do send request
func (*ListOpenOrdersService) Symbol ¶
func (s *ListOpenOrdersService) Symbol(symbol string) *ListOpenOrdersService
Symbol set symbol
type ListOrdersService ¶
type ListOrdersService struct {
// contains filtered or unexported fields
}
ListOrdersService list all orders
func (*ListOrdersService) Do ¶
func (s *ListOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)
Do send request
func (*ListOrdersService) Limit ¶
func (s *ListOrdersService) Limit(limit int) *ListOrdersService
Limit set limit
func (*ListOrdersService) OrderID ¶
func (s *ListOrdersService) OrderID(orderID int64) *ListOrdersService
OrderID set orderID
func (*ListOrdersService) Symbol ¶
func (s *ListOrdersService) Symbol(symbol string) *ListOrdersService
Symbol set symbol
type ListPricesService ¶
type ListPricesService struct {
// contains filtered or unexported fields
}
ListPricesService list all ticker prices
func (*ListPricesService) Do ¶
func (s *ListPricesService) Do(ctx context.Context, opts ...RequestOption) (res []*SymbolPrice, err error)
Do send request
type ListProductService ¶
type ListProductService struct {
// contains filtered or unexported fields
}
ListBookTickersService list all book tickers
func (*ListProductService) Do ¶
func (s *ListProductService) Do(ctx context.Context, opts ...RequestOption) (p ProductList, err error)
Do send request
type ListTradesService ¶
type ListTradesService struct {
// contains filtered or unexported fields
}
ListTradesService list trades
func (*ListTradesService) Do ¶
func (s *ListTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*Trade, err error)
Do send request
func (*ListTradesService) FromID ¶
func (s *ListTradesService) FromID(fromID int64) *ListTradesService
FromID set fromID
func (*ListTradesService) Limit ¶
func (s *ListTradesService) Limit(limit int) *ListTradesService
Limit set limit
func (*ListTradesService) Symbol ¶
func (s *ListTradesService) Symbol(symbol string) *ListTradesService
Symbol set symbol
type ListWithdrawsService ¶
type ListWithdrawsService struct {
// contains filtered or unexported fields
}
ListWithdrawsService list withdraws
func (*ListWithdrawsService) Asset ¶
func (s *ListWithdrawsService) Asset(asset string) *ListWithdrawsService
Asset set asset
func (*ListWithdrawsService) Do ¶
func (s *ListWithdrawsService) Do(ctx context.Context) (withdraws []*Withdraw, err error)
Do send request
func (*ListWithdrawsService) EndTime ¶
func (s *ListWithdrawsService) EndTime(endTime int64) *ListWithdrawsService
EndTime set endTime
func (*ListWithdrawsService) StartTime ¶
func (s *ListWithdrawsService) StartTime(startTime int64) *ListWithdrawsService
StartTime set startTime
func (*ListWithdrawsService) Status ¶
func (s *ListWithdrawsService) Status(status int) *ListWithdrawsService
Status set status
type NewOrderRespType ¶
type NewOrderRespType string
NewOrderRespType define new order response type
type Order ¶
type Order struct { Symbol string `json:"symbol"` OrderID int64 `json:"orderId"` ClientOrderID string `json:"clientOrderId"` Price string `json:"price"` OrigQuantity string `json:"origQty"` ExecutedQuantity string `json:"executedQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Side string `json:"side"` StopPrice string `json:"stopPrice"` IcebergQuantity string `json:"icebergQty"` Time int64 `json:"time"` }
Order define order info
type PingService ¶
type PingService struct {
// contains filtered or unexported fields
}
PingService ping server
func (*PingService) Do ¶
func (s *PingService) Do(ctx context.Context, opts ...RequestOption) (err error)
Do send request
type PriceChangeStats ¶
type PriceChangeStats struct { PriceChange string `json:"priceChange"` PriceChangePercent string `json:"priceChangePercent"` WeightedAvgPrice string `json:"weightedAvgPrice"` PrevClosePrice string `json:"prevClosePrice"` LastPrice string `json:"lastPrice"` BidPrice string `json:"bidPrice"` AskPrice string `json:"askPrice"` OpenPrice string `json:"openPrice"` HighPrice string `json:"highPrice"` LowPrice string `json:"lowPrice"` Volume string `json:"volume"` OpenTime int64 `json:"openTime"` CloseTime int64 `json:"closeTime"` FristID int64 `json:"firstId"` LastID int64 `json:"lastId"` Count int64 `json:"count"` }
PriceChangeStats define price change stats
type PriceChangeStatsService ¶
type PriceChangeStatsService struct {
// contains filtered or unexported fields
}
PriceChangeStatsService show stats of price change in last 24 hours
func (*PriceChangeStatsService) Do ¶
func (s *PriceChangeStatsService) Do(ctx context.Context, opts ...RequestOption) (res *PriceChangeStats, err error)
Do send request
func (*PriceChangeStatsService) Symbol ¶
func (s *PriceChangeStatsService) Symbol(symbol string) *PriceChangeStatsService
Symbol set symbol
type Product ¶
type Product struct { Symbol string `json:"symbol"` TradedMoney float64 `json:"tradedMoney"` Active bool `json:"active"` MinTrade float64 `json:"minTrade,string"` BaseAsset string `json:"baseAsset"` ActiveSell float64 `json:"activeSell"` WithdrawFee float64 `json:"withdrawFee,string"` TickSize float64 `json:"tickSize,string"` PrevClose float64 `json:"prevClose"` ActiveBuy int64 `json:"activeBuy"` Volume float64 `json:"volume,string"` High float64 `json:"high,string"` LastAggTradeId int64 `json:"lastAggTradeId"` DecimalPlaces int64 `json:"decimalPlaces"` QuoteAssetUnit string `json:"quoteAssetUnit"` MatchingUnitType string `json:"matchingUnitType"` Close float64 `json:"close,string"` QuoteAsset string `json:"quoteAsset"` Open float64 `json:"open,string"` Status string `json:"status"` MinQty float64 `json:"minQty,string"` }
type ProductList ¶
type ProductList struct {
Data []Product `json:"data"`
}
{ "symbol": "BNBBTC", "tradedMoney": 537.90333759, "baseAssetUnit": "", "active": true, "minTrade": "1.00000000", "baseAsset": "BNB", "activeSell": 2479809, "withdrawFee": "0", "tickSize": "0.00000001", "prevClose": 2.0002E-4, "activeBuy": 0, "volume": "2479809.00000000", "high": "0.00022969", "lastAggTradeId": 1451985, "decimalPlaces": 8, "low": "0.00019964", "quoteAssetUnit": "฿", "matchingUnitType": "STANDARD", "close": "0.00020495", "quoteAsset": "BTC", "open": "0.00020002", "status": "TRADING", "minQty": "1E-8" },
PriceChangeStats define price change stats
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithRecvWindow ¶
func WithRecvWindow(recvWindow int64) RequestOption
WithRecvWindow set recvWindow param for the request
type ServerTimeService ¶
type ServerTimeService struct {
// contains filtered or unexported fields
}
ServerTimeService get server time
func (*ServerTimeService) Do ¶
func (s *ServerTimeService) Do(ctx context.Context, opts ...RequestOption) (serverTime int64, err error)
Do send request
type StartUserStreamService ¶
type StartUserStreamService struct {
// contains filtered or unexported fields
}
StartUserStreamService create listen key for user stream service
func (*StartUserStreamService) Do ¶
func (s *StartUserStreamService) Do(ctx context.Context, opts ...RequestOption) (listenKey string, err error)
Do send request
type SymbolFilter ¶
type SymbolFilter struct { FilterType string `json:"filterType"` MinPrice string `json:"minPrice"` MaxPrice string `json:"maxPrice"` TickSize string `json:"tickSize"` MinQty string `json:"minQty"` MaxQty string `json:"maxQty"` StepSize string `json:"stepSize"` MinNotional string `json:"minNotional"` }
type SymbolNotionalFilter ¶
type SymbolPrice ¶
SymbolPrice define symbol and price pair
type SymbolPriceFilter ¶
type SymbolPriceService ¶
type SymbolPriceService struct {
// contains filtered or unexported fields
}
func (*SymbolPriceService) Do ¶
func (s *SymbolPriceService) Do(ctx context.Context, opts ...RequestOption) (res *SymbolPrice, err error)
Do send request
func (*SymbolPriceService) Symbol ¶
func (s *SymbolPriceService) Symbol(symbol string) *SymbolPriceService
Symbol set symbol
type SymbolSizeFilter ¶
type SymbolUnit ¶
type Trade ¶
type Trade struct { ID int64 `json:"id"` Price string `json:"price"` Quantity string `json:"qty"` Commission string `json:"commission"` CommissionAsset string `json:"commissionAsset"` Time int64 `json:"time"` IsBuyer bool `json:"isBuyer"` IsMaker bool `json:"isMaker"` IsBestMatch bool `json:"isBestMatch"` }
Trade define trade info
type Withdraw ¶
type Withdraw struct { Amount float64 `json:"amount"` Address string `json:"address"` Asset string `json:"asset"` TxID string `json:"txId"` ApplyTime int64 `json:"applyTime"` Status int `json:"status"` }
Withdraw define withdraw info
type WithdrawHistoryResponse ¶
type WithdrawHistoryResponse struct { Withdraws []*Withdraw `json:"withdrawList"` Success bool `json:"success"` }
WithdrawHistoryResponse define withdraw history response
type WsAggTradeEvent ¶
type WsAggTradeEvent struct { Event string `json:"e"` Time int64 `json:"E"` Symbol string `json:"s"` AggTradeID int64 `json:"a"` Price string `json:"p"` Quantity string `json:"q"` FirstBreakdownTradeID int64 `json:"f"` LastBreakdownTradeID int64 `json:"l"` TradeTime int64 `json:"T"` IsBuyerMaker bool `json:"m"` Placeholder bool `json:"M"` // add this field to avoid case insensitive unmarshaling }
WsAggTradeEvent define websocket aggregate trade event
type WsAggTradeHandler ¶
type WsAggTradeHandler func(event *WsAggTradeEvent)
WsAggTradeHandler handle websocket aggregate trade event
type WsDepthEvent ¶
type WsDepthEvent struct { Event string `json:"e"` Time int64 `json:"E"` Symbol string `json:"s"` UpdateID int64 `json:"u"` Bids []Bid `json:"b"` Asks []Ask `json:"a"` }
WsDepthEvent define websocket depth event
type WsDepthHandler ¶
type WsDepthHandler func(event *WsDepthEvent)
WsDepthHandler handle websocket depth event
type WsKline ¶
type WsKline struct { StartTime int64 `json:"t"` EndTime int64 `json:"T"` Symbol string `json:"s"` Interval string `json:"i"` FirstTradeID int64 `json:"f"` LastTradeID int64 `json:"L"` Open string `json:"o"` Close string `json:"c"` High string `json:"h"` Low string `json:"l"` Volume string `json:"v"` TradeNum int64 `json:"n"` IsFinal bool `json:"x"` QuoteVolume string `json:"q"` ActiveBuyVolume string `json:"V"` ActiveBuyQuoteVolume string `json:"Q"` }
WsKline define websocket kline
type WsKlineEvent ¶
type WsKlineEvent struct { Event string `json:"e"` Time int64 `json:"E"` Symbol string `json:"s"` Kline WsKline `json:"k"` }
WsKlineEvent define websocket kline event
type WsKlineHandler ¶
type WsKlineHandler func(event *WsKlineEvent)
WsKlineHandler handle websocket kline event
type WsUserAccountEvent ¶
type WsUserAccountEvent struct { EventType string `json:"e"` EventTime int64 `json:"E"` MakerCommissionRate float64 `json:"m"` TakerCommissionRate float64 `json:"t"` BuyerCommissionRate float64 `json:"b"` SellerCommissionRate float64 `json:"s"` CanTrade bool `json:"T"` CanWithdraw bool `json:"W"` CanDeposit bool `json:"D"` LastAccountUpdate int64 `json:"u"` Balances []BalanceUpdate `json:"B"` }
type WsUserAccountHandler ¶
type WsUserAccountHandler func(event *WsUserAccountEvent)
type WsUserEventType ¶
type WsUserEventType struct {
EventType string `json:"e"`
}
type WsUserTradeEvent ¶
type WsUserTradeEvent struct { EventType string `json:"e"` EventTime int64 `json:"E"` Symbol string `json:"s"` ClientOrderID string `json:"c"` Side string `json:"S"` OrderType string `json:"o"` TimeInForce string `json:"f"` OrderQuantity decimal.Decimal `json:"q"` OrderPrice decimal.Decimal `json:"p"` StopPrice decimal.Decimal `json:"P"` IcebergQuantity decimal.Decimal `json:"F"` //Ignore int OriginalClientOrderID string `json:"C"` ExecutionType string `json:"x"` OrderStatus string `json:"X"` RejectReason string `json:"r"` OrderID int64 `json:"i"` LastExecutedQuantity decimal.Decimal `json:"l"` CumulativeFilledQuantity decimal.Decimal `json:"z"` LastExecutedPrice decimal.Decimal `json:"L"` CommissionAmount decimal.Decimal `json:"n"` CommissionAsset string `json:"N"` TransactionTime int64 `json:"T"` TradeID int64 `json:"t"` //Ignore int64 IsOrderWorking bool `json:"w"` IsMaker bool `json:"m"` }
type WsUserTradeHandler ¶
type WsUserTradeHandler func(event *WsUserTradeEvent)
Source Files ¶
- account_service.go
- client.go
- deposit_address_service.go
- deposit_service.go
- depth_service.go
- doc.go
- errors.go
- kline_service.go
- order_service.go
- product_service.go
- request.go
- server_service.go
- ticker_service.go
- trade_service.go
- user_stream_service.go
- websocket.go
- websocket_service.go
- withdraw_service.go