portfolio

package
v0.1.47 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 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"
	OrderTypeLiquidation OrderType = "LIQUIDATION"

	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"

	SelfTradePreventionModeNONE SelfTradePreventionMode = "NONE"
	SelfTradePreventionModeET   SelfTradePreventionMode = "EXPIRE_TAKER"
	SelfTradePreventionModeEM   SelfTradePreventionMode = "EXPIRE_MAKER"
	SelfTradePreventionModeEB   SelfTradePreventionMode = "EXPIRE_BOTH"

	OrderExecutionTypeNew        OrderExecutionType = "NEW"
	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"
	OrderStatusTypeExpired         OrderStatusType = "EXPIRED"

	UmBusinessUnit BusinessUnit = "UM"
	CmBusinessUnit BusinessUnit = "CM"

	UserDataEventTypeListenKeyExpired UserDataEventType = "listenKeyExpired"
	UserDataEventTypeAccountUpdate    UserDataEventType = "ACCOUNT_UPDATE"
	UserDataEventTypeOrderTradeUpdate UserDataEventType = "ORDER_TRADE_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"

	SymbolTypeMargin  SymbolType = "MARGIN"
	SymbolTypeFutures SymbolType = "FUTURES"

	SideEffectTypeNoSideEffect SideEffectType = "NO_SIDE_EFFECT"
	SideEffectTypeMarginBuy    SideEffectType = "MARGIN_BUY"
	SideEffectTypeAutoRepay    SideEffectType = "AUTO_REPAY"

	BNBTransferSideToUM   BNBTransferSide = "TO_UM"
	BNBTransferSideFromUM BNBTransferSide = "FROM_UM"
)

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
)

Functions

func UmWsPackedUserDataServe added in v0.1.12

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

func UmWsPackedUserDataServeWithIP added in v0.1.12

func UmWsPackedUserDataServeWithIP(ip string, listenKey string, handler WsPackedUserDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

func WsUserDataServe added in v0.1.19

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

func WsUserDataServeWithIP added in v0.1.19

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

Types

type AccountInfo added in v0.1.44

type AccountInfo struct {
	UniMMR                   string `json:"uniMMR"`
	AccountEquity            string `json:"accountEquity"`
	ActualEquity             string `json:"actualEquity"`
	AccountInitialMargin     string `json:"accountInitialMargin"`
	AccountMaintMargin       string `json:"accountMaintMargin"`
	AccountStatus            string `json:"accountStatus"`
	VirtualMaxWithdrawAmount string `json:"virtualMaxWithdrawAmount"`
	TotalAvailableBalance    string `json:"totalAvailableBalance"`
	TotalMarginOpenLoss      string `json:"totalMarginOpenLoss"`
	UpdateTime               int64  `json:"updateTime"`
}

type AssetCollectionResponse added in v0.1.47

type AssetCollectionResponse struct {
	Message string `json:"msg"`
}

type AssetCollectionService added in v0.1.47

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

func (*AssetCollectionService) Asset added in v0.1.47

func (*AssetCollectionService) Do added in v0.1.47

Do send request

type BNBTransfer added in v0.1.46

type BNBTransfer struct {
	TransferId int64 `json:"tranId"`
}

type BNBTransferService added in v0.1.46

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

func (*BNBTransferService) Amount added in v0.1.46

func (c *BNBTransferService) Amount(amount float64) *BNBTransferService

func (*BNBTransferService) Do added in v0.1.46

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

Do send request

func (*BNBTransferService) TransferSide added in v0.1.46

func (c *BNBTransferService) TransferSide(side BNBTransferSide) *BNBTransferService

type BNBTransferSide added in v0.1.46

type BNBTransferSide string

type Balance added in v0.1.35

type Balance struct {
	Asset               string `json:"asset"`
	TotalWalletBalance  string `json:"totalWalletBalance"`
	CrossMarginAsset    string `json:"crossMarginAsset"`
	CrossMarginBorrowed string `json:"crossMarginBorrowed"`
	CrossMarginFree     string `json:"crossMarginFree"`
	CrossMarginInterest string `json:"crossMarginInterest"`
	CrossMarginLocked   string `json:"crossMarginLocked"`
	UmWalletBalance     string `json:"umWalletBalance"`
	UmUnrealizedPNL     string `json:"umUnrealizedPNL"`
	CmWalletBalance     string `json:"cmWalletBalance"`
	CmUnrealizedPNL     string `json:"cmUnrealizedPNL"`
	UpdateTime          int64  `json:"updateTime"`
	NegativeBalance     string `json:"negativeBalance"`
}

type BusinessUnit added in v0.1.6

type BusinessUnit string

BusinessUnit define business unit

type ChangeRepayFuturesResponse added in v0.1.47

type ChangeRepayFuturesResponse struct {
	Message string `json:"msg"`
}

type ChangeRepayFuturesSwitchService added in v0.1.47

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

func (*ChangeRepayFuturesSwitchService) AutoRepay added in v0.1.47

func (*ChangeRepayFuturesSwitchService) Do added in v0.1.47

Do send request

type Client

type Client struct {
	APIKey     string
	SecretKey  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 NewClientWithIP

func NewClientWithIP(apiKey, secretKey, ip string) *Client

NewClientWithIP initialize an API client instance with API key, secret key and local IP.

func NewProxiedClient

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

NewProxiedClient passing a proxy url

func (*Client) NewAssetCollectionService added in v0.1.47

func (c *Client) NewAssetCollectionService() *AssetCollectionService

func (*Client) NewBNBTransferService added in v0.1.46

func (c *Client) NewBNBTransferService() *BNBTransferService

func (*Client) NewChangeRepayFuturesSwitchService added in v0.1.47

func (c *Client) NewChangeRepayFuturesSwitchService() *ChangeRepayFuturesSwitchService

func (*Client) NewCloseUserStreamService

func (c *Client) NewCloseUserStreamService() *CloseUserStreamService

NewCloseUserStreamService init closing user stream service

func (*Client) NewCmCancelAllOpenOrdersService added in v0.1.19

func (c *Client) NewCmCancelAllOpenOrdersService() *CmCancelAllOpenOrdersService

NewCmCancelAllOpenOrdersService init cancel all um open orders service

func (*Client) NewCmCancelOrderService added in v0.1.19

func (c *Client) NewCmCancelOrderService() *CmCancelOrderService

NewCmCancelOrderService init cancel all um open orders service

func (*Client) NewCmChangePositionModeService added in v0.1.35

func (c *Client) NewCmChangePositionModeService() *CmChangePositionModeService

NewCmChangePositionModeService init cm position side dual service

func (*Client) NewCmCommissionRateService

func (c *Client) NewCmCommissionRateService() *CmCommissionRateService

NewCmCommissionRateService init cm commission rate service

func (*Client) NewCmCreateOrderService added in v0.1.19

func (c *Client) NewCmCreateOrderService() *CmCreateOrderService

NewCmCreateOrderService init cancel all um open orders service

func (*Client) NewCmGetAccountService added in v0.1.19

func (c *Client) NewCmGetAccountService() *CmGetAccountService

NewCmGetAccountService init getting account service

func (*Client) NewCmGetPositionModeService added in v0.1.35

func (c *Client) NewCmGetPositionModeService() *CmGetPositionModeService

NewCmGetPositionModeService init cm position side dual service

func (*Client) NewCmListOpenOrdersService added in v0.1.19

func (c *Client) NewCmListOpenOrdersService() *CmListOpenOrdersService

NewCmListOpenOrdersService init list open orders service

func (*Client) NewCmSetLeverageService

func (c *Client) NewCmSetLeverageService() *CmSetLeverageService

NewCmSetLeverageService init cm set leverage service

func (*Client) NewGetAccountService added in v0.1.44

func (c *Client) NewGetAccountService() *GetAccountService

func (*Client) NewGetAllBalanceService added in v0.1.35

func (c *Client) NewGetAllBalanceService() *GetAllBalanceService

NewGetAllBalanceService init get balances service

func (*Client) NewGetMaxBorrowableService added in v0.1.35

func (c *Client) NewGetMaxBorrowableService() *GetMaxBorrowableService

func (*Client) NewGetRepayFuturesSwitchService added in v0.1.47

func (c *Client) NewGetRepayFuturesSwitchService() *GetRepayFuturesSwitchService

func (*Client) NewKeepaliveUserStreamService

func (c *Client) NewKeepaliveUserStreamService() *KeepaliveUserStreamService

NewKeepaliveUserStreamService init keep alive user stream service

func (*Client) NewMarginCancelOrderService added in v0.1.42

func (c *Client) NewMarginCancelOrderService() *MarginCancelOrderService

func (*Client) NewMarginCreateOrderService added in v0.1.42

func (c *Client) NewMarginCreateOrderService() *MarginCreateOrderService

func (*Client) NewMarginLoanService added in v0.1.42

func (c *Client) NewMarginLoanService() *MarginLoanService

func (*Client) NewMarginRepayService added in v0.1.42

func (c *Client) NewMarginRepayService() *MarginRepayService

func (*Client) NewStartUserStreamService

func (c *Client) NewStartUserStreamService() *StartUserStreamService

NewStartUserStreamService init starting user stream service

func (*Client) NewUmCancelAllOpenOrdersService

func (c *Client) NewUmCancelAllOpenOrdersService() *UmCancelAllOpenOrdersService

NewUmCancelAllOpenOrdersService init cancel all um open orders service

func (*Client) NewUmCancelOrderService

func (c *Client) NewUmCancelOrderService() *UmCancelOrderService

NewUmCancelAllOpenOrdersService init cancel all um open orders service

func (*Client) NewUmChangePositionModeService added in v0.1.35

func (c *Client) NewUmChangePositionModeService() *UmChangePositionModeService

NewUmChangePositionModeService init um position side dual service

func (*Client) NewUmCommissionRateService

func (c *Client) NewUmCommissionRateService() *UmCommissionRateService

#### um NewUmCommissionRateService init um commission rate service

func (*Client) NewUmCreateOrderService

func (c *Client) NewUmCreateOrderService() *UmCreateOrderService

NewUmCreateOrderService init cancel all um open orders service

func (*Client) NewUmGetAccountService

func (c *Client) NewUmGetAccountService() *UmGetAccountService

NewUmGetAccountService init getting account service

func (*Client) NewUmGetPositionModeService added in v0.1.35

func (c *Client) NewUmGetPositionModeService() *UmGetPositionModeService

NewUmGetPositionModeService init um position side dual service

func (*Client) NewUmListOpenOrdersService

func (c *Client) NewUmListOpenOrdersService() *UmListOpenOrdersService

NewListOpenOrdersService init list open orders service

func (*Client) NewUmSetLeverageService

func (c *Client) NewUmSetLeverageService() *UmSetLeverageService

NewUmSetLeverageService init um set leverage service

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 CmAccount added in v0.1.18

type CmAccount struct {
	Assets    []*UmAccountAsset    `json:"assets"`
	Positions []*UmAccountPosition `json:"positions"`
}

CmAccount define account info

type CmAccountAsset added in v0.1.18

type CmAccountAsset struct {
	Asset                  string `json:"asset"`
	CrossWalletBalance     string `json:"crossWalletBalance"`
	CrossUnPnl             string `json:"crossUnPnl"`
	MaintMargin            string `json:"maintMargin"`
	InitialMargin          string `json:"initialMargin"`
	PositionInitialMargin  string `json:"positionInitialMargin"`
	OpenOrderInitialMargin string `json:"openOrderInitialMargin"`
	UpdateTime             int64  `json:"updateTime"`
}

CmAccountAsset define account asset

type CmAccountPosition added in v0.1.18

type CmAccountPosition struct {
	Symbol                 string           `json:"symbol"`
	PositionAmt            string           `json:"positionAmt"`
	InitialMargin          string           `json:"initialMargin"`
	MaintMargin            string           `json:"maintMargin"`
	UnrealizedProfit       string           `json:"unrealizedProfit"`
	PositionInitialMargin  string           `json:"positionInitialMargin"`
	OpenOrderInitialMargin string           `json:"openOrderInitialMargin"`
	Leverage               string           `json:"leverage"`
	PositionSide           PositionSideType `json:"positionSide"`
	EntryPrice             string           `json:"entryPrice"`
	MaxQuantity            string           `json:"maxQty"`
	UpdateTime             int64            `json:"updateTime"`
	BreakEvenPrice         string           `json:"breakEvenPrice"`
}

CmAccountPosition define account position

type CmCancelAllOpenOrdersService added in v0.1.18

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

CmCancelAllOpenOrdersService cancel all open orders

func (*CmCancelAllOpenOrdersService) Do added in v0.1.18

Do send request

func (*CmCancelAllOpenOrdersService) Symbol added in v0.1.18

Symbol set symbol

type CmCancelOrderResponse added in v0.1.18

type CmCancelOrderResponse struct {
	AvgPrice      string `json:"avgPrice"`
	ClientOrderID string `json:"clientOrderId"`
	CumQuantity   string `json:"cumQty"`

	ExecutedQuantity string           `json:"executedQty"`
	OrderID          int64            `json:"orderId"`
	OrigQuantity     string           `json:"origQty"`
	Price            string           `json:"price"`
	ReduceOnly       bool             `json:"reduceOnly"`
	Side             SideType         `json:"side"`
	PositionSide     PositionSideType `json:"positionSide"`
	Status           OrderStatusType  `json:"status"`
	Symbol           string           `json:"symbol"`
	Pair             string           `json:"pair"`
	TimeInForce      TimeInForceType  `json:"timeInForce"`
	Type             OrderType        `json:"type"`
	UpdateTime       int64            `json:"updateTime"`
	// contains filtered or unexported fields
}

CmCancelOrderResponse define response of canceling order

type CmCancelOrderService added in v0.1.18

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

CmCancelOrderService cancel all open orders

func (*CmCancelOrderService) ClientOrderID added in v0.1.18

func (s *CmCancelOrderService) ClientOrderID(clientOrderID string) *CmCancelOrderService

ClientOrderID set clientOrderID

func (*CmCancelOrderService) Do added in v0.1.18

func (*CmCancelOrderService) OrderID added in v0.1.18

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

OrderID set orderID

func (*CmCancelOrderService) Symbol added in v0.1.18

Symbol set symbol

type CmChangePositionMode added in v0.1.35

type CmChangePositionMode struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type CmChangePositionModeService added in v0.1.35

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

func (*CmChangePositionModeService) Do added in v0.1.35

Do send request

func (*CmChangePositionModeService) DualSidePosition added in v0.1.35

func (s *CmChangePositionModeService) DualSidePosition(dualSidePosition bool) *CmChangePositionModeService

DualSidePosition set positionSide

type CmCommissionRateResponse

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

type CmCommissionRateService

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

func (*CmCommissionRateService) Do

Do send request

func (*CmCommissionRateService) Symbol

Symbol set symbol

type CmCreateOrderResponse added in v0.1.18

type CmCreateOrderResponse struct {
	ClientOrderID     string           `json:"clientOrderId"` //
	CumQty            string           `json:"cumQty"`        //
	CumBase           string           `json:"cumBase"`       //
	ExecutedQuantity  string           `json:"executedQty"`   //
	OrderID           int64            `json:"orderId"`       //
	AvgPrice          string           `json:"avgPrice"`      //
	OrigQuantity      string           `json:"origQty"`       //
	Price             string           `json:"price"`         //
	ReduceOnly        bool             `json:"reduceOnly"`    //
	Side              SideType         `json:"side"`          //
	PositionSide      PositionSideType `json:"positionSide"`  //
	Status            OrderStatusType  `json:"status"`        //
	Symbol            string           `json:"symbol"`        //
	Pair              string           `json:"pair"`
	TimeInForce       TimeInForceType  `json:"timeInForce"`                 //
	Type              OrderType        `json:"type"`                        //
	UpdateTime        int64            `json:"updateTime"`                  // update time
	RateLimitOrder10s string           `json:"rateLimitOrder10s,omitempty"` //
	RateLimitOrder1m  string           `json:"rateLimitOrder1m,omitempty"`  //
}

CmCreateOrderResponse define create order response

type CmCreateOrderService added in v0.1.18

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

CmCreateOrderService create order

func (*CmCreateOrderService) Do added in v0.1.18

Do send request

func (*CmCreateOrderService) NewClientOrderID added in v0.1.18

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

NewClientOrderID set newClientOrderID

func (*CmCreateOrderService) NewOrderResponseType added in v0.1.18

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

NewOrderResponseType set newOrderResponseType

func (*CmCreateOrderService) PositionSide added in v0.1.18

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

PositionSide set side

func (*CmCreateOrderService) Price added in v0.1.18

Price set price

func (*CmCreateOrderService) Quantity added in v0.1.18

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

Quantity set quantity

func (*CmCreateOrderService) ReduceOnly added in v0.1.18

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

ReduceOnly set reduceOnly

func (*CmCreateOrderService) Side added in v0.1.18

Side set side

func (*CmCreateOrderService) Symbol added in v0.1.18

Symbol set symbol

func (*CmCreateOrderService) TimeInForce added in v0.1.18

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

TimeInForce set timeInForce

func (*CmCreateOrderService) Type added in v0.1.18

Type set type

type CmGetAccountService added in v0.1.18

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

CmGetAccountService get account info

func (*CmGetAccountService) Do added in v0.1.18

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

Do send request

type CmGetPositionMode added in v0.1.35

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

type CmGetPositionModeService added in v0.1.35

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

func (*CmGetPositionModeService) Do added in v0.1.35

Do send request

type CmListOpenOrdersService added in v0.1.18

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

CmListOpenOrdersService list opened orders

func (*CmListOpenOrdersService) Do added in v0.1.18

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

Do send request

func (*CmListOpenOrdersService) Symbol added in v0.1.18

Symbol set symbol

type CmOrder added in v0.1.18

type CmOrder struct {
	AvgPrice         string           `json:"avgPrice"`
	ClientOrderID    string           `json:"clientOrderId"`
	CumQuote         string           `json:"cumQuote"`
	ExecutedQuantity string           `json:"executedQty"`
	OrderID          int64            `json:"orderId"`
	OrigQuantity     string           `json:"origQty"`
	OrigType         OrderType        `json:"origType"`
	Price            string           `json:"price"`
	ReduceOnly       bool             `json:"reduceOnly"`
	Side             SideType         `json:"side"`
	PositionSide     PositionSideType `json:"positionSide"`
	Status           OrderStatusType  `json:"status"`
	Symbol           string           `json:"symbol"`
	Pair             string           `json:"pair"`
	Time             int64            `json:"time"`
	TimeInForce      TimeInForceType  `json:"timeInForce"`
	Type             OrderType        `json:"type"`
	UpdateTime       int64            `json:"updateTime"`
}

CmOrder define order info

type CmSetLeverageResponse

type CmSetLeverageResponse struct {
	Symbol   string `json:"symbol"`
	Leverage int    `json:"leverage"`
	MaxQty   string `json:"maxQty"`
}

type CmSetLeverageService

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

func (*CmSetLeverageService) Do

Do send request

func (*CmSetLeverageService) Leverage

func (s *CmSetLeverageService) Leverage(leverage int64) *CmSetLeverageService

Leverage set leverage

func (*CmSetLeverageService) Symbol

Symbol set symbol

type ErrHandler

type ErrHandler func(err error)

ErrHandler handles errors

type GetAccountService added in v0.1.44

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

func (*GetAccountService) Do added in v0.1.44

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

Do send request

type GetAllBalanceService added in v0.1.35

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

func (*GetAllBalanceService) Do added in v0.1.35

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

Do send request

type GetMaxBorrowableService added in v0.1.35

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

func (*GetMaxBorrowableService) Asset added in v0.1.35

func (*GetMaxBorrowableService) Do added in v0.1.35

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

Do send request

type GetRepayFuturesResponse added in v0.1.47

type GetRepayFuturesResponse struct {
	AutoRepay bool `json:"autoRepay"`
}

type GetRepayFuturesSwitchService added in v0.1.47

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

func (*GetRepayFuturesSwitchService) Do added in v0.1.47

Do send request

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 MarginCancelOrderResponse added in v0.1.42

type MarginCancelOrderResponse struct {
	Symbol                  string                  `json:"symbol"`
	OrderID                 int64                   `json:"orderId"`
	OrigClientOrderId       string                  `json:"origClientOrderId"`
	ClientOrderID           string                  `json:"clientOrderId"`
	OrigQuantity            string                  `json:"origQty"`
	Price                   string                  `json:"price"`
	ExecutedQuantity        string                  `json:"executedQty"`
	CummulativeQuoteQty     string                  `json:"cummulativeQuoteQty"`
	Status                  OrderStatusType         `json:"status"`
	TimeInForce             TimeInForceType         `json:"timeInForce"`
	Type                    OrderType               `json:"type"`
	Side                    SideType                `json:"side"`
	SelfTradePreventionMode SelfTradePreventionMode `json:"selfTradePreventionMode"`
}

type MarginCancelOrderService added in v0.1.42

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

MarginCancelOrderService cancel order

func (*MarginCancelOrderService) Do added in v0.1.42

func (*MarginCancelOrderService) OrderID added in v0.1.42

func (*MarginCancelOrderService) OrigClientOrderID added in v0.1.42

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

func (*MarginCancelOrderService) Symbol added in v0.1.42

type MarginCreateOrderResponse added in v0.1.42

type MarginCreateOrderResponse struct {
	Symbol                  string                  `json:"symbol"`        //
	OrderID                 int64                   `json:"orderId"`       //
	ClientOrderID           string                  `json:"clientOrderId"` //
	TransactTime            int64                   `json:"transactTime"`
	Price                   string                  `json:"price"`                           //
	SelfTradePreventionMode SelfTradePreventionMode `json:"selfTradePreventionMode"`         // self trading preventation mode
	OrigQuantity            string                  `json:"origQty"`                         //
	ExecutedQuantity        string                  `json:"executedQty"`                     //
	CummulativeQuoteQty     string                  `json:"cummulativeQuoteQty"`             //
	Status                  OrderStatusType         `json:"status"`                          //
	TimeInForce             TimeInForceType         `json:"timeInForce"`                     //
	Type                    OrderType               `json:"type"`                            //
	Side                    SideType                `json:"side"`                            //
	MarginBuyBorrowAsset    string                  `json:"marginBuyBorrowAsset,omitempty"`  //
	MarginBuyBorrowAmount   string                  `json:"marginBuyBorrowAmount,omitempty"` //
	RateLimitOrder10s       string                  `json:"rateLimitOrder10s,omitempty"`     //
	RateLimitOrder1m        string                  `json:"rateLimitOrder1m,omitempty"`      //
}

type MarginCreateOrderService added in v0.1.42

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

MarginCreateOrderService create order

func (*MarginCreateOrderService) Do added in v0.1.42

Do send request

func (*MarginCreateOrderService) NewClientOrderID added in v0.1.42

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

func (*MarginCreateOrderService) NewOrderRespType added in v0.1.42

func (s *MarginCreateOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *MarginCreateOrderService

func (*MarginCreateOrderService) OrderType added in v0.1.42

func (*MarginCreateOrderService) Price added in v0.1.42

func (*MarginCreateOrderService) Quantity added in v0.1.42

func (*MarginCreateOrderService) SelfTradePreventionMode added in v0.1.42

func (s *MarginCreateOrderService) SelfTradePreventionMode(selfTradePreventionMode SelfTradePreventionMode) *MarginCreateOrderService

func (*MarginCreateOrderService) Side added in v0.1.42

func (*MarginCreateOrderService) SideEffectType added in v0.1.42

func (s *MarginCreateOrderService) SideEffectType(sideEffectType SideEffectType) *MarginCreateOrderService

func (*MarginCreateOrderService) Symbol added in v0.1.42

func (*MarginCreateOrderService) TimeInForceType added in v0.1.42

func (s *MarginCreateOrderService) TimeInForceType(timeInForceType TimeInForceType) *MarginCreateOrderService

type MarginLoanResponse added in v0.1.42

type MarginLoanResponse struct {
	TransactionId int64 `json:"tranId"`
}

type MarginLoanService added in v0.1.42

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

func (*MarginLoanService) Amount added in v0.1.42

func (service *MarginLoanService) Amount(amount float64) *MarginLoanService

func (*MarginLoanService) Asset added in v0.1.42

func (service *MarginLoanService) Asset(asset string) *MarginLoanService

func (*MarginLoanService) Do added in v0.1.42

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

Do send request

type MarginRepayService added in v0.1.42

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

func (*MarginRepayService) Amount added in v0.1.42

func (service *MarginRepayService) Amount(amount float64) *MarginRepayService

func (*MarginRepayService) Asset added in v0.1.42

func (service *MarginRepayService) Asset(asset string) *MarginRepayService

func (*MarginRepayService) Do added in v0.1.42

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

Do send request

type MaxBorrowable added in v0.1.35

type MaxBorrowable struct {
	Amount      string `json:"amount"`
	BorrowLimit string `json:"borrowLimit"`
}

type NewOrderRespType

type NewOrderRespType string

NewOrderRespType define response JSON verbosity

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 PositionSideType

type PositionSideType string

PositionSideType define position side type of order

type RepayLoanResponse added in v0.1.42

type RepayLoanResponse struct {
	TransactionId int64 `json:"tranId"`
}

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 SelfTradePreventionMode

type SelfTradePreventionMode string

SelfTradePreventionMode define response JSON verbosity

type SideEffectType added in v0.1.42

type SideEffectType string

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 SymbolType added in v0.1.35

type SymbolType string

// SymbolType define symbol type

type TimeInForceType

type TimeInForceType string

TimeInForceType define time in force type of order

type UmAccount

type UmAccount struct {
	Assets    []*UmAccountAsset    `json:"assets"`
	Positions []*UmAccountPosition `json:"positions"`
	// contains filtered or unexported fields
}

UmAccount define account info

type UmAccountAsset

type UmAccountAsset struct {
	Asset                  string `json:"asset"`
	CrossWalletBalance     string `json:"crossWalletBalance"`
	CrossUnPnl             string `json:"crossUnPnl"`
	MaintMargin            string `json:"maintMargin"`
	InitialMargin          string `json:"initialMargin"`
	PositionInitialMargin  string `json:"positionInitialMargin"`
	OpenOrderInitialMargin string `json:"openOrderInitialMargin"`
	UpdateTime             int64  `json:"updateTime"`
}

UmAccountAsset define account asset

type UmAccountPosition

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

UmAccountPosition define account position

type UmCancelAllOpenOrdersService

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

UmCancelAllOpenOrdersService cancel all open orders

func (*UmCancelAllOpenOrdersService) Do

Do send request

func (*UmCancelAllOpenOrdersService) Symbol

Symbol set symbol

type UmCancelOrderResponse

type UmCancelOrderResponse struct {
	AvgPrice                string                  `json:"avgPrice"`
	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"`
	PositionSide            PositionSideType        `json:"positionSide"`
	Status                  OrderStatusType         `json:"status"`
	Symbol                  string                  `json:"symbol"`
	TimeInForce             TimeInForceType         `json:"timeInForce"`
	Type                    OrderType               `json:"type"`
	UpdateTime              int64                   `json:"updateTime"`
	SelfTradePreventionMode SelfTradePreventionMode `json:"selfTradePreventionMode"`
	GoodTillDate            int64                   `json:"goodTillDate"`
}

UmCancelOrderResponse define response of canceling order

type UmCancelOrderService

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

UmCancelOrderService cancel all open orders

func (*UmCancelOrderService) ClientOrderID

func (s *UmCancelOrderService) ClientOrderID(clientOrderID string) *UmCancelOrderService

ClientOrderID set clientOrderID

func (*UmCancelOrderService) Do

func (*UmCancelOrderService) OrderID

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

OrderID set orderID

func (*UmCancelOrderService) Symbol

Symbol set symbol

type UmChangePositionMode added in v0.1.35

type UmChangePositionMode struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type UmChangePositionModeService added in v0.1.35

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

func (*UmChangePositionModeService) Do added in v0.1.35

Do send request

func (*UmChangePositionModeService) DualSidePosition added in v0.1.35

func (s *UmChangePositionModeService) DualSidePosition(dualSidePosition bool) *UmChangePositionModeService

DualSidePosition set positionSide

type UmCommissionRateService

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

func (*UmCommissionRateService) Do

Do send request

func (*UmCommissionRateService) Symbol

Symbol set symbol

type UmCreateOrderResponse added in v0.1.19

type UmCreateOrderResponse struct {
	ClientOrderID           string                  `json:"clientOrderId"`               //
	CumQty                  string                  `json:"cumQty"`                      //
	CumQuote                string                  `json:"cumQuote"`                    //
	ExecutedQuantity        string                  `json:"executedQty"`                 //
	OrderID                 int64                   `json:"orderId"`                     //
	AvgPrice                string                  `json:"avgPrice"`                    //
	OrigQuantity            string                  `json:"origQty"`                     //
	Price                   string                  `json:"price"`                       //
	ReduceOnly              bool                    `json:"reduceOnly"`                  //
	Side                    SideType                `json:"side"`                        //
	PositionSide            PositionSideType        `json:"positionSide"`                //
	Status                  OrderStatusType         `json:"status"`                      //
	Symbol                  string                  `json:"symbol"`                      //
	TimeInForce             TimeInForceType         `json:"timeInForce"`                 //
	Type                    OrderType               `json:"type"`                        //
	SelfTradePreventionMode SelfTradePreventionMode `json:"selfTradePreventionMode"`     // self trading preventation mode
	GoodTillDate            int64                   `json:"goodTillDate"`                // order pre-set auto cancel time for TIF GTD order
	UpdateTime              int64                   `json:"updateTime"`                  // update time
	RateLimitOrder10s       string                  `json:"rateLimitOrder10s,omitempty"` //
	RateLimitOrder1m        string                  `json:"rateLimitOrder1m,omitempty"`  //
}

CreateOrderResponse define create order response

type UmCreateOrderService

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

UmCreateOrderService create order

func (*UmCreateOrderService) Do

Do send request

func (*UmCreateOrderService) NewClientOrderID

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

NewClientOrderID set newClientOrderID

func (*UmCreateOrderService) NewOrderResponseType

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

NewOrderResponseType set newOrderResponseType

func (*UmCreateOrderService) PositionSide

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

PositionSide set side

func (*UmCreateOrderService) Price

Price set price

func (*UmCreateOrderService) Quantity

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

Quantity set quantity

func (*UmCreateOrderService) ReduceOnly

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

ReduceOnly set reduceOnly

func (*UmCreateOrderService) SelfTradePrevention

func (s *UmCreateOrderService) SelfTradePrevention(selfTradePreventionMode SelfTradePreventionMode) *UmCreateOrderService

SelfTradePrevention set selfTradePreventionMode

func (*UmCreateOrderService) Side

Side set side

func (*UmCreateOrderService) Symbol

Symbol set symbol

func (*UmCreateOrderService) TimeInForce

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

TimeInForce set timeInForce

func (*UmCreateOrderService) Type

Type set type

type UmGetAccountService

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

UmGetAccountService get account info

func (*UmGetAccountService) Do

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

Do send request

type UmGetPositionMode added in v0.1.35

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

type UmGetPositionModeService added in v0.1.35

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

func (*UmGetPositionModeService) Do added in v0.1.35

Do send request

type UmListOpenOrdersService

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

UmListOpenOrdersService list opened orders

func (*UmListOpenOrdersService) Do

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

Do send request

func (*UmListOpenOrdersService) Symbol

Symbol set symbol

type UmOrder

type UmOrder struct {
	AvgPrice                string                  `json:"avgPrice"`
	ClientOrderID           string                  `json:"clientOrderId"`
	CumQuote                string                  `json:"cumQuote"`
	ExecutedQuantity        string                  `json:"executedQty"`
	OrderID                 int64                   `json:"orderId"`
	OrigQuantity            string                  `json:"origQty"`
	OrigType                OrderType               `json:"origType"`
	Price                   string                  `json:"price"`
	ReduceOnly              bool                    `json:"reduceOnly"`
	Side                    SideType                `json:"side"`
	PositionSide            PositionSideType        `json:"positionSide"`
	Status                  OrderStatusType         `json:"status"`
	Symbol                  string                  `json:"symbol"`
	Time                    int64                   `json:"time"`
	TimeInForce             TimeInForceType         `json:"timeInForce"`
	Type                    OrderType               `json:"type"`
	UpdateTime              int64                   `json:"updateTime"`
	SelfTradePreventionMode SelfTradePreventionMode `json:"selfTradePreventionMode"`
	GoodTillDate            int64                   `json:"goodTillDate"`
}

UmOrder define order info

type UmSetLeverageResponse

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

type UmSetLeverageService

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

func (*UmSetLeverageService) Do

Do send request

func (*UmSetLeverageService) Leverage

func (s *UmSetLeverageService) Leverage(leverage int64) *UmSetLeverageService

Leverage set leverage

func (*UmSetLeverageService) Symbol

Symbol set symbol

type UnCommissionRateResponse

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

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 WsAccountUpdate

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

WsAccountUpdate define account update

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 WsConfig

type WsConfig struct {
	Endpoint string
	IP       string
}

WsConfig webservice configuration

func (*WsConfig) WithIP

func (cfg *WsConfig) WithIP(ip string)

type WsHandler

type WsHandler func(message []byte)

WsHandler handle raw websocket message

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
	PositionSide         PositionSideType   `json:"ps"`  // Position Side
	RealizedPnL          string             `json:"rp"`  // Realized Profit of the trade
	StrategyType         string             `json:"st"`  // Strategy type, only pushed with conditional order triggered
	StrategyID           int64              `json:"si"`  // StrategyId,only pushed with conditional order triggered
	STP                  string             `json:"V"`   // STP mode
	GTD                  int64              `json:"gtd"` // TIF GTD order auto cancel time
}

WsOrderTradeUpdate define order trade update

type WsPackedUserDataEvent added in v0.1.12

type WsPackedUserDataEvent struct {
	EventType    string `json:"e"`
	EventTs      int64  `json:"E"`
	EventContent string `json:"EventContent,omitempty"`
}

WsPackedUserDataEvent define user data event

type WsPackedUserDataHandler added in v0.1.12

type WsPackedUserDataHandler func(event *WsPackedUserDataEvent)

WsPackedUserDataHandler handle WsPackedUserDataEvent

type WsPosition

type WsPosition struct {
	Symbol              string           `json:"s"`
	Amount              string           `json:"pa"`
	EntryPrice          string           `json:"ep"`
	AccumulatedRealized string           `json:"cr"`
	UnrealizedPnL       string           `json:"up"`
	Side                PositionSideType `json:"ps"`
	BreakEvenPrice      float64          `json:"bep"`
}

WsPosition define position

type WsUserDataEvent

type WsUserDataEvent struct {
	Event            UserDataEventType  `json:"e"`
	BusinessUnit     BusinessUnit       `json:"fs"`
	Time             int64              `json:"E"`
	TransactionTime  int64              `json:"T"`
	AccountAlias     string             `json:"i,omitempty"`
	AccountUpdate    WsAccountUpdate    `json:"a,omitempty"`
	OrderTradeUpdate WsOrderTradeUpdate `json:"o,omitempty"`
}

WsUserDataEvent define user data event

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