Versions in this module Expand all Collapse all v1 v1.0.2 May 26, 2020 Changes in this version type ApiParameter + BaseURL string v1.0.1 Apr 26, 2020 v1.0.0 Apr 26, 2020 Changes in this version + type AccountInfo struct + AdjustFactor float64 + ContractCode string + LeverRate float64 + LiquidationPrice float64 + MarginAvailable float64 + MarginBalance float64 + MarginFrozen float64 + MarginPosition float64 + MarginStatic float64 + ProfitReal float64 + ProfitUnreal float64 + RiskRate float64 + Symbol string + WithdrawAvailable float64 + type AccountInfoResult struct + Data []AccountInfo + ErrCode int + ErrMsg string + Status string + Ts int64 + type ApiParameter struct + AccessKey string + Debug bool + EnablePrivateSign bool + HttpClient *http.Client + PrivateKeyPrime256 string + ProxyURL string + SecretKey string + Url string + type CancelData struct + Errors []CancelError + Successes string + type CancelError struct + ErrCode int + ErrMsg string + OrderID string + type CancelResult struct + Data CancelData + ErrCode int + ErrMsg string + Status string + Ts int64 + type Client struct + func NewClient(params *ApiParameter) *Client + func (c *Client) Cancel(contractCode string, orderID int64, clientOrderID int64) (result CancelResult, err error) + func (c *Client) GetAccountInfo(contractCode string) (result AccountInfoResult, err error) + func (c *Client) GetHisOrders(contractCode string, tradeType int, _type int, status int, createDate int, ...) (result HisOrdersResult, err error) + func (c *Client) GetKLine(symbol string, period string, size int, from int64, to int64) (result KLineResult, err error) + func (c *Client) GetMarketDepth(contractCode string, _type string) (result MarketDepthResult, err error) + func (c *Client) GetOpenOrders(contractCode string, pageIndex int, pageSize int) (result OpenOrdersResult, err error) + func (c *Client) GetPositionInfo(contractCode string) (result PositionInfoResult, err error) + func (c *Client) Heartbeat() (result HeartbeatResult, err error) + func (c *Client) Order(contractCode string, clientOrderID int64, price float64, volume float64, ...) (result OrderResult, err error) + func (c *Client) OrderInfo(contractCode string, orderID int64, clientOrderID int64) (result OrderInfoResult, err error) + type Heartbeat struct + EstimatedRecoveryTime interface{} + Heartbeat int + SwapEstimatedRecoveryTime interface{} + SwapHeartbeat int + type HeartbeatResult struct + Data Heartbeat + Status string + Ts int64 + type HisOrdersData struct + CurrentPage int + Orders []Order + TotalPage int + TotalSize int + type HisOrdersResult struct + Data HisOrdersData + ErrCode int + ErrMsg string + Status string + Ts int64 + type KLine struct + Amount float64 + Close float64 + Count int + High float64 + ID int + Low float64 + Open float64 + Vol int + type KLineResult struct + Ch string + Data []KLine + ErrCode int + ErrMsg string + Status string + Ts int64 + type MarketDepthResult struct + Ch string + ErrCode int + ErrMsg string + Status string + Tick Tick + Ts int64 + type NWS struct + func NewNWS(wsURL string, accessKey string, secretKey string) *NWS + func (ws *NWS) Login() error + func (ws *NWS) SetAccountsCallback(callback func(accounts *WSAccounts)) + func (ws *NWS) SetLiquidationOrdersCallback(callback func(liquidationOrders *WSLiquidationOrders)) + func (ws *NWS) SetOrdersCallback(callback func(order *WSOrder)) + func (ws *NWS) SetPositionsCallback(callback func(positions *WSPositions)) + func (ws *NWS) SetProxy(proxyURL string) (err error) + func (ws *NWS) Start() + func (ws *NWS) Subscribe(id string, ch map[string]interface{}) error + func (ws *NWS) SubscribeAccounts(id string, symbol string) + func (ws *NWS) SubscribeLiquidationOrders(id string, symbol string) + func (ws *NWS) SubscribeOrders(id string, symbol string) + func (ws *NWS) SubscribePositions(id string, symbol string) + func (ws *NWS) SubscribeTopic(id string, topic string) + func (ws *NWS) Unsubscribe(id string) error + type OpenOrdersData struct + CurrentPage int + Orders []Order + TotalPage int + TotalSize int + type OpenOrdersResult struct + Data OpenOrdersData + ErrCode int + ErrMsg string + Status string + Ts int64 + type Order struct + ClientOrderID string + ContractCode string + CreatedAt int64 + Direction string + Fee float64 + FeeAsset string + LeverRate int + MarginFrozen float64 + Offset string + OrderID int64 + OrderIDStr string + OrderPriceTypeRaw sjson.RawMessage + OrderSource string + OrderType int + Price float64 + Profit float64 + Status int + Symbol string + TradeAvgPrice float64 + TradeTurnover float64 + TradeVolume float64 + Volume float64 + func (o *Order) OrderPriceType() string + type OrderData struct + ClientOrderID int64 + OrderID int64 + OrderIDStr string + type OrderInfoResult struct + Data []Order + ErrCode int + ErrMsg string + Status string + Ts int64 + type OrderResult struct + Data OrderData + ErrCode int + ErrMsg string + Status string + Ts int64 + type Position struct + Available float64 + ContractCode string + CostHold float64 + CostOpen float64 + Direction string + Frozen float64 + LastPrice float64 + LeverRate int + PositionMargin float64 + Profit float64 + ProfitRate float64 + ProfitUnreal float64 + Symbol string + Volume float64 + type PositionInfoResult struct + Data []Position + ErrCode int + ErrMsg string + Status string + Ts int64 + type Tick struct + Asks [][]float64 + Bids [][]float64 + Ch string + ID int64 + MrID int64 + Ts int64 + Version int64 + type WS struct + func NewWS(wsURL string, accessKey string, secretKey string, debugMode bool) *WS + func (ws *WS) SetDepthCallback(callback func(depth *WSDepth)) + func (ws *WS) SetDepthHFCallback(callback func(depth *WSDepthHF)) + func (ws *WS) SetProxy(proxyURL string) (err error) + func (ws *WS) SetTickerCallback(callback func(ticker *WSTicker)) + func (ws *WS) SetTradeCallback(callback func(trade *WSTrade)) + func (ws *WS) Start() + func (ws *WS) Subscribe(id string, ch map[string]interface{}) error + func (ws *WS) SubscribeDepth(id string, symbol string) + func (ws *WS) SubscribeDepthHF(id string, symbol string, size int, dateType string) + func (ws *WS) SubscribeTicker(id string, symbol string) + func (ws *WS) SubscribeTrade(id string, symbol string) + func (ws *WS) Unsubscribe(id string) error + type WSAccountData struct + AdjustFactor float64 + ContractCode string + LeverRate float64 + LiquidationPrice float64 + MarginAvailable float64 + MarginBalance float64 + MarginFrozen float64 + MarginPosition float64 + MarginStatic float64 + ProfitReal float64 + ProfitUnreal float64 + RiskRate float64 + Symbol string + WithdrawAvailable float64 + type WSAccounts struct + Data []WSAccountData + Event string + Op string + Topic string + Ts int64 + type WSDepth struct + Ch string + Tick Tick + Ts int64 + type WSDepthHF struct + Ch string + Tick WSTickHF + Ts int64 + type WSLiquidationOrderData struct + ContractCode string + CreatedAt int64 + Direction string + Offset string + Price float64 + Symbol string + Volume float64 + type WSLiquidationOrders struct + Data []WSLiquidationOrderData + Op string + Topic string + Ts int64 + type WSMyTrade struct + CreatedAt int64 + FeeAsset string + ID string + Role string + TradeFee float64 + TradeID int64 + TradePrice float64 + TradeTurnover float64 + TradeVolume float64 + type WSOrder struct + ClientOrderID int64 + ContractCode string + CreatedAt int64 + Direction string + Fee float64 + LeverRate float64 + MarginFrozen float64 + Offset string + Op string + OrderID int64 + OrderIDStr string + OrderPriceType string + OrderSource string + OrderType int + Price float64 + Profit float64 + Status int + Symbol string + Topic string + Trade []WSMyTrade + TradeAvgPrice float64 + TradeTurnover float64 + TradeVolume float64 + Ts int64 + Volume float64 + type WSPositionData struct + Available float64 + ContractCode string + CostHold float64 + CostOpen float64 + Direction string + Frozen float64 + LastPrice float64 + LeverRate float64 + PositionMargin float64 + Profit float64 + ProfitRate float64 + ProfitUnreal float64 + Symbol string + Volume float64 + type WSPositions struct + Data []WSPositionData + Event string + Op string + Topic string + Ts int64 + type WSTick struct + Asks [][]float64 + Bids [][]float64 + Ch string + ID int + MrID int64 + Ts int64 + Version int + type WSTickHF struct + Asks [][]float64 + Bids [][]float64 + Ch string + Event string + ID int64 + Mrid int64 + Ts int64 + Version int + type WSTicker struct + Ch string + Tick WSTickerTick + Ts int64 + type WSTickerTick struct + Amount float64 + Close float64 + Count int64 + High float64 + ID int64 + Low float64 + MrID int64 + Open float64 + Vol float64 + type WSTrade struct + Ch string + Tick WSTradeTick + Ts int64 + type WSTradeItem struct + Amount int + Direction string + ID int64 + Price float64 + Ts int64 + type WSTradeTick struct + Data []WSTradeItem + ID int64 + Ts int64