huobi

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 38 Imported by: 0

README

GoCryptoTrader package Huobi

Build Status Software License GoDoc Coverage Status Go Report Card

This huobi package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Huobi Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var h exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "Huobi" {
		h = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := h.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := h.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := h.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := h.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := h.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := h.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := h.Trade(...)
if err != nil {
	// Handle error
}
How to do Websocket public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OrderBookDataRequestParamsTypeNone  = OrderBookDataRequestParamsType("")
	OrderBookDataRequestParamsTypeStep0 = OrderBookDataRequestParamsType("step0")
	OrderBookDataRequestParamsTypeStep1 = OrderBookDataRequestParamsType("step1")
	OrderBookDataRequestParamsTypeStep2 = OrderBookDataRequestParamsType("step2")
	OrderBookDataRequestParamsTypeStep3 = OrderBookDataRequestParamsType("step3")
	OrderBookDataRequestParamsTypeStep4 = OrderBookDataRequestParamsType("step4")
	OrderBookDataRequestParamsTypeStep5 = OrderBookDataRequestParamsType("step5")
)

vars for OrderBookDataRequestParamsTypes

View Source
var (
	// SpotNewOrderRequestTypeBuyMarket buy market order
	SpotNewOrderRequestTypeBuyMarket = SpotNewOrderRequestParamsType("buy-market")

	// SpotNewOrderRequestTypeSellMarket sell market order
	SpotNewOrderRequestTypeSellMarket = SpotNewOrderRequestParamsType("sell-market")

	// SpotNewOrderRequestTypeBuyLimit buy limit order
	SpotNewOrderRequestTypeBuyLimit = SpotNewOrderRequestParamsType("buy-limit")

	// SpotNewOrderRequestTypeSellLimit sell limit order
	SpotNewOrderRequestTypeSellLimit = SpotNewOrderRequestParamsType("sell-limit")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID     int64  `json:"id"`
	Type   string `json:"type"`
	State  string `json:"state"`
	UserID int64  `json:"user-id"`
}

Account stores the account data

type AccountBalance

type AccountBalance struct {
	ID                    int64                  `json:"id"`
	Type                  string                 `json:"type"`
	State                 string                 `json:"state"`
	AccountBalanceDetails []AccountBalanceDetail `json:"list"`
}

AccountBalance stores the user all account balance

type AccountBalanceDetail

type AccountBalanceDetail struct {
	Currency string  `json:"currency"`
	Type     string  `json:"type"`
	Balance  float64 `json:"balance,string"`
}

AccountBalanceDetail stores the user account balance

type AccountTradeHistoryData

type AccountTradeHistoryData struct {
	Data struct {
		CurrentPage int64 `json:"current_page"`
		TotalPage   int64 `json:"total_page"`
		TotalSize   int64 `json:"total_size"`
		Trades      []struct {
			ID               string  `json:"id"`
			ContractCode     string  `json:"contract_code"`
			CreateDate       string  `json:"create_date"`
			Direction        string  `json:"direction"`
			MatchID          int64   `json:"match_id"`
			Offset           string  `json:"offset"`
			OffsetProfitloss float64 `json:"offset_profitloss"`
			OrderID          int64   `json:"order_id"`
			OrderIDString    string  `json:"order_id_str"`
			Symbol           string  `json:"symbol"`
			OrderSource      string  `json:"order_source"`
			TradeFee         float64 `json:"trade_fee"`
			TradePrice       float64 `json:"trade_price"`
			TradeTurnover    float64 `json:"trade_turnover"`
			TradeVolume      float64 `json:"trade_volume"`
			Role             string  `json:"role"`
			FeeAsset         string  `json:"fee_asset"`
		} `json:"trades"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

AccountTradeHistoryData stores account trade history for swaps

type AggregatedBalance

type AggregatedBalance struct {
	Currency string  `json:"currency"`
	Balance  float64 `json:"balance,string"`
}

AggregatedBalance stores balances of all the sub-account

type AvailableLeverageData

type AvailableLeverageData struct {
	Data []struct {
		ContractCode      string `json:"contract_code"`
		AvailableLeverage string `json:"available_level_rate"`
	} `json:"data"`
	Timestamp int64 `json:"timestamp"`
}

AvailableLeverageData stores data of available leverage for account

type BasisData

type BasisData struct {
	Channel string `json:"ch"`
	Data    []struct {
		Basis         string `json:"basis"`
		BasisRate     string `json:"basis_rate"`
		ContractPrice string `json:"contract_price"`
		ID            int64  `json:"id"`
		IndexPrice    string `json:"index_price"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

BasisData stores basis data for swaps

type BatchOrderData

type BatchOrderData struct {
	Data struct {
		Errors []struct {
			ErrCode int64  `json:"err_code"`
			ErrMsg  string `json:"err_msg"`
			Index   int64  `json:"index"`
		} `json:"errors"`
		Success []struct {
			Index         int64  `json:"index"`
			OrderID       int64  `json:"order_id"`
			OrderIDString string `json:"order_id_str"`
		} `json:"success"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

BatchOrderData stores data for batch orders

type BatchOrderRequestType

type BatchOrderRequestType struct {
	Data []batchOrderData
}

BatchOrderRequestType stores batch order request data

type BatchTradesData

type BatchTradesData struct {
	ID        int64                      `json:"id"`
	Timestamp int64                      `json:"ts"`
	Data      []CoinMarginedFuturesTrade `json:"data"`
}

BatchTradesData stores batch trades for a given swap contract

type CancelOpenOrdersBatch

type CancelOpenOrdersBatch struct {
	Data struct {
		FailedCount  int `json:"failed-count"`
		NextID       int `json:"next-id"`
		SuccessCount int `json:"success-count"`
	} `json:"data"`
	Status       string `json:"status"`
	ErrorMessage string `json:"err-msg"`
}

CancelOpenOrdersBatch stores open order batch response data

type CancelOrderBatch

type CancelOrderBatch struct {
	Success []string `json:"success"`
	Failed  []struct {
		OrderID      string `json:"order-id"`
		ErrorCode    string `json:"err-code"`
		ErrorMessage string `json:"err-msg"`
	} `json:"failed"`
}

CancelOrderBatch stores the cancel order batch data

type CancelOrdersData

type CancelOrdersData struct {
	Errors []struct {
		OrderID string `json:"order_id"`
		ErrCode int64  `json:"err_code"`
		ErrMsg  string `json:"err_msg"`
	} `json:"errors"`
	Successes string `json:"successes"`
	Timestamp int64  `json:"ts"`
}

CancelOrdersData stores order cancellation data

type CancelTriggerOrdersData

type CancelTriggerOrdersData struct {
	Data struct {
		Errors []struct {
			OrderID int64  `json:"order_id"`
			ErrCode int64  `json:"err_code"`
			ErrMsg  string `json:"err_msg"`
		} `json:"errors"`
		Successes string `json:"successes"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

CancelTriggerOrdersData stores trigger order cancel data

type ChainQuota

type ChainQuota struct {
	Chain                         string  `json:"chain"`
	MaxWithdrawAmount             float64 `json:"maxWithdrawAmt,string"`
	WithdrawQuotaPerDay           float64 `json:"withdrawQuotaPerDay,string"`
	RemainingWithdrawQuotaPerDay  float64 `json:"remainWithdrawQuotaPerDay,string"`
	WithdrawQuotaPerYear          float64 `json:"withdrawQuotaPerYear,string"`
	RemainingWithdrawQuotaPerYear float64 `json:"remainWithdrawQuotaPerYear,string"`
	WithdrawQuotaTotal            float64 `json:"withdrawQuotaTotal,string"`
	RemainingWithdrawQuotaTotal   float64 `json:"remainWithdrawQuotaTotal,string"`
}

ChainQuota stores the users currency chain quota

type CoinMarginedFuturesTrade

type CoinMarginedFuturesTrade struct {
	Amount    float64 `json:"amount"`
	Direction string  `json:"direction"`
	ID        int64   `json:"id"`
	Price     float64 `json:"price"`
	Timestamp int64   `json:"ts"`
}

CoinMarginedFuturesTrade holds coinmarginedfutures trade data

type CurrenciesChainData

type CurrenciesChainData struct {
	Currency   string `json:"currency"`
	AssetType  uint8  `json:"assetType"`
	InstStatus string `json:"instStatus"`
	ChainData  []struct {
		Chain                     string  `json:"chain"`
		DisplayName               string  `json:"displayName"`
		BaseChain                 string  `json:"baseChain"`
		BaseChainProtocol         string  `json:"baseChainProtocol"`
		IsDynamic                 bool    `json:"isDynamic"`
		NumberOfConfirmations     uint16  `json:"numOfConfirmations"`
		NumberOfFastConfirmations uint16  `json:"numOfFastConfirmations"`
		DepositStatus             string  `json:"depositStatus"`
		MinimumDepositAmount      float64 `json:"minDepositAmt,string"`
		WithdrawStatus            string  `json:"withdrawStatus"`
		MinimumWithdrawalAmount   float64 `json:"minWithdrawAmt,string"`
		WithdrawPrecision         int16   `json:"withdrawPrecision"`
		MaximumWithdrawAmount     float64 `json:"maxWithdrawwAmt,string"`
		WithdrawQuotaPerDay       float64 `json:"withdrawQuotaPerDay,string"`
		WithdrawQuotaPerYear      float64 `json:"withdrawQuotaPerYear,string"`
		WithdrawQuotaTotal        float64 `json:"withdrawQuotaTotal,string"`
		WithdrawFeeType           string  `json:"withdrawFeeType"`
		TransactFeeWithdraw       float64 `json:"transactFeeWithdraw,string"`
		AddressWithTag            bool    `json:"addrWithTag"`
		AddressDepositTag         bool    `json:"addrDepositTag"`
	} `json:"chains"`
}

CurrenciesChainData stores currency and chain info

type DepositAddress

type DepositAddress struct {
	UserID     int64  `json:"userId"`
	Currency   string `json:"currency"`
	Address    string `json:"address"`
	AddressTag string `json:"addressTag"`
	Chain      string `json:"chain"`
}

DepositAddress stores the users deposit address info

type Detail

type Detail struct {
	Amount    float64 `json:"amount"`
	Open      float64 `json:"open"`
	Close     float64 `json:"close"`
	High      float64 `json:"high"`
	Timestamp int64   `json:"timestamp"`
	ID        int64   `json:"id"`
	Count     int     `json:"count"`
	Low       float64 `json:"low"`
	Volume    float64 `json:"vol"`
}

Detail stores the ticker detail data

type DetailMerged

type DetailMerged struct {
	Detail
	Version int64     `json:"version"`
	Ask     []float64 `json:"ask"`
	Bid     []float64 `json:"bid"`
}

DetailMerged stores the ticker detail merged data

type EstimatedFundingRateData

type EstimatedFundingRateData struct {
	Channel string `json:"ch"`
	Data    []struct {
		Volume float64 `json:"vol"`
		Close  float64 `json:"close"`
		Count  float64 `json:"count"`
		High   float64 `json:"high"`
		ID     int64   `json:"id"`
		Low    float64 `json:"low"`
		Open   float64 `json:"open"`
		Amount float64 `json:"amount"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

EstimatedFundingRateData stores estimated funding rate data

type FAccountTransferData

type FAccountTransferData struct {
	Status    string `json:"status"`
	Timestamp int64  `json:"ts"`
	Data      struct {
		OrderID string `json:"order_id"`
	} `json:"data"`
}

FAccountTransferData stores internal transfer data for futures

type FAssetsAndPositionsData

type FAssetsAndPositionsData struct {
	Data []struct {
		Symbol            string  `json:"symbol"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		RiskRate          float64 `json:"risk_rate"`
		WithdrawAvailable float64 `json:"withdraw_available"`
	} `json:"data"`
}

FAssetsAndPositionsData stores assets and positions data for futures

type FAvailableLeverageData

type FAvailableLeverageData struct {
	Data []struct {
		Symbol                string `json:"symbol"`
		AvailableLeverageRate string `json:"available_level_rate"`
	} `json:"data"`
	Timestamp int64 `json:"timestamp"`
}

FAvailableLeverageData stores available leverage data for futures

type FBasisData

type FBasisData struct {
	Ch   string `json:"ch"`
	Data []struct {
		Basis         float64 `json:"basis,string"`
		BasisRate     float64 `json:"basis_rate,string"`
		ContractPrice float64 `json:"contract_price,string"`
		ID            int64   `json:"id"`
		IndexPrice    float64 `json:"index_price,string"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FBasisData stores basis data for futures

type FBatchOrderResponse

type FBatchOrderResponse struct {
	OrdersData []FOrderData `json:"orders_data"`
}

FBatchOrderResponse stores batch order data

type FBatchTradesForContractData

type FBatchTradesForContractData struct {
	Ch        string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		ID        int64          `json:"id"`
		Timestamp int64          `json:"ts"`
		Data      []FuturesTrade `json:"data"`
	} `json:"data"`
}

FBatchTradesForContractData stores batch of trades data for a contract

type FCancelOrderData

type FCancelOrderData struct {
	Data struct {
		Errors []struct {
			OrderID int64  `json:"order_id,string"`
			ErrCode int64  `json:"err_code"`
			ErrMsg  string `json:"err_msg"`
		} `json:"errors"`
		Successes string `json:"successes"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FCancelOrderData stores cancel order data

type FClawbackRateAndInsuranceData

type FClawbackRateAndInsuranceData struct {
	Timestamp int64 `json:"ts"`
	Data      []struct {
		Symbol            string  `json:"symbol"`
		InsuranceFund     float64 `json:"insurance_fund"`
		EstimatedClawback float64 `json:"estimated_clawback"`
	} `json:"data"`
}

FClawbackRateAndInsuranceData stores clawback rate and insurance data for futures

type FContractIndexPriceInfo

type FContractIndexPriceInfo struct {
	Data []struct {
		Symbol     string  `json:"symbol"`
		IndexPrice float64 `json:"index_price"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FContractIndexPriceInfo stores contract index price

type FContractInfoData

type FContractInfoData struct {
	Data []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		ContractType   string  `json:"contract_type"`
		ContractSize   float64 `json:"contract_size"`
		PriceTick      float64 `json:"price_tick"`
		DeliveryDate   string  `json:"delivery_date"`
		DeliveryTime   int64   `json:"delivery_time,string"`
		CreateDate     string  `json:"create_date"`
		ContractStatus int64   `json:"contract_status"`
		SettlementTime int64   `json:"settlement_time,string"`
	}
}

FContractInfoData gets contract info data for futures

type FContractInfoOnOrderLimit

type FContractInfoOnOrderLimit struct {
	ContractData []struct {
		OrderPriceType string `json:"order_price_type"`
		List           []struct {
			Symbol        string `json:"symbol"`
			ContractTypes []struct {
				ContractType string `json:"contract_type"`
				OpenLimit    int64  `json:"open_limit"`
				CloseLimit   int64  `json:"close_limit"`
			} `json:"types"`
		} `json:"list"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FContractInfoOnOrderLimit stores contract info on futures order limit

type FContractOIData

type FContractOIData struct {
	Data      []UContractOpenInterest `json:"data"`
	Timestamp int64                   `json:"ts"`
}

FContractOIData stores open interest data for futures contracts

type FContractPriceLimits

type FContractPriceLimits struct {
	Data struct {
		Symbol       string  `json:"symbol"`
		HighLimit    float64 `json:"high_limit"`
		LowLimit     float64 `json:"low_limit"`
		ContractCode string  `json:"contract_code"`
		ContractType string  `json:"contract_type"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FContractPriceLimits gets limits for futures contracts

type FContractTradingFeeData

type FContractTradingFeeData struct {
	ContractTradingFeeData []struct {
		Symbol        string  `json:"symbol"`
		OpenMakerFee  float64 `json:"open_maker_fee,string"`
		OpenTakerFee  float64 `json:"open_taker_fee,string"`
		CloseMakerFee float64 `json:"close_maker_fee,string"`
		CloseTakerFee float64 `json:"close_taker_fee,string"`
		DeliveryFee   float64 `json:"delivery_fee,string"`
		FeeAsset      string  `json:"fee_asset"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FContractTradingFeeData stores contract trading fee data

type FEstimatedDeliveryPriceInfo

type FEstimatedDeliveryPriceInfo struct {
	Data struct {
		DeliveryPrice float64 `json:"delivery_price"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FEstimatedDeliveryPriceInfo stores estimated delivery price data for futures

type FFinancialRecords

type FFinancialRecords struct {
	Data struct {
		FinancialRecord []struct {
			ID         int64   `json:"id"`
			Timestamp  int64   `json:"ts"`
			Symbol     string  `json:"symbol"`
			RecordType int64   `json:"type"`
			Amount     float64 `json:"amount"`
		} `json:"financial_record"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FFinancialRecords stores financial records data for futures

type FHistoricalInsuranceRecordsData

type FHistoricalInsuranceRecordsData struct {
	Timestamp int64 `json:"timestamp"`
	Data      struct {
		Symbol string `json:"symbol"`
		Tick   []struct {
			InsuranceFund float64 `json:"insurance_fund"`
			Timestamp     int64   `json:"ts"`
		} `json:"tick"`
	} `json:"data"`
}

FHistoricalInsuranceRecordsData stores historical records of insurance fund balances for futures

type FIndexKlineData

type FIndexKlineData struct {
	Ch   string `json:"ch"`
	Data []struct {
		Vol    float64 `json:"vol"`
		Close  float64 `json:"close"`
		Count  float64 `json:"count"`
		High   float64 `json:"high"`
		ID     int64   `json:"id"`
		Low    float64 `json:"low"`
		Open   float64 `json:"open"`
		Amount float64 `json:"amount"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FIndexKlineData stores index kline data for futures

type FInfoSystemStatusData

type FInfoSystemStatusData struct {
	Data []struct {
		Symbol      string `json:"symbol"`
		Open        int64  `json:"open"`
		Close       int64  `json:"close"`
		Cancel      int64  `json:"cancel"`
		TransferIn  int64  `json:"transfer_in"`
		TransferOut int64  `json:"transfer_out"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FInfoSystemStatusData stores system status info for futures

type FKlineData

type FKlineData struct {
	Ch   string `json:"ch"`
	Data []struct {
		Volume      float64 `json:"vol"`
		Close       float64 `json:"close"`
		Count       float64 `json:"count"`
		High        float64 `json:"high"`
		IDTimestamp int64   `json:"id"`
		Low         float64 `json:"low"`
		Open        float64 `json:"open"`
		Amount      float64 `json:"amount"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FKlineData stores kline data for futures

type FLastTradeData

type FLastTradeData struct {
	Ch   string `json:"ch"`
	Tick struct {
		Data []struct {
			Amount    float64 `json:"amount,string"`
			Direction string  `json:"direction"`
			ID        int64   `json:"id"`
			Price     float64 `json:"price,string"`
			Timestamp int64   `json:"ts"`
		} `json:"data"`
		ID        int64 `json:"id"`
		Timestamp int64 `json:"ts"`
	} `json:"tick"`
	Timestamp int64 `json:"ts"`
}

FLastTradeData stores last trade's data for a contract

type FLiquidationOrdersInfo

type FLiquidationOrdersInfo struct {
	Data struct {
		Orders []struct {
			Symbol       string  `json:"symbol"`
			ContractCode string  `json:"contract_code"`
			Direction    string  `json:"direction"`
			Offset       string  `json:"offset"`
			Volume       float64 `json:"volume"`
			Price        float64 `json:"price"`
			CreatedAt    int64   `json:"created_at"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FLiquidationOrdersInfo stores data of futures liquidation orders

type FMarketDepth

type FMarketDepth struct {
	Ch        string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		MRID      int64        `json:"mrid"`
		ID        int64        `json:"id"`
		Bids      [][2]float64 `json:"bids"`
		Asks      [][2]float64 `json:"asks"`
		Timestamp int64        `json:"ts"`
		Version   int64        `json:"version"`
		Ch        string       `json:"ch"`
	} `json:"tick"`
}

FMarketDepth gets orderbook data for futures

type FMarketOverviewData

type FMarketOverviewData struct {
	Ch   string `json:"ch"`
	Tick struct {
		Vol       float64 `json:"vol,string"`
		Ask       [2]float64
		Bid       [2]float64
		Close     float64 `json:"close,string"`
		Count     float64 `json:"count"`
		High      float64 `json:"high,string"`
		ID        int64   `jso:"id"`
		Low       float64 `json:"low,string"`
		Open      float64 `json:"open,string"`
		Timestamp int64   `json:"ts"`
		Amount    float64 `json:"amount,string"`
	} `json:"tick"`
	Timestamp int64 `json:"ts"`
}

FMarketOverviewData stores overview data for futures

type FOIData

type FOIData struct {
	Data struct {
		Symbol       string `json:"symbol"`
		ContractType string `json:"contract_type"`
		Tick         []struct {
			Volume     float64 `json:"volume,string"`
			AmountType int64   `json:"amount_type"`
			Timestamp  int64   `json:"ts"`
		} `json:"tick"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FOIData gets oi data on futures

type FOpenOrdersData

type FOpenOrdersData struct {
	Data struct {
		Orders []struct {
			Symbol         string  `json:"symbol"`
			ContractType   string  `json:"contract_type"`
			ContractCode   string  `json:"contract_code"`
			Volume         float64 `json:"volume"`
			Price          float64 `json:"price"`
			OrderPriceType string  `json:"order_price_type"`
			OrderType      int64   `json:"order_type"`
			Direction      string  `json:"direction"`
			Offset         string  `json:"offset"`
			LeverageRate   float64 `json:"lever_rate"`
			OrderID        int64   `json:"order_id"`
			OrderIDString  string  `json:"order_id_string"`
			ClientOrderID  int64   `json:"client_order_id"`
			OrderSource    string  `json:"order_source"`
			CreatedAt      int64   `json:"created_at"`
			TradeVolume    float64 `json:"trade_volume"`
			Fee            float64 `json:"fee"`
			TradeAvgPrice  float64 `json:"trade_avg_price"`
			MarginFrozen   float64 `json:"margin_frozen"`
			Profit         float64 `json:"profit"`
			Status         int64   `json:"status"`
			FeeAsset       string  `json:"fee_asset"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FOpenOrdersData stores open orders data for futures

type FOrderData

type FOrderData struct {
	Data struct {
		OrderID       int64  `json:"order_id"`
		OrderIDStr    string `json:"order_id_str"`
		ClientOrderID int64  `json:"client_order_id"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FOrderData stores order data for futures

type FOrderDetailsData

type FOrderDetailsData struct {
	Data struct {
		Symbol         string  `json:"symbol"`
		ContractType   string  `json:"contract_type"`
		ContractCode   string  `json:"contract_code"`
		Volume         float64 `json:"volume"`
		Price          float64 `json:"price"`
		OrderPriceType string  `json:"order_price_type"`
		Direction      string  `json:"direction"`
		Offset         string  `json:"offset"`
		LeverageRate   float64 `json:"lever_rate"`
		MarginFrozen   float64 `json:"margin_frozen"`
		Profit         float64 `json:"profit"`
		OrderSource    string  `json:"order_source"`
		OrderID        int64   `json:"order_id"`
		OrderIDString  string  `json:"order_id_str"`
		ClientOrderID  int64   `json:"client_order_id"`
		OrderType      int64   `json:"order_type"`
		Status         int64   `json:"status"`
		TradeVolume    float64 `json:"trade_volume"`
		TradeTurnover  int64   `json:"trade_turnover"`
		TradeAvgPrice  float64 `json:"trade_avg_price"`
		Fee            float64 `json:"fee"`
		CreatedAt      int64   `json:"created_at"`
		CanceledAt     int64   `json:"canceled_at"`
		FinalInterest  float64 `json:"final_interest"`
		AdjustValue    int64   `json:"adjust_value"`
		FeeAsset       string  `json:"fee_asset"`
		Trades         []struct {
			ID            string  `json:"id"`
			TradeID       int64   `json:"trade_id"`
			TradeVolume   float64 `json:"trade_volume"`
			TradePrice    float64 `json:"trade_price"`
			TradeFee      float64 `json:"trade_fee"`
			TradeTurnover float64 `json:"trade_turnover"`
			Role          string  `json:"role"`
			CreatedAt     int64   `json:"created_at"`
		} `json:"trades"`
		TotalPage   int64 `json:"total_page"`
		TotalSize   int64 `json:"total_size"`
		CurrentPage int64 `json:"current_page"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FOrderDetailsData stores order details for futures orders

type FOrderHistoryData

type FOrderHistoryData struct {
	Data struct {
		Orders []struct {
			Symbol          string  `json:"symbol"`
			ContractType    string  `json:"contract_type"`
			ContractCode    string  `json:"contract_code"`
			Volume          float64 `json:"volume"`
			Price           float64 `json:"price"`
			OrderPriceType  string  `json:"order_price_type"`
			Direction       string  `json:"direction"`
			Offset          string  `json:"offset"`
			LeverageRate    float64 `json:"lever_rate"`
			OrderID         int64   `json:"order_id"`
			OrderIDString   string  `json:"order_id_str"`
			OrderSource     string  `json:"order_source"`
			CreateDate      int64   `json:"create_date"`
			TradeVolume     float64 `json:"trade_volume"`
			TradeTurnover   float64 `json:"trade_turnover"`
			Fee             float64 `json:"fee"`
			TradeAvgPrice   float64 `json:"trade_avg_price"`
			MarginFrozen    float64 `json:"margin_frozen"`
			Profit          float64 `json:"profit"`
			Status          int64   `json:"status"`
			OrderType       int64   `json:"order_type"`
			FeeAsset        string  `json:"fee_asset"`
			LiquidationType int64   `json:"liquidation_type"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FOrderHistoryData stores order history data

type FOrderInfo

type FOrderInfo struct {
	Data []struct {
		ClientOrderID   int64   `json:"client_order_id"`
		ContractCode    string  `json:"contract_code"`
		ContractType    string  `json:"contract_type"`
		CreatedAt       int64   `json:"created_at"`
		CanceledAt      int64   `json:"canceled_at"`
		Direction       string  `json:"direction"`
		Fee             float64 `json:"fee"`
		FeeAsset        string  `json:"fee_asset"`
		LeverRate       int64   `json:"lever_rate"`
		MarginFrozen    float64 `json:"margin_frozen"`
		Offset          string  `json:"offset"`
		OrderID         int64   `json:"order_id"`
		OrderIDString   string  `json:"order_id_string"`
		OrderPriceType  string  `json:"order_price_type"`
		OrderSource     string  `json:"order_source"`
		OrderType       int64   `json:"order_type"`
		Price           float64 `json:"price"`
		Profit          float64 `json:"profit"`
		Status          int64   `json:"status"`
		Symbol          string  `json:"symbol"`
		TradeAvgPrice   float64 `json:"trade_avg_price"`
		TradeTurnover   float64 `json:"trade_turnover"`
		TradeVolume     float64 `json:"trade_volume"`
		Volume          float64 `json:"volume"`
		LiquidationType int64   `json:"liquidation_type"`
	} `json:"data"`
	Timestamp int64 `json:"timestamp"`
}

FOrderInfo stores order info

type FPositionLimitData

type FPositionLimitData struct {
	Data []struct {
		Symbol string `json:"symbol"`
		List   []struct {
			ContractType string  `json:"contract_type"`
			BuyLimit     float64 `json:"buy_limit"`
			SellLimit    float64 `json:"sell_limit"`
		} `json:"list"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FPositionLimitData stores information on futures positions limit

type FSettlementRecords

type FSettlementRecords struct {
	Data struct {
		SettlementRecords []struct {
			Symbol               string  `json:"symbol"`
			MarginBalanceInit    float64 `json:"margin_balance_init"`
			MarginBalance        int64   `json:"margin_balance"`
			SettlementProfitReal float64 `json:"settlement_profit_real"`
			SettlementTime       int64   `json:"settlement_time"`
			Clawback             float64 `json:"clawback"`
			DeliveryFee          float64 `json:"delivery_fee"`
			OffsetProfitLoss     float64 `json:"offset_profitloss"`
			Fee                  float64 `json:"fee"`
			FeeAsset             string  `json:"fee_asset"`
			Positions            []struct {
				Symbol                 string  `json:"symbol"`
				ContractCode           string  `json:"contract_code"`
				Direction              string  `json:"direction"`
				Volume                 float64 `json:"volume"`
				CostOpen               float64 `json:"cost_open"`
				CostHoldPre            float64 `json:"cost_hold_pre"`
				CostHold               float64 `json:"cost_hold"`
				SettlementProfitUnreal float64 `json:"settlement_profit_unreal"`
				SettlementPrice        float64 `json:"settlement_price"`
				SettlmentType          string  `json:"settlement_type"`
			} `json:"positions"`
		} `json:"settlement_records"`
		CurrentPage int64 `json:"current_page"`
		TotalPage   int64 `json:"total_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FSettlementRecords stores user's futures settlement records

type FSingleSubAccountAssetsInfo

type FSingleSubAccountAssetsInfo struct {
	AssetsData []struct {
		Symbol            string  `json:"symbol"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		AdjustFactor      float64 `json:"adjust_factor"`
		LeverageRate      float64 `json:"lever_rate"`
		MarginStatic      float64 `json:"margin_static"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FSingleSubAccountAssetsInfo stores futures assets info for a single subaccount

type FSingleSubAccountPositionsInfo

type FSingleSubAccountPositionsInfo struct {
	PositionsData []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		ContractType   string  `json:"contract_type"`
		Volume         float64 `json:"volume"`
		Available      float64 `json:"available"`
		Frozen         float64 `json:"frozen"`
		CostOpen       float64 `json:"cost_open"`
		CostHold       float64 `json:"cost_hold"`
		ProfitUnreal   float64 `json:"profit_unreal"`
		ProfitRate     float64 `json:"profit_rate"`
		Profit         float64 `json:"profit"`
		PositionMargin float64 `json:"position_margin"`
		LeverageRate   float64 `json:"lever_rate"`
		Direction      string  `json:"direction"`
		LastPrice      float64 `json:"last_price"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FSingleSubAccountPositionsInfo stores futures positions' info for a single subaccount

type FSubAccountAssetsInfo

type FSubAccountAssetsInfo struct {
	Timestamp int64 `json:"ts"`
	Data      []struct {
		SubUID int64 `json:"sub_uid"`
		List   []struct {
			Symbol           string  `json:"symbol"`
			MarginBalance    float64 `json:"margin_balance"`
			LiquidationPrice float64 `json:"liquidation_price"`
			RiskRate         float64 `json:"risk_rate"`
		} `json:"list"`
	} `json:"data"`
}

FSubAccountAssetsInfo gets subaccounts asset data

type FTieredAdjustmentFactorInfo

type FTieredAdjustmentFactorInfo struct {
	Data []struct {
		Symbol string `json:"symbol"`
		List   []struct {
			LeverageRate float64 `json:"lever_rate"`
			Ladders      []struct {
				Ladder       int64   `json:"ladder"`
				MinSize      float64 `json:"min_size"`
				MaxSize      float64 `json:"max_size"`
				AdjustFactor float64 `json:"adjust_factor"`
			} `json:"ladders"`
		} `json:"list"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTieredAdjustmentFactorInfo stores info on adjustment factor for futures

type FTopAccountsLongShortRatio

type FTopAccountsLongShortRatio struct {
	Data struct {
		List []struct {
			BuyRatio    float64 `json:"buy_ratio"`
			SellRatio   float64 `json:"sell_ratio"`
			LockedRatio float64 `json:"locked_ratio"`
			Timestamp   int64   `json:"ts"`
		} `json:"list"`
		Symbol string `json:"symbol"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTopAccountsLongShortRatio stores long/short ratio for top futures accounts

type FTopPositionsLongShortRatio

type FTopPositionsLongShortRatio struct {
	Data struct {
		Symbol string `json:"symbol"`
		List   []struct {
			BuyRatio  float64 `json:"buy_ratio"`
			SellRatio float64 `json:"sell_ratio"`
			Timestamp int64   `json:"timestamp"`
		} `json:"list"`
	} `json:"data"`
	Timestamp int64 `json:"timestamp"`
}

FTopPositionsLongShortRatio stores long short ratio for top futures positions

type FTradeHistoryData

type FTradeHistoryData struct {
	Data struct {
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
		Trades      []struct {
			ID            string  `json:"id"`
			ContractCode  string  `json:"contract_code"`
			ContractType  string  `json:"contract_type"`
			CreateDate    int64   `json:"create_date"`
			Direction     string  `json:"direction"`
			MatchID       int64   `json:"match_id"`
			Offset        string  `json:"offset"`
			OffsetPNL     float64 `json:"offset_profitloss"`
			OrderID       int64   `json:"order_id"`
			OrderIDString string  `json:"order_id_str"`
			Symbol        string  `json:"symbol"`
			OrderSource   string  `json:"order_source"`
			TradeFee      float64 `json:"trade_fee"`
			TradePrice    float64 `json:"trade_price"`
			TradeTurnover float64 `json:"trade_turnover"`
			TradeVolume   float64 `json:"trade_volume"`
			Role          string  `json:"role"`
			FeeAsset      string  `json:"fee_asset"`
		} `json:"trades"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTradeHistoryData stores trade history data for futures

type FTransferLimitData

type FTransferLimitData struct {
	Data []struct {
		Symbol                 string  `json:"symbol"`
		MaxTransferIn          float64 `json:"transfer_in_max_each"`
		MinTransferIn          float64 `json:"transfer_in_min_each"`
		MaxTransferOut         float64 `json:"transfer_out_max_each"`
		MinTransferOut         float64 `json:"transfer_out_min_each"`
		MaxTransferInDaily     float64 `json:"transfer_in_max_daily"`
		MaxTransferOutDaily    float64 `json:"transfer_out_max_daily"`
		NetTransferInMaxDaily  float64 `json:"net_transfer_in_max_daily"`
		NetTransferOutMaxDaily float64 `json:"net_transfer_out_max_daily"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTransferLimitData stores transfer limit data for futures

type FTransferRecords

type FTransferRecords struct {
	Timestamp int64 `json:"ts"`
	Data      struct {
		TransferRecord []struct {
			ID             int64   `json:"id"`
			Timestamp      int64   `json:"ts"`
			Symbol         string  `json:"symbol"`
			SubUID         int64   `json:"sub_uid"`
			SubAccountName string  `json:"sub_account_name"`
			TransferType   int64   `json:"transfer_type"`
			Amount         float64 `json:"amount"`
		} `json:"transfer_record"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
}

FTransferRecords gets transfer records data

type FTriggerOpenOrders

type FTriggerOpenOrders struct {
	Data struct {
		Orders []struct {
			Symbol         string  `json:"symbol"`
			ContractCode   string  `json:"contract_code"`
			ContractType   string  `json:"contract_type"`
			TriggerType    string  `json:"trigger_type"`
			Volume         float64 `json:"volume"`
			OrderType      int64   `json:"order_type"`
			Direction      string  `json:"direction"`
			Offset         string  `json:"offset"`
			LeverageRate   float64 `json:"lever_rate"`
			OrderID        int64   `json:"order_id"`
			OrderIDString  string  `json:"order_id_str"`
			OrderSource    string  `json:"order_source"`
			TriggerPrice   float64 `json:"trigger_price"`
			OrderPrice     float64 `json:"order_price"`
			CreatedAt      int64   `json:"created_at"`
			OrderPriceType string  `json:"order_price_type"`
			Status         int64   `json:"status"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTriggerOpenOrders stores trigger open orders data

type FTriggerOrderData

type FTriggerOrderData struct {
	Data struct {
		OrderID    int64  `json:"order_id"`
		OrderIDStr string `json:"order_id_str"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTriggerOrderData stores trigger order data

type FTriggerOrderHistoryData

type FTriggerOrderHistoryData struct {
	Data struct {
		Orders []struct {
			Symbol          string  `json:"symbol"`
			ContractCode    string  `json:"contract_code"`
			ContractType    string  `json:"contract_type"`
			TriggerType     string  `json:"trigger_type"`
			Volume          float64 `json:"volume"`
			OrderType       int64   `json:"order_type"`
			Direction       string  `json:"direction"`
			Offset          string  `json:"offset"`
			LeverageRate    float64 `json:"lever_rate"`
			OrderID         int64   `json:"order_id"`
			OrderIDString   string  `json:"order_id_str"`
			RelationOrderID string  `json:"relation_order_id"`
			OrderPriceType  string  `json:"order_price_type"`
			Status          string  `json:"status"`
			OrderSource     string  `json:"order_source"`
			TriggerPrice    int64   `json:"trigger_price"`
			TriggeredPrice  float64 `json:"triggered_price"`
			OrderPrice      float64 `json:"order_price"`
			CreatedAt       int64   `json:"created_at"`
			TriggeredAt     int64   `json:"triggered_at"`
			OrderInsertAt   float64 `json:"order_insert_at"`
			CancelledAt     int64   `json:"canceled_at"`
			FailCode        int64   `json:"fail_code"`
			FailReason      string  `json:"fail_reason"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FTriggerOrderHistoryData stores trigger order history for futures

type FUserAccountData

type FUserAccountData struct {
	AccData []struct {
		Symbol            string  `json:"symbol"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		LeverageRate      float64 `json:"lever_rate"`
		AdjustFactor      float64 `json:"adjust_factor"`
		MarginStatic      float64 `json:"margin_static"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FUserAccountData stores user account data info for futures

type FUsersPositionsInfo

type FUsersPositionsInfo struct {
	PosInfo []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		ContractType   string  `json:"contract_type"`
		Volume         float64 `json:"volume"`
		Available      float64 `json:"available"`
		Frozen         float64 `json:"frozen"`
		CostOpen       float64 `json:"cost_open"`
		CostHold       float64 `json:"cost_hold"`
		ProfitUnreal   float64 `json:"profit_unreal"`
		ProfitRate     float64 `json:"profit_rate"`
		Profit         float64 `json:"profit"`
		PositionMargin float64 `json:"position_margin"`
		LeverageRate   float64 `json:"lever_rate"`
		Direction      string  `json:"direction"`
		LastPrice      float64 `json:"last_price"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

FUsersPositionsInfo stores positions data for futures

type FWsReqBasisData

type FWsReqBasisData struct {
	ID        string `json:"id"`
	Rep       string `json:"rep"`
	Timestamp int64  `json:"ts"`
	WsID      int64  `json:"wsid"`
	Tick      struct {
		ID            int64   `json:"id"`
		IndexPrice    float64 `json:"index_price,string"`
		ContractPrice float64 `json:"contract_price,string"`
		Basis         float64 `json:"basis,string"`
		BasisRate     float64 `json:"basis_rate,string"`
	} `json:"tick"`
}

FWsReqBasisData stores requested basis data for futures websocket

type FWsReqKlineIndex

type FWsReqKlineIndex struct {
	ID        string `json:"id"`
	Rep       string `json:"rep"`
	WsID      int64  `json:"wsid"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		ID     int64   `json:"id"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
	} `json:"data"`
}

FWsReqKlineIndex stores requested kline index data for futures websocket

type FWsReqTradeDetail

type FWsReqTradeDetail struct {
	Rep       string `json:"rep"`
	ID        string `json:"id"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		ID        int64   `json:"id"`
		Price     float64 `json:"price"`
		Amount    float64 `json:"amount"`
		Direction string  `json:"direction"`
		Timestamp int64   `json:"ts"`
	} `json:"data"`
}

FWsReqTradeDetail stores requested trade detail data for futures websocket

type FWsRequestKline

type FWsRequestKline struct {
	Rep  string `json:"rep"`
	ID   string `json:"id"`
	WsID int64  `json:"wsid"`
	Tick []struct {
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
		ID     int64   `json:"id"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
	} `json:"tick"`
}

FWsRequestKline stores requested kline data for futures websocket

type FWsSubBasisData

type FWsSubBasisData struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID            int64   `json:"id"`
		IndexPrice    float64 `json:"index_price,string"`
		ContractPrice float64 `json:"contract_price,string"`
		Basis         float64 `json:"basis,string"`
		BasisRate     float64 `json:"basis_rate,string"`
	}
}

FWsSubBasisData stores subscribed basis data for futures websocket

type FWsSubContractInfo

type FWsSubContractInfo struct {
	Operation    string `json:"op"`
	Topic        string `json:"topic"`
	Timestamp    int64  `json:"ts"`
	Event        string `json:"event"`
	ContractData []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		ContractType   string  `json:"contract_type"`
		ContractSize   float64 `json:"contract_size"`
		PriceTick      float64 `json:"price_tick"`
		DeliveryDate   string  `json:"delivery_date"`
		CreateDate     string  `json:"create_date"`
		ContractStatus int64   `json:"contract_status"`
	} `json:"data"`
}

FWsSubContractInfo stores contract info data for futures websocket

type FWsSubEquityUpdates

type FWsSubEquityUpdates struct {
	Operation string `json:"op"`
	Topic     string `json:"topic"`
	UID       string `json:"uid"`
	Timestamp int64  `json:"ts"`
	Event     string `json:"event"`
	Data      []struct {
		Symbol            string  `json:"symbol"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginStatic      int64   `json:"margin_static"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		LeverageRate      float64 `json:"lever_rate"`
		AdjustFactor      float64 `json:"adjust_factor"`
	} `json:"data"`
}

FWsSubEquityUpdates stores account equity updates data for futures websocket

type FWsSubKlineIndex

type FWsSubKlineIndex struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID     string  `json:"id"`
		Open   float64 `json:"open,string"`
		Close  float64 `json:"close,string"`
		High   float64 `json:"high,string"`
		Low    float64 `json:"low,string"`
		Amount float64 `json:"amount,string"`
		Volume float64 `json:"vol,string"`
		Count  float64 `json:"count,string"`
	} `json:"tick"`
}

FWsSubKlineIndex stores subscribed kline index data for futures websocket

type FWsSubLiquidationOrders

type FWsSubLiquidationOrders struct {
	Operation  string `json:"op"`
	Topic      string `json:"topic"`
	Timestamp  int64  `json:"ts"`
	OrdersData []struct {
		Symbol       string  `json:"symbol"`
		ContractCode string  `json:"contract_code"`
		Direction    string  `json:"direction"`
		Offset       string  `json:"offset"`
		Volume       float64 `json:"volume"`
		Price        float64 `json:"price"`
		CreatedAt    int64   `json:"created_at"`
	} `json:"data"`
}

FWsSubLiquidationOrders stores subscribed liquidation orders data for futures websocket

type FWsSubMatchOrderData

type FWsSubMatchOrderData struct {
	Operation     string  `json:"op"`
	Topic         string  `json:"topic"`
	UID           string  `json:"uid"`
	Timestamp     int64   `json:"ts"`
	Symbol        string  `json:"symbol"`
	ContractType  string  `json:"contract_type"`
	ContractCode  string  `json:"contract_code"`
	Status        int64   `json:"status"`
	OrderID       int64   `json:"order_id"`
	OrderIDString string  `json:"order_id_string"`
	OrderType     string  `json:"order_type"`
	Volume        float64 `json:"volume"`
	TradeVolume   float64 `json:"trade_volume"`
	ClientOrderID int64   `json:"client_order_id"`
	Trade         []struct {
		ID            string  `json:"id"`
		TradeID       int64   `json:"trade_id"`
		TradeVolume   float64 `json:"trade_volume"`
		TradePrice    float64 `json:"trade_price"`
		TradeTurnover float64 `json:"trade_turnover"`
		CreatedAt     int64   `json:"created_at"`
		Role          string  `json:"role"`
	}
}

FWsSubMatchOrderData stores subscribed match order data for futures websocket

type FWsSubOrderData

type FWsSubOrderData struct {
	Operation      string  `json:"op"`
	Topic          string  `json:"topic"`
	UID            string  `json:"uid"`
	Timestamp      int64   `json:"ts"`
	Symbol         string  `json:"symbol"`
	ContractType   string  `json:"contract_type"`
	ContractCode   string  `json:"contract_code"`
	Volume         float64 `json:"volume"`
	Price          float64 `json:"price"`
	OrderPriceType string  `json:"order_price_type"`
	Direction      string  `json:"direction"`
	Offset         string  `json:"offset"`
	Status         int64   `json:"status"`
	LeverageRate   int64   `json:"lever_rate"`
	OrderID        int64   `json:"order_id"`
	OrderIDString  string  `json:"order_id_string"`
	ClientOrderID  int64   `json:"client_order_id"`
	OrderSource    string  `json:"order_source"`
	OrderType      int64   `json:"order_type"`
	CreatedAt      int64   `json:"created_at"`
	TradeVolume    float64 `json:"trade_volume"`
	TradeTurnover  float64 `json:"trade_turnover"`
	Fee            float64 `json:"fee"`
	TradeAvgPrice  float64 `json:"trade_avg_price"`
	MarginFrozen   float64 `json:"margin_frozen"`
	Profit         float64 `json:"profit"`
	FeeAsset       string  `json:"fee_asset"`
	CancelledAt    int64   `json:"canceled_at"`
	Trade          []struct {
		ID            string  `json:"id"`
		TradeID       int64   `json:"trade_id"`
		TradeVolume   float64 `json:"trade_volume"`
		TradePrice    float64 `json:"trade_price"`
		TradeFee      float64 `json:"trade_fee"`
		TradeTurnover float64 `json:"trade_turnover"`
		CreatedAt     int64   `json:"created_at"`
		Role          string  `json:"role"`
		FeeAsset      string  `json:"fee_asset"`
	} `json:"trade"`
}

FWsSubOrderData stores subscribed order data for futures websocket

type FWsSubPositionUpdates

type FWsSubPositionUpdates struct {
	Operation     string `json:"op"`
	Topic         string `json:"topic"`
	UID           string `json:"uid"`
	Timestamp     int64  `json:"ts"`
	Event         string `json:"event"`
	PositionsData []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		ContractType   string  `json:"contract_type"`
		Volume         float64 `json:"volume"`
		Available      float64 `json:"available"`
		Frozen         float64 `json:"frozen"`
		CostOpen       float64 `json:"cost_open"`
		CostHold       float64 `json:"cost_hold"`
		ProfitUnreal   float64 `json:"profit_unreal"`
		ProfitRate     float64 `json:"profit_rate"`
		Profit         float64 `json:"profit"`
		PositionMargin float64 `json:"position_margin"`
		LeverageRate   float64 `json:"lever_rate"`
		Direction      string  `json:"direction"`
		LastPrice      float64 `json:"last_price"`
	} `json:"data"`
}

FWsSubPositionUpdates stores subscribed position updates data for futures websocket

type FWsSubTriggerOrderUpdates

type FWsSubTriggerOrderUpdates struct {
	Operation string `json:"op"`
	Topic     string `json:"topic"`
	UID       string `json:"uid"`
	Event     string `json:"event"`
	Data      []struct {
		Symbol          string  `json:"symbol"`
		ContractCode    string  `json:"contract_code"`
		ContractType    string  `json:"contract_type"`
		TriggerType     string  `json:"trigger_type"`
		Volume          float64 `json:"volume"`
		OrderType       int64   `json:"order_type"`
		Direction       string  `json:"direction"`
		Offset          string  `json:"offset"`
		LeverageRate    int64   `json:"lever_rate"`
		OrderID         int64   `json:"order_id"`
		OrderIDString   string  `json:"order_id_str"`
		RelationOrderID string  `json:"relation_order_id"`
		OrderPriceType  string  `json:"order_price_type"`
		Status          int64   `json:"status"`
		OrderSource     string  `json:"order_source"`
		TriggerPrice    float64 `json:"trigger_price"`
		TriggeredPrice  float64 `json:"triggered_price"`
		OrderPrice      float64 `json:"order_price"`
		CreatedAt       int64   `json:"created_at"`
		TriggeredAt     int64   `json:"triggered_at"`
		OrderInsertAt   int64   `json:"order_insert_at"`
		CancelledAt     int64   `json:"canceled_at"`
		FailCode        int64   `json:"fail_code"`
		FailReason      string  `json:"fail_reason"`
	} `json:"data"`
}

FWsSubTriggerOrderUpdates stores subscribed trigger order updates data for futures websocket

type FinancialRecordData

type FinancialRecordData struct {
	Data struct {
		FinancialRecord []struct {
			ID           int64   `json:"id"`
			Timestamp    int64   `json:"ts"`
			Symbol       string  `json:"symbol"`
			ContractCode string  `json:"contract_code"`
			OrderType    int64   `json:"type"`
			Amount       float64 `json:"amount"`
		} `json:"financial_record"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
}

FinancialRecordData stores an accounts financial records

type FundingRatesData

type FundingRatesData struct {
	EstimatedRate   float64 `json:"estimated_rate,string"`
	FundingRate     float64 `json:"funding_rate,string"`
	ContractCode    string  `json:"contractCode"`
	Symbol          string  `json:"symbol"`
	FeeAsset        string  `json:"fee_asset"`
	FundingTime     int64   `json:"fundingTime,string"`
	NextFundingTime int64   `json:"next_funding_time,string"`
}

FundingRatesData stores funding rates data

type FuturesBatchTicker

type FuturesBatchTicker struct {
	ID             float64      `json:"id"`
	Timestamp      int64        `json:"ts"`
	Ask            [2]float64   `json:"ask"`
	Bid            [2]float64   `json:"bid"`
	BusinessType   string       `json:"business_type"`
	ContractCode   string       `json:"contract_code"`
	Open           types.Number `json:"open"`
	Close          types.Number `json:"close"`
	Low            types.Number `json:"low"`
	High           types.Number `json:"high"`
	Amount         types.Number `json:"amount"`
	Count          float64      `json:"count"`
	Volume         types.Number `json:"vol"`
	TradeTurnover  types.Number `json:"trade_turnover"`
	TradePartition string       `json:"trade_partition"`
	Symbol         string       `json:"symbol"` // If ContractCode is empty, Symbol is populated
}

FuturesBatchTicker holds ticker data

type FuturesTrade

type FuturesTrade struct {
	Amount    float64 `json:"amount"`
	Direction string  `json:"direction"`
	ID        int64   `json:"id"`
	Price     float64 `json:"price"`
	Timestamp int64   `json:"ts"`
}

FuturesTrade is futures trade data

type HUOBI

type HUOBI struct {
	exchange.Base
	AccountID string
}

HUOBI is the overarching type across this package

func (*HUOBI) AccountTransferData

func (h *HUOBI) AccountTransferData(ctx context.Context, code currency.Pair, subUID, transferType string, amount float64) (InternalAccountTransferData, error)

AccountTransferData gets asset transfer data between master and subaccounts

func (*HUOBI) AccountTransferRecords

func (h *HUOBI) AccountTransferRecords(ctx context.Context, code currency.Pair, transferType string, createDate, pageIndex, pageSize int64) (InternalAccountTransferData, error)

AccountTransferRecords gets asset transfer records between master and subaccounts

func (*HUOBI) AuthenticateWebsocket

func (h *HUOBI) AuthenticateWebsocket(ctx context.Context) error

AuthenticateWebsocket sends an authentication message to the websocket

func (*HUOBI) CancelAllOrders

func (h *HUOBI) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*HUOBI) CancelAllSwapOrders

func (h *HUOBI) CancelAllSwapOrders(ctx context.Context, contractCode currency.Pair) (CancelOrdersData, error)

CancelAllSwapOrders sends a request to cancel an order

func (*HUOBI) CancelAllSwapTriggerOrders

func (h *HUOBI) CancelAllSwapTriggerOrders(ctx context.Context, contractCode currency.Pair) (CancelTriggerOrdersData, error)

CancelAllSwapTriggerOrders cancels all swap trigger orders

func (*HUOBI) CancelBatchOrders

func (h *HUOBI) CancelBatchOrders(ctx context.Context, o []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*HUOBI) CancelExistingOrder

func (h *HUOBI) CancelExistingOrder(ctx context.Context, orderID int64) (int64, error)

CancelExistingOrder cancels an order on Huobi

func (*HUOBI) CancelOpenOrdersBatch

func (h *HUOBI) CancelOpenOrdersBatch(ctx context.Context, accountID string, symbol currency.Pair) (CancelOpenOrdersBatch, error)

CancelOpenOrdersBatch cancels a batch of orders -- to-do

func (*HUOBI) CancelOrder

func (h *HUOBI) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*HUOBI) CancelOrderBatch

func (h *HUOBI) CancelOrderBatch(ctx context.Context, orderIDs, clientOrderIDs []string) (*CancelOrderBatch, error)

CancelOrderBatch cancels a batch of orders

func (*HUOBI) CancelSwapOrder

func (h *HUOBI) CancelSwapOrder(ctx context.Context, orderID, clientOrderID string, contractCode currency.Pair) (CancelOrdersData, error)

CancelSwapOrder sends a request to cancel an order

func (*HUOBI) CancelSwapTriggerOrder

func (h *HUOBI) CancelSwapTriggerOrder(ctx context.Context, contractCode currency.Pair, orderID string) (CancelTriggerOrdersData, error)

CancelSwapTriggerOrder cancels swap trigger order

func (*HUOBI) CancelWithdraw

func (h *HUOBI) CancelWithdraw(ctx context.Context, withdrawID int64) (int64, error)

CancelWithdraw cancels a withdraw request

func (*HUOBI) ContractOpenInterestUSDT

func (h *HUOBI) ContractOpenInterestUSDT(ctx context.Context, contractCode, pair currency.Pair, contractType, businessType string) ([]UContractOpenInterest, error)

ContractOpenInterestUSDT gets open interest data for futures contracts

func (*HUOBI) FCancelAllOrders

func (h *HUOBI) FCancelAllOrders(ctx context.Context, contractCode currency.Pair, symbol, contractType string) (FCancelOrderData, error)

FCancelAllOrders cancels all futures order for a given symbol

func (*HUOBI) FCancelAllTriggerOrders

func (h *HUOBI) FCancelAllTriggerOrders(ctx context.Context, contractCode currency.Pair, symbol, contractType string) (FCancelOrderData, error)

FCancelAllTriggerOrders cancels all trigger order for futures

func (*HUOBI) FCancelOrder

func (h *HUOBI) FCancelOrder(ctx context.Context, baseCurrency currency.Code, orderID, clientOrderID string) (FCancelOrderData, error)

FCancelOrder cancels a futures order

func (*HUOBI) FCancelTriggerOrder

func (h *HUOBI) FCancelTriggerOrder(ctx context.Context, symbol, orderID string) (FCancelOrderData, error)

FCancelTriggerOrder cancels trigger order for futures

func (*HUOBI) FContractOpenInterest

func (h *HUOBI) FContractOpenInterest(ctx context.Context, symbol, contractType string, code currency.Pair) (FContractOIData, error)

FContractOpenInterest gets open interest data for futures contracts

func (*HUOBI) FContractPriceLimitations

func (h *HUOBI) FContractPriceLimitations(ctx context.Context, symbol, contractType string, code currency.Pair) (FContractIndexPriceInfo, error)

FContractPriceLimitations gets price limits for a futures contract

func (*HUOBI) FContractTradingFee

func (h *HUOBI) FContractTradingFee(ctx context.Context, symbol currency.Code) (FContractTradingFeeData, error)

FContractTradingFee gets futures contract trading fees

func (*HUOBI) FFlashCloseOrder

func (h *HUOBI) FFlashCloseOrder(ctx context.Context, contractCode currency.Pair, symbol, contractType, direction, orderPriceType, clientOrderID string, volume float64) (FOrderData, error)

FFlashCloseOrder flash closes a futures order

func (*HUOBI) FGetAccountInfo

func (h *HUOBI) FGetAccountInfo(ctx context.Context, symbol currency.Code) (FUserAccountData, error)

FGetAccountInfo gets user info for futures account

func (*HUOBI) FGetAllSubAccountAssets

func (h *HUOBI) FGetAllSubAccountAssets(ctx context.Context, symbol currency.Code) (FSubAccountAssetsInfo, error)

FGetAllSubAccountAssets gets assets info for all futures subaccounts

func (*HUOBI) FGetAssetsAndPositions

func (h *HUOBI) FGetAssetsAndPositions(ctx context.Context, symbol currency.Code) (FAssetsAndPositionsData, error)

FGetAssetsAndPositions gets assets and positions for futures

func (*HUOBI) FGetAvailableLeverage

func (h *HUOBI) FGetAvailableLeverage(ctx context.Context, symbol currency.Code) (FAvailableLeverageData, error)

FGetAvailableLeverage gets available leverage data for futures

func (*HUOBI) FGetBasisData

func (h *HUOBI) FGetBasisData(ctx context.Context, symbol currency.Pair, period, basisPriceType string, size int64) (FBasisData, error)

FGetBasisData gets basis data futures contracts

func (*HUOBI) FGetContractInfo

func (h *HUOBI) FGetContractInfo(ctx context.Context, symbol, contractType string, code currency.Pair) (FContractInfoData, error)

FGetContractInfo gets contract info for futures

func (*HUOBI) FGetEstimatedDeliveryPrice

func (h *HUOBI) FGetEstimatedDeliveryPrice(ctx context.Context, symbol currency.Code) (FEstimatedDeliveryPriceInfo, error)

FGetEstimatedDeliveryPrice gets estimated delivery price info for futures

func (*HUOBI) FGetFinancialRecords

func (h *HUOBI) FGetFinancialRecords(ctx context.Context, symbol, recordType string, createDate, pageIndex, pageSize int64) (FFinancialRecords, error)

FGetFinancialRecords gets financial records for futures

func (*HUOBI) FGetKlineData

func (h *HUOBI) FGetKlineData(ctx context.Context, symbol currency.Pair, period string, size int64, startTime, endTime time.Time) (FKlineData, error)

FGetKlineData gets kline data for futures

func (*HUOBI) FGetMarketDepth

func (h *HUOBI) FGetMarketDepth(ctx context.Context, symbol currency.Pair, dataType string) (*OBData, error)

FGetMarketDepth gets market depth data for futures contracts

func (*HUOBI) FGetMarketOverviewData

func (h *HUOBI) FGetMarketOverviewData(ctx context.Context, symbol currency.Pair) (FMarketOverviewData, error)

FGetMarketOverviewData gets market overview data for futures

func (*HUOBI) FGetOpenOrders

func (h *HUOBI) FGetOpenOrders(ctx context.Context, symbol currency.Code, pageIndex, pageSize int64) (FOpenOrdersData, error)

FGetOpenOrders gets order details for futures orders

func (*HUOBI) FGetOrderHistory

func (h *HUOBI) FGetOrderHistory(ctx context.Context, contractCode currency.Pair, symbol, tradeType, reqType, orderType string, status []order.Status, createDate, pageIndex, pageSize int64) (FOrderHistoryData, error)

FGetOrderHistory gets order history for futures

func (*HUOBI) FGetOrderInfo

func (h *HUOBI) FGetOrderInfo(ctx context.Context, symbol, clientOrderID, orderID string) (FOrderInfo, error)

FGetOrderInfo gets order info for futures

func (*HUOBI) FGetOrderLimits

func (h *HUOBI) FGetOrderLimits(ctx context.Context, symbol, orderPriceType string) (FContractInfoOnOrderLimit, error)

FGetOrderLimits gets order limits for futures contracts

func (*HUOBI) FGetPositionLimits

func (h *HUOBI) FGetPositionLimits(ctx context.Context, symbol currency.Code) (FPositionLimitData, error)

FGetPositionLimits gets position limits for futures

func (*HUOBI) FGetPositionsInfo

func (h *HUOBI) FGetPositionsInfo(ctx context.Context, symbol currency.Code) (FUsersPositionsInfo, error)

FGetPositionsInfo gets positions info for futures account

func (*HUOBI) FGetSettlementRecords

func (h *HUOBI) FGetSettlementRecords(ctx context.Context, symbol currency.Code, pageIndex, pageSize int64, startTime, endTime time.Time) (FSettlementRecords, error)

FGetSettlementRecords gets settlement records for futures

func (*HUOBI) FGetSingleSubAccountInfo

func (h *HUOBI) FGetSingleSubAccountInfo(ctx context.Context, symbol, subUID string) (FSingleSubAccountAssetsInfo, error)

FGetSingleSubAccountInfo gets assets info for a futures subaccount

func (*HUOBI) FGetSingleSubPositions

func (h *HUOBI) FGetSingleSubPositions(ctx context.Context, symbol, subUID string) (FSingleSubAccountPositionsInfo, error)

FGetSingleSubPositions gets positions info for a single sub account

func (*HUOBI) FGetTransferLimits

func (h *HUOBI) FGetTransferLimits(ctx context.Context, symbol currency.Code) (FTransferLimitData, error)

FGetTransferLimits gets transfer limits for futures

func (*HUOBI) FGetTransferRecords

func (h *HUOBI) FGetTransferRecords(ctx context.Context, symbol, transferType string, createDate, pageIndex, pageSize int64) (FTransferRecords, error)

FGetTransferRecords gets transfer records data for futures

func (*HUOBI) FIndexKline

func (h *HUOBI) FIndexKline(ctx context.Context, symbol currency.Pair, period string, size int64) (FIndexKlineData, error)

FIndexKline gets index kline data for futures contracts

func (*HUOBI) FIndexPriceInfo

func (h *HUOBI) FIndexPriceInfo(ctx context.Context, symbol currency.Code) (FContractIndexPriceInfo, error)

FIndexPriceInfo gets index price info for a futures contract

func (*HUOBI) FLastTradeData

func (h *HUOBI) FLastTradeData(ctx context.Context, symbol currency.Pair) (FLastTradeData, error)

FLastTradeData gets last trade data for a futures contract

func (*HUOBI) FLiquidationOrders

func (h *HUOBI) FLiquidationOrders(ctx context.Context, symbol currency.Code, tradeType string, startTime, endTime int64, direction string, fromID int64) (LiquidationOrdersData, error)

FLiquidationOrders gets liquidation orders for futures contracts

func (*HUOBI) FOrder

func (h *HUOBI) FOrder(ctx context.Context, contractCode currency.Pair, symbol, contractType, clientOrderID, direction, offset, orderPriceType string, price, volume, leverageRate float64) (FOrderData, error)

FOrder places an order for futures

func (*HUOBI) FOrderDetails

func (h *HUOBI) FOrderDetails(ctx context.Context, symbol, orderID, orderType string, createdAt time.Time, pageIndex, pageSize int64) (FOrderDetailsData, error)

FOrderDetails gets order details for futures orders

func (*HUOBI) FPlaceBatchOrder

func (h *HUOBI) FPlaceBatchOrder(ctx context.Context, data []fBatchOrderData) (FBatchOrderResponse, error)

FPlaceBatchOrder places a batch of orders for futures

func (*HUOBI) FPlaceTriggerOrder

func (h *HUOBI) FPlaceTriggerOrder(ctx context.Context, contractCode currency.Pair, symbol, contractType, triggerType, orderPriceType, direction, offset string, triggerPrice, orderPrice, volume, leverageRate float64) (FTriggerOrderData, error)

FPlaceTriggerOrder places a trigger order for futures

func (*HUOBI) FQueryHisOpenInterest

func (h *HUOBI) FQueryHisOpenInterest(ctx context.Context, symbol, contractType, period, amountType string, size int64) (FOIData, error)

FQueryHisOpenInterest gets open interest for futures contract

func (*HUOBI) FQueryHistoricalInsuranceData

func (h *HUOBI) FQueryHistoricalInsuranceData(ctx context.Context, symbol currency.Code) (FHistoricalInsuranceRecordsData, error)

FQueryHistoricalInsuranceData gets insurance data

func (*HUOBI) FQueryInsuranceAndClawbackData

func (h *HUOBI) FQueryInsuranceAndClawbackData(ctx context.Context, symbol currency.Code) (FClawbackRateAndInsuranceData, error)

FQueryInsuranceAndClawbackData gets insurance and clawback data for a futures contract

func (*HUOBI) FQuerySystemStatus

func (h *HUOBI) FQuerySystemStatus(ctx context.Context, symbol currency.Code) (FContractOIData, error)

FQuerySystemStatus gets system status data

func (*HUOBI) FQueryTieredAdjustmentFactor

func (h *HUOBI) FQueryTieredAdjustmentFactor(ctx context.Context, symbol currency.Code) (FTieredAdjustmentFactorInfo, error)

FQueryTieredAdjustmentFactor gets tiered adjustment factor for futures contracts

func (*HUOBI) FQueryTopAccountsRatio

func (h *HUOBI) FQueryTopAccountsRatio(ctx context.Context, symbol, period string) (FTopAccountsLongShortRatio, error)

FQueryTopAccountsRatio gets top accounts' ratio

func (*HUOBI) FQueryTopPositionsRatio

func (h *HUOBI) FQueryTopPositionsRatio(ctx context.Context, symbol, period string) (FTopPositionsLongShortRatio, error)

FQueryTopPositionsRatio gets top positions' long/short ratio for futures

func (*HUOBI) FQueryTriggerOpenOrders

func (h *HUOBI) FQueryTriggerOpenOrders(ctx context.Context, contractCode currency.Pair, symbol string, pageIndex, pageSize int64) (FTriggerOpenOrders, error)

FQueryTriggerOpenOrders queries open trigger orders for futures

func (*HUOBI) FQueryTriggerOrderHistory

func (h *HUOBI) FQueryTriggerOrderHistory(ctx context.Context, contractCode currency.Pair, symbol, tradeType, status string, createDate, pageIndex, pageSize int64) (FTriggerOrderHistoryData, error)

FQueryTriggerOrderHistory queries trigger order history for futures

func (*HUOBI) FRequestPublicBatchTrades

func (h *HUOBI) FRequestPublicBatchTrades(ctx context.Context, symbol currency.Pair, size int64) (FBatchTradesForContractData, error)

FRequestPublicBatchTrades gets public batch trades for a futures contract

func (*HUOBI) FTradeHistory

func (h *HUOBI) FTradeHistory(ctx context.Context, contractCode currency.Pair, symbol, tradeType string, createDate, pageIndex, pageSize int64) (FOrderHistoryData, error)

FTradeHistory gets trade history data for futures

func (*HUOBI) FTransfer

func (h *HUOBI) FTransfer(ctx context.Context, subUID, symbol, transferType string, amount float64) (FAccountTransferData, error)

FTransfer transfers assets between master and subaccounts

func (*HUOBI) FetchAccountInfo

func (h *HUOBI) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*HUOBI) FetchOrderbook

func (h *HUOBI) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*HUOBI) FetchTicker

func (h *HUOBI) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*HUOBI) FetchTradablePairs

func (h *HUOBI) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*HUOBI) FormatExchangeKlineInterval

func (h *HUOBI) FormatExchangeKlineInterval(in kline.Interval) string

FormatExchangeKlineInterval returns Interval to exchange formatted string

func (*HUOBI) FuturesAuthenticatedHTTPRequest

func (h *HUOBI) FuturesAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint string, values url.Values, data, result interface{}) error

FuturesAuthenticatedHTTPRequest sends authenticated requests to the HUOBI API

func (*HUOBI) GenerateDefaultSubscriptions

func (h *HUOBI) GenerateDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*HUOBI) Get24HrMarketSummary

func (h *HUOBI) Get24HrMarketSummary(ctx context.Context, symbol currency.Pair) (MarketSummary24Hr, error)

Get24HrMarketSummary returns 24hr market summary for a given market symbol

func (*HUOBI) GetAccountBalance

func (h *HUOBI) GetAccountBalance(ctx context.Context, accountID string) ([]AccountBalanceDetail, error)

GetAccountBalance returns the users Huobi account balance

func (*HUOBI) GetAccountFinancialRecords

func (h *HUOBI) GetAccountFinancialRecords(ctx context.Context, code currency.Pair, orderType string, createDate, pageIndex, pageSize int64) (FinancialRecordData, error)

GetAccountFinancialRecords gets the account's financial records

func (*HUOBI) GetAccountFundingHistory

func (h *HUOBI) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*HUOBI) GetAccountID

func (h *HUOBI) GetAccountID(ctx context.Context) ([]Account, error)

GetAccountID returns the account ID for trades

func (*HUOBI) GetAccounts

func (h *HUOBI) GetAccounts(ctx context.Context) ([]Account, error)

GetAccounts returns the Huobi user accounts

func (*HUOBI) GetActiveOrders

func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*HUOBI) GetAggregatedBalance

func (h *HUOBI) GetAggregatedBalance(ctx context.Context) ([]AggregatedBalance, error)

GetAggregatedBalance returns the balances of all the sub-account aggregated.

func (*HUOBI) GetAvailableLeverage

func (h *HUOBI) GetAvailableLeverage(ctx context.Context, code currency.Pair) (AvailableLeverageData, error)

GetAvailableLeverage gets user's available leverage data

func (*HUOBI) GetAvailableTransferChains

func (h *HUOBI) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)

GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency

func (*HUOBI) GetBasisData

func (h *HUOBI) GetBasisData(ctx context.Context, code currency.Pair, period, basisPriceType string, size int64) (BasisData, error)

GetBasisData gets basis data for perpetual futures

func (*HUOBI) GetBatchCoinMarginSwapContracts

func (h *HUOBI) GetBatchCoinMarginSwapContracts(ctx context.Context) ([]FuturesBatchTicker, error)

GetBatchCoinMarginSwapContracts returns the tickers for coin margined swap contracts

func (*HUOBI) GetBatchFuturesContracts

func (h *HUOBI) GetBatchFuturesContracts(ctx context.Context) ([]FuturesBatchTicker, error)

GetBatchFuturesContracts returns the tickers for futures contracts

func (*HUOBI) GetBatchLinearSwapContracts

func (h *HUOBI) GetBatchLinearSwapContracts(ctx context.Context) ([]FuturesBatchTicker, error)

GetBatchLinearSwapContracts returns the tickers for linear swap contracts

func (*HUOBI) GetBatchTrades

func (h *HUOBI) GetBatchTrades(ctx context.Context, code currency.Pair, size int64) (BatchTradesData, error)

GetBatchTrades gets batch trades for a specified contract (fetching size cannot be bigger than 2000)

func (*HUOBI) GetCurrencies

func (h *HUOBI) GetCurrencies(ctx context.Context) ([]string, error)

GetCurrencies returns a list of currencies supported by Huobi

func (*HUOBI) GetCurrenciesIncludingChains

func (h *HUOBI) GetCurrenciesIncludingChains(ctx context.Context, curr currency.Code) ([]CurrenciesChainData, error)

GetCurrenciesIncludingChains returns currency and chain data

func (*HUOBI) GetCurrencyTradeURL

func (h *HUOBI) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the UR˜L to the exchange's trade page for the given asset and currency pair

func (*HUOBI) GetCurrentServerTime

func (h *HUOBI) GetCurrentServerTime(ctx context.Context) (time.Time, error)

GetCurrentServerTime returns the Huobi server time

func (*HUOBI) GetDepositAddress

func (h *HUOBI) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*HUOBI) GetDepth

func (h *HUOBI) GetDepth(ctx context.Context, obd *OrderBookDataRequestParams) (*Orderbook, error)

GetDepth returns the depth for the specified symbol

func (*HUOBI) GetEstimatedFundingRates

func (h *HUOBI) GetEstimatedFundingRates(ctx context.Context, code currency.Pair, period string, size int64) (EstimatedFundingRateData, error)

GetEstimatedFundingRates gets estimated funding rates for perpetual futures

func (*HUOBI) GetFee

func (h *HUOBI) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*HUOBI) GetFeeByType

func (h *HUOBI) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*HUOBI) GetFuturesContractDetails

func (h *HUOBI) GetFuturesContractDetails(ctx context.Context, item asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns details about futures contracts

func (*HUOBI) GetHistoricCandles

func (h *HUOBI) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*HUOBI) GetHistoricCandlesExtended

func (h *HUOBI) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*HUOBI) GetHistoricTrades

func (h *HUOBI) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*HUOBI) GetHistoricalFundingRatesForPair

func (h *HUOBI) GetHistoricalFundingRatesForPair(ctx context.Context, code currency.Pair, pageSize, pageIndex int64) (HistoricalFundingRateData, error)

GetHistoricalFundingRatesForPair gets historical funding rates for perpetual futures

func (*HUOBI) GetHistoricalInsuranceData

func (h *HUOBI) GetHistoricalInsuranceData(ctx context.Context, code currency.Pair, pageIndex, pageSize int64) (HistoricalInsuranceFundBalance, error)

GetHistoricalInsuranceData gets historical insurance fund data and clawback rates

func (*HUOBI) GetInsuranceData

func (h *HUOBI) GetInsuranceData(ctx context.Context, code currency.Pair) (InsuranceAndClawbackData, error)

GetInsuranceData gets insurance fund data and clawback rates

func (*HUOBI) GetLastTrade

func (h *HUOBI) GetLastTrade(ctx context.Context, code currency.Pair) (LastTradeData, error)

GetLastTrade gets the last trade for a given perpetual contract

func (*HUOBI) GetLatestFundingRates

func (h *HUOBI) GetLatestFundingRates(ctx context.Context, r *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)

GetLatestFundingRates returns the latest funding rates data

func (*HUOBI) GetLatestSpotPrice

func (h *HUOBI) GetLatestSpotPrice(ctx context.Context, symbol currency.Pair) (float64, error)

GetLatestSpotPrice returns latest spot price of symbol

symbol: string of currency pair

func (*HUOBI) GetLiquidationOrders

func (h *HUOBI) GetLiquidationOrders(ctx context.Context, contract currency.Pair, tradeType string, startTime, endTime int64, direction string, fromID int64) (LiquidationOrdersData, error)

GetLiquidationOrders gets liquidation orders for a given perp

func (*HUOBI) GetMarginAccountBalance

func (h *HUOBI) GetMarginAccountBalance(ctx context.Context, symbol currency.Pair) ([]MarginAccountBalance, error)

GetMarginAccountBalance returns the margin account balances

func (*HUOBI) GetMarginLoanOrders

func (h *HUOBI) GetMarginLoanOrders(ctx context.Context, symbol currency.Pair, currency, start, end, states, from, direct, size string) ([]MarginOrder, error)

GetMarginLoanOrders returns the margin loan orders

func (*HUOBI) GetMarginRates

func (h *HUOBI) GetMarginRates(ctx context.Context, symbol currency.Pair) (MarginRatesData, error)

GetMarginRates gets margin rates

func (*HUOBI) GetMarketDetail

func (h *HUOBI) GetMarketDetail(ctx context.Context, symbol currency.Pair) (Detail, error)

GetMarketDetail returns the ticker for the specified symbol

func (*HUOBI) GetMarketDetailMerged

func (h *HUOBI) GetMarketDetailMerged(ctx context.Context, symbol currency.Pair) (DetailMerged, error)

GetMarketDetailMerged returns the ticker for the specified symbol

func (*HUOBI) GetOpenInterest

func (h *HUOBI) GetOpenInterest(ctx context.Context, k ...key.PairAsset) ([]futures.OpenInterest, error)

GetOpenInterest returns the open interest rate for a given asset pair

func (*HUOBI) GetOpenInterestInfo

func (h *HUOBI) GetOpenInterestInfo(ctx context.Context, code currency.Pair, period, amountType string, size int64) (OpenInterestData, error)

GetOpenInterestInfo gets open interest data

func (*HUOBI) GetOpenOrders

func (h *HUOBI) GetOpenOrders(ctx context.Context, symbol currency.Pair, accountID, side string, size int64) ([]OrderInfo, error)

GetOpenOrders returns a list of orders

func (*HUOBI) GetOrder

func (h *HUOBI) GetOrder(ctx context.Context, orderID int64) (OrderInfo, error)

GetOrder returns order information for the specified order

func (*HUOBI) GetOrderHistory

func (h *HUOBI) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*HUOBI) GetOrderInfo

func (h *HUOBI) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*HUOBI) GetOrderMatchResults

func (h *HUOBI) GetOrderMatchResults(ctx context.Context, orderID int64) ([]OrderMatchInfo, error)

GetOrderMatchResults returns matched order info for the specified order

func (*HUOBI) GetOrders

func (h *HUOBI) GetOrders(ctx context.Context, symbol currency.Pair, types, start, end, states, from, direct, size string) ([]OrderInfo, error)

GetOrders returns a list of orders

func (*HUOBI) GetOrdersMatch

func (h *HUOBI) GetOrdersMatch(ctx context.Context, symbol currency.Pair, types, start, end, from, direct, size string) ([]OrderMatchInfo, error)

GetOrdersMatch returns a list of matched orders

func (*HUOBI) GetPremiumIndexKlineData

func (h *HUOBI) GetPremiumIndexKlineData(ctx context.Context, code currency.Pair, period string, size int64) (PremiumIndexKlineData, error)

GetPremiumIndexKlineData gets kline data for premium index

func (*HUOBI) GetRecentTrades

func (h *HUOBI) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*HUOBI) GetServerTime

func (h *HUOBI) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*HUOBI) GetSpotKline

func (h *HUOBI) GetSpotKline(ctx context.Context, arg KlinesRequestParams) ([]KlineItem, error)

GetSpotKline returns kline data KlinesRequestParams contains symbol currency.Pair, period and size

func (*HUOBI) GetSubAccPositionInfo

func (h *HUOBI) GetSubAccPositionInfo(ctx context.Context, code currency.Pair, subUID int64) (SingleSubAccountPositionsInfo, error)

GetSubAccPositionInfo gets a subaccount's positions info

func (*HUOBI) GetSwapAccountInfo

func (h *HUOBI) GetSwapAccountInfo(ctx context.Context, code currency.Pair) (SwapAccountInformation, error)

GetSwapAccountInfo gets swap account info

func (*HUOBI) GetSwapAllSubAccAssets

func (h *HUOBI) GetSwapAllSubAccAssets(ctx context.Context, code currency.Pair) (SubAccountsAssetData, error)

GetSwapAllSubAccAssets gets asset info for all subaccounts

func (*HUOBI) GetSwapAssetsAndPositions

func (h *HUOBI) GetSwapAssetsAndPositions(ctx context.Context, code currency.Pair) (SwapAssetsAndPositionsData, error)

GetSwapAssetsAndPositions gets swap positions and asset info

func (*HUOBI) GetSwapFundingRate

func (h *HUOBI) GetSwapFundingRate(ctx context.Context, contract currency.Pair) (FundingRatesData, error)

GetSwapFundingRate gets funding rate data for one currency

func (*HUOBI) GetSwapFundingRates

func (h *HUOBI) GetSwapFundingRates(ctx context.Context) (SwapFundingRatesResponse, error)

GetSwapFundingRates gets funding rates data

func (*HUOBI) GetSwapKlineData

func (h *HUOBI) GetSwapKlineData(ctx context.Context, code currency.Pair, period string, size int64, startTime, endTime time.Time) (SwapKlineData, error)

GetSwapKlineData gets kline data for perpetual futures

func (*HUOBI) GetSwapMarketDepth

func (h *HUOBI) GetSwapMarketDepth(ctx context.Context, code currency.Pair, dataType string) (SwapMarketDepthData, error)

GetSwapMarketDepth gets market depth for perpetual futures

func (*HUOBI) GetSwapMarketOverview

func (h *HUOBI) GetSwapMarketOverview(ctx context.Context, code currency.Pair) (MarketOverviewData, error)

GetSwapMarketOverview gets market data overview for perpetual futures

func (*HUOBI) GetSwapMarkets

func (h *HUOBI) GetSwapMarkets(ctx context.Context, contract currency.Pair) ([]SwapMarketsData, error)

GetSwapMarkets gets data of swap markets

func (*HUOBI) GetSwapOpenOrders

func (h *HUOBI) GetSwapOpenOrders(ctx context.Context, contractCode currency.Pair, pageIndex, pageSize int64) (SwapOpenOrdersData, error)

GetSwapOpenOrders gets open orders for swap

func (*HUOBI) GetSwapOrderDetails

func (h *HUOBI) GetSwapOrderDetails(ctx context.Context, contractCode currency.Pair, orderID, createdAt, orderType string, pageIndex, pageSize int64) (SwapOrderData, error)

GetSwapOrderDetails gets order info

func (*HUOBI) GetSwapOrderHistory

func (h *HUOBI) GetSwapOrderHistory(ctx context.Context, contractCode currency.Pair, tradeType, reqType string, status []order.Status, createDate, pageIndex, pageSize int64) (SwapOrderHistory, error)

GetSwapOrderHistory gets swap order history

func (*HUOBI) GetSwapOrderInfo

func (h *HUOBI) GetSwapOrderInfo(ctx context.Context, contractCode currency.Pair, orderID, clientOrderID string) (SwapOrderInfo, error)

GetSwapOrderInfo gets info on a swap order

func (*HUOBI) GetSwapOrderLimitInfo

func (h *HUOBI) GetSwapOrderLimitInfo(ctx context.Context, code currency.Pair, orderType string) (SwapOrderLimitInfo, error)

GetSwapOrderLimitInfo gets order limit info for swaps

func (*HUOBI) GetSwapPositionLimitInfo

func (h *HUOBI) GetSwapPositionLimitInfo(ctx context.Context, code currency.Pair) (PositionLimitData, error)

GetSwapPositionLimitInfo gets transfer limit info for swaps

func (*HUOBI) GetSwapPositionsInfo

func (h *HUOBI) GetSwapPositionsInfo(ctx context.Context, code currency.Pair) (SwapPositionInfo, error)

GetSwapPositionsInfo gets swap positions' info

func (*HUOBI) GetSwapPriceLimits

func (h *HUOBI) GetSwapPriceLimits(ctx context.Context, code currency.Pair) (SwapPriceLimitsData, error)

GetSwapPriceLimits gets price caps for perpetual futures

func (*HUOBI) GetSwapSettlementRecords

func (h *HUOBI) GetSwapSettlementRecords(ctx context.Context, code currency.Pair, startTime, endTime time.Time, pageIndex, pageSize int64) (FinancialRecordData, error)

GetSwapSettlementRecords gets the swap account's settlement records

func (*HUOBI) GetSwapTradeHistory

func (h *HUOBI) GetSwapTradeHistory(ctx context.Context, contractCode currency.Pair, tradeType string, createDate, pageIndex, pageSize int64) (AccountTradeHistoryData, error)

GetSwapTradeHistory gets swap trade history

func (*HUOBI) GetSwapTradingFeeInfo

func (h *HUOBI) GetSwapTradingFeeInfo(ctx context.Context, code currency.Pair) (SwapTradingFeeData, error)

GetSwapTradingFeeInfo gets trading fee info for swaps

func (*HUOBI) GetSwapTransferLimitInfo

func (h *HUOBI) GetSwapTransferLimitInfo(ctx context.Context, code currency.Pair) (TransferLimitData, error)

GetSwapTransferLimitInfo gets transfer limit info for swaps

func (*HUOBI) GetSwapTriggerOrderHistory

func (h *HUOBI) GetSwapTriggerOrderHistory(ctx context.Context, contractCode currency.Pair, status, tradeType string, createDate, pageIndex, pageSize int64) (TriggerOrderHistory, error)

GetSwapTriggerOrderHistory gets history for swap trigger orders

func (*HUOBI) GetSymbols

func (h *HUOBI) GetSymbols(ctx context.Context) ([]Symbol, error)

GetSymbols returns an array of symbols supported by Huobi

func (*HUOBI) GetSystemStatusInfo

func (h *HUOBI) GetSystemStatusInfo(ctx context.Context, code currency.Pair) (SystemStatusData, error)

GetSystemStatusInfo gets system status data

func (*HUOBI) GetTickers

func (h *HUOBI) GetTickers(ctx context.Context) (Tickers, error)

GetTickers returns the ticker for the specified symbol

func (*HUOBI) GetTieredAjustmentFactorInfo

func (h *HUOBI) GetTieredAjustmentFactorInfo(ctx context.Context, code currency.Pair) (TieredAdjustmentFactorData, error)

GetTieredAjustmentFactorInfo gets tiered adjustment factor data

func (*HUOBI) GetTradeHistory

func (h *HUOBI) GetTradeHistory(ctx context.Context, symbol currency.Pair, size int64) ([]TradeHistory, error)

GetTradeHistory returns the trades for the specified symbol

func (*HUOBI) GetTraderSentimentIndexAccount

func (h *HUOBI) GetTraderSentimentIndexAccount(ctx context.Context, code currency.Pair, period string) (TraderSentimentIndexAccountData, error)

GetTraderSentimentIndexAccount gets top trader sentiment function-account

func (*HUOBI) GetTraderSentimentIndexPosition

func (h *HUOBI) GetTraderSentimentIndexPosition(ctx context.Context, code currency.Pair, period string) (TraderSentimentIndexPositionData, error)

GetTraderSentimentIndexPosition gets top trader sentiment function-position

func (*HUOBI) GetTrades

func (h *HUOBI) GetTrades(ctx context.Context, symbol currency.Pair) ([]Trade, error)

GetTrades returns the trades for the specified symbol

func (*HUOBI) GetWithdrawalsHistory

func (h *HUOBI) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*HUOBI) IsPerpetualFutureCurrency

func (h *HUOBI) IsPerpetualFutureCurrency(a asset.Item, _ currency.Pair) (bool, error)

IsPerpetualFutureCurrency ensures a given asset and currency is a perpetual future

func (*HUOBI) MarginOrder

func (h *HUOBI) MarginOrder(ctx context.Context, symbol currency.Pair, currency string, amount float64) (int64, error)

MarginOrder submits a margin order application

func (*HUOBI) MarginRepayment

func (h *HUOBI) MarginRepayment(ctx context.Context, orderID int64, amount float64) (int64, error)

MarginRepayment repays a margin amount for a margin ID

func (*HUOBI) MarginTransfer

func (h *HUOBI) MarginTransfer(ctx context.Context, symbol currency.Pair, currency string, amount float64, in bool) (int64, error)

MarginTransfer transfers assets into or out of the margin account

func (*HUOBI) ModifyOrder

func (h *HUOBI) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*HUOBI) PlaceLightningCloseOrder

func (h *HUOBI) PlaceLightningCloseOrder(ctx context.Context, contractCode currency.Pair, direction, orderPriceType string, volume float64, clientOrderID int64) (LightningCloseOrderData, error)

PlaceLightningCloseOrder places a lightning close order

func (*HUOBI) PlaceSwapBatchOrders

func (h *HUOBI) PlaceSwapBatchOrders(ctx context.Context, data BatchOrderRequestType) (BatchOrderData, error)

PlaceSwapBatchOrders places a batch of orders for swaps

func (*HUOBI) PlaceSwapOrders

func (h *HUOBI) PlaceSwapOrders(ctx context.Context, code currency.Pair, clientOrderID, direction, offset, orderPriceType string, price, volume, leverage float64) (SwapOrderData, error)

PlaceSwapOrders places orders for swaps

func (*HUOBI) PlaceSwapTriggerOrder

func (h *HUOBI) PlaceSwapTriggerOrder(ctx context.Context, contractCode currency.Pair, triggerType, direction, offset, orderPriceType string, triggerPrice, orderPrice, volume, leverageRate float64) (AccountTradeHistoryData, error)

PlaceSwapTriggerOrder places a trigger order for a swap

func (*HUOBI) QueryDepositAddress

func (h *HUOBI) QueryDepositAddress(ctx context.Context, cryptocurrency currency.Code) ([]DepositAddress, error)

QueryDepositAddress returns the deposit address for a specified currency

func (*HUOBI) QuerySwapIndexPriceInfo

func (h *HUOBI) QuerySwapIndexPriceInfo(ctx context.Context, code currency.Pair) (SwapIndexPriceData, error)

QuerySwapIndexPriceInfo gets perpetual swap index's price info

func (*HUOBI) QueryWithdrawQuotas

func (h *HUOBI) QueryWithdrawQuotas(ctx context.Context, cryptocurrency string) (WithdrawQuota, error)

QueryWithdrawQuotas returns the users cryptocurrency withdraw quotas

func (*HUOBI) SearchForExistedWithdrawsAndDeposits

func (h *HUOBI) SearchForExistedWithdrawsAndDeposits(ctx context.Context, c currency.Code, transferType, direction string, fromID, limit int64) (WithdrawalHistory, error)

SearchForExistedWithdrawsAndDeposits returns withdrawal and deposit data

func (*HUOBI) SendAuthenticatedHTTPRequest

func (h *HUOBI) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint string, values url.Values, data, result interface{}, isVersion2API bool) error

SendAuthenticatedHTTPRequest sends authenticated requests to the HUOBI API

func (*HUOBI) SendHTTPRequest

func (h *HUOBI) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*HUOBI) SetDefaults

func (h *HUOBI) SetDefaults()

SetDefaults sets default values for the exchange

func (*HUOBI) Setup

func (h *HUOBI) Setup(exch *config.Exchange) error

Setup sets user configuration

func (*HUOBI) SpotNewOrder

func (h *HUOBI) SpotNewOrder(ctx context.Context, arg *SpotNewOrderRequestParams) (int64, error)

SpotNewOrder submits an order to Huobi

func (*HUOBI) SubmitOrder

func (h *HUOBI) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*HUOBI) Subscribe

func (h *HUOBI) Subscribe(channelsToSubscribe []subscription.Subscription) error

Subscribe sends a websocket message to receive data from the channel

func (*HUOBI) SwapOpenInterestInformation

func (h *HUOBI) SwapOpenInterestInformation(ctx context.Context, code currency.Pair) (SwapOpenInterestData, error)

SwapOpenInterestInformation gets open interest data for perpetual futures

func (*HUOBI) SwapSingleSubAccAssets

func (h *HUOBI) SwapSingleSubAccAssets(ctx context.Context, code currency.Pair, subUID int64) (SingleSubAccountAssetsInfo, error)

SwapSingleSubAccAssets gets a subaccount's assets info

func (*HUOBI) Unsubscribe

func (h *HUOBI) Unsubscribe(channelsToUnsubscribe []subscription.Subscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*HUOBI) UpdateAccountInfo

func (h *HUOBI) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the HUOBI exchange - to-do

func (*HUOBI) UpdateOrderExecutionLimits

func (h *HUOBI) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error

UpdateOrderExecutionLimits updates order execution limits

func (*HUOBI) UpdateOrderbook

func (h *HUOBI) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*HUOBI) UpdateTicker

func (h *HUOBI) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*HUOBI) UpdateTickers

func (h *HUOBI) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*HUOBI) UpdateTradablePairs

func (h *HUOBI) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*HUOBI) ValidateAPICredentials

func (h *HUOBI) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*HUOBI) Withdraw

func (h *HUOBI) Withdraw(ctx context.Context, c currency.Code, address, addrTag, chain string, amount, fee float64) (int64, error)

Withdraw withdraws the desired amount and currency

func (*HUOBI) WithdrawCryptocurrencyFunds

func (h *HUOBI) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*HUOBI) WithdrawFiatFunds

func (h *HUOBI) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*HUOBI) WithdrawFiatFundsToInternationalBank

func (h *HUOBI) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*HUOBI) WsConnect

func (h *HUOBI) WsConnect() error

WsConnect initiates a new websocket connection

func (*HUOBI) WsProcessOrderbook

func (h *HUOBI) WsProcessOrderbook(update *WsDepth, symbol string) error

WsProcessOrderbook processes new orderbook data

type HistoricalFundingRateData

type HistoricalFundingRateData struct {
	Data struct {
		TotalPage   int64                `json:"total_page"`
		CurrentPage int64                `json:"current_page"`
		TotalSize   int64                `json:"total_size"`
		Data        []HistoricalRateData `json:"data"`
	}
}

HistoricalFundingRateData stores historical funding rates for perpetuals

type HistoricalInsuranceFundBalance

type HistoricalInsuranceFundBalance struct {
	Data struct {
		Symbol       string `json:"symbol"`
		ContractCode string `json:"contract_code"`
		Tick         []struct {
			InsuranceFund float64 `json:"insurance_fund"`
			Timestamp     int64   `json:"ts"`
		} `json:"tick"`
		TotalPage   int64 `json:"total_page"`
		TotalSize   int64 `json:"total_size"`
		CurrentPage int64 `json:"current_page"`
	} `json:"data"`
}

HistoricalInsuranceFundBalance stores insurance fund balance data in the past

type HistoricalRateData

type HistoricalRateData struct {
	FundingRate     float64 `json:"funding_rate,string"`
	RealizedRate    float64 `json:"realized_rate,string"`
	FundingTime     int64   `json:"fundingTime,string"`
	ContractCode    string  `json:"contract_code"`
	Symbol          string  `json:"symbol"`
	FeeAsset        string  `json:"fee_asset"`
	AvgPremiumIndex float64 `json:"avg_premium_index,string"`
}

HistoricalRateData stores historical rates data

type InsuranceAndClawbackData

type InsuranceAndClawbackData struct {
	Timestamp string `json:"timestamp"`
	Data      []struct {
		ContractCode      string  `json:"contract_code"`
		InsuranceFund     float64 `json:"insurance_fund"`
		EstimatedClawback float64 `json:"estimated_clawback"`
	} `json:"data"`
}

InsuranceAndClawbackData stores insurance fund's and clawback rate's data

type InternalAccountTransferData

type InternalAccountTransferData struct {
	TS   int64 `json:"ts"`
	Data struct {
		OrderID string `json:"order_id"`
	} `json:"data"`
}

InternalAccountTransferData stores transfer data between subaccounts and main account

type InternalAccountTransferRecords

type InternalAccountTransferRecords struct {
	Timestamp int64 `json:"ts"`
	Data      struct {
		TransferRecord []struct {
			ID             int64   `json:"id"`
			Timestamp      int64   `json:"ts"`
			Symbol         string  `json:"symbol"`
			SubUID         int64   `json:"sub_uid"`
			SubAccountName string  `json:"sub_account_name"`
			TransferType   int64   `json:"transfer_type"`
			Amount         float64 `json:"amount"`
		} `json:"transfer_record"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
}

InternalAccountTransferRecords stores data for transfer records within the account

type KlineItem

type KlineItem struct {
	IDTimestamp int64   `json:"id"`
	Open        float64 `json:"open"`
	Close       float64 `json:"close"`
	Low         float64 `json:"low"`
	High        float64 `json:"high"`
	Amount      float64 `json:"amount"`
	Volume      float64 `json:"vol"`
	Count       int     `json:"count"`
}

KlineItem stores a kline item

type KlinesRequestParams

type KlinesRequestParams struct {
	Symbol currency.Pair // Symbol to be used; example btcusdt, bccbtc......
	Period string        // Kline time interval; 1min, 5min, 15min......
	Size   int           // Size; [1-2000]
}

KlinesRequestParams represents Klines request data.

type LastTradeData

type LastTradeData struct {
	Ch   string `json:"ch"`
	Tick struct {
		Data []struct {
			Amount    float64 `json:"amount,string"`
			Direction string  `json:"direction"`
			ID        int64   `json:"id"`
			Price     float64 `json:"price,string"`
			Timestamp int64   `json:"ts"`
		} `json:"data"`
	} `json:"tick"`
}

LastTradeData stores last trade's data of a contract

type LightningCloseOrderData

type LightningCloseOrderData struct {
	Data struct {
		OrderID       int64  `json:"order_id"`
		OrderIDString string `json:"order_id_str"`
		ClientOrderID int64  `json:"client_order_id"`
	}
	Timestamp int64 `json:"ts"`
}

LightningCloseOrderData stores order data from a lightning close order

type LiquidationOrdersData

type LiquidationOrdersData struct {
	Data []struct {
		QueryID      int64   `json:"query_id"`
		ContractCode string  `json:"contract_code"`
		Symbol       string  `json:"symbol"`
		Direction    string  `json:"direction"`
		Offset       string  `json:"offset"`
		Volume       float64 `json:"volume"`
		Price        float64 `json:"price"`
		CreatedAt    int64   `json:"created_at"`
		Amount       float64 `json:"amount"`
	} `json:"data"`
}

LiquidationOrdersData stores data of liquidation orders

type MarginAccountBalance

type MarginAccountBalance struct {
	ID       int              `json:"id"`
	Type     string           `json:"type"`
	State    string           `json:"state"`
	Symbol   string           `json:"symbol"`
	FlPrice  string           `json:"fl-price"`
	FlType   string           `json:"fl-type"`
	RiskRate string           `json:"risk-rate"`
	List     []AccountBalance `json:"list"`
}

MarginAccountBalance stores the margin account balance info

type MarginOrder

type MarginOrder struct {
	Currency        string `json:"currency"`
	Symbol          string `json:"symbol"`
	AccruedAt       int64  `json:"accrued-at"`
	LoanAmount      string `json:"loan-amount"`
	LoanBalance     string `json:"loan-balance"`
	InterestBalance string `json:"interest-balance"`
	CreatedAt       int64  `json:"created-at"`
	InterestAmount  string `json:"interest-amount"`
	InterestRate    string `json:"interest-rate"`
	AccountID       int    `json:"account-id"`
	UserID          int    `json:"user-id"`
	UpdatedAt       int64  `json:"updated-at"`
	ID              int    `json:"id"`
	State           string `json:"state"`
}

MarginOrder stores the margin order info

type MarginRatesData

type MarginRatesData struct {
	Data []struct {
		Symbol     string `json:"symbol"`
		Currencies []struct {
			Currency       string  `json:"currency"`
			InterestRate   float64 `json:"interest-rate,string"`
			MinLoanAmount  float64 `json:"min-loan-amt,string"`
			MaxLoanAmount  float64 `json:"max-loan-amt,string"`
			LoanableAmount float64 `json:"loanable-amt,string"`
			ActualRate     float64 `json:"actual-rate,string"`
		} `json:"currencies"`
	} `json:"data"`
}

MarginRatesData stores margin rates data

type MarketOverviewData

type MarketOverviewData struct {
	Channel string `json:"ch"`
	Tick    struct {
		Vol       float64   `json:"vol,string"`
		Ask       []float64 `json:"ask"`
		Bid       []float64 `json:"bid"`
		Close     float64   `json:"close,string"`
		Count     float64   `json:"count"`
		High      float64   `json:"high,string"`
		ID        int64     `json:"id"`
		Low       float64   `json:"low,string"`
		Open      float64   `json:"open,string"`
		Timestamp int64     `json:"ts"`
		Amount    float64   `json:"amount,string"`
	} `json:"tick"`
}

MarketOverviewData stores market overview data

type MarketSummary24Hr

type MarketSummary24Hr struct {
	Tick struct {
		Amount  float64 `json:"amount"`
		Open    float64 `json:"open"`
		Close   float64 `json:"close"`
		High    float64 `json:"high"`
		ID      int64   `json:"id"`
		Count   float64 `json:"count"`
		Low     float64 `json:"low"`
		Version int64   `json:"version"`
		Volume  float64 `json:"vol"`
	}
}

MarketSummary24Hr stores past 24hr market summary data of a given symbol

type OBData

type OBData struct {
	Symbol string
	Asks   []obItem
	Bids   []obItem
}

OBData stores market depth data

type OpenInterestData

type OpenInterestData struct {
	Data struct {
		Symbol       string `json:"symbol"`
		ContractCode string `json:"contract_code"`
		Tick         []struct {
			Volume     float64 `json:"volume"`
			AmountType float64 `json:"amountType"`
			Timestamp  int64   `json:"ts"`
		} `json:"tick"`
	} `json:"data"`
}

OpenInterestData stores open interest data

type OrderBookDataRequestParams

type OrderBookDataRequestParams struct {
	Symbol currency.Pair                  // Required; example LTCBTC,BTCUSDT
	Type   OrderBookDataRequestParamsType `json:"type"` // step0, step1, step2, step3, step4, step5 (combined depth 0-5); when step0, no depth is merged
}

OrderBookDataRequestParams represents Klines request data.

type OrderBookDataRequestParamsType

type OrderBookDataRequestParamsType string

OrderBookDataRequestParamsType var for request param types

type OrderDetailData

type OrderDetailData struct {
	Data struct {
		Symbol          string  `json:"symbol"`
		ContractCode    string  `json:"contract_code"`
		Volume          float64 `json:"volume"`
		Price           float64 `json:"price"`
		OrderPriceType  string  `json:"order_price_type"`
		Direction       string  `json:"direction"`
		Offset          string  `json:"offset"`
		LeverRate       float64 `json:"lever_rate"`
		MarginFrozen    float64 `json:"margin_frozen"`
		Profit          float64 `json:"profit"`
		OrderSource     string  `json:"order_source"`
		CreatedAt       int64   `json:"created_at"`
		FinalInterest   float64 `json:"final_interest"`
		AdjustValue     float64 `json:"adjust_value"`
		FeeAsset        string  `json:"fee_asset"`
		LiquidationType string  `json:"liquidation_type"`
		OrderID         int64   `json:"order_id"`
		OrderIDStr      string  `json:"order_id_str"`
		ClientOrderID   int     `json:"client_order_id"`
		TradeVolume     float64 `json:"trade_volume"`
		TradeTurnover   float64 `json:"trade_turnover"`
		OrderType       int     `json:"order_type"`
		Status          int     `json:"status"`
		TradeAvgPrice   float64 `json:"trade_avg_price"`
		Trades          []struct {
			ID            string  `json:"id"`
			TradeID       float64 `json:"trade_id"`
			TradeVolume   float64 `json:"trade_volume"`
			TradePrice    float64 `json:"trade_price"`
			TradeFee      float64 `json:"trade_fee"`
			TradeTurnover float64 `json:"trade_turnover"`
			Role          string  `json:"role"`
			CreatedAt     int64   `json:"created_at"`
		} `json:"trades"`
		TotalPage   int64 `json:"total_page"`
		TotalSize   int64 `json:"total_size"`
		CurrentPage int64 `json:"current_page"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

OrderDetailData acquires order details

type OrderInfo

type OrderInfo struct {
	ID               int64   `json:"id"`
	Symbol           string  `json:"symbol"`
	AccountID        int64   `json:"account-id"`
	Amount           float64 `json:"amount,string"`
	Price            float64 `json:"price,string"`
	CreatedAt        int64   `json:"created-at"`
	Type             string  `json:"type"`
	FieldAmount      float64 `json:"field-amount,string"`
	FieldCashAmount  float64 `json:"field-cash-amount,string"`
	FilledAmount     float64 `json:"filled-amount,string"`
	FilledCashAmount float64 `json:"filled-cash-amount,string"`
	FilledFees       float64 `json:"filled-fees,string"`
	FinishedAt       int64   `json:"finished-at"`
	UserID           int64   `json:"user-id"`
	Source           string  `json:"source"`
	State            string  `json:"state"`
	CanceledAt       int64   `json:"canceled-at"`
	Exchange         string  `json:"exchange"`
	Batch            string  `json:"batch"`
}

OrderInfo stores the order info

type OrderMatchInfo

type OrderMatchInfo struct {
	ID           int    `json:"id"`
	OrderID      int    `json:"order-id"`
	MatchID      int    `json:"match-id"`
	Symbol       string `json:"symbol"`
	Type         string `json:"type"`
	Source       string `json:"source"`
	Price        string `json:"price"`
	FilledAmount string `json:"filled-amount"`
	FilledFees   string `json:"filled-fees"`
	CreatedAt    int64  `json:"created-at"`
}

OrderMatchInfo stores the order match info

type OrderVars

type OrderVars struct {
	Side      order.Side
	Status    order.Status
	OrderType order.Type
	Fee       float64
}

OrderVars stores side, status and type for any order/trade

type Orderbook

type Orderbook struct {
	ID         int64        `json:"id"`
	Timetstamp int64        `json:"ts"`
	Bids       [][2]float64 `json:"bids"`
	Asks       [][2]float64 `json:"asks"`
}

Orderbook stores the orderbook data

type PositionLimitData

type PositionLimitData struct {
	Data []struct {
		Symbol       string  `json:"symbol"`
		ContractCode string  `json:"contract_code"`
		BuyLimit     float64 `json:"buy_limit"`
		SellLimit    float64 `json:"sell_limit"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

PositionLimitData stores position limit data

type PremiumIndexKlineData

type PremiumIndexKlineData struct {
	Channel string `json:"ch"`
	Data    []struct {
		Volume float64 `json:"vol,string"`
		Close  float64 `json:"close,string"`
		Count  float64 `json:"count,string"`
		High   float64 `json:"high,string"`
		ID     int64   `json:"id"`
		Low    float64 `json:"low,string"`
		Open   float64 `json:"open,string"`
		Amount float64 `json:"amount,string"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

PremiumIndexKlineData stores kline data for premium

type RateLimit

type RateLimit struct {
	Spot          *rate.Limiter
	FuturesAuth   *rate.Limiter
	FuturesUnauth *rate.Limiter
	SwapAuth      *rate.Limiter
	SwapUnauth    *rate.Limiter
	FuturesXfer   *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit limits outbound requests

type Response

type Response struct {
	Status       string `json:"status"`
	Channel      string `json:"ch"`
	Timestamp    int64  `json:"ts"`
	ErrorCode    string `json:"err-code"`
	ErrorMessage string `json:"err-msg"`
}

Response stores the Huobi response information

type ResponseV2

type ResponseV2 struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

ResponseV2 stores the Huobi generic response info

type SingleSubAccountAssetsInfo

type SingleSubAccountAssetsInfo struct {
	Timestamp int64 `json:"ts"`
	Data      []struct {
		Symbol            string  `json:"symbol"`
		ContractCode      string  `json:"contract_code"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		AdjustFactor      float64 `json:"adjust_factor"`
		LeverageRate      float64 `json:"lever_rate"`
		MarginStatic      float64 `json:"margin_static"`
	} `json:"data"`
}

SingleSubAccountAssetsInfo stores asset info for a single subaccount

type SingleSubAccountPositionsInfo

type SingleSubAccountPositionsInfo struct {
	Timestamp int64 `json:"ts"`
	Data      []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		Volume         float64 `json:"volume"`
		Available      float64 `json:"available"`
		Frozen         float64 `json:"frozen"`
		CostOpen       float64 `json:"cost_open"`
		CostHold       float64 `json:"cost_hold"`
		ProfitUnreal   float64 `json:"profit_unreal"`
		ProfitRate     float64 `json:"profit_rate"`
		Profit         float64 `json:"profit"`
		PositionMargin float64 `json:"position_margin"`
		LeverRate      float64 `json:"lever_rate"`
		Direction      string  `json:"direction"`
		LastPrice      float64 `json:"last_price"`
	} `json:"data"`
}

SingleSubAccountPositionsInfo stores single subaccount's positions data

type SpotNewOrderRequestParams

type SpotNewOrderRequestParams struct {
	AccountID int                           `json:"account-id,string"` // Account ID, obtained using the accounts method. Currency trades use the accountid of the ‘spot’ account; for loan asset transactions, please use the accountid of the ‘margin’ account.
	Amount    float64                       `json:"amount"`            // The limit price indicates the quantity of the order, the market price indicates how much to buy when the order is paid, and the market price indicates how much the coin is sold when the order is sold.
	Price     float64                       `json:"price"`             // Order price, market price does not use  this parameter
	Source    string                        `json:"source"`            // Order source, api: API call, margin-api: loan asset transaction
	Symbol    currency.Pair                 `json:"symbol"`            // The symbol to use; example btcusdt, bccbtc......
	Type      SpotNewOrderRequestParamsType `json:"type"`              // 订单类型, buy-market: 市价买, sell-market: 市价卖, buy-limit: 限价买, sell-limit: 限价卖
}

SpotNewOrderRequestParams holds the params required to place an order

type SpotNewOrderRequestParamsType

type SpotNewOrderRequestParamsType string

SpotNewOrderRequestParamsType order type

type SubAccountsAssetData

type SubAccountsAssetData struct {
	Timestamp int64 `json:"ts"`
	Data      []struct {
		SubUID int64 `json:"sub_uid"`
		List   []struct {
			Symbol           string  `json:"symbol"`
			ContractCode     string  `json:"contract_code"`
			MarginBalance    int64   `json:"margin_balance"`
			LiquidationPrice float64 `json:"liquidation_price"`
			RiskRate         float64 `json:"risk_rate"`
		} `json:"list"`
	} `json:"data"`
}

SubAccountsAssetData stores asset data for all subaccounts

type SwapAccountInformation

type SwapAccountInformation struct {
	Data []struct {
		Symbol            string  `json:"symbol"`
		ContractCode      string  `json:"contract_code"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		AdjustFactor      float64 `json:"adjust_factor"`
		LeverageRate      float64 `json:"lever_rate"`
		MarginStatic      float64 `json:"margin_static"`
	} `json:"data"`
}

SwapAccountInformation stores swap account information

type SwapAssetsAndPositionsData

type SwapAssetsAndPositionsData struct {
	Timestamp int64 `json:"ts"`
	Data      []struct {
		Symbol            string  `json:"symbol"`
		ContractCode      string  `json:"contract_code"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		AdjustFactor      float64 `json:"adjust_factor"`
		LeverageRate      float64 `json:"lever_rate"`
		MarginStatic      float64 `json:"margin_static"`
		Positions         []struct {
			Symbol         string  `json:"symbol"`
			ContractCode   string  `json:"contract_code"`
			Volume         float64 `json:"volume"`
			Available      float64 `json:"available"`
			Frozen         float64 `json:"frozen"`
			CostOpen       float64 `json:"cost_open"`
			CostHold       float64 `json:"cost_hold"`
			ProfitUnreal   float64 `json:"profit_unreal"`
			ProfitRate     float64 `json:"profit_rate"`
			Profit         float64 `json:"profit"`
			PositionMargin float64 `json:"position_margin"`
			LeverRate      float64 `json:"lever_rate"`
			Direction      string  `json:"direction"`
			LastPrice      float64 `json:"last_price"`
		} `json:"positions"`
	} `json:"data"`
}

SwapAssetsAndPositionsData stores positions and assets data for swaps

type SwapFundingRatesResponse

type SwapFundingRatesResponse struct {
	Response
	Data []FundingRatesData `json:"data"`
}

SwapFundingRatesResponse holds funding rates and data response

type SwapIndexPriceData

type SwapIndexPriceData struct {
	Data []struct {
		ContractCode   string  `json:"contract_code"`
		IndexPrice     float64 `json:"index_price"`
		IndexTimestamp int64   `json:"index_ts"`
	} `json:"data"`
}

SwapIndexPriceData gets price of a perpetual swap

type SwapKlineData

type SwapKlineData struct {
	Data []struct {
		Volume      float64 `json:"vol"`
		Close       float64 `json:"close"`
		Count       float64 `json:"count"`
		High        float64 `json:"high"`
		IDTimestamp int64   `json:"id"`
		Low         float64 `json:"low"`
		Open        float64 `json:"open"`
		Amount      float64 `json:"amount"`
	} `json:"data"`
}

SwapKlineData stores kline data for perpetual swaps

type SwapMarketDepthData

type SwapMarketDepthData struct {
	Tick struct {
		Asks      [][]float64 `json:"asks"`
		Bids      [][]float64 `json:"bids"`
		Channel   string      `json:"ch"`
		ID        int64       `json:"id"`
		MRID      int64       `json:"mrid"`
		Timestamp int64       `json:"ts"`
		Version   int64       `json:"version"`
	} `json:"tick"`
}

SwapMarketDepthData stores market depth data

type SwapMarketsData

type SwapMarketsData struct {
	Symbol         string  `json:"symbol"`
	ContractCode   string  `json:"contract_code"`
	ContractSize   float64 `json:"contract_size"`
	PriceTick      float64 `json:"price_tick"`
	SettlementDate string  `json:"settlement_date"`
	CreateDate     string  `json:"create_date"`
	DeliveryTime   string  `json:"delivery_time"`
	ContractStatus int64   `json:"contract_status"`
}

SwapMarketsData stores market data for swaps

type SwapOpenInterestData

type SwapOpenInterestData struct {
	Data []struct {
		Symbol       string  `json:"symbol"`
		Volume       float64 `json:"volume"`
		Amount       float64 `json:"amount"`
		ContractCode string  `json:"contract_code"`
	} `json:"data"`
}

SwapOpenInterestData stores open interest data for swaps

type SwapOpenOrdersData

type SwapOpenOrdersData struct {
	Data struct {
		Orders []struct {
			Symbol         string  `json:"symbol"`
			ContractCode   string  `json:"contract_code"`
			Volume         float64 `json:"volume"`
			Price          float64 `json:"price"`
			OrderPriceType string  `json:"order_price_type"`
			OrderType      int64   `json:"order_type"`
			Direction      string  `json:"direction"`
			Offset         string  `json:"offset"`
			LeverageRate   float64 `json:"lever_rate"`
			OrderID        int64   `json:"order_id"`
			OrderIDString  string  `json:"order_id_str"`
			OrderSource    string  `json:"order_source"`
			CreatedAt      int64   `json:"created_at"`
			TradeVolume    float64 `json:"trade_volume"`
			TradeTurnover  float64 `json:"trade_turnover"`
			Fee            float64 `json:"fee"`
			TradeAvgPrice  float64 `json:"trade_avg_price"`
			MarginFrozen   int64   `json:"margin_frozen"`
			Profit         float64 `json:"profit"`
			Status         int64   `json:"status"`
			FeeAsset       string  `json:"fee_asset"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

SwapOpenOrdersData stores open orders data for swaps

type SwapOrderData

type SwapOrderData struct {
	Data struct {
		OrderID       int64  `json:"order_id"`
		OrderIDString string `json:"order_id_string"`
		ClientOrderID int64  `json:"client_order_id"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

SwapOrderData stores swap order data

type SwapOrderHistory

type SwapOrderHistory struct {
	Data struct {
		Orders []struct {
			Symbol            string  `json:"symbol"`
			ContractCode      string  `json:"contract_code"`
			Volume            float64 `json:"volume"`
			Price             float64 `json:"price"`
			OrderPriceType    string  `json:"order_price_type"`
			Direction         string  `json:"direction"`
			Offset            string  `json:"offset"`
			LeverageRate      float64 `json:"lever_rate"`
			OrderID           int64   `json:"order_id"`
			OrderIDString     string  `json:"order_id_str"`
			OrderSource       string  `json:"order_source"`
			CreateDate        int64   `json:"create_date"`
			TradeVolume       float64 `json:"trade_volume"`
			TradeTurnover     float64 `json:"trade_turnover"`
			Fee               float64 `json:"fee"`
			TradeAveragePrice float64 `json:"trade_avg_price"`
			MarginFrozen      float64 `json:"margin_frozen"`
			Profit            float64 `json:"profit"`
			Status            int64   `json:"status"`
			OrderType         int64   `json:"order_type"`
			FeeAsset          string  `json:"fee_asset"`
			LiquidationType   string  `json:"liquidation_type"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

SwapOrderHistory gets order history for swaps

type SwapOrderInfo

type SwapOrderInfo struct {
	Data []struct {
		Symbol          string  `json:"symbol"`
		ContractCode    string  `json:"contract_code"`
		Volume          float64 `json:"volume"`
		Price           float64 `json:"price"`
		OrderPriceType  string  `json:"order_price_type"`
		Direction       string  `json:"direction"`
		Offset          string  `json:"offset"`
		LeverRate       int64   `json:"lever_rate"`
		OrderID         int64   `json:"order_id"`
		OrderIDString   string  `json:"order_id_string"`
		ClientOrderID   int64   `json:"client_order_id"`
		OrderSource     string  `json:"order_source"`
		CreatedAt       int64   `json:"created_at"`
		CancelledAt     int64   `json:"cancelled_at"`
		TradeVolume     float64 `json:"trade_volume"`
		TradeTurnover   float64 `json:"trade_turnover"`
		Fee             float64 `json:"fee"`
		TradeAvgPrice   float64 `json:"trade_avg_price"`
		MarginFrozen    float64 `json:"margin_frozen"`
		Profit          float64 `json:"profit"`
		Status          int64   `json:"status"`
		FeeAsset        float64 `json:"fee_asset"`
		LiquidationType int64   `json:"liquidation_type"`
	}
	Timestamp int64 `json:"ts"`
}

SwapOrderInfo stores info for swap orders

type SwapOrderLimitInfo

type SwapOrderLimitInfo struct {
	Data struct {
		OrderPriceType string `json:"order_price_type"`
		List           []struct {
			Symbol       string  `json:"symbol"`
			ContractCode string  `json:"contract_code"`
			OpenLimit    float64 `json:"open_limit"`
			CloseLimit   float64 `json:"close_limit"`
		} `json:"list"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

SwapOrderLimitInfo stores information about order limits on a perpetual swap

type SwapPositionInfo

type SwapPositionInfo struct {
	Data []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		Volume         float64 `json:"volume"`
		Available      float64 `json:"available"`
		Frozen         float64 `json:"frozen"`
		CostOpen       float64 `json:"cost_open"`
		CostHold       float64 `json:"cost_hold"`
		ProfitUnreal   float64 `json:"profit_unreal"`
		ProfitRate     float64 `json:"profit_rate"`
		Profit         float64 `json:"profit"`
		PositionMargin float64 `json:"position_margin"`
		LeverRate      float64 `json:"lever_rate"`
		Direction      string  `json:"direction"`
		LastPrice      float64 `json:"last_price"`
	} `json:"data"`
}

SwapPositionInfo stores user's swap positions' info

type SwapPriceLimitsData

type SwapPriceLimitsData struct {
	Data []struct {
		Symbol       string  `json:"symbol"`
		HighLimit    float64 `json:"high_limit"`
		LowLimit     float64 `json:"low_limit"`
		ContractCode string  `json:"contract_code"`
	} `json:"data"`
}

SwapPriceLimitsData gets price restrictions on perpetual swaps

type SwapTradingFeeData

type SwapTradingFeeData struct {
	Data []struct {
		Symbol        string  `json:"symbol"`
		ContractCode  string  `json:"contract_code"`
		FeeAsset      string  `json:"fee_asset"`
		OpenMakerFee  float64 `json:"open_maker_fee,string"`
		OpenTakerFee  float64 `json:"open_taker_fee,string"`
		CloseMakerFee float64 `json:"close_maker_fee,string"`
		CloseTakerFee float64 `json:"close_taker_fee,string"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

SwapTradingFeeData stores trading fee data for swaps

type SwapWsReqBasisData

type SwapWsReqBasisData struct {
	Rep       string `json:"rep"`
	ID        string `json:"id"`
	WsID      int64  `json:"wsid"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		ID            int64   `json:"id"`
		ContractPrice float64 `json:"contract_price"`
		IndexPrice    float64 `json:"index_price"`
		Basis         float64 `json:"basis"`
		BasisRate     float64 `json:"basis_rate"`
	}
}

SwapWsReqBasisData stores requested basis data for swap websocket

type SwapWsReqEstimatedFunding

type SwapWsReqEstimatedFunding struct {
	Rep       string `json:"rep"`
	ID        string `json:"id"`
	WsID      int64  `json:"wsid"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		Volume float64 `json:"vol,string"`
		Count  float64 `json:"count,string"`
		ID     int64   `json:"id"`
		Open   float64 `json:"open,string"`
		Close  float64 `json:"close,string"`
		Low    float64 `json:"low,string"`
		High   float64 `json:"high,string"`
		Amount float64 `json:"amount,string"`
	}
}

SwapWsReqEstimatedFunding stores requested estimated funding data for swap websocket

type SwapWsReqPremiumKline

type SwapWsReqPremiumKline struct {
	Rep       string `json:"rep"`
	ID        string `json:"id"`
	WsID      int64  `json:"wsid"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
		ID     int64   `json:"id"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
	} `json:"data"`
}

SwapWsReqPremiumKline stores requested premium kline data for futures websocket

type SwapWsSubBasisData

type SwapWsSubBasisData struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      []struct {
		ID            int64   `json:"id"`
		ContractPrice float64 `json:"contract_price,string"`
		IndexPrice    float64 `json:"index_price,string"`
		Basis         float64 `json:"basis,string"`
		BasisRate     float64 `json:"basis_rate,string"`
	} `json:"tick"`
}

SwapWsSubBasisData stores subscribed basis data for swap websocket

type SwapWsSubContractInfo

type SwapWsSubContractInfo struct {
	Operation    string `json:"op"`
	Topic        string `json:"topic"`
	Timestamp    int64  `json:"ts"`
	Event        string `json:"event"`
	ContractData []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		ContractSize   float64 `json:"contract_size"`
		PriceTick      float64 `json:"price_tick"`
		SettlementDate string  `json:"settlement_date"`
		CreateDate     string  `json:"create_date"`
		ContractStatus int64   `json:"contract_status"`
	} `json:"data"`
}

SwapWsSubContractInfo stores funding rate data for swap websocket

type SwapWsSubEquityData

type SwapWsSubEquityData struct {
	Operation string `json:"op"`
	Topic     string `json:"topic"`
	Timestamp int64  `json:"ts"`
	UID       string `json:"uid"`
	Event     string `json:"event"`
	Data      []struct {
		Symbol            string  `json:"symbol"`
		MarginBalance     float64 `json:"margin_balance"`
		MarginStatic      int64   `json:"margin_static"`
		MarginPosition    float64 `json:"margin_position"`
		MarginFrozen      float64 `json:"margin_frozen"`
		MarginAvailable   float64 `json:"margin_available"`
		ProfitReal        float64 `json:"profit_real"`
		ProfitUnreal      float64 `json:"profit_unreal"`
		WithdrawAvailable float64 `json:"withdraw_available"`
		RiskRate          float64 `json:"risk_rate"`
		LiquidationPrice  float64 `json:"liquidation_price"`
		LeverageRate      float64 `json:"lever_rate"`
		AdjustFactor      float64 `json:"adjust_factor"`
	} `json:"data"`
}

SwapWsSubEquityData stores subscribed account data for swap account equity updates through websocket

type SwapWsSubEstimatedFunding

type SwapWsSubEstimatedFunding struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID     int64   `json:"id"`
		Volume float64 `json:"vol,string"`
		Count  float64 `json:"count,string"`
		Open   float64 `json:"open,string"`
		Close  float64 `json:"close,string"`
		Low    float64 `json:"low,string"`
		High   float64 `json:"high,string"`
		Amount float64 `json:"amount,string"`
	} `json:"tick"`
}

SwapWsSubEstimatedFunding stores estimated funding rate data for swap websocket

type SwapWsSubFundingData

type SwapWsSubFundingData struct {
	Operation   string `json:"op"`
	Topic       string `json:"topic"`
	Timestamp   int64  `json:"ts"`
	FundingData []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		FeeAsset       string  `json:"fee_asset"`
		FundingTime    int64   `json:"funding_time,string"`
		FundingRate    float64 `json:"funding_rate,string"`
		EstimatedRate  float64 `json:"estimated_rate,string"`
		SettlementTime int64   `json:"settlement_time,string"`
	} `json:"data"`
}

SwapWsSubFundingData stores funding rate data for swap websocket

type SwapWsSubLiquidationOrders

type SwapWsSubLiquidationOrders struct {
	Operation  string `json:"op"`
	Topic      string `json:"topic"`
	Timestamp  int64  `json:"ts"`
	OrdersData []struct {
		Symbol       string  `json:"symbol"`
		ContractCode string  `json:"contract_code"`
		Direction    string  `json:"direction"`
		Offset       string  `json:"offset"`
		Volume       float64 `json:"volume"`
		Price        float64 `json:"price"`
		CreatedAt    int64   `json:"created_at"`
	} `json:"data"`
}

SwapWsSubLiquidationOrders stores subscribed liquidation orders data for swap futures

type SwapWsSubMatchOrderData

type SwapWsSubMatchOrderData struct {
	Operation     string  `json:"op"`
	Topic         string  `json:"topic"`
	UID           string  `json:"uid"`
	Timestamp     int64   `json:"ts"`
	Symbol        string  `json:"symbol"`
	ContractCode  string  `json:"contract_code"`
	Status        int64   `json:"status"`
	OrderID       int64   `json:"order_id"`
	OrderIDString string  `json:"order_id_str"`
	ClientOrderID int64   `json:"client_order_id"`
	OrderType     string  `json:"order_type"`
	TradeVolume   int64   `json:"trade_volume"`
	Volume        float64 `json:"volume"`
	Trade         []struct {
		ID            string  `json:"id"`
		TradeID       int64   `json:"trade_id"`
		TradeVolume   float64 `json:"trade_volume"`
		TradePrice    float64 `json:"trade_price"`
		TradeTurnover float64 `json:"trade_turnover"`
		CreatedAt     int64   `json:"created_at"`
		Role          string  `json:"role"`
	} `json:"trade"`
}

SwapWsSubMatchOrderData stores subscribed match order data for swap websocket

type SwapWsSubOrderData

type SwapWsSubOrderData struct {
	Operation      string  `json:"op"`
	Topic          string  `json:"topic"`
	UID            string  `json:"uid"`
	Timestamp      int64   `json:"ts"`
	Symbol         string  `json:"symbol"`
	ContractCode   string  `json:"contract_code"`
	Volume         float64 `json:"volume"`
	Price          float64 `json:"price"`
	OrderPriceType string  `json:"order_price_type"`
	Direction      string  `json:"direction"`
	Offset         string  `json:"offset"`
	Status         int64   `json:"status"`
	LeverateRate   float64 `json:"lever_rate"`
	OrderID        int64   `json:"order_id"`
	OrderIDString  string  `json:"order_id_str"`
	ClientOrderID  int64   `json:"client_order_id"`
	OrderSource    string  `json:"order_source"`
	OrderType      int64   `json:"order_type"`
	CreatedAt      int64   `json:"created_at"`
	CanceledAt     int64   `json:"canceled_at"`
	TradeVolume    float64 `json:"trade_volume"`
	TradeTurnover  float64 `json:"trade_turnover"`
	Fee            float64 `json:"fee"`
	FeeAsset       string  `json:"fee_asset"`
	TradeAvgPrice  float64 `json:"trade_avg_price"`
	MarginFrozen   float64 `json:"margin_frozen"`
	Profit         float64 `json:"profit"`
	Trade          []struct {
		ID            string  `json:"id"`
		TradeID       int64   `json:"trade_id"`
		TradeVolume   float64 `json:"trade_volume"`
		TradePrice    float64 `json:"trade_price"`
		TradeFee      float64 `json:"trade_fee"`
		TradeTurnover float64 `json:"trade_turnover"`
		CreatedAt     int64   `json:"created_at"`
		FeeAsset      string  `json:"fee_asset"`
		Role          string  `json:"role"`
	} `json:"trade"`
	LiquidationType string `json:"liquidation_type"`
}

SwapWsSubOrderData stores subscribed order data for swap websocket

type SwapWsSubPositionUpdates

type SwapWsSubPositionUpdates struct {
	Operation string `json:"op"`
	Topic     string `json:"topic"`
	UID       string `json:"uid"`
	Timestamp int64  `json:"ts"`
	Event     string `json:"event"`
	Data      []struct {
		Symbol         string  `json:"symbol"`
		ContractCode   string  `json:"contract_code"`
		Volume         float64 `json:"volume"`
		Available      float64 `json:"available"`
		Frozen         float64 `json:"frozen"`
		CostOpen       float64 `json:"cost_open"`
		CostHold       float64 `json:"cost_hold"`
		ProfitUnreal   float64 `json:"profit_unreal"`
		ProfitRate     float64 `json:"profit_rate"`
		Profit         float64 `json:"profit"`
		PositionMargin float64 `json:"position_margin"`
		LeverageRate   float64 `json:"lever_rate"`
		Direction      string  `json:"direction"`
		LastPrice      float64 `json:"last_price"`
	}
}

SwapWsSubPositionUpdates stores subscribed position updates data for swap websocket

type SwapWsSubPremiumKline

type SwapWsSubPremiumKline struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID     int64   `json:"id"`
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
	} `json:"tick"`
}

SwapWsSubPremiumKline stores subscribed premium kline data for futures websocket

type SwapWsSubTriggerOrderUpdates

type SwapWsSubTriggerOrderUpdates struct {
	Operation string `json:"op"`
	Topic     string `json:"topic"`
	UID       string `json:"uid"`
	Event     string `json:"event"`
	Data      []struct {
		Symbol          string  `json:"symbol"`
		ContractCode    string  `json:"contract_code"`
		ContractType    string  `json:"contract_type"`
		Volume          float64 `json:"volume"`
		OrderType       int64   `json:"order_type"`
		Direction       string  `json:"direction"`
		Offset          string  `json:"offset"`
		LeverageRate    int64   `json:"lever_rate"`
		OrderID         int64   `json:"order_id"`
		OrderIDString   string  `json:"order_id_str"`
		RelationOrderID string  `json:"relation_order_id"`
		OrderPriceType  string  `json:"order_price_type"`
		Status          int64   `json:"status"`
		OrderSource     string  `json:"order_source"`
		TriggerPrice    float64 `json:"trigger_price"`
		TriggeredPrice  float64 `json:"triggered_price"`
		OrderPrice      float64 `json:"order_price"`
		CreatedAt       int64   `json:"created_at"`
		TriggeredAt     int64   `json:"triggered_at"`
		OrderInsertAt   int64   `json:"order_insert_at"`
		CancelledAt     int64   `json:"canceled_at"`
		FailCode        int64   `json:"fail_code"`
		FailReason      string  `json:"fail_reason"`
	} `json:"data"`
}

SwapWsSubTriggerOrderUpdates stores subscribed trigger order updates data for swap websocket

type Symbol

type Symbol struct {
	BaseCurrency             string  `json:"base-currency"`
	QuoteCurrency            string  `json:"quote-currency"`
	PricePrecision           float64 `json:"price-precision"`
	AmountPrecision          float64 `json:"amount-precision"`
	SymbolPartition          string  `json:"symbol-partition"`
	Symbol                   string  `json:"symbol"`
	State                    string  `json:"state"`
	ValuePrecision           float64 `json:"value-precision"`
	MinOrderAmt              float64 `json:"min-order-amt"`
	MaxOrderAmt              float64 `json:"max-order-amt"`
	MinOrderValue            float64 `json:"min-order-value"`
	LimitOrderMinOrderAmt    float64 `json:"limit-order-min-order-amt"`
	LimitOrderMaxOrderAmt    float64 `json:"limit-order-max-order-amt"`
	SellMarketMinOrderAmt    float64 `json:"sell-market-min-order-amt"`
	SellMarketMaxOrderAmt    float64 `json:"sell-market-max-order-amt"`
	BuyMarketMaxOrderAmt     float64 `json:"buy-market-max-order-amt"`
	LeverageRatio            float64 `json:"leverage-ratio"`
	SuperMarginLeverageRatio float64 `json:"super-margin-leverage-ratio"`
	FundingLeverageRatio     float64 `json:"funding-leverage-ratio"`
}

Symbol stores the symbol data

type SystemStatusData

type SystemStatusData struct {
	Data []struct {
		Symbol            string  `json:"symbol"`
		ContractCode      string  `json:"contract_code"`
		Open              float64 `json:"open"`
		Close             float64 `json:"close"`
		Cancel            float64 `json:"cancel"`
		TransferIn        float64 `json:"transfer_in"`
		TransferOut       float64 `json:"transfer_out"`
		MasterTransferSub float64 `json:"master_transfer_sub"`
		SubTransferMaster float64 `json:"sub_transfer_master"`
	} `json:"data"`
}

SystemStatusData stores information on system status

type Ticker

type Ticker struct {
	Symbol  string  `json:"symbol"`
	Open    float64 `json:"open"`
	High    float64 `json:"high"`
	Low     float64 `json:"low"`
	Close   float64 `json:"close"`
	Amount  float64 `json:"amount"`
	Volume  float64 `json:"vol"`
	Count   float64 `json:"count"`
	Bid     float64 `json:"bid"`
	BidSize float64 `json:"bidSize"`
	Ask     float64 `json:"ask"`
	AskSize float64 `json:"askSize"`
}

Ticker latest ticker data

type Tickers

type Tickers struct {
	Data []Ticker `json:"data"`
}

Tickers contain all tickers

type TieredAdjustmentFactorData

type TieredAdjustmentFactorData struct {
	Data []struct {
		Symbol       string `json:"symbol"`
		ContractCode string `json:"contract_code"`
		List         []struct {
			LeverRate float64 `json:"lever_rate"`
			Ladders   []struct {
				Ladder       float64 `json:"ladder"`
				MinSize      float64 `json:"min_size"`
				MaxSize      float64 `json:"max_size"`
				AdjustFactor float64 `json:"adjust_factor"`
			} `json:"ladders"`
		} `json:"list"`
	} `json:"data"`
}

TieredAdjustmentFactorData stores tiered adjustment factor data

type Trade

type Trade struct {
	TradeID   float64 `json:"trade-id"`
	Price     float64 `json:"price"`
	Amount    float64 `json:"amount"`
	Direction string  `json:"direction"`
	Timestamp int64   `json:"ts"`
}

Trade stores the trade data

type TradeHistory

type TradeHistory struct {
	ID        int64   `json:"id"`
	Timestamp int64   `json:"ts"`
	Trades    []Trade `json:"data"`
}

TradeHistory stores the trade history data

type TraderSentimentIndexAccountData

type TraderSentimentIndexAccountData struct {
	Data struct {
		Symbol       string `json:"symbol"`
		ContractCode string `json:"contract_code"`
		List         []struct {
			BuyRatio    float64 `json:"buy_ratio"`
			SellRatio   float64 `json:"sell_ratio"`
			LockedRatio float64 `json:"locked_ratio"`
			Timestamp   int64   `json:"ts"`
		} `json:"list"`
	} `json:"data"`
}

TraderSentimentIndexAccountData stores trader sentiment index data

type TraderSentimentIndexPositionData

type TraderSentimentIndexPositionData struct {
	Data struct {
		Symbol       string `json:"symbol"`
		ContractCode string `json:"contract_code"`
		List         []struct {
			BuyRatio  float64 `json:"buy_ratio"`
			SellRatio float64 `json:"sell_ratio"`
			Timestamp int64   `json:"ts"`
		} `json:"list"`
	} `json:"data"`
}

TraderSentimentIndexPositionData stores trader sentiment index data

type TransferLimitData

type TransferLimitData struct {
	Data []struct {
		Symbol                 string  `json:"symbol"`
		ContractCode           string  `json:"contract_code"`
		MaxTransferIn          float64 `json:"transfer_in_max_each"`
		MinTransferIn          float64 `json:"transfer_in_min_each"`
		MaxTransferOut         float64 `json:"transfer_out_max_each"`
		MinTransferOut         float64 `json:"transfer_out_min_each"`
		MaxTransferInDaily     float64 `json:"transfer_in_max_daily"`
		MinTransferInDaily     float64 `json:"transfer_in_min_daily"`
		MaxTransferOutDaily    float64 `json:"transfer_out_max_daily"`
		MinTransferOutDaily    float64 `json:"transfer_out_min_daily"`
		NetTransferInMaxDaily  float64 `json:"net_transfer_in_max_daily"`
		NetTransferOutMaxDaily float64 `json:"net_transfer_out_max_daily"`
	} `json:"data"`
	Timestamp int64 `json:"timestamp"`
}

TransferLimitData stores transfer limits

type TransferMarginBetweenAccountsData

type TransferMarginBetweenAccountsData struct {
	Code    int64  `json:"code"`
	Data    int64  `json:"data"`
	Message string `json:"message"`
	Success bool   `json:"success"`
}

TransferMarginBetweenAccountsData stores margin transfer data between spot and swap accounts

type TriggerOpenOrdersData

type TriggerOpenOrdersData struct {
	Data struct {
		Orders []struct {
			Symbol         string  `json:"symbol"`
			ContractCode   string  `json:"contract_code"`
			TriggerType    string  `json:"trigger_type"`
			Volume         float64 `json:"volume"`
			OrderType      int64   `json:"order_type"`
			Direction      string  `json:"direction"`
			Offset         string  `json:"offset"`
			LeverageRate   float64 `json:"lever_rate"`
			OrderID        int64   `json:"order_id"`
			OrderIDString  string  `json:"order_id_str"`
			OrderSource    string  `json:"order_source"`
			TriggerPrice   float64 `json:"trigger_price"`
			OrderPrice     float64 `json:"order_price"`
			CreatedAt      int64   `json:"created_at"`
			OrderPriceType string  `json:"order_price_type"`
			Status         int64   `json:"status"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

TriggerOpenOrdersData stores trigger open orders data

type TriggerOrderData

type TriggerOrderData struct {
	Data struct {
		OrderID       int64  `json:"order_id"`
		OrderIDString string `json:"order_id_str"`
	} `json:"data"`
}

TriggerOrderData stores trigger order data

type TriggerOrderHistory

type TriggerOrderHistory struct {
	Data struct {
		Orders []struct {
			Symbol          string  `json:"symbol"`
			ContractCode    string  `json:"contract_code"`
			TriggerType     string  `json:"trigger_type"`
			Volume          float64 `json:"volume"`
			OrderType       int64   `json:"order_type"`
			Direction       string  `json:"direction"`
			Offset          string  `json:"offset"`
			LeverageRate    float64 `json:"lever_rate"`
			OrderID         int64   `json:"order_id"`
			OrderIDString   string  `json:"order_id_string"`
			RelationOrderID string  `json:"relation_order_id"`
			OrderPriceType  string  `json:"order_price_type"`
			Status          int64   `json:"status"`
			OrderSource     string  `json:"order_source"`
			TriggerPrice    float64 `json:"trigger_price"`
			TriggeredPrice  float64 `json:"triggered_price"`
			OrderPrice      float64 `json:"order_price"`
			CreatedAt       int64   `json:"created_at"`
			TriggeredAt     int64   `json:"triggered_at"`
			OrderInsertAt   float64 `json:"order_insert_at"`
			CancelledAt     int64   `json:"cancelled_at"`
			FailCode        int64   `json:"fail_code"`
			FailReason      string  `json:"fail_reason"`
		} `json:"orders"`
		TotalPage   int64 `json:"total_page"`
		CurrentPage int64 `json:"current_page"`
		TotalSize   int64 `json:"total_size"`
	} `json:"data"`
	Timestamp int64 `json:"ts"`
}

TriggerOrderHistory stores trigger order history data for swaps

type UContractOpenInterest

type UContractOpenInterest struct {
	Volume        float64 `json:"volume"`
	Amount        float64 `json:"amount"`
	Symbol        string  `json:"symbol"`
	Value         float64 `json:"value"`
	ContractCode  string  `json:"contract_code"`
	TradeAmount   float64 `json:"trade_amount"`
	TradeVolume   float64 `json:"trade_volume"`
	TradeTurnover float64 `json:"trade_turnover"`
	BusinessType  string  `json:"business_type"`
	Pair          string  `json:"pair"`
	ContractType  string  `json:"contract_type"`
}

UContractOpenInterest stores open interest data for futures contracts

type WithdrawQuota

type WithdrawQuota struct {
	Currency string       `json:"currency"`
	Chains   []ChainQuota `json:"chains"`
}

WithdrawQuota stores the users withdraw quotas

type WithdrawalData

type WithdrawalData struct {
	ID              int64         `json:"id"`
	Type            string        `json:"type"`
	Currency        currency.Code `json:"currency"`
	TransactionHash string        `json:"tx-hash"`
	Chain           string        `json:"chain"`
	Amount          float64       `json:"amount"`
	SubType         string        `json:"sub-type"`
	Address         string        `json:"address"`
	AddressTag      string        `json:"address-tag"`
	FromAddressTag  string        `json:"from-addr-tag"`
	Fee             float64       `json:"fee"`
	State           string        `json:"state"`
	ErrorCode       string        `json:"error-code"`
	ErrorMessage    string        `json:"error-message"`
	CreatedAt       int64         `json:"created-at"`
	UpdatedAt       int64         `json:"updated-at"`
}

WithdrawalData contains details of a withdrawal

type WithdrawalHistory

type WithdrawalHistory struct {
	Status string           `json:"status"`
	Data   []WithdrawalData `json:"data"`
}

WithdrawalHistory holds withdrawal history data

type WsAuthenticatedAccountsListRequest

type WsAuthenticatedAccountsListRequest struct {
	Op               string `json:"op"`
	AccessKeyID      string `json:"AccessKeyId"`
	SignatureMethod  string `json:"SignatureMethod"`
	SignatureVersion string `json:"SignatureVersion"`
	Timestamp        string `json:"Timestamp"`
	Signature        string `json:"Signature"`
	Topic            string `json:"topic"`
	Symbol           string `json:"symbol"`
	ClientID         int64  `json:"cid,string,omitempty"`
}

WsAuthenticatedAccountsListRequest request for account list authenticated connection

type WsAuthenticatedAccountsListResponse

type WsAuthenticatedAccountsListResponse struct {
	WsResponse
	Data []WsAuthenticatedAccountsListResponseData `json:"data"`
}

WsAuthenticatedAccountsListResponse response from AccountsList authenticated endpoint

type WsAuthenticatedAccountsListResponseData

type WsAuthenticatedAccountsListResponseData struct {
	ID    int64                                         `json:"id"`
	Type  string                                        `json:"type"`
	State string                                        `json:"state"`
	List  []WsAuthenticatedAccountsListResponseDataList `json:"list"`
}

WsAuthenticatedAccountsListResponseData account data

type WsAuthenticatedAccountsListResponseDataList

type WsAuthenticatedAccountsListResponseDataList struct {
	Currency string  `json:"currency"`
	Type     string  `json:"type"`
	Balance  float64 `json:"balance,string"`
}

WsAuthenticatedAccountsListResponseDataList detailed account data

type WsAuthenticatedAccountsResponse

type WsAuthenticatedAccountsResponse struct {
	WsResponse
	Data WsAuthenticatedAccountsResponseData `json:"data"`
}

WsAuthenticatedAccountsResponse response from Accounts authenticated subscription

type WsAuthenticatedAccountsResponseData

type WsAuthenticatedAccountsResponseData struct {
	Event string                                    `json:"event"`
	List  []WsAuthenticatedAccountsResponseDataList `json:"list"`
}

WsAuthenticatedAccountsResponseData account data

type WsAuthenticatedAccountsResponseDataList

type WsAuthenticatedAccountsResponseDataList struct {
	AccountID int64   `json:"account-id"`
	Currency  string  `json:"currency"`
	Type      string  `json:"type"`
	Balance   float64 `json:"balance,string"`
}

WsAuthenticatedAccountsResponseDataList detailed account data

type WsAuthenticatedOrderDetailResponse

type WsAuthenticatedOrderDetailResponse struct {
	WsResponse
	Data OrderInfo `json:"data"`
}

WsAuthenticatedOrderDetailResponse response from OrderDetail authenticated endpoint

type WsAuthenticatedOrderDetailsRequest

type WsAuthenticatedOrderDetailsRequest struct {
	Op               string `json:"op"`
	AccessKeyID      string `json:"AccessKeyId"`
	SignatureMethod  string `json:"SignatureMethod"`
	SignatureVersion string `json:"SignatureVersion"`
	Timestamp        string `json:"Timestamp"`
	Signature        string `json:"Signature"`
	Topic            string `json:"topic"`
	OrderID          string `json:"order-id"`
	ClientID         int64  `json:"cid,string,omitempty"`
}

WsAuthenticatedOrderDetailsRequest request for order details authenticated connection

type WsAuthenticatedOrdersListRequest

type WsAuthenticatedOrdersListRequest struct {
	Op               string `json:"op"`
	AccessKeyID      string `json:"AccessKeyId"`
	SignatureMethod  string `json:"SignatureMethod"`
	SignatureVersion string `json:"SignatureVersion"`
	Timestamp        string `json:"Timestamp"`
	Signature        string `json:"Signature"`
	Topic            string `json:"topic"`
	States           string `json:"states"`
	AccountID        int64  `json:"account-id"`
	Symbol           string `json:"symbol"`
	ClientID         int64  `json:"cid,string,omitempty"`
}

WsAuthenticatedOrdersListRequest request for orderslist authenticated connection

type WsAuthenticatedOrdersListResponse

type WsAuthenticatedOrdersListResponse struct {
	WsResponse
	Data []OrderInfo `json:"data"`
}

WsAuthenticatedOrdersListResponse response from OrdersList authenticated endpoint

type WsAuthenticatedOrdersResponse

type WsAuthenticatedOrdersResponse struct {
	WsResponse
	Data []WsAuthenticatedOrdersResponseData `json:"data"`
}

WsAuthenticatedOrdersResponse response from Orders authenticated subscription

type WsAuthenticatedOrdersResponseData

type WsAuthenticatedOrdersResponseData struct {
	SeqID            int64   `json:"seq-id"`
	OrderID          int64   `json:"order-id"`
	Symbol           string  `json:"symbol"`
	AccountID        int64   `json:"account-id"`
	OrderAmount      float64 `json:"order-amount,string"`
	OrderPrice       float64 `json:"order-price,string"`
	CreatedAt        int64   `json:"created-at"`
	OrderType        string  `json:"order-type"`
	OrderSource      string  `json:"order-source"`
	OrderState       string  `json:"order-state"`
	Role             string  `json:"role"`
	Price            float64 `json:"price,string"`
	FilledAmount     float64 `json:"filled-amount,string"`
	UnfilledAmount   float64 `json:"unfilled-amount,string"`
	FilledCashAmount float64 `json:"filled-cash-amount,string"`
	FilledFees       float64 `json:"filled-fees,string"`
}

WsAuthenticatedOrdersResponseData order data

type WsAuthenticatedOrdersUpdateResponse

type WsAuthenticatedOrdersUpdateResponse struct {
	WsResponse
	Data WsAuthenticatedOrdersUpdateResponseData `json:"data"`
}

WsAuthenticatedOrdersUpdateResponse response from OrdersUpdate authenticated subscription

type WsAuthenticatedOrdersUpdateResponseData

type WsAuthenticatedOrdersUpdateResponseData struct {
	UnfilledAmount   float64 `json:"unfilled-amount,string"`
	FilledAmount     float64 `json:"filled-amount,string"`
	Price            float64 `json:"price,string"`
	OrderID          int64   `json:"order-id"`
	Symbol           string  `json:"symbol"`
	MatchID          int64   `json:"match-id"`
	FilledCashAmount float64 `json:"filled-cash-amount,string"`
	Role             string  `json:"role"`
	OrderState       string  `json:"order-state"`
	OrderType        string  `json:"order-type"`
}

WsAuthenticatedOrdersUpdateResponseData order update data

type WsAuthenticatedSubscriptionRequest

type WsAuthenticatedSubscriptionRequest struct {
	Op               string `json:"op"`
	AccessKeyID      string `json:"AccessKeyId"`
	SignatureMethod  string `json:"SignatureMethod"`
	SignatureVersion string `json:"SignatureVersion"`
	Timestamp        string `json:"Timestamp"`
	Signature        string `json:"Signature"`
	Topic            string `json:"topic"`
	ClientID         int64  `json:"cid,string,omitempty"`
}

WsAuthenticatedSubscriptionRequest request for subscription on authenticated connection

type WsAuthenticationRequest

type WsAuthenticationRequest struct {
	Op               string `json:"op"`
	AccessKeyID      string `json:"AccessKeyId"`
	SignatureMethod  string `json:"SignatureMethod"`
	SignatureVersion string `json:"SignatureVersion"`
	Timestamp        string `json:"Timestamp"`
	Signature        string `json:"Signature"`
	ClientID         int64  `json:"cid,string,omitempty"`
}

WsAuthenticationRequest data for login

type WsDepth

type WsDepth struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		Bids      [][]interface{} `json:"bids"`
		Asks      [][]interface{} `json:"asks"`
		Timestamp int64           `json:"ts"`
		Version   int64           `json:"version"`
	} `json:"tick"`
}

WsDepth defines market depth websocket response

type WsHeartBeat

type WsHeartBeat struct {
	ClientNonce int64 `json:"ping"`
}

WsHeartBeat defines a heartbeat request

type WsIncrementalMarketDepth

type WsIncrementalMarketDepth struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		MRID      int64        `json:"mrid"`
		ID        int64        `json:"id"`
		Bids      [][2]float64 `json:"bids"`
		Asks      [][2]float64 `json:"asks"`
		Timestamp int64        `json:"ts"`
		Version   int64        `json:"version"`
		Channel   string       `json:"ch"`
		Event     string       `json:"event"`
	} `json:"tick"`
}

WsIncrementalMarketDepth stores incremental market depth data for swap and futures websocket

type WsKline

type WsKline struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID     int64   `json:"id"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
		Volume float64 `json:"vol"`
		Count  int64   `json:"count"`
	} `json:"tick"`
}

WsKline defines market kline websocket response

type WsKlineData

type WsKlineData struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID     int64   `json:"id"`
		MRID   int64   `json:"mrid"`
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
	} `json:"tick"`
}

WsKlineData stores kline data for futures and swap websocket

type WsMarketBBOData

type WsMarketBBOData struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		Channel   string     `json:"ch"`
		MRID      int64      `json:"mrid"`
		ID        int64      `json:"id"`
		Bid       [2]float64 `json:"bid"`
		Ask       [2]float64 `json:"ask"`
		Timestamp int64      `json:"ts"`
		Version   int64      `json:":version"`
	} `json:"tick"`
}

WsMarketBBOData stores BBO data for futures and swap websocket

type WsMarketDepth

type WsMarketDepth struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		MRID      int64        `json:"mrid"`
		ID        int64        `json:"id"`
		Bids      [][2]float64 `json:"bids"`
		Asks      [][2]float64 `json:"asks"`
		Timestamp int64        `json:"ts"`
		Version   int64        `json:"version"`
		Channel   string       `json:"ch"`
	} `json:"tick"`
}

WsMarketDepth stores market depth data for futures and swap websocket

type WsMarketDetail

type WsMarketDetail struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID     int64   `json:"id"`
		MRID   int64   `json:"mrid"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		High   float64 `json:"high"`
		Low    float64 `json:"low"`
		Amount float64 `json:"amount"`
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
	} `json:"tick"`
}

WsMarketDetail stores market detail data for futures and swap websocket

type WsMessage

type WsMessage struct {
	Raw []byte
	URL string
}

WsMessage defines read data from the websocket connection

type WsOldOrderUpdate

type WsOldOrderUpdate struct {
	WsResponse
	Data WsAuthenticatedOrdersResponseData `json:"data"`
}

WsOldOrderUpdate response from Orders authenticated subscription

type WsPong

type WsPong struct {
	Pong int64 `json:"pong"`
}

WsPong sent for pong messages

type WsRequest

type WsRequest struct {
	Topic       string `json:"req,omitempty"`
	Subscribe   string `json:"sub,omitempty"`
	Unsubscribe string `json:"unsub,omitempty"`
	ClientID    int64  `json:"cid,string,omitempty"`
}

WsRequest defines a request data structure

type WsResponse

type WsResponse struct {
	Op     string `json:"op"`
	TS     int64  `json:"ts"`
	Status string `json:"status"`
	// ErrorCode returns either an integer or a string
	ErrorCode    interface{} `json:"err-code"`
	ErrorMessage string      `json:"err-msg"`
	Ping         int64       `json:"ping"`
	Channel      string      `json:"ch"`
	Rep          string      `json:"rep"`
	Topic        string      `json:"topic"`
	Subscribed   string      `json:"subbed"`
	UnSubscribed string      `json:"unsubbed"`
	ClientID     int64       `json:"cid,string"`
}

WsResponse defines a response from the websocket connection when there is an error

type WsSubTradeDetail

type WsSubTradeDetail struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID        int64 `json:"id"`
		Timestamp int64 `json:"ts"`
		Data      []struct {
			Amount    float64 `json:"amount"`
			Timestamp int64   `json:"ts"`
			ID        int64   `json:"id"`
			Price     float64 `json:"price"`
			Direction string  `json:"direction"`
		} `json:"data"`
	} `json:"tick"`
}

WsSubTradeDetail stores trade detail data for futures websocket

type WsSwapReqKline

type WsSwapReqKline struct {
	Rep  string `json:"rep"`
	ID   string `json:"id"`
	WsID int64  `json:"wsid"`
	Tick []struct {
		Volume float64 `json:"vol"`
		Count  float64 `json:"count"`
		ID     int64   `json:"id"`
		Open   float64 `json:"open"`
		Close  float64 `json:"close"`
		Low    float64 `json:"low"`
		High   float64 `json:"high"`
		Amount float64 `json:"amount"`
	} `json:"tick"`
}

WsSwapReqKline stores req kline data for swap websocket

type WsSwapReqTradeDetail

type WsSwapReqTradeDetail struct {
	Rep       string `json:"rep"`
	ID        int64  `json:"id"`
	Timestamp int64  `json:"ts"`
	Data      []struct {
		ID        int64   `json:"id"`
		Price     float64 `json:"price"`
		Amount    float64 `json:"amount"`
		Direction string  `json:"direction"`
		Timestamp int64   `json:"ts"`
	} `json:"data"`
}

WsSwapReqTradeDetail stores requested trade detail data for swap websocket

type WsTick

type WsTick struct {
	Channel   string `json:"ch"`
	Rep       string `json:"rep"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		Amount    float64 `json:"amount"`
		Close     float64 `json:"close"`
		Count     float64 `json:"count"`
		High      float64 `json:"high"`
		ID        float64 `json:"id"`
		Low       float64 `json:"low"`
		Open      float64 `json:"open"`
		Timestamp float64 `json:"ts"`
		Volume    float64 `json:"vol"`
	} `json:"tick"`
}

WsTick stores websocket ticker data

type WsTrade

type WsTrade struct {
	Channel   string `json:"ch"`
	Timestamp int64  `json:"ts"`
	Tick      struct {
		ID        int64 `json:"id"`
		Timestamp int64 `json:"ts"`
		Data      []struct {
			Amount    float64 `json:"amount"`
			Timestamp int64   `json:"ts"`
			TradeID   float64 `json:"tradeId"`
			Price     float64 `json:"price"`
			Direction string  `json:"direction"`
		} `json:"data"`
	}
}

WsTrade defines market trade websocket response

Jump to

Keyboard shortcuts

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