okgroup

package
v0.0.0-...-4c12c4a Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 23 Imported by: 0

README

GoCryptoTrader package Okex

Build Status Software License GoDoc Coverage Status Go Report Card

This okex package is part of the GoCryptoTrader codebase.

This is still in active development

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

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

OKex Exchange

Current Features
  • REST 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 o exchange.IBotExchange

for i := range bot.exchanges {
  if bot.exchanges[i].GetName() == "OKex" {
    y = bot.exchanges[i]
  }
}

// Public calls - wrapper functions

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

// Fetches current orderbook information
ob, err := o.GetOrderbookEx()
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 := o.GetAccountInfo()
if err != nil {
  // Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

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

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

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

// GetContractPosition returns contract positioning
accountInfo, err := o.GetContractPosition(...)
if err != nil {
  // Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := o.PlaceContractOrders(...)
if err != nil {
  // Handle error
}
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:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

Documentation

Index

Constants

View Source
const (

	// OKGroupAPIPath const to help with api url formatting
	OKGroupAPIPath = "api/"

	// OKGroupAccounts common api endpoint
	OKGroupAccounts = "accounts"
	// OKGroupLedger common api endpoint
	OKGroupLedger = "ledger"
	// OKGroupOrders common api endpoint
	OKGroupOrders = "orders"
	// OKGroupBatchOrders common api endpoint
	OKGroupBatchOrders = "batch_orders"
	// OKGroupCancelOrders common api endpoint
	OKGroupCancelOrders = "cancel_orders"
	// OKGroupCancelOrder common api endpoint
	OKGroupCancelOrder = "cancel_order"
	// OKGroupCancelBatchOrders common api endpoint
	OKGroupCancelBatchOrders = "cancel_batch_orders"
	// OKGroupPendingOrders common api endpoint
	OKGroupPendingOrders = "orders_pending"
	// OKGroupTrades common api endpoint
	OKGroupTrades = "trades"
	// OKGroupTicker common api endpoint
	OKGroupTicker = "ticker"
	// OKGroupInstruments common api endpoint
	OKGroupInstruments = "instruments"
	// OKGroupLiquidation common api endpoint
	OKGroupLiquidation = "liquidation"
	// OKGroupMarkPrice common api endpoint
	OKGroupMarkPrice = "mark_price"
	// OKGroupGetAccountDepositHistory common api endpoint
	OKGroupGetAccountDepositHistory = "deposit/history"
	// OKGroupGetSpotTransactionDetails common api endpoint
	OKGroupGetSpotTransactionDetails = "fills"
	// OKGroupGetSpotOrderBook common api endpoint
	OKGroupGetSpotOrderBook = "book"
	// OKGroupGetSpotMarketData common api endpoint
	OKGroupGetSpotMarketData = "candles"
	// OKGroupPriceLimit common api endpoint
	OKGroupPriceLimit = "price_limit"
)

Variables

View Source
var OrderStatus = map[int64]string{
	-3: "pending cancel",
	-2: "cancelled",
	-1: "failed",
	0:  "pending",
	1:  "sending",
	2:  "sent",
	3:  "email confirmation",
	4:  "manual confirmation",
	5:  "awaiting identity confirmation",
}

OrderStatus Holds OKGroup order status values

Functions

func FormatParameters

func FormatParameters(request interface{}) (parameters string)

FormatParameters Formats URL parameters, useful for optional parameters due to OKEX signature check

Types

type AccountWithdrawRequest

type AccountWithdrawRequest struct {
	Amount      float64 `json:"amount"`      // [required] withdrawal amount
	Currency    string  `json:"currency"`    // [required] token
	Destination int64   `json:"destination"` // [required] withdrawal address(2:OKCoin International 3:OKEx 4:others)
	Fee         float64 `json:"fee"`         // [required] Network transaction fee≥0. Withdrawals to OKCoin or OKEx are fee-free, please set as 0. Withdrawal to external digital asset address requires network transaction fee.
	ToAddress   string  `json:"to_address"`  // [required] verified digital asset address, email or mobile number,some digital asset address format is address+tag , eg: "ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456"
	TradePwd    string  `json:"trade_pwd"`   // [required] fund password
}

AccountWithdrawRequest request data for AccountWithdrawRequest

type AccountWithdrawResponse

type AccountWithdrawResponse struct {
	Amount       float64 `json:"amount"`
	Currency     string  `json:"currency"`
	Result       bool    `json:"result"`
	WithdrawalID int64   `json:"withdrawal_id"`
}

AccountWithdrawResponse response data for AccountWithdrawResponse

type CancelFuturesOrderRequest

type CancelFuturesOrderRequest struct {
	OrderID      string `json:"order_id"`      // [required] Order ID
	InstrumentID string `json:"instrument_id"` // [required] Contract ID,e.g. "BTC-USD-180213"
}

CancelFuturesOrderRequest request data for CancelFuturesOrder

type CancelFuturesOrderResponse

type CancelFuturesOrderResponse struct {
	InstrumentID string `json:"instrument_id"`
	OrderID      string `json:"order_id"`
	Result       bool   `json:"result"`
}

CancelFuturesOrderResponse response data from CancelFuturesOrder

type CancelMultipleSpotOrdersRequest

type CancelMultipleSpotOrdersRequest struct {
	OrderIDs     []int64 `json:"order_ids,omitempty"` // order ID. You may cancel up to 4 orders of a trading pair
	InstrumentID string  `json:"instrument_id"`       // by providing this parameter, the corresponding order of a designated trading pair will be cancelled. If not providing this parameter, it will be back to error code.
}

CancelMultipleSpotOrdersRequest request data for CancelMultipleSpotOrders

type CancelMultipleSpotOrdersResponse

type CancelMultipleSpotOrdersResponse struct {
	ClientOID string `json:"client_oid"`
	OrderID   int64  `json:"order_id,string"`
	Result    bool   `json:"result"`
	Error     error  // Placeholder to store errors
}

CancelMultipleSpotOrdersResponse response data for CancelMultipleSpotOrders

type CancelMultipleSwapOrdersRequest

type CancelMultipleSwapOrdersRequest struct {
	InstrumentID string  `json:"instrument_id,omitempty"` // [required] The contract of the orders to be cancelled
	OrderIDs     []int64 `json:"order_ids"`               // [required] ID's of the orders canceled
}

CancelMultipleSwapOrdersRequest request data for CancelMultipleSwapOrders

type CancelMultipleSwapOrdersResponse

type CancelMultipleSwapOrdersResponse struct {
	Result       bool     `json:"result,string"`
	OrderIDS     []string `json:"order_ids"`
	InstrumentID string   `json:"instrument_id"`
}

CancelMultipleSwapOrdersResponse response data for CancelMultipleSwapOrders

type CancelSpotOrderRequest

type CancelSpotOrderRequest struct {
	ClientOID    string `json:"client_oid,omitempty"` // the order ID created by yourself
	OrderID      int64  `json:"order_id,string"`      // order ID
	InstrumentID string `json:"instrument_id"`        // By providing this parameter, the corresponding order of a designated trading pair will be cancelled. If not providing this parameter, it will be back to error code.
}

CancelSpotOrderRequest request data for CancelSpotOrder

type CancelSpotOrderResponse

type CancelSpotOrderResponse struct {
	ClientOID string `json:"client_oid"`
	OrderID   int64  `json:"order_id,string"`
	Result    bool   `json:"result"`
}

CancelSpotOrderResponse response data for CancelSpotOrder

type CancelSwapOrderRequest

type CancelSwapOrderRequest struct {
	OrderID      string `json:"order_id"`      // [required] Order ID
	InstrumentID string `json:"instrument_id"` // [required] Contract ID,e.g. BTC-USD-SWAP
}

CancelSwapOrderRequest request data for CancelSwapOrder

type CancelSwapOrderResponse

type CancelSwapOrderResponse struct {
	Result       bool   `json:"result,string"`
	OrderID      string `json:"order_id"`
	InstrumentID string `json:"instrument_id"`
}

CancelSwapOrderResponse response data for CancelSwapOrder

type ConstituentData

type ConstituentData struct {
	Amount   float64 `json:"amount"`
	Currency string  `json:"currency"`
}

ConstituentData response data for GetETTConstituents

type FuturesAccountForAllCurrenciesResponse

type FuturesAccountForAllCurrenciesResponse struct {
	Info struct {
		Currency map[string]FuturesCurrencyData
	} `json:"info"`
}

FuturesAccountForAllCurrenciesResponse response data for FuturesAccountForAllCurrencies

type FuturesContractsData

type FuturesContractsData struct {
	AvailableQty      string `json:"available_qty"`
	FixedBalance      string `json:"fixed_balance"`
	InstrumentID      string `json:"instrument_id"`
	MarginForUnfilled string `json:"margin_for_unfilled"`
	MarginFrozen      string `json:"margin_frozen"`
	RealizedPnl       string `json:"realized_pnl"`
	UnrealizedPnl     string `json:"unrealized_pnl"`
}

FuturesContractsData Futures details

type FuturesCurrencyData

type FuturesCurrencyData struct {
	Contracts         []FuturesContractsData `json:"contracts,omitempty"`
	Equity            string                 `json:"equity,omitempty"`
	Margin            string                 `json:"margin,omitempty"`
	MarginMode        string                 `json:"margin_mode,omitempty"`
	MarginRatio       string                 `json:"margin_ratio,omitempty"`
	RealizedPnl       string                 `json:"realized_pnl,omitempty"`
	TotalAvailBalance string                 `json:"total_avail_balance,omitempty"`
	UnrealizedPnl     string                 `json:"unrealized_pnl,omitempty"`
}

FuturesCurrencyData Futures details

type FuturesOrderbookItem

type FuturesOrderbookItem struct {
	Price                 float64
	Size                  int64
	ForceLiquidatedOrders int64 // Number of force liquidated orders
	NumberOrders          int64 // Number of orders on the price
}

FuturesOrderbookItem stores an individual futures orderbook item

type GetAccountBillDetailsRequest

type GetAccountBillDetailsRequest struct {
	Currency string `url:"currency,omitempty"` // [optional] token ,information of all tokens will be returned if the field is left blank
	Type     int64  `url:"type,omitempty"`     // [optional] 1:deposit 2:withdrawal 13:cancel withdrawal 18: into futures account 19: out of futures account 20:into sub account 21:out of sub account 28: claim 29: into ETT account 30: out of ETT account 31: into C2C account 32:out of C2C account 33: into margin account 34: out of margin account 37: into spot account 38: out of spot account
	From     int64  `url:"from,omitempty"`     // [optional] you would request pages after this page.
	To       int64  `url:"to,omitempty"`       // [optional] you would request pages before this page
	Limit    int64  `url:"limit,omitempty"`    // [optional] Number of results per request. Maximum 100. (default 100)
}

GetAccountBillDetailsRequest request data for GetAccountBillDetailsRequest

type GetAccountBillDetailsResponse

type GetAccountBillDetailsResponse struct {
	Amount    float64   `json:"amount"`
	Balance   int64     `json:"balance"`
	Currency  string    `json:"currency"`
	Fee       int64     `json:"fee"`
	LedgerID  int64     `json:"ledger_id"`
	Timestamp time.Time `json:"timestamp"`
	Typename  string    `json:"typename"`
}

GetAccountBillDetailsResponse response data for GetAccountBillDetails

type GetAccountCurrenciesResponse

type GetAccountCurrenciesResponse struct {
	CanDeposit    int64   `json:"can_deposit"`
	CanWithdraw   int64   `json:"can_withdraw"`
	Currency      string  `json:"currency"`
	MinWithdrawal float64 `json:"min_withdrawal"`
	Name          string  `json:"name"`
}

GetAccountCurrenciesResponse response data for GetAccountCurrencies

type GetAccountDepositHistoryResponse

type GetAccountDepositHistoryResponse struct {
	Amount        float64   `json:"amount"`
	Currency      string    `json:"currency"`
	Status        int64     `json:"status"`
	Timestamp     time.Time `json:"timestamp"`
	To            string    `json:"to"`
	TransactionID string    `json:"txid"`
}

GetAccountDepositHistoryResponse response data for GetAccountDepositHistory

type GetAccountWithdrawalFeeResponse

type GetAccountWithdrawalFeeResponse struct {
	Currency string  `json:"currency"`
	MinFee   float64 `json:"min_fee"`
	MaxFee   float64 `json:"max_fee"`
}

GetAccountWithdrawalFeeResponse response data for GetAccountWithdrawalFee

type GetAllSwapTokensInformationResponse

type GetAllSwapTokensInformationResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Last         float64   `json:"last,string"`
	High24H      float64   `json:"high_24h,string"`
	Low24H       float64   `json:"low_24h,string"`
	BestBid      float64   `json:"best_bid,string"`
	BestAsk      float64   `json:"best_ask,string"`
	Volume24H    float64   `json:"volume_24h,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetAllSwapTokensInformationResponse response data for GetAllSwapTokensInformation

type GetDepositAddressResponse

type GetDepositAddressResponse struct {
	Address   string `json:"address"`
	Tag       string `json:"tag"`
	PaymentID string `json:"payment_id,omitempty"`
	Currency  string `json:"currency"`
}

GetDepositAddressResponse response data for GetDepositAddress

type GetETTBillsDetailsResponse

type GetETTBillsDetailsResponse struct {
	LedgerID  int64   `json:"ledger_id"`
	Currency  string  `json:"currency"`
	Balance   float64 `json:"balance"`
	Amount    float64 `json:"amount"`
	Type      string  `json:"type"`
	CreatedAt string  `json:"created_at"`
	Details   int64   `json:"details"`
}

GetETTBillsDetailsResponse response data for GetETTBillsDetails

type GetETTConstituentsResponse

type GetETTConstituentsResponse struct {
	NetValue     float64           `json:"net_value"`
	Ett          string            `json:"ett"`
	Constituents []ConstituentData `json:"constituents"`
}

GetETTConstituentsResponse response data for GetETTConstituents

type GetETTOrderListRequest

type GetETTOrderListRequest struct {
	ETT    string `url:"ett"`                    //  	[required] list specific ETT order
	Type   int64  `url:"type"`                   //  	[required](1: subscription 2: redemption)
	Status int64  `url:"status,omitempty"`       // [optional]  	List the orders of the status (0:All 1:Unfilled 2:Filled 3:Canceled)
	From   int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To     int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit  int64  `url:"limit,string,omitempty"` // [optional] Number of results per request. Maximum 100.
}

GetETTOrderListRequest request data for GetETTOrderList

type GetETTOrderListResponse

type GetETTOrderListResponse struct {
	OrderID       string `json:"order_id"`
	Price         string `json:"price"`
	Size          string `json:"size"`
	Amount        string `json:"amount"`
	QuoteCurrency string `json:"quote_currency"`
	Ett           string `json:"ett"`
	Type          int64  `json:"type"`
	CreatedAt     string `json:"created_at"`
	Status        string `json:"status"`
}

GetETTOrderListResponse response data for GetETTOrderList

type GetETTResponse

type GetETTResponse struct {
	Currency  string  `json:"currency"`
	Balance   float64 `json:"balance"`
	Holds     float64 `json:"holds"`
	Available float64 `json:"available"`
}

GetETTResponse response data for GetETT

type GetETTSettlementPriceHistoryResponse

type GetETTSettlementPriceHistoryResponse struct {
	Date  string  `json:"date"`
	Price float64 `json:"price"`
}

GetETTSettlementPriceHistoryResponse response data for GetETTSettlementPriceHistory

type GetFuturePostionsDetails

type GetFuturePostionsDetails struct {
	CreatedAt            string `json:"created_at"`
	InstrumentID         string `json:"instrument_id"`
	Leverage             string `json:"leverage"`
	LiquidationPrice     string `json:"liquidation_price"`
	LongAvailQty         string `json:"long_avail_qty"`
	LongAvgCost          string `json:"long_avg_cost"`
	LongLeverage         string `json:"long_leverage"`
	LongLiquiPrice       string `json:"long_liqui_price"`
	LongMargin           string `json:"long_margin"`
	LongPnlRatio         string `json:"long_pnl_ratio"`
	LongQty              string `json:"long_qty"`
	LongSettlementPrice  string `json:"long_settlement_price"`
	MarginMode           string `json:"margin_mode"`
	RealisedPnl          string `json:"realised_pnl"`
	ShortAvailQty        string `json:"short_avail_qty"`
	ShortAvgCost         string `json:"short_avg_cost"`
	ShortLeverage        string `json:"short_leverage"`
	ShortLiquiPrice      string `json:"short_liqui_price"`
	ShortMargin          string `json:"short_margin"`
	ShortPnlRatio        string `json:"short_pnl_ratio"`
	ShortQty             string `json:"short_qty"`
	ShortSettlementPrice string `json:"short_settlement_price"`
	UpdatedAt            string `json:"updated_at"`
}

GetFuturePostionsDetails Futures details

type GetFuturesContractInformationResponse

type GetFuturesContractInformationResponse struct {
	ContractVal     int64   `json:"contract_val,string"`
	Delivery        string  `json:"delivery"`
	InstrumentID    string  `json:"instrument_id"`
	Listing         string  `json:"listing"`
	QuoteCurrency   string  `json:"quote_currency"`
	TickSize        float64 `json:"tick_size,string"`
	TradeIncrement  int64   `json:"trade_increment,string"`
	UnderlyingIndex string  `json:"underlying_index"`
}

GetFuturesContractInformationResponse individual contract details from GetFuturesContractInformation

type GetFuturesCurrentMarkPriceResponse

type GetFuturesCurrentMarkPriceResponse struct {
	MarkPrice    float64   `json:"mark_price,string"`
	InstrumentID string    `json:"instrument_id"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesCurrentMarkPriceResponse response data for GetFuturesCurrentMarkPrice

type GetFuturesCurrentPriceLimitResponse

type GetFuturesCurrentPriceLimitResponse struct {
	Highest      float64   `json:"highest,string"`
	InstrumentID string    `json:"instrument_id"`
	Lowest       float64   `json:"lowest,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesCurrentPriceLimitResponse response data for GetFuturesCurrentPriceLimit

type GetFuturesEstimatedDeliveryPriceResponse

type GetFuturesEstimatedDeliveryPriceResponse struct {
	InstrumentID    string    `json:"instrument_id"`
	SettlementPrice float64   `json:"settlement_price,string"`
	Timestamp       time.Time `json:"timestamp"`
}

GetFuturesEstimatedDeliveryPriceResponse response data for GetFuturesEstimatedDeliveryPrice

type GetFuturesExchangeRatesResponse

type GetFuturesExchangeRatesResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Rate         float64   `json:"rate,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesExchangeRatesResponse response data for GetFuturesExchangeRate

type GetFuturesFilledOrderRequest

type GetFuturesFilledOrderRequest struct {
	InstrumentID string `url:"-"`                      // [required] Contract ID, e.g. "BTC-USD-180213"
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional]  	Number of results per request. Maximum 100. (default 100)
}

GetFuturesFilledOrderRequest request data for GetFuturesFilledOrder

type GetFuturesFilledOrdersResponse

type GetFuturesFilledOrdersResponse struct {
	Price     float64   `json:"price,string"`
	Qty       int64     `json:"qty,string"`
	Side      string    `json:"side"`
	Timestamp time.Time `json:"timestamp"`
	TradeID   string    `json:"trade_id"`
}

GetFuturesFilledOrdersResponse response data for GetFuturesFilledOrders

type GetFuturesForceLiquidatedOrdersRequest

type GetFuturesForceLiquidatedOrdersRequest struct {
	InstrumentID string `url:"-"`                      // [required] Contract ID, e.g. "BTC-USD-180213"
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional]  	Number of results per request. Maximum 100. (default 100)
	Status       string `url:"status,omitempty"`       // [optional] Status (0:unfilled orders in the recent 7 days 1:filled orders in the recent 7 days)
}

GetFuturesForceLiquidatedOrdersRequest request data for GetFuturesForceLiquidatedOrders

type GetFuturesForceLiquidatedOrdersResponse

type GetFuturesForceLiquidatedOrdersResponse struct {
	Loss         float64 `json:"loss,string"`
	Size         int64   `json:"size,string"`
	Price        float64 `json:"price,string"`
	CreatedAt    string  `json:"created_at"`
	InstrumentID string  `json:"instrument_id"`
	Type         int64   `json:"type,string"`
}

GetFuturesForceLiquidatedOrdersResponse response data for GetFuturesForceLiquidatedOrders

type GetFuturesHoldAmountResponse

type GetFuturesHoldAmountResponse struct {
	Amount       float64   `json:"amount,string"`
	InstrumentID string    `json:"instrument_id"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesHoldAmountResponse response data for GetFuturesHoldAmount

type GetFuturesIndicesResponse

type GetFuturesIndicesResponse struct {
	Index        float64   `json:"index,string"`
	InstrumentID string    `json:"instrument_id"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesIndicesResponse response data for GetFuturesIndices

type GetFuturesLeverageData

type GetFuturesLeverageData struct {
	LongLeverage  int64 `json:"long_leverage"`
	ShortLeverage int64 `json:"short_leverage"`
}

GetFuturesLeverageData Futures details

type GetFuturesLeverageResponse

type GetFuturesLeverageResponse struct {
	MarginMode      string `json:"margin_mode,omitempty"`
	Currency        string `json:"currency,omitempty"`
	Leverage        int64  `json:"leverage,omitempty"`
	LeveragePerCoin map[string]GetFuturesLeverageData
}

GetFuturesLeverageResponse response data for GetFuturesLeverage

type GetFuturesMarketDataResponse

type GetFuturesMarketDataResponse []interface{}

GetFuturesMarketDataResponse contains candle data from a GetSpotMarketDataRequest Return Parameters time string Start time open string Open price high string Highest price low string Lowest price close string Close price volume string Trading volume currencyvolume string The trading volume in a specific token

type GetFuturesMarketDateRequest

type GetFuturesMarketDateRequest struct {
	Start        string `url:"start,omitempty"`       // [optional] start time in ISO 8601
	End          string `url:"end,omitempty"`         // [optional] end time in ISO 8601
	Granularity  int64  `url:"granularity,omitempty"` // [optional] The granularity field must be one of the following values: {60, 180, 300, 900, 1800, 3600, 7200, 14400, 43200, 86400, 604800}.
	InstrumentID string `url:"-"`                     // [required] trading pairs
}

GetFuturesMarketDateRequest retrieves candle data information

type GetFuturesOpenInterestsResponse

type GetFuturesOpenInterestsResponse struct {
	Amount       float64   `json:"amount,string"`
	InstrumentID string    `json:"instrument_id"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesOpenInterestsResponse response data for GetFuturesOpenInterests

type GetFuturesOrderBookRequest

type GetFuturesOrderBookRequest struct {
	InstrumentID string `url:"-"`              // [required] Contract ID, e.g. "BTC-USD-180213"
	Size         int64  `url:"size,omitempty"` // [optional] The size of the price range (max: 200)
}

GetFuturesOrderBookRequest request data for GetFuturesOrderBook

type GetFuturesOrderBookResponse

type GetFuturesOrderBookResponse struct {
	Asks      []FuturesOrderbookItem
	Bids      []FuturesOrderbookItem
	Timestamp time.Time
}

GetFuturesOrderBookResponse response data for GetFuturesOrderBook

type GetFuturesOrderDetailsRequest

type GetFuturesOrderDetailsRequest struct {
	OrderID      int64  `json:"order_id,string"` // [required] Order ID
	InstrumentID string `json:"instrument_id"`   // [required] Contract ID, e.g. "BTC-USD-180213"
}

GetFuturesOrderDetailsRequest request data for GetFuturesOrderDetails

type GetFuturesOrderDetailsResponseData

type GetFuturesOrderDetailsResponseData struct {
	ContractVal  float64   `json:"contract_val,string"`
	Fee          float64   `json:"fee,string"`
	FilledQty    float64   `json:"filled_qty,string"`
	InstrumentID string    `json:"instrument_id"`
	Leverage     int64     `json:"leverage,string"` //  	Leverage value:10\20 default:10
	OrderID      int64     `json:"order_id,string"`
	Price        float64   `json:"price,string"`
	PriceAvg     float64   `json:"price_avg,string"`
	Size         float64   `json:"size,string"`
	Status       int64     `json:"status,string"` // Order Status (-1 canceled; 0: pending, 1: partially filled, 2: fully filled)
	Timestamp    time.Time `json:"timestamp"`
	Type         int64     `json:"type,string"` //  	Type (1: open long 2: open short 3: close long 4: close short)
}

GetFuturesOrderDetailsResponseData individual order data from GetFuturesOrderList

type GetFuturesOrderListResponse

type GetFuturesOrderListResponse struct {
	OrderInfo []GetFuturesOrderDetailsResponseData `json:"order_info"`
	Result    bool                                 `json:"result"`
}

GetFuturesOrderListResponse response data from GetFuturesOrderList

type GetFuturesOrdersListRequest

type GetFuturesOrdersListRequest struct {
	InstrumentID string `url:"-"`                      // [required] Contract ID, e.g. "BTC-USD-180213"
	Status       int64  `url:"status,string"`          // [required] Order Status (-1 canceled; 0: pending, 1: partially filled, 2: fully filled, 6: open (pending partially + fully filled), 7: completed (canceled + fully filled))
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional] Number of results per request. Maximum 100. (default 100)
}

GetFuturesOrdersListRequest request data for GetFutureOrdersList

type GetFuturesPositionsForCurrencyResponse

type GetFuturesPositionsForCurrencyResponse struct {
	Holding []GetFuturePostionsDetails `json:"holding"`
	Result  bool                       `json:"result"`
}

GetFuturesPositionsForCurrencyResponse response data for GetFuturesPositionsForCurrency

type GetFuturesPositionsResponse

type GetFuturesPositionsResponse struct {
	Holding [][]GetFuturePostionsDetails `json:"holding"`
	Result  bool                         `json:"result"`
}

GetFuturesPositionsResponse response data for GetFuturesPositions

type GetFuturesTagPriceResponse

type GetFuturesTagPriceResponse struct {
	MarkPrice    float64   `json:"mark_price"`
	InstrumentID string    `json:"instrument_id"`
	Timestamp    time.Time `json:"timestamp"`
}

GetFuturesTagPriceResponse response data for GetFuturesTagPrice

type GetFuturesTokenInfoResponse

type GetFuturesTokenInfoResponse struct {
	BestAsk      float64   `json:"best_ask,string"`
	BestBid      float64   `json:"best_bid,string"`
	High24h      float64   `json:"high_24h,string"`
	InstrumentID string    `json:"instrument_id"`
	Last         float64   `json:"last,string"`
	Low24h       float64   `json:"low_24h,string"`
	Timestamp    time.Time `json:"timestamp"`
	Volume24h    int64     `json:"volume_24h,string"`
}

GetFuturesTokenInfoResponse response data for GetFuturesOrderBook

type GetFuturesTransactionDetailsRequest

type GetFuturesTransactionDetailsRequest struct {
	OrderID      int64  `json:"order_id,string"`        // [required] Order ID
	InstrumentID string `json:"instrument_id"`          // [required] Contract ID, e.g. "BTC-USD-180213"
	Status       int64  `json:"status,string"`          // [required] Order Status (-1 canceled; 0: pending, 1: partially filled, 2: fully filled, 6: open (pending partially + fully filled), 7: completed (canceled + fully filled))
	From         int64  `json:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `json:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `json:"limit,string,omitempty"` // [optional]  	Number of results per request. Maximum 100. (default 100)
}

GetFuturesTransactionDetailsRequest request data for GetFuturesTransactionDetails

type GetFuturesTransactionDetailsResponse

type GetFuturesTransactionDetailsResponse struct {
	CreatedAt    string `json:"created_at"`
	ExecType     string `json:"exec_type"`
	Fee          string `json:"fee"`
	InstrumentID string `json:"instrument_id"`
	OrderID      string `json:"order_id"`
	OrderQty     string `json:"order_qty"`
	Price        string `json:"price"`
	Side         string `json:"side"`
	TradeID      string `json:"trade_id"`
}

GetFuturesTransactionDetailsResponse response data for GetFuturesTransactionDetails

type GetMarginAccountSettingsResponse

type GetMarginAccountSettingsResponse struct {
	InstrumentID string `json:"instrument_id"`
	ProductID    string `json:"product_id"`
	Currencies   map[string]MarginAccountSettingsInfo
}

GetMarginAccountSettingsResponse response data for GetMarginAccountSettings

type GetMarginAccountsResponse

type GetMarginAccountsResponse struct {
	InstrumentID     string `json:"instrument_id,omitempty"`
	LiquidationPrice string `json:"liquidation_price"`
	ProductID        string `json:"product_id,omitempty"`
	RiskRate         string `json:"risk_rate"`
	Currencies       map[string]MarginAccountInfo
}

GetMarginAccountsResponse response data for GetMarginAccounts

type GetMarginBillDetailsRequest

type GetMarginBillDetailsRequest struct {
	InstrumentID string `url:"-"`               // [required] trading pair
	Type         int64  `url:"type,omitempty"`  // [optional] 1:deposit 2:withdrawal 13:cancel withdrawal 18: into futures account 19: out of futures account 20:into sub account 21:out of sub account 28: claim 29: into ETT account 30: out of ETT account 31: into C2C account 32:out of C2C account 33: into margin account 34: out of margin account 37: into spot account 38: out of spot account
	From         int64  `url:"from,omitempty"`  // [optional] you would request pages after this page.
	To           int64  `url:"to,omitempty"`    // [optional] you would request pages before this page
	Limit        int64  `url:"limit,omitempty"` // [optional] Number of results per request. Maximum 100. (default 100)
}

GetMarginBillDetailsRequest request data for GetMarginBillDetails

type GetMarginLoanHistoryRequest

type GetMarginLoanHistoryRequest struct {
	InstrumentID string // [optional] Used when a specific currency response is desired
	Status       int64  `json:"status,string,omitempty"` // [optional] status(0: outstanding 1: repaid)
	From         int64  `json:"from,string,omitempty"`   // [optional] request page from(newer) this id.
	To           int64  `json:"to,string,omitempty"`     // [optional] request page to(older) this id.
	Limit        int64  `json:"limit,string,omitempty"`  // [optional] number of results per request. Maximum 100.(default 100)
}

GetMarginLoanHistoryRequest request data for GetMarginLoanHistory

type GetMarginLoanHistoryResponse

type GetMarginLoanHistoryResponse struct {
	Amount           float64   `json:"amount,string"`
	BorrowID         int64     `json:"borrow_id"`
	CreatedAt        string    `json:"created_at"`
	Currency         string    `json:"currency"`
	ForceRepayTime   string    `json:"force_repay_time"`
	InstrumentID     string    `json:"instrument_id"`
	Interest         float64   `json:"interest,string"`
	LastInterestTime string    `json:"last_interest_time"`
	PaidInterest     float64   `json:"paid_interest,string"`
	ProductID        string    `json:"product_id"`
	Rate             float64   `json:"rate,string"`
	RepayAmount      string    `json:"repay_amount"`
	RepayInterest    string    `json:"repay_interest"`
	ReturnedAmount   float64   `json:"returned_amount,string"`
	Timestamp        time.Time `json:"timestamp"`
}

GetMarginLoanHistoryResponse response data for GetMarginLoanHistory

type GetSpotBillDetailsForCurrencyRequest

type GetSpotBillDetailsForCurrencyRequest struct {
	Currency string `url:"-"`                      // [required] token
	From     int64  `url:"from,string,omitempty"`  // [optional] request page before(newer) this id.
	To       int64  `url:"to,string,omitempty"`    // [optional] request page after(older) this id.
	Limit    int64  `url:"limit,string,omitempty"` // [optional] number of results per request. Maximum 100.(default 100)
}

GetSpotBillDetailsForCurrencyRequest request data for GetSpotBillDetailsForCurrency

type GetSpotBillDetailsForCurrencyResponse

type GetSpotBillDetailsForCurrencyResponse struct {
	LedgerID         string          `json:"ledger_id"`
	Balance          string          `json:"balance"`
	CurrencyResponse string          `json:"currency"`
	Amount           string          `json:"amount"`
	Type             string          `json:"type"`
	TimeStamp        time.Time       `json:"timestamp"`
	Details          SpotBillDetails `json:"details"`
}

GetSpotBillDetailsForCurrencyResponse response data for GetSpotBillDetailsForCurrency

type GetSpotFilledOrdersInformationRequest

type GetSpotFilledOrdersInformationRequest struct {
	InstrumentID string `url:"-"`                      // [required] trading pairs
	From         int64  `url:"from,string,omitempty"`  // [optional] number of results per request. Maximum 100. (default 100)
	To           int64  `url:"to,string,omitempty"`    // [optional] request page after (older) this id.
	Limit        int64  `url:"limit,string,omitempty"` // [optional] number of results per request. Maximum 100. (default 100)
}

GetSpotFilledOrdersInformationRequest request data for GetSpotFilledOrdersInformation

type GetSpotFilledOrdersInformationResponse

type GetSpotFilledOrdersInformationResponse struct {
	Price     string    `json:"price"`
	Side      string    `json:"side"`
	Size      string    `json:"size"`
	Timestamp time.Time `json:"timestamp"`
	TradeID   string    `json:"trade_id"`
}

GetSpotFilledOrdersInformationResponse response data for GetSpotFilledOrdersInformation

type GetSpotMarketDataRequest

type GetSpotMarketDataRequest struct {
	Start        string `url:"start,omitempty"` // [optional] start time in ISO 8601
	End          string `url:"end,omitempty"`   // [optional] end time in ISO 8601
	Granularity  int64  `url:"granularity"`     // The granularity field must be one of the following values: {60, 180, 300, 900, 1800, 3600, 7200, 14400, 43200, 86400, 604800}.
	InstrumentID string `url:"-"`               // [required] trading pairs
}

GetSpotMarketDataRequest request data for GetSpotMarketData

type GetSpotMarketDataResponse

type GetSpotMarketDataResponse []interface{}

GetSpotMarketDataResponse response data for GetSpotMarketData Return Parameters time string Start time open string Open price high string Highest price low string Lowest price close string Close price volume string Trading volume

type GetSpotOpenOrdersRequest

type GetSpotOpenOrdersRequest struct {
	InstrumentID string `json:"instrument_id"`          // [optional] trading pair ,information of all trading pair will be returned if the field is left blank
	From         int64  `json:"from,string,omitempty"`  // [optional] request page after this id (latest information) (eg. 1, 2, 3, 4, 5. There is only a 5 "from 4", while there are 1, 2, 3 "to 4")
	To           int64  `json:"to,string,omitempty"`    // [optional] request page after (older) this id.
	Limit        int64  `json:"limit,string,omitempty"` // [optional] number of results per request. Maximum 100. (default 100)
}

GetSpotOpenOrdersRequest request data for GetSpotOpenOrders

type GetSpotOrderBookRequest

type GetSpotOrderBookRequest struct {
	Size         int64   `url:"size,string,omitempty"`  // [optional] number of results per request. Maximum 200
	Depth        float64 `url:"depth,string,omitempty"` // [optional] the aggregation of the book. e.g . 0.1,0.001
	InstrumentID string  `url:"-"`                      // [required] trading pairs
}

GetSpotOrderBookRequest request data for GetSpotOrderBook

type GetSpotOrderBookResponse

type GetSpotOrderBookResponse struct {
	Timestamp time.Time  `json:"timestamp"`
	Asks      [][]string `json:"asks"` // [[0]: "Price", [1]: "Size", [2]: "Num_orders"], ...
	Bids      [][]string `json:"bids"` // [[0]: "Price", [1]: "Size", [2]: "Num_orders"], ...
}

GetSpotOrderBookResponse response data for GetSpotOrderBook

type GetSpotOrderRequest

type GetSpotOrderRequest struct {
	OrderID      string `url:"-"`             // [required] order ID
	InstrumentID string `url:"instrument_id"` // [required]trading pair
}

GetSpotOrderRequest request data for GetSpotOrder

type GetSpotOrderResponse

type GetSpotOrderResponse struct {
	FilledNotional float64   `json:"filled_notional,string"`
	FilledSize     float64   `json:"filled_size,string"`
	InstrumentID   string    `json:"instrument_id"`
	Notional       string    `json:"notional"`
	OrderID        string    `json:"order_id"`
	Price          float64   `json:"price,string"`
	Side           string    `json:"side"`
	Size           float64   `json:"size,string"`
	Status         string    `json:"status"`
	Timestamp      time.Time `json:"timestamp"`
	Type           string    `json:"type"`
}

GetSpotOrderResponse response data for GetSpotOrders

type GetSpotOrdersRequest

type GetSpotOrdersRequest struct {
	Status string `url:"status"` // list the status of all orders (all, open, part_filled, canceling, filled, cancelled,ordering,failure)
	// (Multiple status separated by '|',and '|' need encode to ' %7C')
	InstrumentID string `url:"instrument_id"`          // trading pair ,information of all trading pair will be returned if the field is left blank
	From         int64  `url:"from,string,omitempty"`  // [optional] request page after this id (latest information) (eg. 1, 2, 3, 4, 5. There is only a 5 "from 4", while there are 1, 2, 3 "to 4")
	To           int64  `url:"to,string,omitempty"`    // [optional] request page after (older) this id.
	Limit        int64  `url:"limit,string,omitempty"` // [optional] number of results per request. Maximum 100. (default 100)
}

GetSpotOrdersRequest request data for GetSpotOrders

type GetSpotTokenPairDetailsResponse

type GetSpotTokenPairDetailsResponse struct {
	BaseCurrency  string `json:"base_currency"`
	InstrumentID  string `json:"instrument_id"`
	MinSize       string `json:"min_size"`
	QuoteCurrency string `json:"quote_currency"`
	SizeIncrement string `json:"size_increment"`
	TickSize      string `json:"tick_size"`
}

GetSpotTokenPairDetailsResponse response data for GetSpotTokenPairDetails

type GetSpotTokenPairsInformationResponse

type GetSpotTokenPairsInformationResponse struct {
	BaseVolume24h  float64   `json:"base_volume_24h,string"`  // 24 trading volume of the base currency
	BestAsk        float64   `json:"best_ask,string"`         // best ask price
	BestBid        float64   `json:"best_bid,string"`         // best bid price
	High24h        float64   `json:"high_24h,string"`         // 24 hour high
	InstrumentID   string    `json:"instrument_id"`           // trading pair
	Last           float64   `json:"last,string"`             // last traded price
	Low24h         float64   `json:"low_24h,string"`          // 24 hour low
	Open24h        float64   `json:"open_24h,string"`         // 24 hour open
	QuoteVolume24h float64   `json:"quote_volume_24h,string"` // 24 trading volume of the quote currency
	Timestamp      time.Time `json:"timestamp"`
}

GetSpotTokenPairsInformationResponse response data for GetSpotTokenPairsInformation

type GetSpotTradingAccountResponse

type GetSpotTradingAccountResponse struct {
	Available string `json:"available"`
	Balance   string `json:"balance"`
	Currency  string `json:"currency"`
	Frozen    string `json:"frozen"`
	Hold      string `json:"hold"`
	Holds     string `json:"holds"`
	ID        string `json:"id"`
}

GetSpotTradingAccountResponse response data for GetSpotTradingAccount

type GetSpotTransactionDetailsRequest

type GetSpotTransactionDetailsRequest struct {
	InstrumentID string `url:"instrument_id"`          // [required]list all transaction details of this instrument_id.
	OrderID      int64  `url:"order_id,string"`        // [required]list all transaction details of this order_id.
	From         int64  `url:"from,string,omitempty"`  // [optional] request page after this id (latest information) (eg. 1, 2, 3, 4, 5. There is only a 5 "from 4", while there are 1, 2, 3 "to 4")
	To           int64  `url:"to,string,omitempty"`    // [optional] request page after (older) this id.
	Limit        int64  `url:"limit,string,omitempty"` // [optional] number of results per request. Maximum 100. (default 100)
}

GetSpotTransactionDetailsRequest request data for GetSpotTransactionDetails

type GetSpotTransactionDetailsResponse

type GetSpotTransactionDetailsResponse struct {
	ExecType     string    `json:"exec_type"`
	Fee          string    `json:"fee"`
	InstrumentID string    `json:"instrument_id"`
	LedgerID     string    `json:"ledger_id"`
	OrderID      string    `json:"order_id"`
	Price        string    `json:"price"`
	Side         string    `json:"side"`
	Size         string    `json:"size"`
	Timestamp    time.Time `json:"timestamp"`
}

GetSpotTransactionDetailsResponse response data for GetSpotTransactionDetails

type GetSwapAccountOfAllCurrencyResponse

type GetSwapAccountOfAllCurrencyResponse struct {
	Info []GetSwapAccountOfAllCurrencyResponseInfo `json:"info"`
}

GetSwapAccountOfAllCurrencyResponse response data for GetSwapAccountOfAllCurrency

type GetSwapAccountOfAllCurrencyResponseInfo

type GetSwapAccountOfAllCurrencyResponseInfo struct {
	Equity            string    `json:"equity"`
	FixedBalance      string    `json:"fixed_balance"`
	TotalAvailBalance string    `json:"total_avail_balance"`
	Margin            string    `json:"margin"`
	RealizedPnl       string    `json:"realized_pnl"`
	UnrealizedPnl     string    `json:"unrealized_pnl"`
	MarginRatio       string    `json:"margin_ratio"`
	InstrumentID      string    `json:"instrument_id"`
	MarginFrozen      string    `json:"margin_frozen"`
	Timestamp         time.Time `json:"timestamp"`
	MarginMode        string    `json:"margin_mode"`
}

GetSwapAccountOfAllCurrencyResponseInfo response data for GetSwapAccountOfAllCurrency

type GetSwapAccountSettingsOfAContractResponse

type GetSwapAccountSettingsOfAContractResponse struct {
	LongLeverage  float64 `json:"long_leverage,string"`
	MarginMode    string  `json:"margin_mode"`
	ShortLeverage float64 `json:"short_leverage,string"`
	InstrumentID  string  `json:"instrument_id"`
}

GetSwapAccountSettingsOfAContractResponse response data for GetSwapAccountSettingsOfAContract

type GetSwapBillDetailsResponse

type GetSwapBillDetailsResponse struct {
	LedgerID     string    `json:"ledger_id"`
	Amount       string    `json:"amount"`
	Type         string    `json:"type"`
	Fee          string    `json:"fee"`
	Timestamp    time.Time `json:"timestamp"`
	InstrumentID string    `json:"instrument_id"`
}

GetSwapBillDetailsResponse response data for GetSwapBillDetails

type GetSwapContractInformationResponse

type GetSwapContractInformationResponse struct {
	InstrumentID    string  `json:"instrument_id"`
	UnderlyingIndex string  `json:"underlying_index"`
	QuoteCurrency   string  `json:"quote_currency"`
	Coin            string  `json:"coin"`
	ContractVal     float64 `json:"contract_val,string"`
	Listing         string  `json:"listing"`
	Delivery        string  `json:"delivery"`
	SizeIncrement   float64 `json:"size_increment,string"`
	TickSize        float64 `json:"tick_size,string"`
}

GetSwapContractInformationResponse response data for GetSwapContractInformation

type GetSwapCurrentPriceLimitsResponse

type GetSwapCurrentPriceLimitsResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Highest      float64   `json:"highest,string"`
	Lowest       float64   `json:"lowest,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetSwapCurrentPriceLimitsResponse response data for GetSwapCurrentPriceLimits

type GetSwapExchangeRatesResponse

type GetSwapExchangeRatesResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Rate         float64   `json:"rate,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetSwapExchangeRatesResponse response data for GetSwapExchangeRates

type GetSwapFilledOrdersDataRequest

type GetSwapFilledOrdersDataRequest struct {
	InstrumentID string `url:"-"`                      // [required] Contract ID, e.g. "BTC-USD-SWAP
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional] Number of results per request. Maximum 100. (default 100)
}

GetSwapFilledOrdersDataRequest request data for GetSwapFilledOrdersData

type GetSwapFilledOrdersDataResponse

type GetSwapFilledOrdersDataResponse struct {
	TradeID   string    `json:"trade_id"`
	Price     float64   `json:"price,string"`
	Size      float64   `json:"size,string"`
	Side      string    `json:"side"`
	Timestamp time.Time `json:"timestamp"`
}

GetSwapFilledOrdersDataResponse response data for GetSwapFilledOrdersData

type GetSwapForceLiquidatedOrdersRequest

type GetSwapForceLiquidatedOrdersRequest struct {
	InstrumentID string `url:"-"`                      // [required] Contract ID, e.g. "BTC-USD-180213"
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional]  	Number of results per request. Maximum 100. (default 100)
	Status       string `url:"status,omitempty"`       // [optional] Status (0:unfilled orders in the recent 7 days 1:filled orders in the recent 7 days)
}

GetSwapForceLiquidatedOrdersRequest request data for GetSwapForceLiquidatedOrders

type GetSwapForceLiquidatedOrdersResponse

type GetSwapForceLiquidatedOrdersResponse struct {
	Loss         float64 `json:"loss,string"`
	Size         int64   `json:"size,string"`
	Price        float64 `json:"price,string"`
	CreatedAt    string  `json:"created_at"`
	InstrumentID string  `json:"instrument_id"`
	Type         int64   `json:"type,string"`
}

GetSwapForceLiquidatedOrdersResponse response data for GetSwapForceLiquidatedOrders

type GetSwapFundingRateHistoryRequest

type GetSwapFundingRateHistoryRequest struct {
	InstrumentID string `url:"ins-trument_id"`         // [required] Contract ID, e.g. "BTC-USD-SWAP
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional] Number of results per request. Maximum 100.
}

GetSwapFundingRateHistoryRequest request data for GetSwapFundingRateHistory

type GetSwapFundingRateHistoryResponse

type GetSwapFundingRateHistoryResponse struct {
	InstrumentID string  `json:"instrument_id"`
	FundingRate  float64 `json:"funding_rate,string,omitempty"`
	RealizedRate float64 `json:"realized_rate,string"`
	InterestRate float64 `json:"interest_rate,string"`
	FundingTime  string  `json:"funding_time"`
	FundingFee   float64 `json:"funding_fee,string,omitempty"`
}

GetSwapFundingRateHistoryResponse response data for GetSwapFundingRateHistory

type GetSwapIndecesResponse

type GetSwapIndecesResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Index        float64   `json:"index,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetSwapIndecesResponse response data for GetSwapIndeces

type GetSwapMarkPriceResponse

type GetSwapMarkPriceResponse struct {
	InstrumentID string `json:"instrument_id"`
	MarkPrice    string `json:"mark_price"`
	Timstamp     string `json:"timstamp"`
}

GetSwapMarkPriceResponse response data for GetSwapMarkPrice

type GetSwapMarketDataRequest

type GetSwapMarketDataRequest struct {
	Start        string `url:"start,omitempty"`       // [optional] start time in ISO 8601
	End          string `url:"end,omitempty"`         // [optional] end time in ISO 8601
	Granularity  int64  `url:"granularity,omitempty"` // The granularity field must be one of the following values: {60, 180, 300, 900, 1800, 3600, 7200, 14400, 43200, 86400, 604800}.
	InstrumentID string `url:"-"`                     // [required] trading pairs
}

GetSwapMarketDataRequest retrieves candle data information

type GetSwapMarketDataResponse

type GetSwapMarketDataResponse []interface{}

GetSwapMarketDataResponse response data for GetSwapMarketData Return Parameters time string Start time open string Open price high string Highest price low string Lowest price close string Close price volume string Trading volume currency_volume string Volume in a specific token

type GetSwapNextSettlementTimeResponse

type GetSwapNextSettlementTimeResponse struct {
	InstrumentID string `json:"instrument_id"`
	FundingTime  string `json:"funding_time"`
}

GetSwapNextSettlementTimeResponse response data for GetSwapNextSettlementTime

type GetSwapOnHoldAmountForOpenOrdersResponse

type GetSwapOnHoldAmountForOpenOrdersResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Amount       float64   `json:"amount,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetSwapOnHoldAmountForOpenOrdersResponse response data for GetSwapOnHoldAmountForOpenOrders

type GetSwapOpenInterestResponse

type GetSwapOpenInterestResponse struct {
	InstrumentID string    `json:"instrument_id"`
	Amount       float64   `json:"amount,string"`
	Timestamp    time.Time `json:"timestamp"`
}

GetSwapOpenInterestResponse response data for GetSwapOpenInterest

type GetSwapOrderBookRequest

type GetSwapOrderBookRequest struct {
	InstrumentID string  `url:"-"`
	Size         float64 `url:"size,string,omitempty"`
}

GetSwapOrderBookRequest request data for GetSwapOrderBook

type GetSwapOrderBookResponse

type GetSwapOrderBookResponse struct {
	Asks      [][]interface{} `json:"asks"` // eg [["411.3","16",5,4]] [[0: Price, 1: Size price, 2: number of force liquidated orders, 3: number of orders on the price]]
	Bids      [][]interface{} `json:"bids"` // eg [["411.3","16",5,4]] [[0: Price, 1: Size price, 2: number of force liquidated orders, 3: number of orders on the price]]
	Timestamp time.Time       `json:"timestamp"`
}

GetSwapOrderBookResponse response data for GetSwapOrderBook

type GetSwapOrderDetailsRequest

type GetSwapOrderDetailsRequest struct {
	InstrumentID string `json:"instrument_id"` // [required] Contract ID,e.g. BTC-USD-SWAP
	OrderID      string `json:"order_id"`      // [required] Order ID
}

GetSwapOrderDetailsRequest request data for GetSwapOrderList

type GetSwapOrderListRequest

type GetSwapOrderListRequest struct {
	InstrumentID string `url:"-"`                      // [required] Contract ID, e.g. "BTC-USD-180213"
	Status       int64  `url:"status,string"`          // [required] Order Status (-1 canceled; 0: pending, 1: partially filled, 2: fully filled, 6: open (pending partially + fully filled), 7: completed (canceled + fully filled))
	From         int64  `url:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `url:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `url:"limit,string,omitempty"` // [optional] Number of results per request. Maximum 100. (default 100)
}

GetSwapOrderListRequest request data for GetSwapOrderList

type GetSwapOrderListResponse

type GetSwapOrderListResponse struct {
	Result    bool                           `json:"result,string"`
	OrderInfo []GetSwapOrderListResponseData `json:"order_info"`
}

GetSwapOrderListResponse response data for GetSwapOrderList

type GetSwapOrderListResponseData

type GetSwapOrderListResponseData struct {
	ContractVal  float64   `json:"contract_val,string"`
	Fee          float64   `json:"fee,string"`
	FilledQty    float64   `json:"filled_qty,string"`
	InstrumentID string    `json:"instrument_id"`
	Leverage     int64     `json:"leverage,string"` //  	Leverage value:10\20 default:10
	OrderID      int64     `json:"order_id,string"`
	Price        float64   `json:"price,string"`
	PriceAvg     float64   `json:"price_avg,string"`
	Size         float64   `json:"size,string"`
	Status       int64     `json:"status,string"` // Order Status (-1 canceled; 0: pending, 1: partially filled, 2: fully filled)
	Timestamp    time.Time `json:"timestamp"`
	Type         int64     `json:"type,string"` //  	Type (1: open long 2: open short 3: close long 4: close short)
}

GetSwapOrderListResponseData individual order data from GetSwapOrderList

type GetSwapPostionsResponse

type GetSwapPostionsResponse struct {
	MarginMode string                           `json:"margin_mode"`
	Holding    []GetSwapPostionsResponseHolding `json:"holding"`
}

GetSwapPostionsResponse response data for GetSwapPostions

type GetSwapPostionsResponseHolding

type GetSwapPostionsResponseHolding struct {
	AvailPosition    string    `json:"avail_position"`
	AvgCost          string    `json:"avg_cost"`
	InstrumentID     string    `json:"instrument_id"`
	Leverage         string    `json:"leverage"`
	LiquidationPrice string    `json:"liquidation_price"`
	Margin           string    `json:"margin"`
	Position         string    `json:"position"`
	RealizedPnl      string    `json:"realized_pnl"`
	SettlementPrice  string    `json:"settlement_price"`
	Side             string    `json:"side"`
	Timestamp        time.Time `json:"timestamp"`
}

GetSwapPostionsResponseHolding response data for GetSwapPostions

type GetSwapTransactionDetailsRequest

type GetSwapTransactionDetailsRequest struct {
	InstrumentID string `json:"instrument_id"`          // [required] Contract ID, e.g. BTC-USD-SWAP
	OrderID      string `json:"order_id"`               // [required] Order ID
	From         int64  `json:"from,string,omitempty"`  // [optional] Request paging content for this page number.(Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	To           int64  `json:"to,string,omitempty"`    // [optional] Request page after (older) this pagination id. (Example: 1,2,3,4,5. From 4 we only have 4, to 4 we only have 3)
	Limit        int64  `json:"limit,string,omitempty"` // [optional] number of results per request. Maximum 100. (default 100)
}

GetSwapTransactionDetailsRequest request data for GetSwapTransactionDetails

type GetSwapTransactionDetailsResponse

type GetSwapTransactionDetailsResponse struct {
	TradeID      string    `json:"trade_id"`
	InstrumentID string    `json:"instrument_id"`
	OrderID      string    `json:"order_id"`
	Price        string    `json:"price"`
	OrderQty     string    `json:"order_qty"`
	Fee          string    `json:"fee"`
	Timestamp    time.Time `json:"timestamp"`
	ExecType     string    `json:"exec_type"`
	Side         string    `json:"side"`
}

GetSwapTransactionDetailsResponse response data for GetSwapTransactionDetails

type MarginAccountInfo

type MarginAccountInfo struct {
	Available  float64 `json:"available,string"`
	Balance    float64 `json:"balance,string"`
	Borrowed   float64 `json:"borrowed,string"`
	Frozen     float64 `json:"frozen,string"`
	Hold       float64 `json:"hold,string"`
	Holds      float64 `json:"holds,string"`
	LendingFee float64 `json:"lending_fee,string"`
}

MarginAccountInfo contains individual currency information

type MarginAccountSettingsInfo

type MarginAccountSettingsInfo struct {
	Available     float64 `json:"available,string"`
	Leverage      float64 `json:"leverage,string"`
	LeverageRatio float64 `json:"leverage_ratio,string"`
	Rate          float64 `json:"rate,string"`
}

MarginAccountSettingsInfo contains individual currency data

type OKGroup

type OKGroup struct {
	exchange.Base
	ExchangeName  string
	WebsocketConn *wshandler.WebsocketConnection
	// Spot and contract market error codes as per https://www.okex.com/rest_request.html
	ErrorCodes map[string]error
	// Stores for corresponding variable checks
	ContractTypes    []string
	CurrencyPairs    []string
	ContractPosition []string
	Types            []string
	// URLs to be overridden by implementations of OKGroup
	APIURL       string
	APIVersion   string
	WebsocketURL string
}

OKGroup is the overaching type across the all of OKEx's exchange methods

func (*OKGroup) AccountWithdraw

func (o *OKGroup) AccountWithdraw(request AccountWithdrawRequest) (resp AccountWithdrawResponse, _ error)

AccountWithdraw withdrawal of tokens to OKCoin International, other OKEx accounts or other addresses.

func (*OKGroup) AppendWsOrderbookItems

func (o *OKGroup) AppendWsOrderbookItems(entries [][]interface{}) (orderbookItems []orderbook.Item)

AppendWsOrderbookItems adds websocket orderbook data bid/asks into an orderbook item array

func (*OKGroup) AuthenticateWebsocket

func (o *OKGroup) AuthenticateWebsocket() error

AuthenticateWebsocket sends an authentication message to the websocket

func (*OKGroup) CalculatePartialOrderbookChecksum

func (o *OKGroup) CalculatePartialOrderbookChecksum(orderbookData *WebsocketDataWrapper) int32

CalculatePartialOrderbookChecksum alternates over the first 25 bid and ask entries from websocket data The checksum is made up of the price and the quantity with a semicolon (:) deliminating them This will also work when there are less than 25 entries (for whatever reason) eg Bid:Ask:Bid:Ask:Ask:Ask

func (*OKGroup) CalculateUpdateOrderbookChecksum

func (o *OKGroup) CalculateUpdateOrderbookChecksum(orderbookData *orderbook.Base) int32

CalculateUpdateOrderbookChecksum alternates over the first 25 bid and ask entries of a merged orderbook The checksum is made up of the price and the quantity with a semicolon (:) deliminating them This will also work when there are less than 25 entries (for whatever reason) eg Bid:Ask:Bid:Ask:Ask:Ask

func (*OKGroup) CancelAllOrders

func (o *OKGroup) CancelAllOrders(orderCancellation *exchange.OrderCancellation) (resp exchange.CancelAllOrdersResponse, err error)

CancelAllOrders cancels all orders associated with a currency pair

func (*OKGroup) CancelMarginOrder

func (o *OKGroup) CancelMarginOrder(request CancelSpotOrderRequest) (resp CancelSpotOrderResponse, _ error)

CancelMarginOrder Cancelling an unfilled order.

func (*OKGroup) CancelMultipleMarginOrders

func (o *OKGroup) CancelMultipleMarginOrders(request CancelMultipleSpotOrdersRequest) (map[string][]CancelMultipleSpotOrdersResponse, []error)

CancelMultipleMarginOrders Cancelling multiple unfilled orders.

func (*OKGroup) CancelMultipleSpotOrders

func (o *OKGroup) CancelMultipleSpotOrders(request CancelMultipleSpotOrdersRequest) (resp map[string][]CancelMultipleSpotOrdersResponse, err error)

CancelMultipleSpotOrders Cancelling multiple unfilled orders.

func (*OKGroup) CancelOrder

func (o *OKGroup) CancelOrder(orderCancellation *exchange.OrderCancellation) (err error)

CancelOrder cancels an order by its corresponding ID number

func (*OKGroup) CancelSpotOrder

func (o *OKGroup) CancelSpotOrder(request CancelSpotOrderRequest) (resp CancelSpotOrderResponse, _ error)

CancelSpotOrder Cancelling an unfilled order.

func (*OKGroup) GenerateDefaultSubscriptions

func (o *OKGroup) GenerateDefaultSubscriptions()

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

func (*OKGroup) GetAccountBillDetails

func (o *OKGroup) GetAccountBillDetails(request GetAccountBillDetailsRequest) (resp []GetAccountBillDetailsResponse, _ error)

GetAccountBillDetails retrieves the bill details of the wallet. All the information will be paged and sorted in reverse chronological order, which means the latest will be at the top. Please refer to the pagination section for additional records after the first page. 3 months recent records will be returned at maximum

func (*OKGroup) GetAccountCurrencies

func (o *OKGroup) GetAccountCurrencies() (resp []GetAccountCurrenciesResponse, _ error)

GetAccountCurrencies returns a list of tradable spot instruments and their properties

func (*OKGroup) GetAccountDepositAddressForCurrency

func (o *OKGroup) GetAccountDepositAddressForCurrency(currency string) (resp []GetDepositAddressResponse, _ error)

GetAccountDepositAddressForCurrency retrieves the deposit addresses of different tokens, including previously used addresses.

func (*OKGroup) GetAccountDepositHistory

func (o *OKGroup) GetAccountDepositHistory(currency string) (resp []GetAccountDepositHistoryResponse, _ error)

GetAccountDepositHistory retrieves the deposit history of all tokens.100 recent records will be returned at maximum

func (*OKGroup) GetAccountInfo

func (o *OKGroup) GetAccountInfo() (resp exchange.AccountInfo, err error)

GetAccountInfo retrieves balances for all enabled currencies

func (*OKGroup) GetAccountWalletInformation

func (o *OKGroup) GetAccountWalletInformation(currency string) (resp []WalletInformationResponse, _ error)

GetAccountWalletInformation returns a list of wallets and their properties

func (*OKGroup) GetAccountWithdrawalFee

func (o *OKGroup) GetAccountWithdrawalFee(currency string) (resp []GetAccountWithdrawalFeeResponse, _ error)

GetAccountWithdrawalFee retrieves the information about the recommended network transaction fee for withdrawals to digital asset addresses. The higher the fees are, the sooner the confirmations you will get.

func (*OKGroup) GetAccountWithdrawalHistory

func (o *OKGroup) GetAccountWithdrawalHistory(currency string) (resp []WithdrawalHistoryResponse, _ error)

GetAccountWithdrawalHistory retrieves all recent withdrawal records.

func (*OKGroup) GetActiveOrders

func (o *OKGroup) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) (resp []exchange.OrderDetail, err error)

GetActiveOrders retrieves any orders that are active/open

func (*OKGroup) GetAssetTypeFromTableName

func (o *OKGroup) GetAssetTypeFromTableName(table string) string

GetAssetTypeFromTableName gets the asset type from the table name eg "spot/ticker:BTCUSD" results in "SPOT"

func (*OKGroup) GetDepositAddress

func (o *OKGroup) GetDepositAddress(p currency.Code, accountID string) (_ string, err error)

GetDepositAddress returns a deposit address for a specified currency

func (*OKGroup) GetErrorCode

func (o *OKGroup) GetErrorCode(code interface{}) error

GetErrorCode returns an error code

func (*OKGroup) GetExchangeHistory

func (o *OKGroup) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

func (*OKGroup) GetFee

func (o *OKGroup) GetFee(feeBuilder *exchange.FeeBuilder) (fee float64, _ error)

GetFee returns an estimate of fee based on type of transaction

func (*OKGroup) GetFeeByType

func (o *OKGroup) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*OKGroup) GetFundingHistory

func (o *OKGroup) GetFundingHistory() (resp []exchange.FundHistory, err error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*OKGroup) GetMarginAccountSettings

func (o *OKGroup) GetMarginAccountSettings(currency string) (resp []GetMarginAccountSettingsResponse, _ error)

GetMarginAccountSettings Get all information of the margin trading account, including the maximum loan amount, interest rate, and maximum leverage.

func (*OKGroup) GetMarginBillDetails

func (o *OKGroup) GetMarginBillDetails(request GetMarginBillDetailsRequest) (resp []GetSpotBillDetailsForCurrencyResponse, _ error)

GetMarginBillDetails List all bill details. Pagination is used here. before and after cursor arguments should not be confused with before and after in chronological time. Most paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetMarginLoanHistory

func (o *OKGroup) GetMarginLoanHistory(request GetMarginLoanHistoryRequest) (resp []GetMarginLoanHistoryResponse, _ error)

GetMarginLoanHistory Get loan history of the margin trading account. Pagination is used here. before and after cursor arguments should not be confused with before and after in chronological time. Most paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetMarginOpenOrders

func (o *OKGroup) GetMarginOpenOrders(request GetSpotOpenOrdersRequest) (resp []GetSpotOrderResponse, _ error)

GetMarginOpenOrders List all your current open orders. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetMarginOrder

func (o *OKGroup) GetMarginOrder(request GetSpotOrderRequest) (resp GetSpotOrderResponse, _ error)

GetMarginOrder Get order details by order ID.

func (*OKGroup) GetMarginOrders

func (o *OKGroup) GetMarginOrders(request GetSpotOrdersRequest) (resp []GetSpotOrderResponse, _ error)

GetMarginOrders List your orders. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetMarginTradingAccounts

func (o *OKGroup) GetMarginTradingAccounts() (resp []GetMarginAccountsResponse, _ error)

GetMarginTradingAccounts List all assets under token margin trading account, including information such as balance, amount on hold and more.

func (*OKGroup) GetMarginTradingAccountsForCurrency

func (o *OKGroup) GetMarginTradingAccountsForCurrency(currency string) (resp GetMarginAccountsResponse, _ error)

GetMarginTradingAccountsForCurrency Get the balance, amount on hold and more useful information.

func (*OKGroup) GetMarginTransactionDetails

func (o *OKGroup) GetMarginTransactionDetails(request GetSpotTransactionDetailsRequest) (resp []GetSpotTransactionDetailsResponse, _ error)

GetMarginTransactionDetails Get details of the recent filled orders. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetOrderHistory

func (o *OKGroup) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) (resp []exchange.OrderDetail, err error)

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

func (*OKGroup) GetOrderInfo

func (o *OKGroup) GetOrderInfo(orderID string) (resp exchange.OrderDetail, err error)

GetOrderInfo returns information on a current open order

func (*OKGroup) GetOrderbookEx

func (o *OKGroup) GetOrderbookEx(p currency.Pair, assetType string) (resp orderbook.Base, err error)

GetOrderbookEx returns orderbook base on the currency pair

func (*OKGroup) GetSpotAllTokenPairsInformation

func (o *OKGroup) GetSpotAllTokenPairsInformation() (resp []GetSpotTokenPairsInformationResponse, _ error)

GetSpotAllTokenPairsInformation Get the last traded price, best bid/ask price, 24 hour trading volume and more info of all trading pairs.

func (*OKGroup) GetSpotAllTokenPairsInformationForCurrency

func (o *OKGroup) GetSpotAllTokenPairsInformationForCurrency(currency string) (resp GetSpotTokenPairsInformationResponse, _ error)

GetSpotAllTokenPairsInformationForCurrency Get the last traded price, best bid/ask price, 24 hour trading volume and more info of a currency

func (*OKGroup) GetSpotBillDetailsForCurrency

func (o *OKGroup) GetSpotBillDetailsForCurrency(request GetSpotBillDetailsForCurrencyRequest) (resp []GetSpotBillDetailsForCurrencyResponse, _ error)

GetSpotBillDetailsForCurrency This endpoint supports getting the balance, amount available/on hold of a token in spot account.

func (*OKGroup) GetSpotFilledOrdersInformation

func (o *OKGroup) GetSpotFilledOrdersInformation(request GetSpotFilledOrdersInformationRequest) (resp []GetSpotFilledOrdersInformationResponse, _ error)

GetSpotFilledOrdersInformation Get the recent 60 transactions of all trading pairs. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetSpotMarketData

func (o *OKGroup) GetSpotMarketData(request GetSpotMarketDataRequest) (resp GetSpotMarketDataResponse, _ error)

GetSpotMarketData Get the charts of the trading pairs. Charts are returned in grouped buckets based on requested granularity.

func (*OKGroup) GetSpotOpenOrders

func (o *OKGroup) GetSpotOpenOrders(request GetSpotOpenOrdersRequest) (resp []GetSpotOrderResponse, _ error)

GetSpotOpenOrders List all your current open orders. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetSpotOrder

func (o *OKGroup) GetSpotOrder(request GetSpotOrderRequest) (resp GetSpotOrderResponse, _ error)

GetSpotOrder Get order details by order ID.

func (*OKGroup) GetSpotOrderBook

func (o *OKGroup) GetSpotOrderBook(request GetSpotOrderBookRequest) (resp GetSpotOrderBookResponse, _ error)

GetSpotOrderBook Getting the order book of a trading pair. Pagination is not supported here. The whole book will be returned for one request. Websocket is recommended here.

func (*OKGroup) GetSpotOrders

func (o *OKGroup) GetSpotOrders(request GetSpotOrdersRequest) (resp []GetSpotOrderResponse, _ error)

GetSpotOrders List your orders. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetSpotTokenPairDetails

func (o *OKGroup) GetSpotTokenPairDetails() (resp []GetSpotTokenPairDetailsResponse, _ error)

GetSpotTokenPairDetails Get market data. This endpoint provides the snapshots of market data and can be used without verifications. List trading pairs and get the trading limit, price, and more information of different trading pairs.

func (*OKGroup) GetSpotTradingAccountForCurrency

func (o *OKGroup) GetSpotTradingAccountForCurrency(currency string) (resp GetSpotTradingAccountResponse, _ error)

GetSpotTradingAccountForCurrency This endpoint supports getting the balance, amount available/on hold of a token in spot account.

func (*OKGroup) GetSpotTradingAccounts

func (o *OKGroup) GetSpotTradingAccounts() (resp []GetSpotTradingAccountResponse, _ error)

GetSpotTradingAccounts retrieves the list of assets(only show pairs with balance larger than 0), the balances, amount available/on hold in spot accounts.

func (*OKGroup) GetSpotTransactionDetails

func (o *OKGroup) GetSpotTransactionDetails(request GetSpotTransactionDetailsRequest) (resp []GetSpotTransactionDetailsResponse, _ error)

GetSpotTransactionDetails Get details of the recent filled orders. Cursor pagination is used. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKGroup) GetSubscriptions

func (o *OKGroup) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)

GetSubscriptions returns a copied list of subscriptions

func (*OKGroup) GetTickerPrice

func (o *OKGroup) GetTickerPrice(p currency.Pair, assetType string) (tickerData ticker.Price, err error)

GetTickerPrice returns the ticker for a currency pair

func (*OKGroup) GetWebsocket

func (o *OKGroup) GetWebsocket() (*wshandler.Websocket, error)

GetWebsocket returns a pointer to the exchange websocket

func (*OKGroup) GetWithdrawCapabilities

func (o *OKGroup) GetWithdrawCapabilities() uint32

GetWithdrawCapabilities returns the types of withdrawal methods permitted by the exchange

func (*OKGroup) GetWsChannelWithoutOrderType

func (o *OKGroup) GetWsChannelWithoutOrderType(table string) string

GetWsChannelWithoutOrderType takes WebsocketDataResponse.Table and returns The base channel name eg receive "spot/depth5:BTC-USDT" return "depth5"

func (*OKGroup) ModifyOrder

func (o *OKGroup) ModifyOrder(action *exchange.ModifyOrder) (string, error)

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

func (*OKGroup) OpenMarginLoan

func (o *OKGroup) OpenMarginLoan(request OpenMarginLoanRequest) (resp OpenMarginLoanResponse, _ error)

OpenMarginLoan Borrowing tokens in a margin trading account.

func (*OKGroup) PlaceMarginOrder

func (o *OKGroup) PlaceMarginOrder(request *PlaceSpotOrderRequest) (resp PlaceSpotOrderResponse, _ error)

PlaceMarginOrder OKEx API only supports limit and market orders (more orders will become available in the future). You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold.

func (*OKGroup) PlaceMultipleMarginOrders

func (o *OKGroup) PlaceMultipleMarginOrders(request []PlaceSpotOrderRequest) (map[string][]PlaceSpotOrderResponse, []error)

PlaceMultipleMarginOrders Place multiple orders for specific trading pairs (up to 4 trading pairs, maximum 4 orders each)

func (*OKGroup) PlaceMultipleSpotOrders

func (o *OKGroup) PlaceMultipleSpotOrders(request []PlaceSpotOrderRequest) (map[string][]PlaceSpotOrderResponse, []error)

PlaceMultipleSpotOrders supports placing multiple orders for specific trading pairs up to 4 trading pairs, maximum 4 orders for each pair

func (*OKGroup) PlaceSpotOrder

func (o *OKGroup) PlaceSpotOrder(request *PlaceSpotOrderRequest) (resp PlaceSpotOrderResponse, _ error)

PlaceSpotOrder token trading only supports limit and market orders (more order types will become available in the future). You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold.

func (*OKGroup) RepayMarginLoan

func (o *OKGroup) RepayMarginLoan(request RepayMarginLoanRequest) (resp RepayMarginLoanResponse, _ error)

RepayMarginLoan Repaying tokens in a margin trading account.

func (*OKGroup) Run

func (o *OKGroup) Run()

Run implements the OKEX wrapper

func (*OKGroup) SendHTTPRequest

func (o *OKGroup) SendHTTPRequest(httpMethod, requestType, requestPath string, data, result interface{}, authenticated bool) (err error)

SendHTTPRequest sends an authenticated http request to a desired path with a JSON payload (of present) URL arguments must be in the request path and not as url.URL values

func (*OKGroup) SetCheckVarDefaults

func (o *OKGroup) SetCheckVarDefaults()

SetCheckVarDefaults sets main variables that will be used in requests because api does not return an error if there are misspellings in strings. So better to check on this, this end.

func (*OKGroup) SetErrorDefaults

func (o *OKGroup) SetErrorDefaults()

SetErrorDefaults sets the full error default list

func (*OKGroup) Setup

func (o *OKGroup) Setup(exch *config.ExchangeConfig)

Setup method sets current configuration details if enabled

func (*OKGroup) Start

func (o *OKGroup) Start(wg *sync.WaitGroup)

Start starts the OKGroup go routine

func (*OKGroup) SubmitOrder

func (o *OKGroup) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (resp exchange.SubmitOrderResponse, err error)

SubmitOrder submits a new order

func (*OKGroup) Subscribe

func (o *OKGroup) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error

Subscribe sends a websocket message to receive data from the channel

func (*OKGroup) SubscribeToWebsocketChannels

func (o *OKGroup) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error

SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing

func (*OKGroup) TransferAccountFunds

func (o *OKGroup) TransferAccountFunds(request TransferAccountFundsRequest) (resp TransferAccountFundsResponse, _ error)

TransferAccountFunds the transfer of funds between wallet, trading accounts, main account and sub accounts.

func (*OKGroup) Unsubscribe

func (o *OKGroup) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error

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

func (*OKGroup) UnsubscribeToWebsocketChannels

func (o *OKGroup) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error

UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing

func (*OKGroup) UpdateOrderbook

func (o *OKGroup) UpdateOrderbook(p currency.Pair, assetType string) (resp orderbook.Base, err error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*OKGroup) UpdateTicker

func (o *OKGroup) UpdateTicker(p currency.Pair, assetType string) (tickerData ticker.Price, err error)

UpdateTicker updates and returns the ticker for a currency pair

func (*OKGroup) WithdrawCryptocurrencyFunds

func (o *OKGroup) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*OKGroup) WithdrawFiatFunds

func (o *OKGroup) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*OKGroup) WithdrawFiatFundsToInternationalBank

func (o *OKGroup) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*OKGroup) WsConnect

func (o *OKGroup) WsConnect() error

WsConnect initiates a websocket connection

func (*OKGroup) WsHandleData

func (o *OKGroup) WsHandleData(wg *sync.WaitGroup)

WsHandleData handles the read data from the websocket connection

func (*OKGroup) WsHandleDataResponse

func (o *OKGroup) WsHandleDataResponse(response *WebsocketDataResponse)

WsHandleDataResponse classifies the WS response and sends to appropriate handler

func (*OKGroup) WsHandleErrorResponse

func (o *OKGroup) WsHandleErrorResponse(event WebsocketErrorResponse)

WsHandleErrorResponse sends an error message to ws handler

func (*OKGroup) WsLogin

func (o *OKGroup) WsLogin() error

WsLogin sends a login request to websocket to enable access to authenticated endpoints

func (*OKGroup) WsProcessOrderBook

func (o *OKGroup) WsProcessOrderBook(response *WebsocketDataResponse) (err error)

WsProcessOrderBook Validates the checksum and updates internal orderbook values

func (*OKGroup) WsProcessPartialOrderBook

func (o *OKGroup) WsProcessPartialOrderBook(wsEventData *WebsocketDataWrapper, instrument currency.Pair, tableName string) error

WsProcessPartialOrderBook takes websocket orderbook data and creates an orderbook Calculates checksum to ensure it is valid

func (*OKGroup) WsProcessUpdateOrderbook

func (o *OKGroup) WsProcessUpdateOrderbook(wsEventData *WebsocketDataWrapper, instrument currency.Pair, tableName string) error

WsProcessUpdateOrderbook updates an existing orderbook using websocket data After merging WS data, it will sort, validate and finally update the existing orderbook

type OpenMarginLoanRequest

type OpenMarginLoanRequest struct {
	QuoteCurrency string  `json:"currency"`      // [required] Second currency eg BTC-USDT: USDT is quote
	InstrumentID  string  `json:"instrument_id"` // [required] Full pair BTC-USDT
	Amount        float64 `json:"amount,string"` // [required] Amount wanting to borrow
}

OpenMarginLoanRequest request data for OpenMarginLoan

type OpenMarginLoanResponse

type OpenMarginLoanResponse struct {
	BorrowID int64 `json:"borrow_id"`
	Result   bool  `json:"result"`
}

OpenMarginLoanResponse response data for OpenMarginLoan

type PlaceETTOrderRequest

type PlaceETTOrderRequest struct {
	ClientOID     string  `json:"client_oid"`     // [optional]the order ID customized by yourself
	Type          int64   `json:"type"`           // Type of order (0:ETT subscription 1:subscribe with USDT 2:Redeem in USDT 3:Redeem in underlying)
	QuoteCurrency string  `json:"quote_currency"` // Subscription/redemption currency
	Amount        float64 `json:"amount"`         // Subscription amount. Required for usdt subscription
	Size          string  `json:"size"`           // Redemption size. Required for ETT subscription and redemption
	ETT           string  `json:"ett"`            // ETT name
}

PlaceETTOrderRequest request data for PlaceETTOrder

type PlaceETTOrderResponse

type PlaceETTOrderResponse struct {
	ClientOID string `json:"client_oid"`
	OrderID   string `json:"type"`
	Result    bool   `json:"quote_currency"`
}

PlaceETTOrderResponse response data for PlaceETTOrder

type PlaceFuturesOrderBatchRequest

type PlaceFuturesOrderBatchRequest struct {
	InstrumentID string                                 `json:"instrument_id"` // [required] Contract ID, e.g."BTC-USD-180213"
	Leverage     int                                    `json:"leverage"`      // [required] 10x or 20x leverage
	OrdersData   []PlaceFuturesOrderBatchRequestDetails `json:"orders_data"`   // [required] the JSON word string for placing multiple orders, include:{client_oid type price size match_price}
}

PlaceFuturesOrderBatchRequest request data for PlaceFuturesOrderBatch

type PlaceFuturesOrderBatchRequestDetails

type PlaceFuturesOrderBatchRequestDetails struct {
	ClientOid  string `json:"client_oid"`  // [required] To identify your order with the order ID set by you
	MatchPrice string `json:"match_price"` // undocumented
	Price      string `json:"price"`       // undocumented
	Size       string `json:"size"`        // undocumented
	Type       string `json:"type"`        // undocumented
}

PlaceFuturesOrderBatchRequestDetails individual order details for PlaceFuturesOrderBatchRequest

type PlaceFuturesOrderBatchResponse

type PlaceFuturesOrderBatchResponse struct {
	OrderInfo []PlaceFuturesOrderBatchResponseData `json:"order_info"`
	Result    bool                                 `json:"result"`
}

PlaceFuturesOrderBatchResponse response data from PlaceFuturesOrderBatch

type PlaceFuturesOrderBatchResponseData

type PlaceFuturesOrderBatchResponseData struct {
	ClientOid    string  `json:"client_oid"`
	ErrorCode    int     `json:"error_code"`
	ErrorMessage string  `json:"error_message"`
	OrderID      float64 `json:"order_id"`
}

PlaceFuturesOrderBatchResponseData individual order details from PlaceFuturesOrderBatchResponse

type PlaceFuturesOrderRequest

type PlaceFuturesOrderRequest struct {
	ClientOid    string  `json:"client_oid,omitempty"`         // [optional] 	the order ID customized by yourself
	InstrumentID string  `json:"instrument_id"`                // [required]   	Contract ID,e.g. "TC-USD-180213"
	Type         int64   `json:"type,string"`                  //  [required] 	1:open long 2:open short 3:close long 4:close short
	Price        float64 `json:"price,string"`                 //  [required] 	Price of each contract
	Size         int64   `json:"size,string"`                  //  [required] The buying or selling quantity
	MatchPrice   int64   `json:"match_price,string,omitempty"` // [optional] 	Order at best counter party price? (0:no 1:yes) the parameter is defaulted as 0. If it is set as 1, the price parameter will be ignored
	Leverage     int64   `json:"leverage,string"`              // [required]  	 	10x or 20x leverage
}

PlaceFuturesOrderRequest request data for PlaceFuturesOrder

type PlaceFuturesOrderResponse

type PlaceFuturesOrderResponse struct {
	ClientOid     string `json:"client_oid"`
	ErrorCode     int    `json:"error_code"`
	ErrorMesssage string `json:"error_messsage"`
	OrderID       string `json:"order_id"`
	Result        bool   `json:"result"`
}

PlaceFuturesOrderResponse response data for PlaceFuturesOrder

type PlaceMultipleSwapOrderData

type PlaceMultipleSwapOrderData struct {
	ClientOID  string `json:"client_oid"`  // [required] To identify your order with the order ID set by you
	Type       string `json:"type"`        // Undocumented
	Price      string `json:"price"`       // Undocumented
	Size       string `json:"size"`        // Undocumented
	MatchPrice string `json:"match_price"` // Undocumented
}

PlaceMultipleSwapOrderData response data for PlaceMultipleSwapOrders

type PlaceMultipleSwapOrdersRequest

type PlaceMultipleSwapOrdersRequest struct {
	InstrumentID string                       `json:"instrument_id"` // [required] Contract ID, e.g. BTC-USD-SWAP
	Leverage     int64                        `json:"leverage"`      // [required] 10x or 20x leverage
	OrdersData   []PlaceMultipleSwapOrderData `json:"orders_data"`   // [required] the JSON word string for placing multiple orders, include:{client_oid type price size match_price}
}

PlaceMultipleSwapOrdersRequest response data for PlaceMultipleSwapOrders

type PlaceMultipleSwapOrdersResponse

type PlaceMultipleSwapOrdersResponse struct {
	Result    bool                                  `json:"result,string"`
	OrderInfo []PlaceMultipleSwapOrdersResponseInfo `json:"order_info"`
}

PlaceMultipleSwapOrdersResponse response data for PlaceMultipleSwapOrders

type PlaceMultipleSwapOrdersResponseInfo

type PlaceMultipleSwapOrdersResponseInfo struct {
	ErrorMessage string `json:"error_message"`
	ErrorCode    int64  `json:"error_code"`
	ClientOID    string `json:"client_oid"`
	OrderID      string `json:"order_id"`
}

PlaceMultipleSwapOrdersResponseInfo response data for PlaceMultipleSwapOrders

type PlaceSpotOrderRequest

type PlaceSpotOrderRequest struct {
	ClientOID     string `json:"client_oid,omitempty"` // the order ID customized by yourself
	Type          string `json:"type"`                 // limit / market(default: limit)
	Side          string `json:"side"`                 // buy or sell
	InstrumentID  string `json:"instrument_id"`        // trading pair
	MarginTrading string `json:"margin_trading"`       // order type (The request value is 1)
	Size          string `json:"size"`
	Notional      string `json:"notional,omitempty"` //
	Price         string `json:"price,omitempty"`    // price (Limit order only)
}

PlaceSpotOrderRequest request data for PlaceSpotOrder

type PlaceSpotOrderResponse

type PlaceSpotOrderResponse struct {
	ClientOid string `json:"client_oid"`
	OrderID   string `json:"order_id"`
	Result    bool   `json:"result"`
}

PlaceSpotOrderResponse response data for PlaceSpotOrder

type PlaceSwapOrderRequest

type PlaceSwapOrderRequest struct {
	ClientOID    string  `json:"client_oid,omitempty"`         // [optional] the order ID customized by yourself. 1-32 with digits and letter,The type of client_oid should be comprised of alphabets + numbers or only alphabets within 1 – 32 characters,Both uppercase and lowercase letters are supported
	Size         float64 `json:"size,string"`                  // [required] The buying or selling quantity
	Type         int64   `json:"type,string"`                  // [required] 1:open long 2:open short 3:close long 4:close short
	MatchPrice   int64   `json:"match_price,string,omitempty"` // [optional] Order at best counter party price? (0:no 1:yes)
	Price        float64 `json:"price,string"`                 // [required] Price of each contract
	InstrumentID string  `json:"instrument_id"`                // [required] Contract ID, e.g. BTC-USD-SWAP
}

PlaceSwapOrderRequest request data for PlaceSwapOrder

type PlaceSwapOrderResponse

type PlaceSwapOrderResponse struct {
	OrderID      string `json:"order_id"`
	ClientOID    int64  `json:"client_oid,string"`
	ErrorCode    int64  `json:"error_code,string"`
	ErrorMessage string `json:"error_message"`
	Result       bool   `json:"result,string"`
}

PlaceSwapOrderResponse response data for PlaceSwapOrder

type RepayMarginLoanRequest

type RepayMarginLoanRequest struct {
	Amount        float64 `json:"amount,string"` // [required] amount repaid
	BorrowID      float64 `json:"borrow_id"`     // [optional] borrow ID . all borrowed token under this trading pair will be repay if the field is left blank
	QuoteCurrency string  `json:"currency"`      // [required] Second currency eg BTC-USDT: USDT is quote
	InstrumentID  string  `json:"instrument_id"` // [required] Full pair BTC-USDT
}

RepayMarginLoanRequest request data for RepayMarginLoan

type RepayMarginLoanResponse

type RepayMarginLoanResponse struct {
	RepaymentID int64 `json:"repayment_id"`
	Result      bool  `json:"result"`
}

RepayMarginLoanResponse response data for RepayMarginLoan

type SetFutureLeverageShortLongData

type SetFutureLeverageShortLongData struct {
	Long  int `json:"long"`
	Short int `json:"short"`
}

SetFutureLeverageShortLongData long and short data from SetFuturesLeverage

type SetFuturesLeverageRequest

type SetFuturesLeverageRequest struct {
	Direction    string `json:"direction,omitempty"`     // opening side (long or short)
	InstrumentID string `json:"instrument_id,omitempty"` //  	Contract ID, e.g. "BTC-USD-180213"
	Leverage     int64  `json:"leverage,omitempty"`      //  	10x or 20x leverage
	Currency     string `json:"currency,omitempty"`
}

SetFuturesLeverageRequest request data for SetFuturesLeverage

type SetFuturesLeverageResponse

type SetFuturesLeverageResponse struct {
	Currency                 string `json:"currency"`
	Leverage                 int64  `json:"leverage"`
	MarginMode               string `json:"margin_mode"`
	Result                   string `json:"result"`
	Direction                string `json:"direction"`
	ShortLongDataPerContract map[string]SetFutureLeverageShortLongData
}

SetFuturesLeverageResponse returned data for SetFuturesLeverage

type SetSwapLeverageLevelOfAContractRequest

type SetSwapLeverageLevelOfAContractRequest struct {
	InstrumentID string `json:"instrument_id,omitempty"` // [required] Contract ID, e.g. BTC-USD-SWAP
	Leverage     int64  `json:"leverage,string"`         // [required] New leverage level from 1-100
	Side         int64  `json:"side,string"`             // [required] Side: 1.FIXED-LONG 2.FIXED-SHORT 3.CROSSED
}

SetSwapLeverageLevelOfAContractRequest request data for SetSwapLeverageLevelOfAContract

type SetSwapLeverageLevelOfAContractResponse

type SetSwapLeverageLevelOfAContractResponse struct {
	InstrumentID  string `json:"instrument_id"`
	LongLeverage  int64  `json:"long_leverage,string"`
	MarginMode    string `json:"margin_mode"`
	ShortLeverage int64  `json:"short_leverage,string"`
}

SetSwapLeverageLevelOfAContractResponse response data for SetSwapLeverageLevelOfAContract

type SpotBillDetails

type SpotBillDetails struct {
	OrderID      string `json:"order_id"`
	InstrumentID string `json:"instrument_id"`
}

SpotBillDetails response data for GetSpotBillDetailsForCurrency

type SpotInstrument

type SpotInstrument struct {
	BaseCurrency   string  `json:"base_currency"`
	BaseIncrement  float64 `json:"base_increment,string"`
	BaseMinSize    float64 `json:"base_min_size,string"`
	InstrumentID   string  `json:"instrument_id"`
	MinSize        float64 `json:"min_size,string"`
	ProductID      string  `json:"product_id"`
	QuoteCurrency  string  `json:"quote_currency"`
	QuoteIncrement float64 `json:"quote_increment,string"`
	SizeIncrement  float64 `json:"size_increment,string"`
	TickSize       float64 `json:"tick_size,string"`
}

SpotInstrument contains spot data

type TransferAccountFundsRequest

type TransferAccountFundsRequest struct {
	Currency     string  `json:"currency"`                // [required] token
	Amount       float64 `json:"amount"`                  // [required] Transfer amount
	From         int64   `json:"from"`                    // [required] the remitting account (0: sub account 1: spot 3: futures 4:C2C 5: margin 6: wallet 7:ETT 8:PiggyBank 9:swap)
	To           int64   `json:"to"`                      // [required] the beneficiary account(0: sub account 1:spot 3: futures 4:C2C 5: margin 6: wallet 7:ETT 8:PiggyBank 9 :swap)
	SubAccountID string  `json:"sub_account,omitempty"`   // [optional] sub account name
	InstrumentID int64   `json:"instrument_id,omitempty"` // [optional] margin token pair ID, for supported pairs only
}

TransferAccountFundsRequest request data for TransferAccountFunds

type TransferAccountFundsResponse

type TransferAccountFundsResponse struct {
	Amount     float64 `json:"amount"`
	Currency   string  `json:"currency"`
	From       int64   `json:"from"`
	Result     bool    `json:"result"`
	To         int64   `json:"to"`
	TransferID int64   `json:"transfer_id"`
}

TransferAccountFundsResponse response data for TransferAccountFunds

type WalletInformationResponse

type WalletInformationResponse struct {
	Available float64 `json:"available"`
	Balance   float64 `json:"balance"`
	Currency  string  `json:"currency"`
	Hold      float64 `json:"hold"`
}

WalletInformationResponse response data for WalletInformation

type WebsocketCandleResponse

type WebsocketCandleResponse struct {
	Candle []string `json:"candle,omitempty"` // [0]timestamp, [1]open, [2]high, [3]low, [4]close, [5]volume, [6]currencyVolume
}

WebsocketCandleResponse contains formatted data for candle related websocket responses

type WebsocketDataResponse

type WebsocketDataResponse struct {
	Table  string                 `json:"table"`
	Action string                 `json:"action,omitempty"`
	Data   []WebsocketDataWrapper `json:"data"`
}

WebsocketDataResponse formats all response data for a websocket event

type WebsocketErrorResponse

type WebsocketErrorResponse struct {
	Event     string `json:"event"`
	Message   string `json:"message"`
	ErrorCode int64  `json:"errorCode"`
}

WebsocketErrorResponse yo

type WebsocketEstimatedPriceResponse

type WebsocketEstimatedPriceResponse struct {
	SettlementPrice float64 `json:"settlement_price,string,omitempty"`
}

WebsocketEstimatedPriceResponse contains formatted data for estimated prices

type WebsocketEventRequest

type WebsocketEventRequest struct {
	Operation string   `json:"op"`   // 1--subscribe 2--unsubscribe 3--login
	Arguments []string `json:"args"` // args: the value is the channel name, which can be one or more channels
}

WebsocketEventRequest contains event data for a websocket channel

type WebsocketEventResponse

type WebsocketEventResponse struct {
	Event   string `json:"event"`
	Channel string `json:"channel,omitempty"`
	Success bool   `json:"success,omitempty"`
}

WebsocketEventResponse contains event data for a websocket channel

type WebsocketFundingFeeResponse

type WebsocketFundingFeeResponse struct {
	FundingRate  float64   `json:"funding_rate,string,omitempty"`
	FundingTime  time.Time `json:"funding_time,omitempty"`
	InterestRate float64   `json:"interest_rate,string,omitempty"`
}

WebsocketFundingFeeResponse contains formatted data for funding fee related websocket responses

type WebsocketMarkPriceResponse

type WebsocketMarkPriceResponse struct {
	MarkPrice float64 `json:"mark_price,string,omitempty"`
}

WebsocketMarkPriceResponse contains formatted data for mark prices

type WebsocketOrderBooksData

type WebsocketOrderBooksData struct {
	Asks     [][]interface{} `json:"asks,omitempty"` // [0] Price, [1] Size, [2] Number of orders
	Bids     [][]interface{} `json:"bids,omitempty"` // [0] Price, [1] Size, [2] Number of orders
	Checksum int32           `json:"checksum,omitempty"`
}

WebsocketOrderBooksData contains orderbook data from WebsocketOrderBooksResponse

type WebsocketPriceRangeResponse

type WebsocketPriceRangeResponse struct {
	Highest float64 `json:"highest,omitempty"`
	Lowest  float64 `json:"lowest,omitempty"`
}

WebsocketPriceRangeResponse contains formatted data for mark prices

type WebsocketSpotMarginOrderResponse

type WebsocketSpotMarginOrderResponse struct {
	MarginMode        string `json:"margin_mode"`
	TotalAvailBalance string `json:"total_avail_balance"`
}

WebsocketSpotMarginOrderResponse contains formatted data for user account data

type WebsocketSpotOrderResponse

type WebsocketSpotOrderResponse struct {
	FilledNotional float64 `json:"filled_notional,string"`
	FilledSize     float64 `json:"filled_size,string"`
	Notional       float64 `json:"notional,string"`
	Size           float64 `json:"size,string"`
	Status         string  `json:"status"`
	MarginTrading  int64   `json:"margin_trading"`
	Type           string  `json:"type"`
}

WebsocketSpotOrderResponse contains formatted data for spot user orders

type WebsocketTickerData

type WebsocketTickerData struct {
	High24H   float64 `json:"high_24h,string,omitempty"`
	Last      float64 `json:"last,string,omitempty"`
	BestBid   float64 `json:"best_bid,string,omitempty"`
	BestAsk   float64 `json:"best_ask,string,omitempty"`
	Low24H    float64 `json:"low_24h,string,omitempty"`
	Volume24H float64 `json:"volume_24h,string,omitempty"`
}

WebsocketTickerData contains formatted data for ticker related websocket responses

type WebsocketTradeResponse

type WebsocketTradeResponse struct {
	Price   float64 `json:"price,string,omitempty"`
	Side    string  `json:"side,omitempty"`
	Qty     float64 `json:"qty,string,omitempty"`
	TradeID string  `json:"trade_id,omitempty"`
}

WebsocketTradeResponse contains formatted data for trade related websocket responses

type WebsocketUserFutureFixedMarginAccountData

type WebsocketUserFutureFixedMarginAccountData struct {
	Contracts         []WebsocketUserSwapFutureAccountResponse `json:"contracts"`
	Equity            string                                   `json:"equity"`
	MarginMode        string                                   `json:"margin_mode"`
	TotalAvailBalance string                                   `json:"total_avail_balance"`
}

WebsocketUserFutureFixedMarginAccountData contains the user fixed margin account data

type WebsocketUserFutureFixedMarginAccountResponse

type WebsocketUserFutureFixedMarginAccountResponse map[string]WebsocketUserFutureFixedMarginAccountData

WebsocketUserFutureFixedMarginAccountResponse contains formatted data for user account data

type WebsocketUserFuturePositionResponse

type WebsocketUserFuturePositionResponse struct {
	LongQty              string `json:"long_qty"`
	LongAvailQty         int64  `json:"long_avail_qty"`
	LongAvgCost          string `json:"long_avg_cost"`
	LongSettlementPrice  string `json:"long_settlement_price"`
	RealisedPnl          string `json:"realised_pnl"`
	ShortQty             string `json:"short_qty"`
	ShortAvailQty        string `json:"short_avail_qty"`
	ShortAvgCost         string `json:"short_avg_cost"`
	ShortSettlementPrice string `json:"short_settlement_price"`
	LiquidationPrice     string `json:"liquidation_price"`
	Leverage             string `json:"leverage"`
	CreatedAt            string `json:"created_at"`
	UpdatedAt            string `json:"updated_at"`
	LongMargin           string `json:"long_margin"`
	LongLiquiPrice       string `json:"long_liqui_price"`
	LongPnlRatio         string `json:"long_pnl_ratio"`
	ShortMargin          string `json:"short_margin"`
	ShortLiquiPrice      string `json:"short_liqui_price"`
	ShortPnlRatio        string `json:"short_pnl_ratio"`
	LongLeverage         string `json:"long_leverage"`
	ShortLeverage        string `json:"short_leverage"`
}

WebsocketUserFuturePositionResponse contains formatted data for futures positions data

type WebsocketUserSpotAccountResponse

type WebsocketUserSpotAccountResponse struct {
	Balance   string `json:"balance"`
	Available string `json:"available"`
	Currency  string `json:"currency"`
	ID        int64  `json:"id"`
	Hold      string `json:"hold"`
}

WebsocketUserSpotAccountResponse contains formatted data for user account data

type WebsocketUserSwapFutureAccountResponse

type WebsocketUserSwapFutureAccountResponse struct {
	Equity        float64 `json:"equity,string,omitempty"`
	FixedBalance  float64 `json:"fixed_balance,string,omitempty"`
	MarginFrozen  float64 `json:"margin_frozen,string,omitempty"`
	MarginRatio   float64 `json:"margin_ratio,string,omitempty"`
	RealizedPnl   float64 `json:"realized_pnl,string,omitempty"`
	UnrealizedPnl float64 `json:"unrealized_pnl,string,omitempty"`
}

WebsocketUserSwapFutureAccountResponse contains formatted data for user account data

type WebsocketUserSwapOrdersResponse

type WebsocketUserSwapOrdersResponse struct {
	FilledQuantity float64 `json:"filled_qty,string,omitempty"`
	ClientOID      string  `json:"client_oid,omitempty"`
	Fee            float64 `json:"fee,string,omitempty"`
	ContractValue  float64 `json:"contract_val,string,omitempty"`
	PriceAverage   float64 `json:"price_avg,string,omitempty"`
	OrderID        string  `json:"order_id,omitempty"`
}

WebsocketUserSwapOrdersResponse contains formatted data for user order data

type WebsocketUserSwapPositionHoldingData

type WebsocketUserSwapPositionHoldingData struct {
	AvailablePosition float64   `json:"avail_position,string,omitempty"`
	AverageCost       float64   `json:"avg_cost,string,omitempty"`
	Leverage          float64   `json:"leverage,string,omitempty"`
	LiquidationPrice  float64   `json:"liquidation_price,string,omitempty"`
	Margin            float64   `json:"margin,string,omitempty"`
	Position          float64   `json:"position,string,omitempty"`
	RealizedPnl       float64   `json:"realized_pnl,string,omitempty"`
	SettlementPrice   float64   `json:"settlement_price,string,omitempty"`
	Side              string    `json:"side,omitempty"`
	Timestamp         time.Time `json:"timestamp,omitempty"`
}

WebsocketUserSwapPositionHoldingData contains formatted data for user position holding data

type WebsocketUserSwapPositionResponse

type WebsocketUserSwapPositionResponse struct {
	Holding []WebsocketUserSwapPositionHoldingData `json:"holding,omitempty"`
}

WebsocketUserSwapPositionResponse contains formatted data for user position data

type WithdrawalHistoryResponse

type WithdrawalHistoryResponse struct {
	Amount    float64   `json:"amount"`
	Currency  string    `json:"currency"`
	Fee       string    `json:"fee"`
	From      string    `json:"from"`
	Status    int64     `json:"status"`
	Timestamp time.Time `json:"timestamp"`
	To        string    `json:"to"`
	Txid      string    `json:"txid"`
	PaymentID string    `json:"payment_id"`
	Tag       string    `json:"tag"`
}

WithdrawalHistoryResponse response data for WithdrawalHistoryResponse

Jump to

Keyboard shortcuts

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