Documentation ¶
Index ¶
- Constants
- Variables
- func SetWsProxyUrl(url string)
- func WsCombinedServe(streamName []string, handler map[string]interface{}, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsDepthServe(symbol string, levels string, rate *time.Duration, handler WsDepthHandler, ...) (doneC, stopC chan struct{}, err error)
- func WsIndexServe(symbol string, handler WsIndexHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsKlineServe(symbol string, interval string, handler WsKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsMarkPriceServe(symbol string, handler WsMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsOpenInterestServe(underlying string, expireDate string, handler WsOpenInterestHandler, ...) (doneC, stopC chan struct{}, err error)
- func WsOptionPairServe(handler WsOptionPairHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsTickerServe(symbol string, handler WsTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsTickerWithExpireServe(underlying string, expireDate string, handler WsTickerHandler, ...) (doneC, stopC chan struct{}, err error)
- func WsTradeServe(symbol string, handler WsTradeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsUserDataServe(listenKey string, handler WsUserDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- type Account
- type AccountService
- type Ask
- type Asset
- type Bid
- type Bill
- type BillService
- func (s *BillService) Currency(c string) *BillService
- func (s *BillService) Do(ctx context.Context, opts ...RequestOption) (res []*Bill, err error)
- func (s *BillService) EndTime(et uint64) *BillService
- func (s *BillService) Limit(limit int) *BillService
- func (s *BillService) RecordId(ri uint64) *BillService
- func (s *BillService) StartTime(st uint64) *BillService
- type CancelAllOpenOrdersByUnderlyingRsp
- type CancelAllOpenOrdersByUnderlyingService
- type CancelAllOpenOrdersRsp
- type CancelAllOpenOrdersService
- type CancelBatchOrdersService
- func (s *CancelBatchOrdersService) ClientOrderIds(clientOrderIds []string) *CancelBatchOrdersService
- func (s *CancelBatchOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []interface{}, err error)
- func (s *CancelBatchOrdersService) OrderIds(orderIds []int64) *CancelBatchOrdersService
- func (s *CancelBatchOrdersService) Symbol(symbol string) *CancelBatchOrdersService
- type CancelOrderService
- func (s *CancelOrderService) ClientOrderId(clientOrderId string) *CancelOrderService
- func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
- func (s *CancelOrderService) OrderId(orderId int64) *CancelOrderService
- func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService
- type Client
- func (c *Client) NewAccountService() *AccountService
- func (c *Client) NewBillService() *BillService
- func (c *Client) NewCancelAllOpenOrdersByUnderlyingService() *CancelAllOpenOrdersByUnderlyingService
- func (c *Client) NewCancelAllOpenOrdersService() *CancelAllOpenOrdersService
- func (c *Client) NewCancelBatchOrdersService() *CancelBatchOrdersService
- func (c *Client) NewCancelOrderService() *CancelOrderService
- func (c *Client) NewCloseUserStreamService() *CloseUserStreamService
- func (c *Client) NewCreateBatchOrdersService() *CreateBatchOrdersService
- func (c *Client) NewCreateOrderService() *CreateOrderService
- func (c *Client) NewDepthService() *DepthService
- func (c *Client) NewExchangeInfoService() *ExchangeInfoService
- func (c *Client) NewExerciseHistoryService() *ExerciseHistoryService
- func (c *Client) NewExercistRecordService() *ExerciseRecordService
- func (c *Client) NewGetOrderService() *GetOrderService
- func (c *Client) NewHistoricalTradesService() *HistoricalTradesService
- func (c *Client) NewHistoryOrdersService() *HistoryOrdersService
- func (c *Client) NewIncomeDownloadIdService() *IncomeDownloadIdService
- func (c *Client) NewIncomeDownloadLinkService() *IncomeDownloadLinkService
- func (c *Client) NewIndexService() *IndexService
- func (c *Client) NewKeepaliveUserStreamService() *KeepaliveUserStreamService
- func (c *Client) NewKlinesService() *KlinesService
- func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
- func (c *Client) NewMarkService() *MarkService
- func (c *Client) NewOpenInterestService() *OpenInterestService
- func (c *Client) NewPingService() *PingService
- func (c *Client) NewPositionService() *PositionService
- func (c *Client) NewServerTimeService() *ServerTimeService
- func (c *Client) NewStartUserStreamService() *StartUserStreamService
- func (c *Client) NewTickerService() *TickerService
- func (c *Client) NewTradesService() *TradesService
- func (c *Client) NewUserTradesService() *UserTradesService
- func (c *Client) SetApiEndpoint(url string) *Client
- type CloseUserStreamService
- type ContractType
- type CreateBatchOrdersService
- type CreateOrderService
- func (s *CreateOrderService) ClientOrderId(ClientOrderId string) *CreateOrderService
- func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
- func (s *CreateOrderService) IsMmp(isMmp bool) *CreateOrderService
- func (s *CreateOrderService) NewOrderResponseType(newOrderResponseType NewOrderRespType) *CreateOrderService
- func (s *CreateOrderService) PostOnly(postOnly bool) *CreateOrderService
- func (s *CreateOrderService) Price(price string) *CreateOrderService
- func (s *CreateOrderService) Quantity(quantity string) *CreateOrderService
- func (s *CreateOrderService) ReduceOnly(reduceOnly bool) *CreateOrderService
- func (s *CreateOrderService) Side(side SideType) *CreateOrderService
- func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
- func (s *CreateOrderService) TimeInForce(timeInForce TimeInForceType) *CreateOrderService
- func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService
- type DepthResponse
- type DepthService
- type ErrHandler
- type ExchangeInfo
- type ExchangeInfoService
- type ExerciseHistory
- type ExerciseHistoryService
- func (s *ExerciseHistoryService) Do(ctx context.Context, opts ...RequestOption) (res []*ExerciseHistory, err error)
- func (s *ExerciseHistoryService) EndTime(endTime uint64) *ExerciseHistoryService
- func (s *ExerciseHistoryService) Limit(limit uint64) *ExerciseHistoryService
- func (s *ExerciseHistoryService) StartTime(startTime uint64) *ExerciseHistoryService
- func (s *ExerciseHistoryService) Underlying(underlying string) *ExerciseHistoryService
- type ExerciseRecord
- type ExerciseRecordService
- func (s *ExerciseRecordService) Do(ctx context.Context, opts ...RequestOption) (res []*ExerciseRecord, err error)
- func (s *ExerciseRecordService) EndTime(et uint64) *ExerciseRecordService
- func (s *ExerciseRecordService) Limit(limit int) *ExerciseRecordService
- func (s *ExerciseRecordService) StartTime(st uint64) *ExerciseRecordService
- func (s *ExerciseRecordService) Symbol(symbol string) *ExerciseRecordService
- type ForceOrderCloseType
- type GetOrderService
- func (s *GetOrderService) ClientOrderId(clientOrderId string) *GetOrderService
- func (s *GetOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
- func (s *GetOrderService) OrderId(orderId int64) *GetOrderService
- func (s *GetOrderService) Symbol(symbol string) *GetOrderService
- type Greek
- type HistoricalTrade
- type HistoricalTradesService
- func (s *HistoricalTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*HistoricalTrade, err error)
- func (s *HistoricalTradesService) FromID(fromID int64) *HistoricalTradesService
- func (s *HistoricalTradesService) Limit(limit int) *HistoricalTradesService
- func (s *HistoricalTradesService) Symbol(symbol string) *HistoricalTradesService
- type HistoryOrdersService
- func (s *HistoryOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)
- func (s *HistoryOrdersService) EndTime(et uint64) *HistoryOrdersService
- func (s *HistoryOrdersService) Limit(limit int) *HistoryOrdersService
- func (s *HistoryOrdersService) OrderId(orderId uint64) *HistoryOrdersService
- func (s *HistoryOrdersService) StartTime(st uint64) *HistoryOrdersService
- func (s *HistoryOrdersService) Symbol(symbol string) *HistoryOrdersService
- type IncomeDownloadId
- type IncomeDownloadIdService
- type IncomeDownloadLink
- type IncomeDownloadLinkService
- type Index
- type IndexService
- 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 LastTrade
- type ListOpenOrdersService
- func (s *ListOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)
- func (s *ListOpenOrdersService) EndTime(endTime int64) *ListOpenOrdersService
- func (s *ListOpenOrdersService) Limit(limit int) *ListOpenOrdersService
- func (s *ListOpenOrdersService) OrderId(orderId int64) *ListOpenOrdersService
- func (s *ListOpenOrdersService) StartTime(startTime int64) *ListOpenOrdersService
- func (s *ListOpenOrdersService) Symbol(symbol string) *ListOpenOrdersService
- type LotSizeFilter
- type MarginType
- type Mark
- type MarkService
- type NewOrderRespType
- type OpenInterest
- type OpenInterestService
- type OptionAsset
- type OptionContract
- type OptionSideType
- type OptionSymbol
- type Order
- type OrderExecutionType
- type OrderStatusType
- type OrderType
- type PL
- type PingService
- type Position
- type PositionService
- type PositionSideType
- type PriceFilter
- type RateLimit
- type RequestOption
- type ServerTimeService
- type SideEffectType
- type SideType
- type StartUserStreamService
- type SymbolFilterType
- type SymbolStatusType
- type SymbolType
- type Ticker
- type TickerService
- type TimeInForceType
- type Trade
- type TradesService
- type UserDataEventReasonType
- type UserDataEventType
- type UserTrade
- type UserTradesService
- func (s *UserTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*UserTrade, err error)
- func (s *UserTradesService) EndTime(et uint64) *UserTradesService
- func (s *UserTradesService) FromId(fromId uint64) *UserTradesService
- func (s *UserTradesService) Limit(limit int) *UserTradesService
- func (s *UserTradesService) StartTime(st uint64) *UserTradesService
- func (s *UserTradesService) Symbol(symbol string) *UserTradesService
- type WorkingType
- type WsBalance
- type WsConfig
- type WsDepthEvent
- type WsDepthHandler
- type WsFilled
- type WsGreek
- type WsHandler
- type WsIndexEvent
- type WsIndexHandler
- type WsKline
- type WsKlineEvent
- type WsKlineHandler
- type WsMarkPriceEvent
- type WsMarkPriceHandler
- type WsOpenInterestEvent
- type WsOpenInterestHandler
- type WsOptionPairEvent
- type WsOptionPairHandler
- type WsOrderTradeUpdate
- type WsPosition
- type WsTickerEvent
- type WsTickerHandler
- type WsTradeEvent
- type WsTradeHandler
- type WsUserDataEvent
- type WsUserDataHandler
Constants ¶
const ( SideTypeBuy SideType = "BUY" SideTypeSell SideType = "SELL" PositionSideTypeBoth PositionSideType = "BOTH" PositionSideTypeLong PositionSideType = "LONG" PositionSideTypeShort PositionSideType = "SHORT" OptionSideTypeCall OptionSideType = "CALL" OptionSideTypePut OptionSideType = "PUT" OrderTypeLimit OrderType = "LIMIT" OrderTypeMarket OrderType = "MARKET" OrderTypeStop OrderType = "STOP" OrderTypeStopMarket OrderType = "STOP_MARKET" OrderTypeTakeProfit OrderType = "TAKE_PROFIT" OrderTypeTakeProfitMarket OrderType = "TAKE_PROFIT_MARKET" OrderTypeTrailingStopMarket OrderType = "TRAILING_STOP_MARKET" TimeInForceTypeGTC TimeInForceType = "GTC" // Good Till Cancel TimeInForceTypeIOC TimeInForceType = "IOC" // Immediate or Cancel TimeInForceTypeFOK TimeInForceType = "FOK" // Fill or Kill TimeInForceTypeGTX TimeInForceType = "GTX" // Good Till Crossing (Post Only) NewOrderRespTypeACK NewOrderRespType = "ACK" NewOrderRespTypeRESULT NewOrderRespType = "RESULT" OrderExecutionTypeNew OrderExecutionType = "NEW" OrderExecutionTypePartialFill OrderExecutionType = "PARTIAL_FILL" OrderExecutionTypeFill OrderExecutionType = "FILL" OrderExecutionTypeCanceled OrderExecutionType = "CANCELED" OrderExecutionTypeCalculated OrderExecutionType = "CALCULATED" OrderExecutionTypeExpired OrderExecutionType = "EXPIRED" OrderExecutionTypeTrade OrderExecutionType = "TRADE" OrderStatusTypeNew OrderStatusType = "NEW" OrderStatusTypePartiallyFilled OrderStatusType = "PARTIALLY_FILLED" OrderStatusTypeFilled OrderStatusType = "FILLED" OrderStatusTypeCanceled OrderStatusType = "CANCELED" OrderStatusTypeRejected OrderStatusType = "REJECTED" OrderStatusTypeExpired OrderStatusType = "EXPIRED" OrderStatusTypeNewInsurance OrderStatusType = "NEW_INSURANCE" OrderStatusTypeNewADL OrderStatusType = "NEW_ADL" OrderStatusTypeAccepted OrderStatusType = "ACCEPTED" SymbolTypeFuture SymbolType = "FUTURE" WorkingTypeMarkPrice WorkingType = "MARK_PRICE" WorkingTypeContractPrice WorkingType = "CONTRACT_PRICE" SymbolStatusTypePreTrading SymbolStatusType = "PRE_TRADING" SymbolStatusTypeTrading SymbolStatusType = "TRADING" SymbolStatusTypePostTrading SymbolStatusType = "POST_TRADING" SymbolStatusTypeEndOfDay SymbolStatusType = "END_OF_DAY" SymbolStatusTypeHalt SymbolStatusType = "HALT" SymbolStatusTypeAuctionMatch SymbolStatusType = "AUCTION_MATCH" SymbolStatusTypeBreak SymbolStatusType = "BREAK" SymbolFilterTypeLotSize SymbolFilterType = "LOT_SIZE" SymbolFilterTypePrice SymbolFilterType = "PRICE_FILTER" SymbolFilterTypePercentPrice SymbolFilterType = "PERCENT_PRICE" SymbolFilterTypeMarketLotSize SymbolFilterType = "MARKET_LOT_SIZE" SymbolFilterTypeMaxNumOrders SymbolFilterType = "MAX_NUM_ORDERS" SymbolFilterTypeMaxNumAlgoOrders SymbolFilterType = "MAX_NUM_ALGO_ORDERS" SymbolFilterTypeMinNotional SymbolFilterType = "MIN_NOTIONAL" SideEffectTypeNoSideEffect SideEffectType = "NO_SIDE_EFFECT" SideEffectTypeMarginBuy SideEffectType = "MARGIN_BUY" SideEffectTypeAutoRepay SideEffectType = "AUTO_REPAY" MarginTypeIsolated MarginType = "ISOLATED" MarginTypeCrossed MarginType = "CROSSED" ContractTypePerpetual ContractType = "PERPETUAL" UserDataEventTypeListenKeyExpired UserDataEventType = "listenKeyExpired" UserDataEventTypeMarginCall UserDataEventType = "MARGIN_CALL" UserDataEventTypeAccountUpdate UserDataEventType = "ACCOUNT_UPDATE" UserDataEventTypeOrderTradeUpdate UserDataEventType = "ORDER_TRADE_UPDATE" UserDataEventTypeAccountConfigUpdate UserDataEventType = "ACCOUNT_CONFIG_UPDATE" UserDataEventReasonTypeDeposit UserDataEventReasonType = "DEPOSIT" UserDataEventReasonTypeWithdraw UserDataEventReasonType = "WITHDRAW" UserDataEventReasonTypeOrder UserDataEventReasonType = "ORDER" UserDataEventReasonTypeFundingFee UserDataEventReasonType = "FUNDING_FEE" UserDataEventReasonTypeWithdrawReject UserDataEventReasonType = "WITHDRAW_REJECT" UserDataEventReasonTypeAdjustment UserDataEventReasonType = "ADJUSTMENT" UserDataEventReasonTypeInsuranceClear UserDataEventReasonType = "INSURANCE_CLEAR" UserDataEventReasonTypeAdminDeposit UserDataEventReasonType = "ADMIN_DEPOSIT" UserDataEventReasonTypeAdminWithdraw UserDataEventReasonType = "ADMIN_WITHDRAW" UserDataEventReasonTypeMarginTransfer UserDataEventReasonType = "MARGIN_TRANSFER" UserDataEventReasonTypeMarginTypeChange UserDataEventReasonType = "MARGIN_TYPE_CHANGE" UserDataEventReasonTypeAssetTransfer UserDataEventReasonType = "ASSET_TRANSFER" UserDataEventReasonTypeOptionsPremiumFee UserDataEventReasonType = "OPTIONS_PREMIUM_FEE" UserDataEventReasonTypeOptionsSettleProfit UserDataEventReasonType = "OPTIONS_SETTLE_PROFIT" ForceOrderCloseTypeLiquidation ForceOrderCloseType = "LIQUIDATION" ForceOrderCloseTypeADL ForceOrderCloseType = "ADL" )
Global enums
Variables ¶
var ( // WebsocketTimeout is an interval for sending ping/pong messages if WebsocketKeepalive is enabled WebsocketTimeout = time.Second * 60 // WebsocketKeepalive enables sending ping/pong messages to check the connection stability WebsocketKeepalive = false // UseTestnet switch all the WS streams from production to the testnet UseTestnet = false ProxyUrl = "" )
Functions ¶
func SetWsProxyUrl ¶
func SetWsProxyUrl(url string)
func WsCombinedServe ¶
func WsCombinedServe(streamName []string, handler map[string]interface{}, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
reference: https://binance-docs.github.io/apidocs/voptions/en/#websocket-market-streams
streamName: you should collaborate stream names through official documentation or other function above defined,
the legitimacy of parameters needs to be guaranteed by the caller
handler: a map of handler function, its key needs to correspond to the handler of the incoming streamname,
handler's key should be in ["trade", "index", "markPrice", "kline", "ticker", "openInterest", "option_pair", "depth"]
for example:
WsCombinedServe({"ETH-240927-5500-P@depth10"}, map[string]interface{}{"depth": func(*WsDepthEvent) {}}, func(error){}) WsCombinedServe({"ETH-240927-5500-P@depth10", "ETH-240927-5500-P@kline_1m"}, map[string]interface{}{"depth": func(*WsDepthEvent) {}, "kline": func(*WsKlineEvent){}}, func(error){})
note: the symbol(underlying) of streamName should be upper.
func WsDepthServe ¶
func WsDepthServe(symbol string, levels string, rate *time.Duration, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
levels: [10, 20, 50, 100, 1000] rate: [100, 500, 100] ms, default 500ms while rate is nil
func WsIndexServe ¶
func WsIndexServe(symbol string, handler WsIndexHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
WsIndexServe serve websocket that push trade information that is aggregated for a single taker order.
func WsKlineServe ¶
func WsKlineServe(symbol string, interval string, handler WsKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
func WsMarkPriceServe ¶
func WsMarkPriceServe(symbol string, handler WsMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
func WsOpenInterestServe ¶
func WsOpenInterestServe(underlying string, expireDate string, handler WsOpenInterestHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
expireDate: for example 220930 underlying: for example ETH
func WsOptionPairServe ¶
func WsOptionPairServe(handler WsOptionPairHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
func WsTickerServe ¶
func WsTickerServe(symbol string, handler WsTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
func WsTickerWithExpireServe ¶
func WsTickerWithExpireServe(underlying string, expireDate string, handler WsTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
expireDate: for example 220930 underlying: for example ETH
func WsTradeServe ¶
func WsTradeServe(symbol string, handler WsTradeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
WsTradeServe serve websocket that push trade information that is aggregated for a single taker order.
func WsUserDataServe ¶
func WsUserDataServe(listenKey string, handler WsUserDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
Types ¶
type Account ¶
type Account struct { Asset []*Asset `json:"asset"` Greek []*Greek `json:"greek"` RiskLevel string `json:"riskLevel"` Time uint64 `json:"time"` }
Account define create order response
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService create order
func (*AccountService) Do ¶
func (s *AccountService) Do(ctx context.Context, opts ...RequestOption) (res *Account, err error)
Do send request
type BillService ¶
type BillService struct {
// contains filtered or unexported fields
}
func (*BillService) Currency ¶
func (s *BillService) Currency(c string) *BillService
func (*BillService) Do ¶
func (s *BillService) Do(ctx context.Context, opts ...RequestOption) (res []*Bill, err error)
func (*BillService) EndTime ¶
func (s *BillService) EndTime(et uint64) *BillService
func (*BillService) Limit ¶
func (s *BillService) Limit(limit int) *BillService
func (*BillService) RecordId ¶
func (s *BillService) RecordId(ri uint64) *BillService
func (*BillService) StartTime ¶
func (s *BillService) StartTime(st uint64) *BillService
type CancelAllOpenOrdersByUnderlyingService ¶
type CancelAllOpenOrdersByUnderlyingService struct {
// contains filtered or unexported fields
}
func (*CancelAllOpenOrdersByUnderlyingService) Do ¶
func (s *CancelAllOpenOrdersByUnderlyingService) Do(ctx context.Context, opts ...RequestOption) (res *CancelAllOpenOrdersByUnderlyingRsp, err error)
func (*CancelAllOpenOrdersByUnderlyingService) Underlying ¶
func (s *CancelAllOpenOrdersByUnderlyingService) Underlying(underlying string) *CancelAllOpenOrdersByUnderlyingService
type CancelAllOpenOrdersRsp ¶
type CancelAllOpenOrdersService ¶
type CancelAllOpenOrdersService struct {
// contains filtered or unexported fields
}
CancelAllOpenOrdersService cancel all open orders
func (*CancelAllOpenOrdersService) Do ¶
func (s *CancelAllOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (*CancelAllOpenOrdersRsp, error)
func (*CancelAllOpenOrdersService) Symbol ¶
func (s *CancelAllOpenOrdersService) Symbol(symbol string) *CancelAllOpenOrdersService
Symbol set symbol
type CancelBatchOrdersService ¶
type CancelBatchOrdersService struct {
// contains filtered or unexported fields
}
CancelBatchOrdersService cancel a list of orders
func (*CancelBatchOrdersService) ClientOrderIds ¶
func (s *CancelBatchOrdersService) ClientOrderIds(clientOrderIds []string) *CancelBatchOrdersService
ClientOrderIDList set clientOrderIds
func (*CancelBatchOrdersService) Do ¶
func (s *CancelBatchOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []interface{}, err error)
return: [Order, APIError]
func (*CancelBatchOrdersService) OrderIds ¶
func (s *CancelBatchOrdersService) OrderIds(orderIds []int64) *CancelBatchOrdersService
OrderId set OrderId
func (*CancelBatchOrdersService) Symbol ¶
func (s *CancelBatchOrdersService) Symbol(symbol string) *CancelBatchOrdersService
Symbol set symbol
type CancelOrderService ¶
type CancelOrderService struct {
// contains filtered or unexported fields
}
CancelOrderService cancel an order
func (*CancelOrderService) ClientOrderId ¶
func (s *CancelOrderService) ClientOrderId(clientOrderId string) *CancelOrderService
ClientOrderId set clientOrderId
func (*CancelOrderService) Do ¶
func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
Do send request
func (*CancelOrderService) OrderId ¶
func (s *CancelOrderService) OrderId(orderId int64) *CancelOrderService
OrderId set OrderId
func (*CancelOrderService) Symbol ¶
func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService
Symbol set symbol
type Client ¶
type Client struct { APIKey string SecretKey string KeyType string BaseURL string UserAgent string HTTPClient *http.Client Debug bool Logger *log.Logger TimeOffset int64 // 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 NewProxiedClient ¶
NewProxiedClient passing a proxy url
func (*Client) NewAccountService ¶
func (c *Client) NewAccountService() *AccountService
func (*Client) NewBillService ¶
func (c *Client) NewBillService() *BillService
GET /eapi/v1/bill Obtain account fund flow
func (*Client) NewCancelAllOpenOrdersByUnderlyingService ¶
func (c *Client) NewCancelAllOpenOrdersByUnderlyingService() *CancelAllOpenOrdersByUnderlyingService
DELETE /eapi/v1/allOpenOrdersByUnderlying
func (*Client) NewCancelAllOpenOrdersService ¶
func (c *Client) NewCancelAllOpenOrdersService() *CancelAllOpenOrdersService
NewCancelAllOpenOrdersService init cancel all open orders service DELETE /eapi/v1/allOpenOrders
func (*Client) NewCancelBatchOrdersService ¶
func (c *Client) NewCancelBatchOrdersService() *CancelBatchOrdersService
NewCancelBatchOrdersService init cancel multiple orders service DELETE /eapi/v1/batchOrders
func (*Client) NewCancelOrderService ¶
func (c *Client) NewCancelOrderService() *CancelOrderService
NewCancelOrderService init cancel order service DELETE /eapi/v1/order
func (*Client) NewCloseUserStreamService ¶
func (c *Client) NewCloseUserStreamService() *CloseUserStreamService
func (*Client) NewCreateBatchOrdersService ¶
func (c *Client) NewCreateBatchOrdersService() *CreateBatchOrdersService
NewCreateBatchOrdersService init creating batch order service POST /eapi/v1/batchOrders
func (*Client) NewCreateOrderService ¶
func (c *Client) NewCreateOrderService() *CreateOrderService
NewCreateOrderService init creating order service POST /eapi/v1/order
func (*Client) NewDepthService ¶
func (c *Client) NewDepthService() *DepthService
NewDepthService init depth service
func (*Client) NewExchangeInfoService ¶
func (c *Client) NewExchangeInfoService() *ExchangeInfoService
NewExchangeInfoService init exchange info service
func (*Client) NewExerciseHistoryService ¶
func (c *Client) NewExerciseHistoryService() *ExerciseHistoryService
func (*Client) NewExercistRecordService ¶
func (c *Client) NewExercistRecordService() *ExerciseRecordService
GET /eapi/v1/exerciseRecord
func (*Client) NewGetOrderService ¶
func (c *Client) NewGetOrderService() *GetOrderService
NewGetOrderService init get order service GET /eapi/v1/order
func (*Client) NewHistoricalTradesService ¶
func (c *Client) NewHistoricalTradesService() *HistoricalTradesService
func (*Client) NewHistoryOrdersService ¶
func (c *Client) NewHistoryOrdersService() *HistoryOrdersService
GET /eapi/v1/historyOrders
func (*Client) NewIncomeDownloadIdService ¶
func (c *Client) NewIncomeDownloadIdService() *IncomeDownloadIdService
GET /eapi/v1/income/asyn Get option fund flow download ID
func (*Client) NewIncomeDownloadLinkService ¶
func (c *Client) NewIncomeDownloadLinkService() *IncomeDownloadLinkService
GET /eapi/v1/income/asyn/id Obtain the contract fund flow download link through the download ID
func (*Client) NewIndexService ¶
func (c *Client) NewIndexService() *IndexService
func (*Client) NewKeepaliveUserStreamService ¶
func (c *Client) NewKeepaliveUserStreamService() *KeepaliveUserStreamService
func (*Client) NewKlinesService ¶
func (c *Client) NewKlinesService() *KlinesService
NewKlinesService init klines service
func (*Client) NewListOpenOrdersService ¶
func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
NewListOpenOrdersService init list open orders service GET /eapi/v1/openOrders
func (*Client) NewMarkService ¶
func (c *Client) NewMarkService() *MarkService
func (*Client) NewOpenInterestService ¶
func (c *Client) NewOpenInterestService() *OpenInterestService
func (*Client) NewPositionService ¶
func (c *Client) NewPositionService() *PositionService
GET /eapi/v1/position
func (*Client) NewServerTimeService ¶
func (c *Client) NewServerTimeService() *ServerTimeService
get timestamp(ms) of server
func (*Client) NewStartUserStreamService ¶
func (c *Client) NewStartUserStreamService() *StartUserStreamService
func (*Client) NewTickerService ¶
func (c *Client) NewTickerService() *TickerService
func (*Client) NewTradesService ¶
func (c *Client) NewTradesService() *TradesService
func (*Client) NewUserTradesService ¶
func (c *Client) NewUserTradesService() *UserTradesService
GET /eapi/v1/userTrades
func (*Client) SetApiEndpoint ¶
SetApiEndpoint set api Endpoint
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 CreateBatchOrdersService ¶
type CreateBatchOrdersService struct {
// contains filtered or unexported fields
}
func (*CreateBatchOrdersService) Do ¶
func (s *CreateBatchOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []interface{}, err error)
return: [Order, APIError]
func (*CreateBatchOrdersService) OrderList ¶
func (s *CreateBatchOrdersService) OrderList(orders []*CreateOrderService) *CreateBatchOrdersService
type CreateOrderService ¶
type CreateOrderService struct {
// contains filtered or unexported fields
}
CreateOrderService create order
func (*CreateOrderService) ClientOrderId ¶
func (s *CreateOrderService) ClientOrderId(ClientOrderId string) *CreateOrderService
ClientOrderId set clientOrderId
func (*CreateOrderService) Do ¶
func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)
Do send request
func (*CreateOrderService) IsMmp ¶
func (s *CreateOrderService) IsMmp(isMmp bool) *CreateOrderService
IsMmp set isMmp
func (*CreateOrderService) NewOrderResponseType ¶
func (s *CreateOrderService) NewOrderResponseType(newOrderResponseType NewOrderRespType) *CreateOrderService
NewOrderResponseType set newOrderResponseType
func (*CreateOrderService) PostOnly ¶
func (s *CreateOrderService) PostOnly(postOnly bool) *CreateOrderService
PostOnly set postOnly
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) ReduceOnly ¶
func (s *CreateOrderService) ReduceOnly(reduceOnly bool) *CreateOrderService
ReduceOnly set reduceOnly
func (*CreateOrderService) Side ¶
func (s *CreateOrderService) Side(side SideType) *CreateOrderService
Side set side
func (*CreateOrderService) Symbol ¶
func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
Symbol set symbol
func (*CreateOrderService) TimeInForce ¶
func (s *CreateOrderService) TimeInForce(timeInForce TimeInForceType) *CreateOrderService
TimeInForce set timeInForce
func (*CreateOrderService) Type ¶
func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService
Type set type
type DepthResponse ¶
type DepthResponse struct { TradeTime int64 `json:"T"` UpdateID int64 `json:"u"` 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"` OptionContracts []OptionContract `json:"optionContracts"` OptionAssets []OptionAsset `json:"optionAssets"` OptionSymbols []OptionSymbol `json:"optionSymbols"` RateLimits []RateLimit `json:"rateLimits"` }
ExchangeInfo exchange info
type ExchangeInfoService ¶
type ExchangeInfoService struct {
// contains filtered or unexported fields
}
ExchangeInfoService exchange info service
func (*ExchangeInfoService) Do ¶
func (s *ExchangeInfoService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeInfo, err error)
Do send request
type ExerciseHistory ¶
type ExerciseHistoryService ¶
type ExerciseHistoryService struct {
// contains filtered or unexported fields
}
underlying: Spot trading pairs such as BTCUSDT
func (*ExerciseHistoryService) Do ¶
func (s *ExerciseHistoryService) Do(ctx context.Context, opts ...RequestOption) (res []*ExerciseHistory, err error)
Do send request
func (*ExerciseHistoryService) EndTime ¶
func (s *ExerciseHistoryService) EndTime(endTime uint64) *ExerciseHistoryService
func (*ExerciseHistoryService) Limit ¶
func (s *ExerciseHistoryService) Limit(limit uint64) *ExerciseHistoryService
func (*ExerciseHistoryService) StartTime ¶
func (s *ExerciseHistoryService) StartTime(startTime uint64) *ExerciseHistoryService
func (*ExerciseHistoryService) Underlying ¶
func (s *ExerciseHistoryService) Underlying(underlying string) *ExerciseHistoryService
Underlying set underlying
type ExerciseRecord ¶
type ExerciseRecord struct { Id string `json:"id"` Currency string `json:"currency"` Symbol string `json:"symbol"` ExercisePrice string `json:"exercisePrice"` MarkPrice string `json:"markPrice"` Quantity string `json:"quantity"` Amount string `json:"amount"` Fee string `json:"fee"` CreateDate uint64 `json:"createDate"` PriceScale int `json:"priceScale"` QuantityScale int `json:"quantityScale"` OptionSide string `json:"optionSide"` PositionSide string `json:"positionSide"` QuoteAsset string `json:"quoteAsset"` }
type ExerciseRecordService ¶
type ExerciseRecordService struct {
// contains filtered or unexported fields
}
func (*ExerciseRecordService) Do ¶
func (s *ExerciseRecordService) Do(ctx context.Context, opts ...RequestOption) (res []*ExerciseRecord, err error)
func (*ExerciseRecordService) EndTime ¶
func (s *ExerciseRecordService) EndTime(et uint64) *ExerciseRecordService
func (*ExerciseRecordService) Limit ¶
func (s *ExerciseRecordService) Limit(limit int) *ExerciseRecordService
func (*ExerciseRecordService) StartTime ¶
func (s *ExerciseRecordService) StartTime(st uint64) *ExerciseRecordService
func (*ExerciseRecordService) Symbol ¶
func (s *ExerciseRecordService) Symbol(symbol string) *ExerciseRecordService
type ForceOrderCloseType ¶
type ForceOrderCloseType string
ForceOrderCloseType define reason type for force order
type GetOrderService ¶
type GetOrderService struct {
// contains filtered or unexported fields
}
GetOrderService get an order
func (*GetOrderService) ClientOrderId ¶
func (s *GetOrderService) ClientOrderId(clientOrderId string) *GetOrderService
ClientOrderId set clientOrderId
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) Symbol ¶
func (s *GetOrderService) Symbol(symbol string) *GetOrderService
Symbol set symbol
type HistoricalTrade ¶
type HistoricalTrade struct { Id uint64 `json:"id"` TradeId int `json:"tradeId"` Price string `json:"price"` Qty string `json:"qty"` QuoteQty string `json:"quoteQty"` Side int `json:"side"` Time uint64 `json:"time"` }
HistoricalTrade define historical trade info
type HistoricalTradesService ¶
type HistoricalTradesService struct {
// contains filtered or unexported fields
}
HistoricalTradesService trades
func (*HistoricalTradesService) Do ¶
func (s *HistoricalTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*HistoricalTrade, err error)
Do send request
func (*HistoricalTradesService) FromID ¶
func (s *HistoricalTradesService) FromID(fromID int64) *HistoricalTradesService
FromID set fromID
func (*HistoricalTradesService) Limit ¶
func (s *HistoricalTradesService) Limit(limit int) *HistoricalTradesService
Limit set limit
func (*HistoricalTradesService) Symbol ¶
func (s *HistoricalTradesService) Symbol(symbol string) *HistoricalTradesService
Symbol set symbol
type HistoryOrdersService ¶
type HistoryOrdersService struct {
// contains filtered or unexported fields
}
func (*HistoryOrdersService) Do ¶
func (s *HistoryOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)
func (*HistoryOrdersService) EndTime ¶
func (s *HistoryOrdersService) EndTime(et uint64) *HistoryOrdersService
func (*HistoryOrdersService) Limit ¶
func (s *HistoryOrdersService) Limit(limit int) *HistoryOrdersService
func (*HistoryOrdersService) OrderId ¶
func (s *HistoryOrdersService) OrderId(orderId uint64) *HistoryOrdersService
func (*HistoryOrdersService) StartTime ¶
func (s *HistoryOrdersService) StartTime(st uint64) *HistoryOrdersService
func (*HistoryOrdersService) Symbol ¶
func (s *HistoryOrdersService) Symbol(symbol string) *HistoryOrdersService
type IncomeDownloadId ¶
type IncomeDownloadIdService ¶
type IncomeDownloadIdService struct {
// contains filtered or unexported fields
}
func (*IncomeDownloadIdService) Do ¶
func (s *IncomeDownloadIdService) Do(ctx context.Context, opts ...RequestOption) (res *IncomeDownloadId, err error)
func (*IncomeDownloadIdService) EndTime ¶
func (s *IncomeDownloadIdService) EndTime(et uint64) *IncomeDownloadIdService
func (*IncomeDownloadIdService) StartTime ¶
func (s *IncomeDownloadIdService) StartTime(st uint64) *IncomeDownloadIdService
type IncomeDownloadLink ¶
type IncomeDownloadLinkService ¶
type IncomeDownloadLinkService struct {
// contains filtered or unexported fields
}
func (*IncomeDownloadLinkService) Do ¶
func (s *IncomeDownloadLinkService) Do(ctx context.Context, opts ...RequestOption) (res *IncomeDownloadLink, err error)
func (*IncomeDownloadLinkService) DownloadId ¶
func (s *IncomeDownloadLinkService) DownloadId(di string) *IncomeDownloadLinkService
type IndexService ¶
type IndexService struct {
// contains filtered or unexported fields
}
underlying: Spot trading pairs such as BTCUSDT
func (*IndexService) Do ¶
func (s *IndexService) Do(ctx context.Context, opts ...RequestOption) (res *Index, err error)
Do send request
func (*IndexService) Underlying ¶
func (s *IndexService) Underlying(underlying string) *IndexService
Underlying set underlying
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 { Open string `json:"open"` High string `json:"high"` Low string `json:"low"` Close string `json:"close"` Volume string `json:"volume"` Amount string `json:"amount"` Interval string `json:"interval"` TradeCount int64 `json:"tradeCount"` TakerVolume string `json:"takerVolume"` TakerAmount string `json:"takerAmount"` OpenTime int64 `json:"openTime"` CloseTime int64 `json:"closeTime"` }
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 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) EndTime ¶
func (s *ListOpenOrdersService) EndTime(endTime int64) *ListOpenOrdersService
EndTime set endTime
func (*ListOpenOrdersService) Limit ¶
func (s *ListOpenOrdersService) Limit(limit int) *ListOpenOrdersService
Limit set limit
func (*ListOpenOrdersService) OrderId ¶
func (s *ListOpenOrdersService) OrderId(orderId int64) *ListOpenOrdersService
OrderId set orderId
func (*ListOpenOrdersService) StartTime ¶
func (s *ListOpenOrdersService) StartTime(startTime int64) *ListOpenOrdersService
StartTime set startTime
func (*ListOpenOrdersService) Symbol ¶
func (s *ListOpenOrdersService) Symbol(symbol string) *ListOpenOrdersService
Symbol set symbol
type LotSizeFilter ¶
type LotSizeFilter struct { MaxQuantity string `json:"maxQty"` MinQuantity string `json:"minQty"` StepSize string `json:"stepSize"` }
LotSizeFilter define lot size filter of symbol
type Mark ¶
type Mark struct { Symbol string `json:"symbol"` MarkPrice string `json:"markPrice"` BidIV string `json:"bidIV"` AskIV string `json:"askIV"` MarkIV string `json:"markIV"` Delta string `json:"delta"` Theta string `json:"theta"` Gamma string `json:"gamma"` Vega string `json:"vega"` HighPriceLimit string `json:"highPriceLimit"` LowPriceLimit string `json:"lowPriceLimit"` RiskFreeInterest string `json:"riskFreeInterest"` }
type MarkService ¶
type MarkService struct {
// contains filtered or unexported fields
}
MarkService list recent trades in orderbook
func (*MarkService) Do ¶
func (s *MarkService) Do(ctx context.Context, opts ...RequestOption) (res []*Mark, err error)
Do send request
func (*MarkService) Symbol ¶
func (s *MarkService) Symbol(symbol string) *MarkService
Symbol set symbol
type NewOrderRespType ¶
type NewOrderRespType string
NewOrderRespType define response JSON verbosity
type OpenInterest ¶
type OpenInterestService ¶
type OpenInterestService struct {
// contains filtered or unexported fields
}
underlying: Spot trading pairs such as BTCUSDT
func (*OpenInterestService) Do ¶
func (s *OpenInterestService) Do(ctx context.Context, opts ...RequestOption) (res []*OpenInterest, err error)
Do send request
func (*OpenInterestService) Expiration ¶
func (s *OpenInterestService) Expiration(expiration string) *OpenInterestService
func (*OpenInterestService) UnderlyingAsset ¶
func (s *OpenInterestService) UnderlyingAsset(underlyingAsset string) *OpenInterestService
Underlying set underlying
type OptionAsset ¶
Option Asset
type OptionContract ¶
type OptionContract struct { Id int64 `json:"id"` BaseAsset string `json:"baseAsset"` QuoteAsset string `json:"quoteAsset"` Underlying string `json:"underlying"` SettleAsset string `json:"settleAsset"` }
Option Contract
type OptionSymbol ¶
type OptionSymbol struct { ContractId int64 `json:"contractId"` ExpiryDate int64 `json:"expiryDate"` Filters []map[string]interface{} `json:"filters"` Id int64 `json:"id"` Symbol string `json:"symbol"` Side string `json:"side"` StrikePrice string `json:"strikePrice"` Underlying string `json:"underlying"` Unit int64 `json:"unit"` MakerFeeRate string `json:"makerFeeRate"` TakerFeeRate string `json:"takerFeeRate"` MinQty string `json:"minQty"` MaxQty string `json:"maxQty"` InitialMargin string `json:"initialMargin"` MaintenanceMargin string `json:"maintenanceMargin"` MinInitialMargin string `json:"minInitialMargin"` MinMaintenanceMargin string `json:"minMaintenanceMargin"` PriceScale int `json:"priceScale"` QuantityScale int `json:"quantityScale"` QuoteAsset string `json:"quoteAsset"` }
Option Symbol
func (*OptionSymbol) LotSizeFilter ¶
func (s *OptionSymbol) LotSizeFilter() *LotSizeFilter
LotSizeFilter return lot size filter of symbol
func (*OptionSymbol) PriceFilter ¶
func (s *OptionSymbol) PriceFilter() *PriceFilter
PriceFilter return price filter of symbol
type Order ¶
type Order struct { OrderId int64 `json:"orderId"` Symbol string `json:"symbol"` Price string `json:"price"` Quantity string `json:"quantity"` ExecutedQty string `json:"executedQty"` Fee string `json:"fee"` Side SideType `json:"side"` Type OrderType `json:"type"` TimeInForce TimeInForceType `json:"timeInForce"` ReduceOnly bool `json:"reduceOnly"` PostOnly bool `json:"postOnly"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` Status OrderStatusType `json:"status"` Reason *string `json:"reason"` // set while query history orders. AvgPrice string `json:"avgPrice"` Source string `json:"source"` ClientOrderId string `json:"clientOrderId"` PriceScale int `json:"priceScale"` QuantityScale int `json:"quantityScale"` OptionSide OptionSideType `json:"optionSide"` QuoteAsset string `json:"quoteAsset"` Mmp bool `json:"mmp"` LastTrade *LastTrade `json:"lastTrade"` // order is immediately filled while calling create order, it will be set. RateLimitOrder10s string `json:"rateLimitOrder10s,omitempty"` RateLimitOrder1m string `json:"rateLimitOrder1m,omitempty"` }
Unified order structure, it would be used in many ways, for example, create order, cancel order, query open orders, query historical order and so on
type OrderExecutionType ¶
type OrderExecutionType string
OrderExecutionType define order execution type
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 Position ¶
type Position struct { EntryPrice string `json:"entryPrice"` Symbol string `json:"symbol"` Side string `json:"side"` Quantity string `json:"quantity"` ReducibleQty string `json:"reducibleQty"` MarkValue string `json:"markValue"` Ror string `json:"ror"` UnrealizedPNL string `json:"unrealizedPNL"` MarkPrice string `json:"markPrice"` StrikePrice string `json:"strikePrice"` ExpiryDate uint64 `json:"expiryDate"` PositionCost string `json:"positionCost"` PriceScale int `json:"priceScale"` QuantityScale int `json:"quantityScale"` OptionSide string `json:"optionSide"` QuoteAsset string `json:"quoteAsset"` Time int64 `json:"time"` }
type PositionService ¶
type PositionService struct {
// contains filtered or unexported fields
}
func (*PositionService) Do ¶
func (s *PositionService) Do(ctx context.Context, opts ...RequestOption) (res []*Position, err error)
func (*PositionService) Symbol ¶
func (s *PositionService) Symbol(symbol string) *PositionService
type PositionSideType ¶
type PositionSideType string
PositionSideType define position side type of order
type PriceFilter ¶
type PriceFilter struct { MaxPrice string `json:"maxPrice"` MinPrice string `json:"minPrice"` TickSize string `json:"tickSize"` }
PriceFilter define price filter of symbol
type RateLimit ¶
type RateLimit struct { RateLimitType string `json:"rateLimitType"` Interval string `json:"interval"` IntervalNum int64 `json:"intervalNum"` Limit int64 `json:"limit"` }
RateLimit struct
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithHeader ¶
func WithHeader(key, value string, replace bool) RequestOption
WithHeader set or add a header value to the request
func WithHeaders ¶
func WithHeaders(header http.Header) RequestOption
WithHeaders set or replace the headers of the 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 Ticker ¶
type Ticker struct { Symbol string `json:"symbol"` PriceChange string `json:"priceChange"` PriceChangePercent string `json:"priceChangePercent"` LastPrice string `json:"lastPrice"` LastQty string `json:"lastQty"` Open string `json:"open"` High string `json:"high"` Low string `json:"low"` Volume string `json:"volume"` Amount string `json:"amount"` BidPrice string `json:"bidPrice"` AskPrice string `json:"askPrice"` OpenTime int64 `json:"openTime"` CloseTime int64 `json:"closeTime"` FirstTradeId int `json:"firstTradeId"` TradeCount int `json:"tradeCount"` StrikePrice string `json:"strikePrice"` ExercisePrice string `json:"exercisePrice"` }
type TickerService ¶
type TickerService struct {
// contains filtered or unexported fields
}
TickerService list recent trades in orderbook
func (*TickerService) Do ¶
func (s *TickerService) Do(ctx context.Context, opts ...RequestOption) (res []*Ticker, err error)
Do send request
func (*TickerService) Symbol ¶
func (s *TickerService) Symbol(symbol string) *TickerService
Symbol set symbol
type TimeInForceType ¶
type TimeInForceType string
TimeInForceType define time in force type of order
type TradesService ¶
type TradesService struct {
// contains filtered or unexported fields
}
TradesService list recent trades in orderbook
func (*TradesService) Do ¶
func (s *TradesService) Do(ctx context.Context, opts ...RequestOption) (res []*Trade, err error)
Do send request
func (*TradesService) Limit ¶
func (s *TradesService) Limit(limit int) *TradesService
Limit set limit
func (*TradesService) Symbol ¶
func (s *TradesService) Symbol(symbol string) *TradesService
Symbol set symbol
type UserDataEventReasonType ¶
type UserDataEventReasonType string
UserDataEventReasonType define reason type for user data event
type UserDataEventType ¶
type UserDataEventType string
UserDataEventType define user data event type
type UserTrade ¶
type UserTrade struct { Id uint64 `json:"id"` TradeId uint32 `json:"tradeId"` OrderId uint64 `json:"orderId"` Symbol string `json:"symbol"` Price string `json:"price"` Quantity string `json:"quantity"` Fee string `json:"fee"` RealizedProfit string `json:"realizedProfit"` Side string `json:"side"` Type string `json:"type"` Volatility string `json:"volatility"` Liquidity string `json:"liquidity"` Time uint64 `json:"time"` PriceScale int `json:"priceScale"` QuantityScale int `json:"quantityScale"` OptionSide string `json:"optionSide"` QuoteAsset string `json:"quoteAsset"` }
type UserTradesService ¶
type UserTradesService struct {
// contains filtered or unexported fields
}
func (*UserTradesService) Do ¶
func (s *UserTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*UserTrade, err error)
func (*UserTradesService) EndTime ¶
func (s *UserTradesService) EndTime(et uint64) *UserTradesService
func (*UserTradesService) FromId ¶
func (s *UserTradesService) FromId(fromId uint64) *UserTradesService
func (*UserTradesService) Limit ¶
func (s *UserTradesService) Limit(limit int) *UserTradesService
func (*UserTradesService) StartTime ¶
func (s *UserTradesService) StartTime(st uint64) *UserTradesService
func (*UserTradesService) Symbol ¶
func (s *UserTradesService) Symbol(symbol string) *UserTradesService
type WsBalance ¶
type WsBalance struct { Balance string `json:"b"` Merit string `json:"m"` UnrealizedPnL string `json:"u"` MaintenanceMargin string `json:"M"` InitialMargin string `json:"i"` Asset string `json:"a"` }
WsBalance define balance
type WsDepthEvent ¶
type WsDepthHandler ¶
type WsDepthHandler func(events *WsDepthEvent)
type WsIndexEvent ¶
type WsIndexHandler ¶
type WsIndexHandler func(event *WsIndexEvent)
type WsKline ¶
type WsKline struct { StartTime int64 `json:"t"` EndTime int64 `json:"T"` Symbol string `json:"s"` Interval string `json:"i"` FirstTradeID string `json:"F"` LastTradeID string `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"` TakerVolume string `json:"V"` TakerQuoteVolume string `json:"Q"` }
type WsKlineEvent ¶
type WsKlineHandler ¶
type WsKlineHandler func(events *WsKlineEvent)
type WsMarkPriceEvent ¶
type WsMarkPriceHandler ¶
type WsMarkPriceHandler func(events []*WsMarkPriceEvent)
type WsOpenInterestEvent ¶
type WsOpenInterestHandler ¶
type WsOpenInterestHandler func(events []*WsOpenInterestEvent)
type WsOptionPairEvent ¶
type WsOptionPairEvent struct { Event string `json:"e"` Time int64 `json:"E"` Id int `json:"id"` // option id CId int `json:"cid"` // Contract ID Underlying string `json:"u"` QuoteAsset string `json:"qa"` Symbol string `json:"s"` Unit int `json:"unit"` // The number of targets represented by a contract MinQuantity string `json:"mq"` // Minimum transaction quantity Type string `json:"d"` // datatype is better ? StrikePrice string `json:"sp"` ExerciseDate int64 `json:"ed"` }
type WsOptionPairHandler ¶
type WsOptionPairHandler func(events *WsOptionPairEvent)
type WsOrderTradeUpdate ¶
type WsOrderTradeUpdate struct { CreateTime int64 `json:"T"` UpdateTime int64 `json:"t"` Symbol string `json:"s"` ClientOrderID string `json:"c"` OrderId string `json:"oid"` Price string `json:"p"` Quantity string `json:"q"` Stp int `json:"stp"` //don't know ReduleOnly bool `json:"r"` PostOnly bool `json:"po"` Status string `json:"S"` ExecutedQty string `json:"e"` ExecutedCost string `json:"ec"` // maybe there's a better one word Fee string `json:"f"` TimeInForce string `json:"tif"` OrderType string `json:"oty"` Filled []WsFilled `json:"fi"` }
WsOrderTradeUpdate define order trade update
type WsPosition ¶
type WsPosition struct { Symbol string `json:"s"` CountQty string `json:"c"` ReduleQty string `json:"r"` PositionVal string `json:"p"` AvgPrice string `json:"a"` }
WsPosition define position
type WsTickerEvent ¶
type WsTickerEvent struct { Event string `json:"e"` Time int64 `json:"E"` TradeTime int64 `json:"T"` Symbol string `json:"s"` Open string `json:"o"` High string `json:"h"` Low string `json:"l"` Close string `json:"c"` Volume string `json:"V"` Amount string `json:"A"` PriceChangePercent string `json:"P"` PriceChange string `json:"p"` LastQty string `json:"Q"` FirstID string `json:"F"` LastID string `json:"L"` TradeNum int64 `json:"n"` BidOpenPrice string `json:"bo"` AskOpenPrice string `json:"ao"` BidQty string `json:"bq"` AskQty string `json:"aq"` BidIV string `json:"b"` AskIV string `json:"a"` Delta string `json:"d"` Theta string `json:"t"` Gamma string `json:"g"` Vega string `json:"v"` Volatility string `json:"vo"` MarkPrice string `json:"mp"` HighPriceLimit string `json:"hl"` // highest limit price LowPriceLimit string `json:"ll"` ExercisPrice string `json:"eep"` // Perhaps there is a better one word to express certain meaning RiskFreeInterest string `json:"r"` }
type WsTickerHandler ¶
type WsTickerHandler func(events []*WsTickerEvent)
type WsTradeEvent ¶
type WsTradeEvent struct { Event string `json:"e"` Time int64 `json:"E"` Symbol string `json:"s"` TradeId string `json:"t"` Price string `json:"p"` Quantity string `json:"q"` BuyId string `json:"b"` SellId string `json:"a"` TradeTime int64 `json:"T"` Side string `json:"S"` // -1 active sell, 1 active buy }
type WsTradeHandler ¶
type WsTradeHandler func(event *WsTradeEvent)
type WsUserDataEvent ¶
type WsUserDataEvent struct { Event UserDataEventType `json:"e"` Time int64 `json:"E"` RLCStatus *string `json:"s"` // RLC = RISK_LEVEL_CHANGE RLCMarginBalance *string `json:"mb"` RLCMaintenanceMargin *string `json:"mm"` AUBalance []*WsBalance `json:"B"` // AU = ACCOUNT_UPDATE AUGreek []*WsGreek `json:"G"` AUPosition []*WsPosition `json:"P"` AUUid *int64 `json:"uid"` OTU []*WsOrderTradeUpdate `json:"o"` // OTU = ORDER_TRADE_UPDATE }
WsUserDataEvent define user data event
type WsUserDataHandler ¶
type WsUserDataHandler func(event *WsUserDataEvent)
WsUserDataHandler handle WsUserDataEvent
Source Files ¶
- account_service.go
- client.go
- depth_service.go
- exchange_info_service.go
- exercise_history_service.go
- index_service.go
- kline_service.go
- mark_service.go
- open_interest_service.go
- order_service.go
- request.go
- server_service.go
- ticker_service.go
- trades_service.go
- user_stream_service.go
- websocket.go
- websocket_service.go