futures

package
v2.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SideTypeBuy  SideType = "BUY"
	SideTypeSell SideType = "SELL"

	PositionSideTypeBoth  PositionSideType = "BOTH"
	PositionSideTypeLong  PositionSideType = "LONG"
	PositionSideTypeShort PositionSideType = "SHORT"

	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"

	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

View Source
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 WsAggTradeServe

func WsAggTradeServe(symbol string, handler WsAggTradeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAggTradeServe serve websocket that push trade information that is aggregated for a single taker order.

func WsAllBookTickerServe

func WsAllBookTickerServe(handler WsBookTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllBookTickerServe serve websocket that pushes updates to the best bid or ask price or quantity in real-time for all symbols.

func WsAllLiquidationOrderServe

func WsAllLiquidationOrderServe(handler WsLiquidationOrderHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllLiquidationOrderServe serve websocket that pushes force liquidation order information for all symbols.

func WsAllMarkPriceServe

func WsAllMarkPriceServe(handler WsAllMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllMarkPriceServe serve websocket that pushes price and funding rate for all symbol.

func WsAllMarkPriceServeWithRate

func WsAllMarkPriceServeWithRate(rate time.Duration, handler WsAllMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllMarkPriceServeWithRate serve websocket that pushes price and funding rate for all symbol and rate.

func WsAllMarketTickerServe

func WsAllMarketTickerServe(handler WsAllMarketTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllMarketTickerServe serve websocket that pushes price and funding rate for all markets.

func WsAllMiniMarketTickerServe

func WsAllMiniMarketTickerServe(handler WsAllMiniMarketTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllMiniMarketTickerServe serve websocket that pushes price and funding rate for all markets.

func WsBLVTInfoServe

func WsBLVTInfoServe(name string, handler WsBLVTInfoHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsBLVTInfoServe serve BLVT info stream

func WsBLVTKlineServe

func WsBLVTKlineServe(name string, interval string, handler WsBLVTKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsBLVTKlineServe serve BLVT kline stream

func WsBookTickerServe

func WsBookTickerServe(symbol string, handler WsBookTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsBookTickerServe serve websocket that pushes updates to the best bid or ask price or quantity in real-time for a specified symbol.

func WsCombinedAggTradeServe

func WsCombinedAggTradeServe(symbols []string, handler WsAggTradeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedAggTradeServe is similar to WsAggTradeServe, but it handles multiple symbols

func WsCombinedContinuousKlineServe

func WsCombinedContinuousKlineServe(subscribeArgsList []*WsContinuousKlineSubscribeArgs,
	handler WsContinuousKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedContinuousKlineServe is similar to WsContinuousKlineServe, but it handles multiple pairs of different contractType with its interval

func WsCombinedDepthServe

func WsCombinedDepthServe(symbolLevels map[string]string, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedDepthServe is similar to WsPartialDepthServe, but it for multiple symbols

func WsCombinedDiffDepthServe

func WsCombinedDiffDepthServe(symbols []string, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedDiffDepthServe is similar to WsDiffDepthServe, but it for multiple symbols

func WsCombinedKlineServe

func WsCombinedKlineServe(symbolIntervalPair map[string]string, handler WsKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedKlineServe is similar to WsKlineServe, but it handles multiple symbols with it interval

func WsCombinedMarkPriceServe

func WsCombinedMarkPriceServe(symbols []string, handler WsMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedMarkPriceServe is similar to WsMarkPriceServe, but it handles multiple symbols

func WsCombinedMarkPriceServeWithRate

func WsCombinedMarkPriceServeWithRate(symbolLevels map[string]time.Duration, handler WsMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedMarkPriceServeWithRate is similar to WsMarkPriceServeWithRate, but it for multiple symbols

func WsCompositiveIndexServe

func WsCompositiveIndexServe(symbol string, handler WsCompositeIndexHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCompositiveIndexServe serve composite index information for index symbols

func WsContinuousKlineServe

func WsContinuousKlineServe(subscribeArgs *WsContinuousKlineSubscribeArgs, handler WsContinuousKlineHandler,
	errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsContinuousKlineServe serve websocket continuous kline handler with a pair and contractType and interval like 15m, 30s

func WsDiffDepthServe

func WsDiffDepthServe(symbol string, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsDiffDepthServe serve websocket diff. depth handler.

func WsDiffDepthServeWithRate

func WsDiffDepthServeWithRate(symbol string, rate time.Duration, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsDiffDepthServeWithRate serve websocket diff. depth handler with rate.

func WsKlineServe

func WsKlineServe(symbol string, interval string, handler WsKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsKlineServe serve websocket kline handler with a symbol and interval like 15m, 30s

func WsLiquidationOrderServe

func WsLiquidationOrderServe(symbol string, handler WsLiquidationOrderHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsLiquidationOrderServe serve websocket that pushes force liquidation order information for specific symbol.

func WsMarkPriceServe

func WsMarkPriceServe(symbol string, handler WsMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsMarkPriceServe serve websocket that pushes price and funding rate for a single symbol.

func WsMarkPriceServeWithRate

func WsMarkPriceServeWithRate(symbol string, rate time.Duration, handler WsMarkPriceHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsMarkPriceServeWithRate serve websocket that pushes price and funding rate for a single symbol and rate.

func WsMarketTickerServe

func WsMarketTickerServe(symbol string, handler WsMarketTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsMarketTickerServe serve websocket that pushes 24hr rolling window mini-ticker statistics for a single symbol.

func WsMiniMarketTickerServe

func WsMiniMarketTickerServe(symbol string, handler WsMiniMarketTickerHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsMiniMarketTickerServe serve websocket that pushes 24hr rolling window mini-ticker statistics for a single symbol.

func WsPartialDepthServe

func WsPartialDepthServe(symbol string, levels int, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsPartialDepthServe serve websocket partial depth handler.

func WsPartialDepthServeWithRate

func WsPartialDepthServeWithRate(symbol string, levels int, rate time.Duration, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsPartialDepthServeWithRate serve websocket partial depth handler with rate.

func WsUserDataServe

func WsUserDataServe(listenKey string, handler WsUserDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsUserDataServe serve user data handler with listen key

Types

type Account

type Account struct {
	Assets                      []*AccountAsset    `json:"assets"`
	FeeTier                     int                `json:"feeTier"`
	CanTrade                    bool               `json:"canTrade"`
	CanDeposit                  bool               `json:"canDeposit"`
	CanWithdraw                 bool               `json:"canWithdraw"`
	UpdateTime                  int64              `json:"updateTime"`
	MultiAssetsMargin           bool               `json:"multiAssetsMargin"`
	TotalInitialMargin          string             `json:"totalInitialMargin"`
	TotalMaintMargin            string             `json:"totalMaintMargin"`
	TotalWalletBalance          string             `json:"totalWalletBalance"`
	TotalUnrealizedProfit       string             `json:"totalUnrealizedProfit"`
	TotalMarginBalance          string             `json:"totalMarginBalance"`
	TotalPositionInitialMargin  string             `json:"totalPositionInitialMargin"`
	TotalOpenOrderInitialMargin string             `json:"totalOpenOrderInitialMargin"`
	TotalCrossWalletBalance     string             `json:"totalCrossWalletBalance"`
	TotalCrossUnPnl             string             `json:"totalCrossUnPnl"`
	AvailableBalance            string             `json:"availableBalance"`
	MaxWithdrawAmount           string             `json:"maxWithdrawAmount"`
	Positions                   []*AccountPosition `json:"positions"`
}

Account define account info

type AccountAsset

type AccountAsset struct {
	Asset                  string `json:"asset"`
	InitialMargin          string `json:"initialMargin"`
	MaintMargin            string `json:"maintMargin"`
	MarginBalance          string `json:"marginBalance"`
	MaxWithdrawAmount      string `json:"maxWithdrawAmount"`
	OpenOrderInitialMargin string `json:"openOrderInitialMargin"`
	PositionInitialMargin  string `json:"positionInitialMargin"`
	UnrealizedProfit       string `json:"unrealizedProfit"`
	WalletBalance          string `json:"walletBalance"`
	CrossWalletBalance     string `json:"crossWalletBalance"`
	CrossUnPnl             string `json:"crossUnPnl"`
	AvailableBalance       string `json:"availableBalance"`
	MarginAvailable        bool   `json:"marginAvailable"`
	UpdateTime             int64  `json:"updateTime"`
}

AccountAsset define account asset

type AccountPosition

type AccountPosition struct {
	Isolated               bool             `json:"isolated"`
	Leverage               string           `json:"leverage"`
	InitialMargin          string           `json:"initialMargin"`
	MaintMargin            string           `json:"maintMargin"`
	OpenOrderInitialMargin string           `json:"openOrderInitialMargin"`
	PositionInitialMargin  string           `json:"positionInitialMargin"`
	Symbol                 string           `json:"symbol"`
	UnrealizedProfit       string           `json:"unrealizedProfit"`
	EntryPrice             string           `json:"entryPrice"`
	MaxNotional            string           `json:"maxNotional"`
	PositionSide           PositionSideType `json:"positionSide"`
	PositionAmt            string           `json:"positionAmt"`
	Notional               string           `json:"notional"`
	BidNotional            string           `json:"bidNotional"`
	AskNotional            string           `json:"askNotional"`
	UpdateTime             int64            `json:"updateTime"`
}

AccountPosition define account position

type AccountTrade

type AccountTrade struct {
	Buyer           bool             `json:"buyer"`
	Commission      string           `json:"commission"`
	CommissionAsset string           `json:"commissionAsset"`
	ID              int64            `json:"id"`
	Maker           bool             `json:"maker"`
	OrderID         int64            `json:"orderId"`
	Price           string           `json:"price"`
	Quantity        string           `json:"qty"`
	QuoteQuantity   string           `json:"quoteQty"`
	RealizedPnl     string           `json:"realizedPnl"`
	Side            SideType         `json:"side"`
	PositionSide    PositionSideType `json:"positionSide"`
	Symbol          string           `json:"symbol"`
	Time            int64            `json:"time"`
}

AccountTrade define account trade

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"`
}

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 Ask

type Ask = common.PriceLevel

Ask is a type alias for PriceLevel.

type AssetIndex

type AssetIndex struct {
	Symbol                string `json:"symbol"`
	Time                  uint64 `json:"time"`
	Index                 string `json:"index"`
	BidBuffer             string `json:"bidBuffer"`
	AskBuffer             string `json:"askBuffer"`
	BidRate               string `json:"bidRate"`
	AskRate               string `json:"askRate"`
	AutoExchangeBidBuffer string `json:"autoExchangeBidBuffer"`
	AutoExchangeAskBuffer string `json:"autoExchangeAskBuffer"`
	AutoExchangeBidRate   string `json:"autoExchangeBidRate"`
	AutoExchangeAskRate   string `json:"autoExchangeAskRate"`
}

type AssetIndexService

type AssetIndexService struct {
	// contains filtered or unexported fields
}

func (*AssetIndexService) Do

func (s *AssetIndexService) Do(ctx context.Context, opts ...RequestOption) (res []*AssetIndex, err error)

func (*AssetIndexService) Symbol

func (s *AssetIndexService) Symbol(symbol string) *AssetIndexService

type Balance

type Balance struct {
	AccountAlias       string `json:"accountAlias"`
	Asset              string `json:"asset"`
	Balance            string `json:"balance"`
	CrossWalletBalance string `json:"crossWalletBalance"`
	CrossUnPnl         string `json:"crossUnPnl"`
	AvailableBalance   string `json:"availableBalance"`
	MaxWithdrawAmount  string `json:"maxWithdrawAmount"`
}

Balance define user balance of your account

type BaseAssetList

type BaseAssetList struct {
	BaseAsset          string `json:"baseAsset"`
	QuoteAsset         string `json:"quoteAsset"`
	WeightInQuantity   string `json:"weightInQuantity"`
	WeightInPercentage string `json:"weightInPercentage"`
}

type Basis

type Basis struct {
	Pair                string `json:"pair"`
	IndexPrice          string `json:"indexPrice"`
	ContractType        string `json:"contractType"`
	BasisRate           string `json:"basisRate"`
	FuturesPrice        string `json:"futuresPrice"`
	AnnualizedBasisRate string `json:"annualizedBasisRate"`
	Basis               string `json:"basis"`
	Timestamp           uint64 `json:"timestamp"`
}

type BasisService

type BasisService struct {
	// contains filtered or unexported fields
}

func (*BasisService) ContractType

func (s *BasisService) ContractType(contractType string) *BasisService

func (*BasisService) Do

func (s *BasisService) Do(ctx context.Context, opts ...RequestOption) (res []*Basis, err error)

func (*BasisService) EndTime

func (s *BasisService) EndTime(endTime uint64) *BasisService

func (*BasisService) Limit

func (s *BasisService) Limit(limit uint32) *BasisService

func (*BasisService) Pair

func (s *BasisService) Pair(pair string) *BasisService

func (*BasisService) Period

func (s *BasisService) Period(period string) *BasisService

func (*BasisService) StartTime

func (s *BasisService) StartTime(startTime uint64) *BasisService

type Bid

type Bid = common.PriceLevel

Bid is a type alias for PriceLevel.

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 Bracket

type Bracket struct {
	Bracket          int     `json:"bracket"`
	InitialLeverage  int     `json:"initialLeverage"`
	NotionalCap      float64 `json:"notionalCap"`
	NotionalFloor    float64 `json:"notionalFloor"`
	MaintMarginRatio float64 `json:"maintMarginRatio"`
	Cum              float64 `json:"cum"`
}

Bracket define the bracket

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) (err error)

Do send request

func (*CancelAllOpenOrdersService) Symbol

Symbol set symbol

type CancelMultiplesOrdersService

type CancelMultiplesOrdersService struct {
	// contains filtered or unexported fields
}

CancelMultiplesOrdersService cancel a list of orders

func (*CancelMultiplesOrdersService) Do

Do send request

func (*CancelMultiplesOrdersService) OrderIDList

func (s *CancelMultiplesOrdersService) OrderIDList(orderIDList []int64) *CancelMultiplesOrdersService

OrderID set orderID

func (*CancelMultiplesOrdersService) OrigClientOrderIDList

func (s *CancelMultiplesOrdersService) OrigClientOrderIDList(origClientOrderIDList []string) *CancelMultiplesOrdersService

OrigClientOrderID set origClientOrderID

func (*CancelMultiplesOrdersService) Symbol

Symbol set symbol

type CancelOrderResponse

type CancelOrderResponse struct {
	ClientOrderID    string           `json:"clientOrderId"`
	CumQuantity      string           `json:"cumQty"`
	CumQuote         string           `json:"cumQuote"`
	ExecutedQuantity string           `json:"executedQty"`
	OrderID          int64            `json:"orderId"`
	OrigQuantity     string           `json:"origQty"`
	Price            string           `json:"price"`
	ReduceOnly       bool             `json:"reduceOnly"`
	Side             SideType         `json:"side"`
	Status           OrderStatusType  `json:"status"`
	StopPrice        string           `json:"stopPrice"`
	Symbol           string           `json:"symbol"`
	TimeInForce      TimeInForceType  `json:"timeInForce"`
	Type             OrderType        `json:"type"`
	UpdateTime       int64            `json:"updateTime"`
	WorkingType      WorkingType      `json:"workingType"`
	ActivatePrice    string           `json:"activatePrice"`
	PriceRate        string           `json:"priceRate"`
	OrigType         string           `json:"origType"`
	PositionSide     PositionSideType `json:"positionSide"`
	PriceProtect     bool             `json:"priceProtect"`
}

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) 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 ChangeLeverageService

type ChangeLeverageService struct {
	// contains filtered or unexported fields
}

ChangeLeverageService change user's initial leverage of specific symbol market

func (*ChangeLeverageService) Do

func (s *ChangeLeverageService) Do(ctx context.Context, opts ...RequestOption) (res *SymbolLeverage, err error)

Do send request

func (*ChangeLeverageService) Leverage

func (s *ChangeLeverageService) Leverage(leverage int) *ChangeLeverageService

Leverage set leverage

func (*ChangeLeverageService) Symbol

Symbol set symbol

type ChangeMarginTypeService

type ChangeMarginTypeService struct {
	// contains filtered or unexported fields
}

ChangeMarginTypeService change user's margin type of specific symbol market

func (*ChangeMarginTypeService) Do

func (s *ChangeMarginTypeService) Do(ctx context.Context, opts ...RequestOption) (err error)

Do send request

func (*ChangeMarginTypeService) MarginType

func (s *ChangeMarginTypeService) MarginType(marginType MarginType) *ChangeMarginTypeService

MarginType set margin type

func (*ChangeMarginTypeService) Symbol

Symbol set symbol

type ChangeMultiAssetModeService

type ChangeMultiAssetModeService struct {
	// contains filtered or unexported fields
}

ChangeMultiAssetModeService change user's multi-asset mode

func (*ChangeMultiAssetModeService) Do

Do send request

func (*ChangeMultiAssetModeService) MultiAssetsMargin

func (s *ChangeMultiAssetModeService) MultiAssetsMargin(multiAssetsMargin bool) *ChangeMultiAssetModeService

MultiAssetsMargin set multiAssetsMargin

type ChangePositionModeService

type ChangePositionModeService struct {
	// contains filtered or unexported fields
}

ChangePositionModeService change user's position mode

func (*ChangePositionModeService) Do

func (s *ChangePositionModeService) Do(ctx context.Context, opts ...RequestOption) (err error)

Do send request

func (*ChangePositionModeService) DualSide

Change user's position mode: true - Hedge Mode, false - One-way Mode

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

func NewClient(apiKey, secretKey string) *Client

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

func NewProxiedClient(apiKey, secretKey, proxyUrl string) *Client

NewProxiedClient passing a proxy url

func (*Client) NewAggTradesService

func (c *Client) NewAggTradesService() *AggTradesService

NewAggTradesService init aggregate trades service

func (*Client) NewAssetIndexService

func (c *Client) NewAssetIndexService() *AssetIndexService

func (*Client) NewBasisService

func (c *Client) NewBasisService() *BasisService

func (*Client) NewCancelAllOpenOrdersService

func (c *Client) NewCancelAllOpenOrdersService() *CancelAllOpenOrdersService

NewCancelAllOpenOrdersService init cancel all open orders service

func (*Client) NewCancelMultipleOrdersService

func (c *Client) NewCancelMultipleOrdersService() *CancelMultiplesOrdersService

NewCancelMultipleOrdersService init cancel multiple orders service

func (*Client) NewCancelOrderService

func (c *Client) NewCancelOrderService() *CancelOrderService

NewCancelOrderService init cancel order service

func (*Client) NewChangeLeverageService

func (c *Client) NewChangeLeverageService() *ChangeLeverageService

NewChangeLeverageService init change leverage service

func (*Client) NewChangeMarginTypeService

func (c *Client) NewChangeMarginTypeService() *ChangeMarginTypeService

NewChangeMarginTypeService init change margin type service

func (*Client) NewChangeMultiAssetModeService

func (c *Client) NewChangeMultiAssetModeService() *ChangeMultiAssetModeService

NewChangeMultiAssetModeService init change multi-asset mode service

func (*Client) NewChangePositionModeService

func (c *Client) NewChangePositionModeService() *ChangePositionModeService

NewChangePositionModeService init change position mode service

func (*Client) NewCloseUserStreamService

func (c *Client) NewCloseUserStreamService() *CloseUserStreamService

NewCloseUserStreamService init closing user stream service

func (*Client) NewCommissionRateService

func (c *Client) NewCommissionRateService() *CommissionRateService

NewCommissionRateService returns commission rate

func (*Client) NewConstituentsService

func (c *Client) NewConstituentsService() *ConstituentsService

func (*Client) NewContinuousKlinesService

func (c *Client) NewContinuousKlinesService() *ContinuousKlinesService

NewContinuousKlinesService init continuous klines service

func (*Client) NewCreateBatchOrdersService

func (c *Client) NewCreateBatchOrdersService() *CreateBatchOrdersService

NewCreateBatchOrdersService init creating batch order service

func (*Client) NewCreateOrderService

func (c *Client) NewCreateOrderService() *CreateOrderService

NewCreateOrderService init creating order service

func (*Client) NewDeliveryPriceService

func (c *Client) NewDeliveryPriceService() *DeliveryPriceService

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) NewFeeBurnService

func (c *Client) NewFeeBurnService() *FeeBurnService

func (*Client) NewFundingRateInfoService

func (c *Client) NewFundingRateInfoService() *FundingRateInfoService

NewFundingRateInfoService init funding rate info service

func (*Client) NewFundingRateService

func (c *Client) NewFundingRateService() *FundingRateService

NewFundingRateService init funding rate service

func (*Client) NewGetAccountService

func (c *Client) NewGetAccountService() *GetAccountService

NewGetAccountService init getting account service

func (*Client) NewGetBalanceService

func (c *Client) NewGetBalanceService() *GetBalanceService

NewGetBalanceService init getting balance service

func (*Client) NewGetFeeBurnService

func (c *Client) NewGetFeeBurnService() *GetFeeBurnService

func (*Client) NewGetIncomeHistoryService

func (c *Client) NewGetIncomeHistoryService() *GetIncomeHistoryService

NewGetIncomeHistoryService init getting income history service

func (*Client) NewGetLeverageBracketService

func (c *Client) NewGetLeverageBracketService() *GetLeverageBracketService

NewGetLeverageBracketService init change leverage service

func (*Client) NewGetMultiAssetModeService

func (c *Client) NewGetMultiAssetModeService() *GetMultiAssetModeService

NewGetMultiAssetModeService init get multi-asset mode service

func (*Client) NewGetOpenInterestService

func (c *Client) NewGetOpenInterestService() *GetOpenInterestService

NewGetOpenInterestService init open interest service

func (*Client) NewGetOpenOrderService

func (c *Client) NewGetOpenOrderService() *GetOpenOrderService

NewGetOpenOrderService init get open order service

func (*Client) NewGetOrderService

func (c *Client) NewGetOrderService() *GetOrderService

NewGetOrderService init get order service

func (*Client) NewGetPositionMarginHistoryService

func (c *Client) NewGetPositionMarginHistoryService() *GetPositionMarginHistoryService

NewGetPositionMarginHistoryService init getting position margin history service

func (*Client) NewGetPositionModeService

func (c *Client) NewGetPositionModeService() *GetPositionModeService

NewGetPositionModeService init get position mode service

func (*Client) NewGetPositionRiskService

func (c *Client) NewGetPositionRiskService() *GetPositionRiskService

NewGetPositionRiskService init getting position risk service

func (*Client) NewGetRebateNewUserService

func (c *Client) NewGetRebateNewUserService() *GetRebateNewUserService

NewGetRebateNewUserService init get rebate_newuser service

func (*Client) NewHistoricalTradesService

func (c *Client) NewHistoricalTradesService() *HistoricalTradesService

NewHistoricalTradesService init listing trades service

func (*Client) NewIndexInfoService

func (c *Client) NewIndexInfoService() *IndexInfoService

func (*Client) NewIndexPriceKlinesService

func (c *Client) NewIndexPriceKlinesService() *IndexPriceKlinesService

NewIndexPriceKlinesService init index price klines 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) NewListAccountTradeService

func (c *Client) NewListAccountTradeService() *ListAccountTradeService

NewListAccountTradeService init account trade list service

func (*Client) NewListBookTickersService

func (c *Client) NewListBookTickersService() *ListBookTickersService

NewListBookTickersService init listing booking tickers service

func (*Client) NewListLiquidationOrdersService

func (c *Client) NewListLiquidationOrdersService() *ListLiquidationOrdersService

NewListLiquidationOrdersService init funding rate 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) NewListPriceChangeStatsService

func (c *Client) NewListPriceChangeStatsService() *ListPriceChangeStatsService

NewListPriceChangeStatsService init list prices change stats service

func (*Client) NewListPricesService

func (c *Client) NewListPricesService() *ListPricesService

NewListPricesService init listing prices service

func (*Client) NewListUserLiquidationOrdersService

func (c *Client) NewListUserLiquidationOrdersService() *ListUserLiquidationOrdersService

NewListUserLiquidationOrdersService init list user's liquidation orders service

func (*Client) NewLongShortRatioService

func (c *Client) NewLongShortRatioService() *LongShortRatioService

NewLongShortRatioService init open interest statistics service

func (*Client) NewLvtKlinesService

func (c *Client) NewLvtKlinesService() *LvtKlinesService

func (*Client) NewMarkPriceKlinesService

func (c *Client) NewMarkPriceKlinesService() *MarkPriceKlinesService

NewMarkPriceKlinesService init markPriceKlines service

func (*Client) NewModifyOrderService

func (c *Client) NewModifyOrderService() *ModifyOrderService

NewModifyOrderService init creating order service

func (*Client) NewOpenInterestStatisticsService

func (c *Client) NewOpenInterestStatisticsService() *OpenInterestStatisticsService

NewOpenInterestStatisticsService init open interest statistics service

func (*Client) NewPingService

func (c *Client) NewPingService() *PingService

NewPingService init ping service

func (*Client) NewPremiumIndexKlinesService

func (c *Client) NewPremiumIndexKlinesService() *PremiumIndexKlinesService

NewPremiumIndexKlinesService init premium index klines service

func (*Client) NewPremiumIndexService

func (c *Client) NewPremiumIndexService() *PremiumIndexService

NewPremiumIndexService init premium index service

func (*Client) NewRecentTradesService

func (c *Client) NewRecentTradesService() *RecentTradesService

NewRecentTradesService init recent trades service

func (*Client) NewServerTimeService

func (c *Client) NewServerTimeService() *ServerTimeService

NewServerTimeService init server time service

func (*Client) NewSetServerTimeService

func (c *Client) NewSetServerTimeService() *SetServerTimeService

NewSetServerTimeService init set server time service

func (*Client) NewStartUserStreamService

func (c *Client) NewStartUserStreamService() *StartUserStreamService

NewStartUserStreamService init starting user stream service

func (*Client) NewTakerLongShortRatioService

func (c *Client) NewTakerLongShortRatioService() *TakerLongShortRatioService

func (*Client) NewTopLongShortAccountRatioService

func (c *Client) NewTopLongShortAccountRatioService() *TopLongShortAccountRatioService

func (*Client) NewTopLongShortPositionRatioService

func (c *Client) NewTopLongShortPositionRatioService() *TopLongShortPositionRatioService

func (*Client) NewUpdatePositionMarginService

func (c *Client) NewUpdatePositionMarginService() *UpdatePositionMarginService

NewUpdatePositionMarginService init update position margin

func (*Client) SetApiEndpoint

func (c *Client) SetApiEndpoint(url string) *Client

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 CommissionRate

type CommissionRate struct {
	Symbol              string `json:"symbol"`
	MakerCommissionRate string `json:"makerCommissionRate"`
	TakerCommissionRate string `json:"takerCommissionRate"`
}

Commission Rate

type CommissionRateService

type CommissionRateService struct {
	// contains filtered or unexported fields
}

func (*CommissionRateService) Do

func (s *CommissionRateService) Do(ctx context.Context, opts ...RequestOption) (res *CommissionRate, err error)

Do send request

func (*CommissionRateService) Symbol

func (service *CommissionRateService) Symbol(symbol string) *CommissionRateService

Symbol set symbol

type Constituents

type Constituents struct {
	Exchange string `json:"exchange"`
	Symbol   string `json:"symbol"`
}

type ConstituentsService

type ConstituentsService struct {
	// contains filtered or unexported fields
}

func (*ConstituentsService) Do

func (*ConstituentsService) Symbol

func (s *ConstituentsService) Symbol(symbol string) *ConstituentsService

type ConstituentsServiceRsp

type ConstituentsServiceRsp struct {
	Symbol       string          `json:"symbol"`
	Time         uint64          `json:"time"`
	Constituents []*Constituents `json:"constituents"`
}

type ContinuousKline

type ContinuousKline 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"`
}

ContinuousKline define ContinuousKline info

type ContinuousKlinesService

type ContinuousKlinesService struct {
	// contains filtered or unexported fields
}

ContinuousKlinesService list klines

func (*ContinuousKlinesService) ContractType

func (s *ContinuousKlinesService) ContractType(contractType string) *ContinuousKlinesService

contractType set contractType

func (*ContinuousKlinesService) Do

func (s *ContinuousKlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*ContinuousKline, err error)

Do send request

func (*ContinuousKlinesService) EndTime

EndTime set endTime

func (*ContinuousKlinesService) Interval

Interval set interval

func (*ContinuousKlinesService) Limit

Limit set limit

func (*ContinuousKlinesService) Pair

pair set pair

func (*ContinuousKlinesService) StartTime

func (s *ContinuousKlinesService) StartTime(startTime int64) *ContinuousKlinesService

StartTime set startTime

type ContractType

type ContractType string

ContractType define contract type

type CreateBatchOrdersResponse

type CreateBatchOrdersResponse struct {
	// Total number of messages in the response
	N int
	// List of orders which were placed successfully which can have a length between 0 and N
	Orders []*Order
	// List of errors of length N, where each item corresponds to a nil value if
	// the order from that specific index was placed succeessfully OR an non-nil *APIError if there was an error with
	// the order at that index
	Errors []error
}

CreateBatchOrdersResponse contains the response from CreateBatchOrders operation

type CreateBatchOrdersService

type CreateBatchOrdersService struct {
	// contains filtered or unexported fields
}

func (*CreateBatchOrdersService) Do

func (*CreateBatchOrdersService) OrderList

type CreateOrderResponse

type CreateOrderResponse 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"`                 //
	CumQuote                string           `json:"cumQuote"`                    //
	ReduceOnly              bool             `json:"reduceOnly"`                  //
	Status                  OrderStatusType  `json:"status"`                      //
	StopPrice               string           `json:"stopPrice"`                   // please ignore when order type is TRAILING_STOP_MARKET
	TimeInForce             TimeInForceType  `json:"timeInForce"`                 //
	Type                    OrderType        `json:"type"`                        //
	Side                    SideType         `json:"side"`                        //
	UpdateTime              int64            `json:"updateTime"`                  // update time
	WorkingType             WorkingType      `json:"workingType"`                 //
	ActivatePrice           string           `json:"activatePrice"`               // activation price, only return with TRAILING_STOP_MARKET order
	PriceRate               string           `json:"priceRate"`                   // callback rate, only return with TRAILING_STOP_MARKET order
	AvgPrice                string           `json:"avgPrice"`                    //
	PositionSide            PositionSideType `json:"positionSide"`                //
	ClosePosition           bool             `json:"closePosition"`               // if Close-All
	PriceProtect            bool             `json:"priceProtect"`                // if conditional order trigger is protected
	PriceMatch              string           `json:"priceMatch"`                  // price match mode
	SelfTradePreventionMode string           `json:"selfTradePreventionMode"`     // self trading prevention mode
	GoodTillDate            int64            `json:"goodTillDate"`                // order pre-set auto cancel time for TIF GTD order
	CumQty                  string           `json:"cumQty"`                      //
	OrigType                OrderType        `json:"origType"`                    //
	RateLimitOrder10s       string           `json:"rateLimitOrder10s,omitempty"` //
	RateLimitOrder1m        string           `json:"rateLimitOrder1m,omitempty"`  //
}

CreateOrderResponse define create order response

type CreateOrderService

type CreateOrderService struct {
	// contains filtered or unexported fields
}

CreateOrderService create order

func (*CreateOrderService) ActivationPrice

func (s *CreateOrderService) ActivationPrice(activationPrice string) *CreateOrderService

ActivationPrice set activationPrice

func (*CreateOrderService) CallbackRate

func (s *CreateOrderService) CallbackRate(callbackRate string) *CreateOrderService

CallbackRate set callbackRate

func (*CreateOrderService) ClosePosition

func (s *CreateOrderService) ClosePosition(closePosition bool) *CreateOrderService

ClosePosition set closePosition

func (*CreateOrderService) Do

func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOrderResponse, err error)

Do send request

func (*CreateOrderService) NewClientOrderID

func (s *CreateOrderService) NewClientOrderID(newClientOrderID string) *CreateOrderService

NewClientOrderID set newClientOrderID

func (*CreateOrderService) NewOrderResponseType

func (s *CreateOrderService) NewOrderResponseType(newOrderResponseType NewOrderRespType) *CreateOrderService

NewOrderResponseType set newOrderResponseType

func (*CreateOrderService) PositionSide

func (s *CreateOrderService) PositionSide(positionSide PositionSideType) *CreateOrderService

PositionSide set side

func (*CreateOrderService) Price

func (s *CreateOrderService) Price(price string) *CreateOrderService

Price set price

func (*CreateOrderService) PriceProtect

func (s *CreateOrderService) PriceProtect(priceProtect bool) *CreateOrderService

PriceProtect set priceProtect

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

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) TimeInForce

func (s *CreateOrderService) TimeInForce(timeInForce TimeInForceType) *CreateOrderService

TimeInForce set timeInForce

func (*CreateOrderService) Type

func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService

Type set type

func (*CreateOrderService) WorkingType

func (s *CreateOrderService) WorkingType(workingType WorkingType) *CreateOrderService

WorkingType set workingType

type DeliveryPrice

type DeliveryPrice struct {
	DeliveryTime  uint64  `json:"deliveryTime"`  // deliveryTime
	DeliveryPrice float64 `json:"deliveryPrice"` // deliveryPrice
}

type DeliveryPriceService

type DeliveryPriceService struct {
	// contains filtered or unexported fields
}

func (*DeliveryPriceService) Do

func (s *DeliveryPriceService) Do(ctx context.Context, opts ...RequestOption) (res []*DeliveryPrice, err error)

func (*DeliveryPriceService) Pair

type DepthResponse

type DepthResponse struct {
	LastUpdateID int64 `json:"lastUpdateId"`
	Time         int64 `json:"E"`
	TradeTime    int64 `json:"T"`
	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) Limit

func (s *DepthService) Limit(limit int) *DepthService

Limit set limit

func (*DepthService) Symbol

func (s *DepthService) Symbol(symbol string) *DepthService

Symbol set symbol

type ErrHandler

type ErrHandler func(err error)

ErrHandler handles errors

type ExchangeInfo

type ExchangeInfo struct {
	Timezone        string        `json:"timezone"`
	ServerTime      int64         `json:"serverTime"`
	RateLimits      []RateLimit   `json:"rateLimits"`
	ExchangeFilters []interface{} `json:"exchangeFilters"`
	Symbols         []Symbol      `json:"symbols"`
}

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 FeeBurn

type FeeBurn struct {
	FeeBurn bool `json:"feeBurn"`
}

type FeeBurnService

type FeeBurnService struct {
	// contains filtered or unexported fields
}

FeeBurnService set fee burn info

func (*FeeBurnService) Disable

func (f *FeeBurnService) Disable() *FeeBurnService

func (*FeeBurnService) Do

func (s *FeeBurnService) Do(ctx context.Context, opts ...RequestOption) (err error)

Do send request

func (*FeeBurnService) Enable

func (f *FeeBurnService) Enable() *FeeBurnService

type ForceOrderCloseType

type ForceOrderCloseType string

ForceOrderCloseType define reason type for force order

type FundingRate

type FundingRate struct {
	Symbol      string `json:"symbol"`
	FundingRate string `json:"fundingRate"`
	FundingTime int64  `json:"fundingTime"`
	MarkPrice   string `json:"markPrice"`
}

FundingRate define funding rate of mark price

type FundingRateInfo

type FundingRateInfo struct {
	Symbol                   string `json:"symbol"`
	AdjustedFundingRateCap   string `json:"adjustedFundingRateCap"`
	AdjustedFundingRateFloor string `json:"adjustedFundingRateFloor"`
	FundingIntervalHours     int64  `json:"fundingIntervalHours"`
}

FundingRateInfo defines funding rate info for symbols

type FundingRateInfoService

type FundingRateInfoService struct {
	// contains filtered or unexported fields
}

FundingRateInfoService gets funding rate info

func (*FundingRateInfoService) Do

func (s *FundingRateInfoService) Do(ctx context.Context, opts ...RequestOption) (res []*FundingRateInfo, err error)

Do sends request

type FundingRateService

type FundingRateService struct {
	// contains filtered or unexported fields
}

FundingRateService get funding rate

func (*FundingRateService) Do

func (s *FundingRateService) Do(ctx context.Context, opts ...RequestOption) (res []*FundingRate, err error)

Do send request

func (*FundingRateService) EndTime

func (s *FundingRateService) EndTime(endTime int64) *FundingRateService

EndTime set startTime

func (*FundingRateService) Limit

func (s *FundingRateService) Limit(limit int) *FundingRateService

Limit set limit

func (*FundingRateService) StartTime

func (s *FundingRateService) StartTime(startTime int64) *FundingRateService

StartTime set startTime

func (*FundingRateService) Symbol

func (s *FundingRateService) Symbol(symbol string) *FundingRateService

Symbol set symbol

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 GetBalanceService

type GetBalanceService struct {
	// contains filtered or unexported fields
}

GetBalanceService get account balance

func (*GetBalanceService) Do

func (s *GetBalanceService) Do(ctx context.Context, opts ...RequestOption) (res []*Balance, err error)

Do send request

type GetFeeBurnService

type GetFeeBurnService struct {
	// contains filtered or unexported fields
}

GetFeeBurnService get fee burn info

func (*GetFeeBurnService) Do

func (s *GetFeeBurnService) Do(ctx context.Context, opts ...RequestOption) (res *FeeBurn, err error)

Do send request

type GetIncomeHistoryService

type GetIncomeHistoryService struct {
	// contains filtered or unexported fields
}

GetIncomeHistoryService get position margin history service

func (*GetIncomeHistoryService) Do

func (s *GetIncomeHistoryService) Do(ctx context.Context, opts ...RequestOption) (res []*IncomeHistory, err error)

Do send request

func (*GetIncomeHistoryService) EndTime

EndTime set endTime

func (*GetIncomeHistoryService) IncomeType

func (s *GetIncomeHistoryService) IncomeType(incomeType string) *GetIncomeHistoryService

IncomeType set income type

func (*GetIncomeHistoryService) Limit

Limit set limit

func (*GetIncomeHistoryService) StartTime

func (s *GetIncomeHistoryService) StartTime(startTime int64) *GetIncomeHistoryService

StartTime set startTime

func (*GetIncomeHistoryService) Symbol

Symbol set symbol

type GetLeverageBracketService

type GetLeverageBracketService struct {
	// contains filtered or unexported fields
}

GetLeverageBracketService get funding rate

func (*GetLeverageBracketService) Do

func (s *GetLeverageBracketService) Do(ctx context.Context, opts ...RequestOption) (res []*LeverageBracket, err error)

Do send request

func (*GetLeverageBracketService) Symbol

Symbol set symbol

type GetMultiAssetModeService

type GetMultiAssetModeService struct {
	// contains filtered or unexported fields
}

GetMultiAssetModeService get user's multi-asset mode

func (*GetMultiAssetModeService) Do

Do send request

type GetOpenInterestService

type GetOpenInterestService struct {
	// contains filtered or unexported fields
}

GetOpenInterestService get present open interest of a specific symbol.

func (*GetOpenInterestService) Do

func (s *GetOpenInterestService) Do(ctx context.Context, opts ...RequestOption) (res *OpenInterest, err error)

Do send request

func (*GetOpenInterestService) Symbol

Symbol set symbol

type GetOpenOrderService

type GetOpenOrderService struct {
	// contains filtered or unexported fields
}

GetOpenOrderService query current open order

func (*GetOpenOrderService) Do

func (s *GetOpenOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)

func (*GetOpenOrderService) OrderID

func (s *GetOpenOrderService) OrderID(orderID int64) *GetOpenOrderService

func (*GetOpenOrderService) OrigClientOrderID

func (s *GetOpenOrderService) OrigClientOrderID(origClientOrderID string) *GetOpenOrderService

func (*GetOpenOrderService) Symbol

func (s *GetOpenOrderService) Symbol(symbol string) *GetOpenOrderService

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 GetPositionMarginHistoryService

type GetPositionMarginHistoryService struct {
	// contains filtered or unexported fields
}

GetPositionMarginHistoryService get position margin history service

func (*GetPositionMarginHistoryService) Do

Do send request

func (*GetPositionMarginHistoryService) EndTime

EndTime set endTime

func (*GetPositionMarginHistoryService) Limit

Limit set limit

func (*GetPositionMarginHistoryService) StartTime

StartTime set startTime

func (*GetPositionMarginHistoryService) Symbol

Symbol set symbol

func (*GetPositionMarginHistoryService) Type

Type set type

type GetPositionModeService

type GetPositionModeService struct {
	// contains filtered or unexported fields
}

GetPositionModeService get user's position mode

func (*GetPositionModeService) Do

func (s *GetPositionModeService) Do(ctx context.Context, opts ...RequestOption) (res *PositionMode, err error)

Do send request

type GetPositionRiskService

type GetPositionRiskService struct {
	// contains filtered or unexported fields
}

GetPositionRiskService get account balance

func (*GetPositionRiskService) Do

func (s *GetPositionRiskService) Do(ctx context.Context, opts ...RequestOption) (res []*PositionRisk, err error)

Do send request

func (*GetPositionRiskService) Symbol

Symbol set symbol

type GetRebateNewUserService

type GetRebateNewUserService struct {
	// contains filtered or unexported fields
}

GetRebateNewUserService

func (*GetRebateNewUserService) BrokerageID

func (s *GetRebateNewUserService) BrokerageID(brokerageID string) *GetRebateNewUserService

BrokerageID setting

func (*GetRebateNewUserService) Do

func (s *GetRebateNewUserService) Do(ctx context.Context, opts ...RequestOption) (res *RebateNewUser, err error)

Do send request

func (*GetRebateNewUserService) Type

func (s *GetRebateNewUserService) Type(type_future int) *GetRebateNewUserService

Type future setting

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 []*Trade, err error)

Do send request

func (*HistoricalTradesService) FromID

FromID set fromID

func (*HistoricalTradesService) Limit

Limit set limit

func (*HistoricalTradesService) Symbol

Symbol set symbol

type IncomeHistory

type IncomeHistory struct {
	Asset      string `json:"asset"`
	Income     string `json:"income"`
	IncomeType string `json:"incomeType"`
	Info       string `json:"info"`
	Symbol     string `json:"symbol"`
	Time       int64  `json:"time"`
	TranID     int64  `json:"tranId"`
	TradeID    string `json:"tradeId"`
}

IncomeHistory define position margin history info

type IndexInfo

type IndexInfo struct {
	Symbol        string           `json:"symbol"`
	Time          uint64           `json:"time"`
	Component     string           `json:"component"`
	BaseAssetList []*BaseAssetList `json:"baseAssetList"`
}

type IndexInfoService

type IndexInfoService struct {
	// contains filtered or unexported fields
}

func (*IndexInfoService) Do

func (s *IndexInfoService) Do(ctx context.Context, opts ...RequestOption) (res []*IndexInfo, err error)

func (*IndexInfoService) Symbol

func (s *IndexInfoService) Symbol(symbol string) *IndexInfoService

type IndexPriceKlinesService

type IndexPriceKlinesService struct {
	// contains filtered or unexported fields
}

IndexPriceKlinesService list klines

func (*IndexPriceKlinesService) Do

func (ipks *IndexPriceKlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)

Do send request

func (*IndexPriceKlinesService) EndTime

func (ipks *IndexPriceKlinesService) EndTime(endTime int64) *IndexPriceKlinesService

EndTime set endTime

func (*IndexPriceKlinesService) Interval

func (ipks *IndexPriceKlinesService) Interval(interval string) *IndexPriceKlinesService

Interval set interval

func (*IndexPriceKlinesService) Limit

Limit set limit

func (*IndexPriceKlinesService) Pair

Pair sets pair

func (*IndexPriceKlinesService) StartTime

func (ipks *IndexPriceKlinesService) StartTime(startTime int64) *IndexPriceKlinesService

StartTime set startTime

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

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 LeverageBracket

type LeverageBracket struct {
	Symbol   string    `json:"symbol"`
	Brackets []Bracket `json:"brackets"`
}

LeverageBracket define the leverage bracket

type LiquidationOrder

type LiquidationOrder struct {
	Symbol           string          `json:"symbol"`
	Price            string          `json:"price"`
	OrigQuantity     string          `json:"origQty"`
	ExecutedQuantity string          `json:"executedQty"`
	AveragePrice     string          `json:"avragePrice"`
	Status           OrderStatusType `json:"status"`
	TimeInForce      TimeInForceType `json:"timeInForce"`
	Type             OrderType       `json:"type"`
	Side             SideType        `json:"side"`
	Time             int64           `json:"time"`
}

LiquidationOrder define liquidation order

type ListAccountTradeService

type ListAccountTradeService struct {
	// contains filtered or unexported fields
}

ListAccountTradeService define account trade list service

func (*ListAccountTradeService) Do

func (s *ListAccountTradeService) Do(ctx context.Context, opts ...RequestOption) (res []*AccountTrade, err error)

Do send request

func (*ListAccountTradeService) EndTime

EndTime set endTime

func (*ListAccountTradeService) FromID

FromID set fromID

func (*ListAccountTradeService) Limit

Limit set limit

func (*ListAccountTradeService) OrderID

OrderID set orderId

func (*ListAccountTradeService) StartTime

func (s *ListAccountTradeService) StartTime(startTime int64) *ListAccountTradeService

StartTime set startTime

func (*ListAccountTradeService) Symbol

Symbol set symbol

type ListBookTickersService

type ListBookTickersService struct {
	// contains filtered or unexported fields
}

ListBookTickersService list best price/qty on the order book for a symbol or symbols

func (*ListBookTickersService) Do

func (s *ListBookTickersService) Do(ctx context.Context, opts ...RequestOption) (res []*BookTicker, err error)

Do send request

func (*ListBookTickersService) Symbol

Symbol set symbol

type ListLiquidationOrdersService

type ListLiquidationOrdersService struct {
	// contains filtered or unexported fields
}

ListLiquidationOrdersService list liquidation orders

func (*ListLiquidationOrdersService) Do

Do send request

func (*ListLiquidationOrdersService) EndTime

EndTime set startTime

func (*ListLiquidationOrdersService) Limit

Limit set limit

func (*ListLiquidationOrdersService) StartTime

StartTime set startTime

func (*ListLiquidationOrdersService) Symbol

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) Symbol

Symbol set symbol

type ListOrdersService

type ListOrdersService struct {
	// contains filtered or unexported fields
}

ListOrdersService all account orders; active, canceled, or filled

func (*ListOrdersService) Do

func (s *ListOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)

Do send request

func (*ListOrdersService) EndTime

func (s *ListOrdersService) EndTime(endTime int64) *ListOrdersService

EndTime set endtime

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) StartTime

func (s *ListOrdersService) StartTime(startTime int64) *ListOrdersService

StartTime set starttime

func (*ListOrdersService) Symbol

func (s *ListOrdersService) Symbol(symbol string) *ListOrdersService

Symbol set symbol

type ListPriceChangeStatsService

type ListPriceChangeStatsService struct {
	// contains filtered or unexported fields
}

ListPriceChangeStatsService show stats of price change in last 24 hours for all symbols

func (*ListPriceChangeStatsService) Do

Do send request

func (*ListPriceChangeStatsService) Symbol

Symbol set symbol

type ListPricesService

type ListPricesService struct {
	// contains filtered or unexported fields
}

ListPricesService list latest price for a symbol or symbols

func (*ListPricesService) Do

func (s *ListPricesService) Do(ctx context.Context, opts ...RequestOption) (res []*SymbolPrice, err error)

Do send request

func (*ListPricesService) Symbol

func (s *ListPricesService) Symbol(symbol string) *ListPricesService

Symbol set symbol

type ListUserLiquidationOrdersService

type ListUserLiquidationOrdersService struct {
	// contains filtered or unexported fields
}

ListUserLiquidationOrdersService lists user's liquidation orders

func (*ListUserLiquidationOrdersService) AutoCloseType

AutoCloseType set symbol

func (*ListUserLiquidationOrdersService) Do

Do send request

func (*ListUserLiquidationOrdersService) EndTime

EndTime set endTime

func (*ListUserLiquidationOrdersService) Limit

Limit set limit

func (*ListUserLiquidationOrdersService) StartTime

StartTime set startTime

func (*ListUserLiquidationOrdersService) Symbol

Symbol set symbol

type LongShortRatio

type LongShortRatio struct {
	Symbol         string `json:"symbol"`
	LongShortRatio string `json:"longShortRatio"`
	LongAccount    string `json:"longAccount"`
	ShortAccount   string `json:"shortAccount"`
	Timestamp      int64  `json:"timestamp"`
}

type LongShortRatioService

type LongShortRatioService struct {
	// contains filtered or unexported fields
}

LongShortRatioService list open history data of a symbol.

func (*LongShortRatioService) Do

func (s *LongShortRatioService) Do(ctx context.Context, opts ...RequestOption) (res []*LongShortRatio, err error)

Do send request

func (*LongShortRatioService) EndTime

func (s *LongShortRatioService) EndTime(endTime int64) *LongShortRatioService

EndTime set endTime

func (*LongShortRatioService) Limit

Limit set limit

func (*LongShortRatioService) Period

Period set period interval

func (*LongShortRatioService) StartTime

func (s *LongShortRatioService) StartTime(startTime int64) *LongShortRatioService

StartTime set startTime

func (*LongShortRatioService) Symbol

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 LvtKline

type LvtKline struct {
	OpenTime      uint64
	Open          string
	High          string
	Low           string
	Close         string
	CloseLeverage string
	CloseTime     uint64
}

type LvtKlinesService

type LvtKlinesService struct {
	// contains filtered or unexported fields
}

func (*LvtKlinesService) Do

func (s *LvtKlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*LvtKline, err error)

func (*LvtKlinesService) EndTime

func (s *LvtKlinesService) EndTime(endTime uint64) *LvtKlinesService

func (*LvtKlinesService) Interval

func (s *LvtKlinesService) Interval(interval string) *LvtKlinesService

func (*LvtKlinesService) Limit

func (s *LvtKlinesService) Limit(limit uint32) *LvtKlinesService

func (*LvtKlinesService) StartTime

func (s *LvtKlinesService) StartTime(startTime uint64) *LvtKlinesService

func (*LvtKlinesService) Symbol

func (s *LvtKlinesService) Symbol(symbol string) *LvtKlinesService

type MarginType

type MarginType string

MarginType define margin type

type MarkPriceKlinesService

type MarkPriceKlinesService struct {
	// contains filtered or unexported fields
}

MarkPriceKlinesService list mark price klines

func (*MarkPriceKlinesService) Do

func (mpks *MarkPriceKlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)

Do send request

func (*MarkPriceKlinesService) EndTime

func (mpks *MarkPriceKlinesService) EndTime(endTime int64) *MarkPriceKlinesService

EndTime set endTime

func (*MarkPriceKlinesService) Interval

func (mpks *MarkPriceKlinesService) Interval(interval string) *MarkPriceKlinesService

Interval set interval

func (*MarkPriceKlinesService) Limit

Limit set limit

func (*MarkPriceKlinesService) StartTime

func (mpks *MarkPriceKlinesService) StartTime(startTime int64) *MarkPriceKlinesService

StartTime set startTime

func (*MarkPriceKlinesService) Symbol

Symbol set symbol

type MarketLotSizeFilter

type MarketLotSizeFilter struct {
	MaxQuantity string `json:"maxQty"`
	MinQuantity string `json:"minQty"`
	StepSize    string `json:"stepSize"`
}

MarketLotSizeFilter define market lot size filter of symbol

type MaxNumAlgoOrdersFilter

type MaxNumAlgoOrdersFilter struct {
	Limit int64 `json:"limit"`
}

MaxNumAlgoOrdersFilter define max num algo orders filter of symbol

type MaxNumOrdersFilter

type MaxNumOrdersFilter struct {
	Limit int64 `json:"limit"`
}

MaxNumOrdersFilter define max num orders filter of symbol

type MinNotionalFilter

type MinNotionalFilter struct {
	Notional string `json:"notional"`
}

MinNotionalFilter define min notional filter of symbol

type ModifyOrderService

type ModifyOrderService struct {
	// contains filtered or unexported fields
}

ModifyOrderService create order

func (*ModifyOrderService) ActivationPrice

func (s *ModifyOrderService) ActivationPrice(activationPrice string) *ModifyOrderService

ActivationPrice set activationPrice

func (*ModifyOrderService) CallbackRate

func (s *ModifyOrderService) CallbackRate(callbackRate string) *ModifyOrderService

CallbackRate set callbackRate

func (*ModifyOrderService) ClosePosition

func (s *ModifyOrderService) ClosePosition(closePosition bool) *ModifyOrderService

ClosePosition set closePosition

func (*ModifyOrderService) Do

func (s *ModifyOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)

Do send request

func (*ModifyOrderService) NewClientOrderID

func (s *ModifyOrderService) NewClientOrderID(newClientOrderID string) *ModifyOrderService

NewClientOrderID set newClientOrderID

func (*ModifyOrderService) NewOrderResponseType

func (s *ModifyOrderService) NewOrderResponseType(newOrderResponseType NewOrderRespType) *ModifyOrderService

NewOrderResponseType set newOrderResponseType

func (*ModifyOrderService) OrderID

func (s *ModifyOrderService) OrderID(orderID int64) *ModifyOrderService

func (*ModifyOrderService) OrigClientOrderID

func (s *ModifyOrderService) OrigClientOrderID(origClientOrderID string) *ModifyOrderService

func (*ModifyOrderService) PositionSide

func (s *ModifyOrderService) PositionSide(positionSide PositionSideType) *ModifyOrderService

PositionSide set side

func (*ModifyOrderService) Price

func (s *ModifyOrderService) Price(price string) *ModifyOrderService

Price set price

func (*ModifyOrderService) PriceProtect

func (s *ModifyOrderService) PriceProtect(priceProtect bool) *ModifyOrderService

PriceProtect set priceProtect

func (*ModifyOrderService) Quantity

func (s *ModifyOrderService) Quantity(quantity string) *ModifyOrderService

Quantity set quantity

func (*ModifyOrderService) ReduceOnly

func (s *ModifyOrderService) ReduceOnly(reduceOnly bool) *ModifyOrderService

ReduceOnly set reduceOnly

func (*ModifyOrderService) Side

Side set side

func (*ModifyOrderService) StopPrice

func (s *ModifyOrderService) StopPrice(stopPrice string) *ModifyOrderService

StopPrice set stopPrice

func (*ModifyOrderService) Symbol

func (s *ModifyOrderService) Symbol(symbol string) *ModifyOrderService

Symbol set symbol

func (*ModifyOrderService) TimeInForce

func (s *ModifyOrderService) TimeInForce(timeInForce TimeInForceType) *ModifyOrderService

TimeInForce set timeInForce

func (*ModifyOrderService) Type

func (s *ModifyOrderService) Type(orderType OrderType) *ModifyOrderService

Type set type

func (*ModifyOrderService) WorkingType

func (s *ModifyOrderService) WorkingType(workingType WorkingType) *ModifyOrderService

WorkingType set workingType

type MultiAssetMode

type MultiAssetMode struct {
	MultiAssetsMargin bool `json:"multiAssetsMargin"`
}

Response of user's multi-asset mode

type NewOrderRespType

type NewOrderRespType string

NewOrderRespType define response JSON verbosity

type OpenInterest

type OpenInterest struct {
	OpenInterest string `json:"openInterest"`
	Symbol       string `json:"symbol"`
	Time         int64  `json:"time"`
}

type OpenInterestStatistic

type OpenInterestStatistic struct {
	Symbol               string `json:"symbol"`
	SumOpenInterest      string `json:"sumOpenInterest"`
	SumOpenInterestValue string `json:"sumOpenInterestValue"`
	Timestamp            int64  `json:"timestamp"`
}

type OpenInterestStatisticsService

type OpenInterestStatisticsService struct {
	// contains filtered or unexported fields
}

OpenInterestStatisticsService list open history data of a symbol.

func (*OpenInterestStatisticsService) Do

Do send request

func (*OpenInterestStatisticsService) EndTime

EndTime set endTime

func (*OpenInterestStatisticsService) Limit

Limit set limit

func (*OpenInterestStatisticsService) Period

Period set period interval

func (*OpenInterestStatisticsService) StartTime

StartTime set startTime

func (*OpenInterestStatisticsService) Symbol

Symbol set symbol

type Order

type Order struct {
	Symbol                  string           `json:"symbol"`
	OrderID                 int64            `json:"orderId"`
	ClientOrderID           string           `json:"clientOrderId"`
	Price                   string           `json:"price"`
	ReduceOnly              bool             `json:"reduceOnly"`
	OrigQuantity            string           `json:"origQty"`
	ExecutedQuantity        string           `json:"executedQty"`
	CumQuantity             string           `json:"cumQty"`
	CumQuote                string           `json:"cumQuote"`
	Status                  OrderStatusType  `json:"status"`
	TimeInForce             TimeInForceType  `json:"timeInForce"`
	Type                    OrderType        `json:"type"`
	Side                    SideType         `json:"side"`
	StopPrice               string           `json:"stopPrice"`
	Time                    int64            `json:"time"`
	UpdateTime              int64            `json:"updateTime"`
	WorkingType             WorkingType      `json:"workingType"`
	ActivatePrice           string           `json:"activatePrice"`
	PriceRate               string           `json:"priceRate"`
	AvgPrice                string           `json:"avgPrice"`
	OrigType                OrderType        `json:"origType"`
	PositionSide            PositionSideType `json:"positionSide"`
	PriceProtect            bool             `json:"priceProtect"`
	ClosePosition           bool             `json:"closePosition"`
	PriceMatch              string           `json:"priceMatch"`
	SelfTradePreventionMode string           `json:"selfTradePreventionMode"`
	GoodTillDate            int64            `json:"goodTillDate"`
}

Order define order info

type OrderExecutionType

type OrderExecutionType string

OrderExecutionType define order execution type

type OrderStatusType

type OrderStatusType string

OrderStatusType define order status type

type OrderType

type OrderType string

OrderType define order type

type PercentPriceFilter

type PercentPriceFilter struct {
	MultiplierDecimal string `json:"multiplierDecimal"`
	MultiplierUp      string `json:"multiplierUp"`
	MultiplierDown    string `json:"multiplierDown"`
}

PercentPriceFilter define percent price filter of symbol

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 PositionMarginHistory

type PositionMarginHistory struct {
	Amount       string `json:"amount"`
	Asset        string `json:"asset"`
	Symbol       string `json:"symbol"`
	Time         int64  `json:"time"`
	Type         int    `json:"type"`
	PositionSide string `json:"positionSide"`
}

PositionMarginHistory define position margin history info

type PositionMode

type PositionMode struct {
	DualSidePosition bool `json:"dualSidePosition"`
}

Response of user's position mode

type PositionRisk

type PositionRisk struct {
	EntryPrice       string `json:"entryPrice"`
	BreakEvenPrice   string `json:"breakEvenPrice"`
	MarginType       string `json:"marginType"`
	IsAutoAddMargin  string `json:"isAutoAddMargin"`
	IsolatedMargin   string `json:"isolatedMargin"`
	Leverage         string `json:"leverage"`
	LiquidationPrice string `json:"liquidationPrice"`
	MarkPrice        string `json:"markPrice"`
	MaxNotionalValue string `json:"maxNotionalValue"`
	PositionAmt      string `json:"positionAmt"`
	Symbol           string `json:"symbol"`
	UnRealizedProfit string `json:"unRealizedProfit"`
	PositionSide     string `json:"positionSide"`
	Notional         string `json:"notional"`
	IsolatedWallet   string `json:"isolatedWallet"`
}

PositionRisk define position risk info

type PositionSideType

type PositionSideType string

PositionSideType define position side type of order

type PremiumIndex

type PremiumIndex struct {
	Symbol               string `json:"symbol"`
	MarkPrice            string `json:"markPrice"`
	IndexPrice           string `json:"indexPrice"`
	EstimatedSettlePrice string `json:"estimatedSettlePrice"`
	LastFundingRate      string `json:"lastFundingRate"`
	NextFundingTime      int64  `json:"nextFundingTime"`
	InterestRate         string `json:"interestRate"`
	Time                 int64  `json:"time"`
}

PremiumIndex define premium index of mark price

type PremiumIndexKlinesService

type PremiumIndexKlinesService struct {
	// contains filtered or unexported fields
}

PremiumIndexKlinesService list klines

func (*PremiumIndexKlinesService) Do

func (piks *PremiumIndexKlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)

Do send request

func (*PremiumIndexKlinesService) EndTime

EndTime set endTime

func (*PremiumIndexKlinesService) Interval

Interval set interval

func (*PremiumIndexKlinesService) Limit

Limit set limit

func (*PremiumIndexKlinesService) StartTime

func (piks *PremiumIndexKlinesService) StartTime(startTime int64) *PremiumIndexKlinesService

StartTime set startTime

func (*PremiumIndexKlinesService) Symbol

Symbol sets symbol

type PremiumIndexService

type PremiumIndexService struct {
	// contains filtered or unexported fields
}

PremiumIndexService get premium index

func (*PremiumIndexService) Do

func (s *PremiumIndexService) Do(ctx context.Context, opts ...RequestOption) (res []*PremiumIndex, err error)

Do send request

func (*PremiumIndexService) Symbol

func (s *PremiumIndexService) Symbol(symbol string) *PremiumIndexService

Symbol set symbol

type PriceChangeStats

type PriceChangeStats struct {
	Symbol             string `json:"symbol"`
	PriceChange        string `json:"priceChange"`
	PriceChangePercent string `json:"priceChangePercent"`
	WeightedAvgPrice   string `json:"weightedAvgPrice"`
	PrevClosePrice     string `json:"prevClosePrice"`
	LastPrice          string `json:"lastPrice"`
	LastQuantity       string `json:"lastQty"`
	OpenPrice          string `json:"openPrice"`
	HighPrice          string `json:"highPrice"`
	LowPrice           string `json:"lowPrice"`
	Volume             string `json:"volume"`
	QuoteVolume        string `json:"quoteVolume"`
	OpenTime           int64  `json:"openTime"`
	CloseTime          int64  `json:"closeTime"`
	FirstID            int64  `json:"firstId"`
	LastID             int64  `json:"lastId"`
	Count              int64  `json:"count"`
}

PriceChangeStats define price change stats

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 RebateNewUser

type RebateNewUser struct {
	BrokerId      string `json:"brokerId"`
	RebateWorking bool   `json:"rebateWorking"`
	IfNewUser     bool   `json:"ifNewUser"`
}

PositionRisk define position risk info

type RecentTradesService

type RecentTradesService struct {
	// contains filtered or unexported fields
}

RecentTradesService list recent trades

func (*RecentTradesService) Do

func (s *RecentTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*Trade, err error)

Do send request

func (*RecentTradesService) Limit

func (s *RecentTradesService) Limit(limit int) *RecentTradesService

Limit set limit

func (*RecentTradesService) Symbol

func (s *RecentTradesService) Symbol(symbol string) *RecentTradesService

Symbol set symbol

type RequestOption

type RequestOption func(*request)

RequestOption define option type for request

func WithExtraForm

func WithExtraForm(m map[string]any) RequestOption

WithExtraForm add extra form data of the 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 SetServerTimeService

type SetServerTimeService struct {
	// contains filtered or unexported fields
}

SetServerTimeService set server time

func (*SetServerTimeService) Do

func (s *SetServerTimeService) Do(ctx context.Context, opts ...RequestOption) (timeOffset int64, err error)

Do send request

type SideEffectType

type SideEffectType string

SideEffectType define side effect type for orders

type SideType

type SideType string

SideType define side type of order

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 Symbol

type Symbol struct {
	Symbol                string                   `json:"symbol"`
	Pair                  string                   `json:"pair"`
	ContractType          ContractType             `json:"contractType"`
	DeliveryDate          int64                    `json:"deliveryDate"`
	OnboardDate           int64                    `json:"onboardDate"`
	Status                string                   `json:"status"`
	MaintMarginPercent    string                   `json:"maintMarginPercent"`
	RequiredMarginPercent string                   `json:"requiredMarginPercent"`
	PricePrecision        int                      `json:"pricePrecision"`
	QuantityPrecision     int                      `json:"quantityPrecision"`
	BaseAssetPrecision    int                      `json:"baseAssetPrecision"`
	QuotePrecision        int                      `json:"quotePrecision"`
	UnderlyingType        string                   `json:"underlyingType"`
	UnderlyingSubType     []string                 `json:"underlyingSubType"`
	SettlePlan            int64                    `json:"settlePlan"`
	TriggerProtect        string                   `json:"triggerProtect"`
	OrderType             []OrderType              `json:"orderType"`
	TimeInForce           []TimeInForceType        `json:"timeInForce"`
	Filters               []map[string]interface{} `json:"filters"`
	QuoteAsset            string                   `json:"quoteAsset"`
	MarginAsset           string                   `json:"marginAsset"`
	BaseAsset             string                   `json:"baseAsset"`
	LiquidationFee        string                   `json:"liquidationFee"`
	MarketTakeBound       string                   `json:"marketTakeBound"`
}

Symbol market symbol

func (*Symbol) LotSizeFilter

func (s *Symbol) LotSizeFilter() *LotSizeFilter

LotSizeFilter return lot size filter of symbol

func (*Symbol) MarketLotSizeFilter

func (s *Symbol) MarketLotSizeFilter() *MarketLotSizeFilter

MarketLotSizeFilter return market lot size filter of symbol

func (*Symbol) MaxNumAlgoOrdersFilter

func (s *Symbol) MaxNumAlgoOrdersFilter() *MaxNumAlgoOrdersFilter

MaxNumAlgoOrdersFilter return max num orders filter of symbol

func (*Symbol) MaxNumOrdersFilter

func (s *Symbol) MaxNumOrdersFilter() *MaxNumOrdersFilter

MaxNumOrdersFilter return max num orders filter of symbol

func (*Symbol) MinNotionalFilter

func (s *Symbol) MinNotionalFilter() *MinNotionalFilter

MinNotionalFilter return min notional filter of symbol

func (*Symbol) PercentPriceFilter

func (s *Symbol) PercentPriceFilter() *PercentPriceFilter

PercentPriceFilter return percent price filter of symbol

func (*Symbol) PriceFilter

func (s *Symbol) PriceFilter() *PriceFilter

PriceFilter return price filter of symbol

type SymbolFilterType

type SymbolFilterType string

SymbolFilterType define symbol filter type

type SymbolLeverage

type SymbolLeverage struct {
	Leverage         int    `json:"leverage"`
	MaxNotionalValue string `json:"maxNotionalValue"`
	Symbol           string `json:"symbol"`
}

SymbolLeverage define leverage info of symbol

type SymbolPrice

type SymbolPrice struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

SymbolPrice define symbol and price pair

type SymbolStatusType

type SymbolStatusType string

SymbolStatusType define symbol status type

type SymbolType

type SymbolType string

SymbolType define symbol type

type TakerLongShortRatio

type TakerLongShortRatio struct {
	BuySellRatio string `json:"buySellRatio"`
	BuyVol       string `json:"buyVol"`
	SellVol      string `json:"sellVol"`
	Timestamp    uint64 `json:"timestamp"`
}

type TakerLongShortRatioService

type TakerLongShortRatioService struct {
	// contains filtered or unexported fields
}

func (*TakerLongShortRatioService) Do

func (*TakerLongShortRatioService) EndTime

func (*TakerLongShortRatioService) Limit

func (*TakerLongShortRatioService) Period

func (*TakerLongShortRatioService) StartTime

func (*TakerLongShortRatioService) Symbol

type TimeInForceType

type TimeInForceType string

TimeInForceType define time in force type of order

type TopLongShortAccountRatio

type TopLongShortAccountRatio struct {
	Symbol         string `json:"symbol"`
	LongShortRatio string `json:"longShortRatio"`
	LongAccount    string `json:"longAccount"`
	ShortAccount   string `json:"shortAccount"`
	Timestamp      uint64 `json:"timestamp"`
}

type TopLongShortAccountRatioService

type TopLongShortAccountRatioService struct {
	// contains filtered or unexported fields
}

func (*TopLongShortAccountRatioService) Do

func (*TopLongShortAccountRatioService) EndTime

func (*TopLongShortAccountRatioService) Limit

func (*TopLongShortAccountRatioService) Period

func (*TopLongShortAccountRatioService) StartTime

func (*TopLongShortAccountRatioService) Symbol

type TopLongShortPositionRatio

type TopLongShortPositionRatio struct {
	Symbol         string `json:"symbol"`
	LongShortRatio string `json:"longShortRatio"`
	LongAccount    string `json:"longAccount"`
	ShortAccount   string `json:"shortAccount"`
	Timestamp      uint64 `json:"timestamp"`
}

type TopLongShortPositionRatioService

type TopLongShortPositionRatioService struct {
	// contains filtered or unexported fields
}

func (*TopLongShortPositionRatioService) Do

func (*TopLongShortPositionRatioService) EndTime

func (*TopLongShortPositionRatioService) Limit

func (*TopLongShortPositionRatioService) Period

func (*TopLongShortPositionRatioService) StartTime

func (*TopLongShortPositionRatioService) Symbol

type Trade

type Trade struct {
	ID            int64  `json:"id"`
	Price         string `json:"price"`
	Quantity      string `json:"qty"`
	QuoteQuantity string `json:"quoteQty"`
	Time          int64  `json:"time"`
	IsBuyerMaker  bool   `json:"isBuyerMaker"`
}

Trade define trade info

type TradeV3

type TradeV3 struct {
	ID              int64  `json:"id"`
	Symbol          string `json:"symbol"`
	OrderID         int64  `json:"orderId"`
	Price           string `json:"price"`
	Quantity        string `json:"qty"`
	QuoteQuantity   string `json:"quoteQty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
	Time            int64  `json:"time"`
	IsBuyer         bool   `json:"isBuyer"`
	IsMaker         bool   `json:"isMaker"`
	IsBestMatch     bool   `json:"isBestMatch"`
}

TradeV3 define v3 trade info

type UpdatePositionMarginService

type UpdatePositionMarginService struct {
	// contains filtered or unexported fields
}

UpdatePositionMarginService update isolated position margin

func (*UpdatePositionMarginService) Amount

Amount set position margin amount

func (*UpdatePositionMarginService) Do

Do send request

func (*UpdatePositionMarginService) PositionSide

Side set side

func (*UpdatePositionMarginService) Symbol

Symbol set symbol

func (*UpdatePositionMarginService) Type

Type set action type: 1: Add position margin,2: Reduce position margin

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 UserLiquidationOrder

type UserLiquidationOrder struct {
	OrderId          int64            `json:"orderId"`
	Symbol           string           `json:"symbol"`
	Status           OrderStatusType  `json:"status"`
	ClientOrderId    string           `json:"clientOrderId"`
	Price            string           `json:"price"`
	AveragePrice     string           `json:"avgPrice"`
	OrigQuantity     string           `json:"origQty"`
	ExecutedQuantity string           `json:"executedQty"`
	CumQuote         string           `json:"cumQuote"`
	TimeInForce      TimeInForceType  `json:"timeInForce"`
	Type             OrderType        `json:"type"`
	ReduceOnly       bool             `json:"reduceOnly"`
	ClosePosition    bool             `json:"closePosition"`
	Side             SideType         `json:"side"`
	PositionSide     PositionSideType `json:"positionSide"`
	StopPrice        string           `json:"stopPrice"`
	WorkingType      WorkingType      `json:"workingType"`
	OrigType         string           `json:"origType"`
	Time             int64            `json:"time"`
	UpdateTime       int64            `json:"updateTime"`
}

UserLiquidationOrder defines user's liquidation order

type WorkingType

type WorkingType string

WorkingType define working type

type WsAccountConfigUpdate

type WsAccountConfigUpdate struct {
	Symbol   string `json:"s"`
	Leverage int64  `json:"l"`
}

WsAccountConfigUpdate define account config update

type WsAccountUpdate

type WsAccountUpdate struct {
	Reason    UserDataEventReasonType `json:"m"`
	Balances  []WsBalance             `json:"B"`
	Positions []WsPosition            `json:"P"`
}

WsAccountUpdate define account update

type WsAggTradeEvent

type WsAggTradeEvent struct {
	Event            string `json:"e"`
	Time             int64  `json:"E"`
	Symbol           string `json:"s"`
	AggregateTradeID int64  `json:"a"`
	Price            string `json:"p"`
	Quantity         string `json:"q"`
	FirstTradeID     int64  `json:"f"`
	LastTradeID      int64  `json:"l"`
	TradeTime        int64  `json:"T"`
	Maker            bool   `json:"m"`
}

WsAggTradeEvent define websocket aggTrde event.

type WsAggTradeHandler

type WsAggTradeHandler func(event *WsAggTradeEvent)

WsAggTradeHandler handle websocket that push trade information that is aggregated for a single taker order.

type WsAllMarkPriceEvent

type WsAllMarkPriceEvent []*WsMarkPriceEvent

WsAllMarkPriceEvent defines an array of websocket markPriceUpdate events.

type WsAllMarkPriceHandler

type WsAllMarkPriceHandler func(event WsAllMarkPriceEvent)

WsAllMarkPriceHandler handle websocket that pushes price and funding rate for all symbol.

type WsAllMarketTickerEvent

type WsAllMarketTickerEvent []*WsMarketTickerEvent

WsAllMarketTickerEvent define an array of websocket mini ticker events.

type WsAllMarketTickerHandler

type WsAllMarketTickerHandler func(event WsAllMarketTickerEvent)

WsAllMarketTickerHandler handle websocket that pushes price and funding rate for all markets.

type WsAllMiniMarketTickerEvent

type WsAllMiniMarketTickerEvent []*WsMiniMarketTickerEvent

WsAllMiniMarketTickerEvent define an array of websocket mini market ticker events.

type WsAllMiniMarketTickerHandler

type WsAllMiniMarketTickerHandler func(event WsAllMiniMarketTickerEvent)

WsAllMiniMarketTickerHandler handle websocket that pushes price and funding rate for all markets.

type WsBLVTBasket

type WsBLVTBasket struct {
	Symbol   string `json:"s"`
	Position int64  `json:"n"`
}

WsBLVTBasket define websocket BLVT basket

type WsBLVTInfoEvent

type WsBLVTInfoEvent struct {
	Event          string         `json:"e"`
	Time           int64          `json:"E"`
	Symbol         string         `json:"s"`
	Issued         float64        `json:"m"`
	Baskets        []WsBLVTBasket `json:"b"`
	Nav            float64        `json:"n"`
	Leverage       float64        `json:"l"`
	TargetLeverage int64          `json:"t"`
	FundingRate    float64        `json:"f"`
}

WsBLVTInfoEvent define websocket BLVT info event

type WsBLVTInfoHandler

type WsBLVTInfoHandler func(event *WsBLVTInfoEvent)

WsBLVTInfoHandler handle websocket BLVT event

type WsBLVTKline

type WsBLVTKline struct {
	StartTime       int64  `json:"t"`
	CloseTime       int64  `json:"T"`
	Symbol          string `json:"s"`
	Interval        string `json:"i"`
	FirstUpdateTime int64  `json:"f"`
	LastUpdateTime  int64  `json:"L"`
	OpenPrice       string `json:"o"`
	ClosePrice      string `json:"c"`
	HighPrice       string `json:"h"`
	LowPrice        string `json:"l"`
	Leverage        string `json:"v"`
	Count           int64  `json:"n"`
}

WsBLVTKline BLVT kline

type WsBLVTKlineEvent

type WsBLVTKlineEvent struct {
	Event  string      `json:"e"`
	Time   int64       `json:"E"`
	Symbol string      `json:"s"`
	Kline  WsBLVTKline `json:"k"`
}

WsBLVTKlineEvent define BLVT kline event

type WsBLVTKlineHandler

type WsBLVTKlineHandler func(event *WsBLVTKlineEvent)

WsBLVTKlineHandler BLVT kline handler

type WsBalance

type WsBalance struct {
	Asset              string `json:"a"`
	Balance            string `json:"wb"`
	CrossWalletBalance string `json:"cw"`
	ChangeBalance      string `json:"bc"`
}

WsBalance define balance

type WsBookTickerEvent

type WsBookTickerEvent struct {
	Event           string `json:"e"`
	UpdateID        int64  `json:"u"`
	Time            int64  `json:"E"`
	TransactionTime int64  `json:"T"`
	Symbol          string `json:"s"`
	BestBidPrice    string `json:"b"`
	BestBidQty      string `json:"B"`
	BestAskPrice    string `json:"a"`
	BestAskQty      string `json:"A"`
}

WsBookTickerEvent define websocket best book ticker event.

type WsBookTickerHandler

type WsBookTickerHandler func(event *WsBookTickerEvent)

WsBookTickerHandler handle websocket that pushes updates to the best bid or ask price or quantity in real-time for a specified symbol.

type WsCompositeIndexEvent

type WsCompositeIndexEvent struct {
	Event       string          `json:"e"`
	Time        int64           `json:"E"`
	Symbol      string          `json:"s"`
	Price       string          `json:"p"`
	Composition []WsComposition `json:"c"`
}

WsCompositeIndexEvent websocket composite index event

type WsCompositeIndexHandler

type WsCompositeIndexHandler func(event *WsCompositeIndexEvent)

WsCompositeIndexHandler websocket composite index handler

type WsComposition

type WsComposition struct {
	BaseAsset    string `json:"b"`
	WeightQty    string `json:"w"`
	WeighPercent string `json:"W"`
}

WsComposition websocket composite index event composition

type WsConfig

type WsConfig struct {
	Endpoint string
	Proxy    *string
}

WsConfig webservice configuration

type WsContinuousKline

type WsContinuousKline struct {
	StartTime            int64  `json:"t"`
	EndTime              int64  `json:"T"`
	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"`
}

WsContinuousKline define websocket continuous kline

type WsContinuousKlineEvent

type WsContinuousKlineEvent struct {
	Event        string            `json:"e"`
	Time         int64             `json:"E"`
	PairSymbol   string            `json:"ps"`
	ContractType string            `json:"ct"`
	Kline        WsContinuousKline `json:"k"`
}

WsContinuousKlineEvent define websocket continuous kline event

type WsContinuousKlineHandler

type WsContinuousKlineHandler func(event *WsContinuousKlineEvent)

WsContinuousKlineHandler handle websocket continuous kline event

type WsContinuousKlineSubscribeArgs

type WsContinuousKlineSubscribeArgs struct {
	Pair         string
	ContractType string
	Interval     string
}

WsContinuousKlineSubscribeArgs used with WsContinuousKlineServe or WsCombinedContinuousKlineServe

type WsDepthEvent

type WsDepthEvent struct {
	Event            string `json:"e"`
	Time             int64  `json:"E"`
	TransactionTime  int64  `json:"T"`
	Symbol           string `json:"s"`
	FirstUpdateID    int64  `json:"U"`
	LastUpdateID     int64  `json:"u"`
	PrevLastUpdateID int64  `json:"pu"`
	Bids             []Bid  `json:"b"`
	Asks             []Ask  `json:"a"`
}

WsDepthEvent define websocket depth book event

type WsDepthHandler

type WsDepthHandler func(event *WsDepthEvent)

WsDepthHandler handle websocket depth event

type WsHandler

type WsHandler func(message []byte)

WsHandler handle raw websocket message

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 WsLiquidationOrder

type WsLiquidationOrder struct {
	Symbol               string          `json:"s"`
	Side                 SideType        `json:"S"`
	OrderType            OrderType       `json:"o"`
	TimeInForce          TimeInForceType `json:"f"`
	OrigQuantity         string          `json:"q"`
	Price                string          `json:"p"`
	AvgPrice             string          `json:"ap"`
	OrderStatus          OrderStatusType `json:"X"`
	LastFilledQty        string          `json:"l"`
	AccumulatedFilledQty string          `json:"z"`
	TradeTime            int64           `json:"T"`
}

WsLiquidationOrder define websocket liquidation order.

type WsLiquidationOrderEvent

type WsLiquidationOrderEvent struct {
	Event            string             `json:"e"`
	Time             int64              `json:"E"`
	LiquidationOrder WsLiquidationOrder `json:"o"`
}

WsLiquidationOrderEvent define websocket liquidation order event.

type WsLiquidationOrderHandler

type WsLiquidationOrderHandler func(event *WsLiquidationOrderEvent)

WsLiquidationOrderHandler handle websocket that pushes force liquidation order information for specific symbol.

type WsMarkPriceEvent

type WsMarkPriceEvent struct {
	Event                string `json:"e"`
	Time                 int64  `json:"E"`
	Symbol               string `json:"s"`
	MarkPrice            string `json:"p"`
	IndexPrice           string `json:"i"`
	EstimatedSettlePrice string `json:"P"`
	FundingRate          string `json:"r"`
	NextFundingTime      int64  `json:"T"`
}

WsMarkPriceEvent define websocket markPriceUpdate event.

type WsMarkPriceHandler

type WsMarkPriceHandler func(event *WsMarkPriceEvent)

WsMarkPriceHandler handle websocket that pushes price and funding rate for a single symbol.

type WsMarketTickerEvent

type WsMarketTickerEvent struct {
	Event              string `json:"e"`
	Time               int64  `json:"E"`
	Symbol             string `json:"s"`
	PriceChange        string `json:"p"`
	PriceChangePercent string `json:"P"`
	WeightedAvgPrice   string `json:"w"`
	ClosePrice         string `json:"c"`
	CloseQty           string `json:"Q"`
	OpenPrice          string `json:"o"`
	HighPrice          string `json:"h"`
	LowPrice           string `json:"l"`
	BaseVolume         string `json:"v"`
	QuoteVolume        string `json:"q"`
	OpenTime           int64  `json:"O"`
	CloseTime          int64  `json:"C"`
	FirstID            int64  `json:"F"`
	LastID             int64  `json:"L"`
	TradeCount         int64  `json:"n"`
}

WsMarketTickerEvent define websocket market ticker event.

type WsMarketTickerHandler

type WsMarketTickerHandler func(event *WsMarketTickerEvent)

WsMarketTickerHandler handle websocket that pushes 24hr rolling window mini-ticker statistics for a single symbol.

type WsMiniMarketTickerEvent

type WsMiniMarketTickerEvent struct {
	Event       string `json:"e"`
	Time        int64  `json:"E"`
	Symbol      string `json:"s"`
	ClosePrice  string `json:"c"`
	OpenPrice   string `json:"o"`
	HighPrice   string `json:"h"`
	LowPrice    string `json:"l"`
	Volume      string `json:"v"`
	QuoteVolume string `json:"q"`
}

WsMiniMarketTickerEvent define websocket mini market ticker event.

type WsMiniMarketTickerHandler

type WsMiniMarketTickerHandler func(event *WsMiniMarketTickerEvent)

WsMiniMarketTickerHandler handle websocket that pushes 24hr rolling window mini-ticker statistics for a single symbol.

type WsOrderTradeUpdate

type WsOrderTradeUpdate struct {
	Symbol               string             `json:"s"`   // Symbol
	ClientOrderID        string             `json:"c"`   // Client order ID
	Side                 SideType           `json:"S"`   // Side
	Type                 OrderType          `json:"o"`   // Order type
	TimeInForce          TimeInForceType    `json:"f"`   // Time in force
	OriginalQty          string             `json:"q"`   // Original quantity
	OriginalPrice        string             `json:"p"`   // Original price
	AveragePrice         string             `json:"ap"`  // Average price
	StopPrice            string             `json:"sp"`  // Stop price. Please ignore with TRAILING_STOP_MARKET order
	ExecutionType        OrderExecutionType `json:"x"`   // Execution type
	Status               OrderStatusType    `json:"X"`   // Order status
	ID                   int64              `json:"i"`   // Order ID
	LastFilledQty        string             `json:"l"`   // Order Last Filled Quantity
	AccumulatedFilledQty string             `json:"z"`   // Order Filled Accumulated Quantity
	LastFilledPrice      string             `json:"L"`   // Last Filled Price
	CommissionAsset      string             `json:"N"`   // Commission Asset, will not push if no commission
	Commission           string             `json:"n"`   // Commission, will not push if no commission
	TradeTime            int64              `json:"T"`   // Order Trade Time
	TradeID              int64              `json:"t"`   // Trade ID
	BidsNotional         string             `json:"b"`   // Bids Notional
	AsksNotional         string             `json:"a"`   // Asks Notional
	IsMaker              bool               `json:"m"`   // Is this trade the maker side?
	IsReduceOnly         bool               `json:"R"`   // Is this reduce only
	WorkingType          WorkingType        `json:"wt"`  // Stop Price Working Type
	OriginalType         OrderType          `json:"ot"`  // Original Order Type
	PositionSide         PositionSideType   `json:"ps"`  // Position Side
	IsClosingPosition    bool               `json:"cp"`  // If Close-All, pushed with conditional order
	ActivationPrice      string             `json:"AP"`  // Activation Price, only puhed with TRAILING_STOP_MARKET order
	CallbackRate         string             `json:"cr"`  // Callback Rate, only puhed with TRAILING_STOP_MARKET order
	PriceProtect         bool               `json:"pP"`  // If price protection is turned on
	RealizedPnL          string             `json:"rp"`  // Realized Profit of the trade
	STP                  string             `json:"V"`   // STP mode
	PriceMode            string             `json:"pm"`  // Price match mode
	GTD                  int64              `json:"gtd"` // TIF GTD order auto cancel time
}

WsOrderTradeUpdate define order trade update

type WsPosition

type WsPosition struct {
	Symbol                    string           `json:"s"`
	Side                      PositionSideType `json:"ps"`
	Amount                    string           `json:"pa"`
	MarginType                MarginType       `json:"mt"`
	IsolatedWallet            string           `json:"iw"`
	EntryPrice                string           `json:"ep"`
	MarkPrice                 string           `json:"mp"`
	UnrealizedPnL             string           `json:"up"`
	AccumulatedRealized       string           `json:"cr"`
	MaintenanceMarginRequired string           `json:"mm"`
}

WsPosition define position

type WsUserDataEvent

type WsUserDataEvent struct {
	Event               UserDataEventType     `json:"e"`
	Time                int64                 `json:"E"`
	CrossWalletBalance  string                `json:"cw"`
	MarginCallPositions []WsPosition          `json:"p"`
	TransactionTime     int64                 `json:"T"`
	AccountUpdate       WsAccountUpdate       `json:"a"`
	OrderTradeUpdate    WsOrderTradeUpdate    `json:"o"`
	AccountConfigUpdate WsAccountConfigUpdate `json:"ac"`
}

WsUserDataEvent define user data event

func (*WsUserDataEvent) UnmarshalJSON

func (e *WsUserDataEvent) UnmarshalJSON(data []byte) error

type WsUserDataHandler

type WsUserDataHandler func(event *WsUserDataEvent)

WsUserDataHandler handle WsUserDataEvent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL