Documentation ¶
Index ¶
- Constants
- Variables
- func FormatParameters(request interface{}) (parameters string)
- func StringToOrderStatus(num int64) (order.Status, error)
- type AccountWithdrawRequest
- type AccountWithdrawResponse
- type CancelFuturesOrderRequest
- type CancelFuturesOrderResponse
- type CancelMultipleSpotOrdersRequest
- type CancelMultipleSpotOrdersResponse
- type CancelMultipleSwapOrdersRequest
- type CancelMultipleSwapOrdersResponse
- type CancelSpotOrderRequest
- type CancelSpotOrderResponse
- type CancelSwapOrderRequest
- type CancelSwapOrderResponse
- type ConstituentData
- type FuturesAccountForAllCurrenciesResponse
- type FuturesContractsData
- type FuturesCurrencyData
- type GetAccountBillDetailsRequest
- type GetAccountBillDetailsResponse
- type GetAccountCurrenciesResponse
- type GetAccountDepositHistoryResponse
- type GetAccountWithdrawalFeeResponse
- type GetAllSwapTokensInformationResponse
- type GetDepositAddressResponse
- type GetETTBillsDetailsResponse
- type GetETTConstituentsResponse
- type GetETTOrderListRequest
- type GetETTOrderListResponse
- type GetETTResponse
- type GetETTSettlementPriceHistoryResponse
- type GetFuturePostionsDetails
- type GetFuturesContractInformationResponse
- type GetFuturesCurrentMarkPriceResponse
- type GetFuturesCurrentPriceLimitResponse
- type GetFuturesEstimatedDeliveryPriceResponse
- type GetFuturesExchangeRatesResponse
- type GetFuturesFilledOrderRequest
- type GetFuturesFilledOrdersResponse
- type GetFuturesForceLiquidatedOrdersRequest
- type GetFuturesForceLiquidatedOrdersResponse
- type GetFuturesHoldAmountResponse
- type GetFuturesIndicesResponse
- type GetFuturesLeverageData
- type GetFuturesLeverageResponse
- type GetFuturesMarketDataResponse
- type GetFuturesMarketDateRequest
- type GetFuturesOpenInterestsResponse
- type GetFuturesOrderDetailsRequest
- type GetFuturesOrderDetailsResponseData
- type GetFuturesOrderListResponse
- type GetFuturesOrdersListRequest
- type GetFuturesPositionsForCurrencyResponse
- type GetFuturesPositionsResponse
- type GetFuturesTagPriceResponse
- type GetFuturesTokenInfoResponse
- type GetFuturesTransactionDetailsRequest
- type GetFuturesTransactionDetailsResponse
- type GetMarginAccountSettingsResponse
- type GetMarginAccountsResponse
- type GetMarginBillDetailsRequest
- type GetMarginLoanHistoryRequest
- type GetMarginLoanHistoryResponse
- type GetMarketDataRequest
- type GetMarketDataResponse
- type GetOrderBookRequest
- type GetOrderBookResponse
- type GetSpotBillDetailsForCurrencyRequest
- type GetSpotBillDetailsForCurrencyResponse
- type GetSpotFilledOrdersInformationRequest
- type GetSpotFilledOrdersInformationResponse
- type GetSpotOpenOrdersRequest
- type GetSpotOrderRequest
- type GetSpotOrderResponse
- type GetSpotOrdersRequest
- type GetSpotTokenPairDetailsResponse
- type GetSpotTokenPairsInformationResponse
- type GetSpotTradingAccountResponse
- type GetSpotTransactionDetailsRequest
- type GetSpotTransactionDetailsResponse
- type GetSwapAccountOfAllCurrencyResponse
- type GetSwapAccountOfAllCurrencyResponseInfo
- type GetSwapAccountSettingsOfAContractResponse
- type GetSwapBillDetailsResponse
- type GetSwapContractInformationResponse
- type GetSwapCurrentPriceLimitsResponse
- type GetSwapExchangeRatesResponse
- type GetSwapFilledOrdersDataRequest
- type GetSwapFilledOrdersDataResponse
- type GetSwapForceLiquidatedOrdersRequest
- type GetSwapForceLiquidatedOrdersResponse
- type GetSwapFundingRateHistoryRequest
- type GetSwapFundingRateHistoryResponse
- type GetSwapIndecesResponse
- type GetSwapMarkPriceResponse
- type GetSwapMarketDataRequest
- type GetSwapMarketDataResponse
- type GetSwapNextSettlementTimeResponse
- type GetSwapOnHoldAmountForOpenOrdersResponse
- type GetSwapOpenInterestResponse
- type GetSwapOrderBookRequest
- type GetSwapOrderBookResponse
- type GetSwapOrderDetailsRequest
- type GetSwapOrderListRequest
- type GetSwapOrderListResponse
- type GetSwapOrderListResponseData
- type GetSwapPostionsResponse
- type GetSwapPostionsResponseHolding
- type GetSwapTransactionDetailsRequest
- type GetSwapTransactionDetailsResponse
- type MarginAccountInfo
- type MarginAccountSettingsInfo
- type MarginCurrencyData
- type MarginData
- type OKGroup
- func (o *OKGroup) AccountWithdraw(ctx context.Context, request AccountWithdrawRequest) (resp AccountWithdrawResponse, _ error)
- func (o *OKGroup) AppendWsOrderbookItems(entries [][]interface{}) ([]orderbook.Item, error)
- func (o *OKGroup) AuthenticateWebsocket(_ context.Context) error
- func (o *OKGroup) CalculatePartialOrderbookChecksum(orderbookData *WebsocketOrderBook) int32
- func (o *OKGroup) CalculateUpdateOrderbookChecksum(orderbookData *orderbook.Base) int32
- func (o *OKGroup) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)
- func (o *OKGroup) CancelMarginOrder(ctx context.Context, request CancelSpotOrderRequest) (resp CancelSpotOrderResponse, _ error)
- func (o *OKGroup) CancelMultipleMarginOrders(ctx context.Context, request CancelMultipleSpotOrdersRequest) (map[string][]CancelMultipleSpotOrdersResponse, []error)
- func (o *OKGroup) CancelMultipleSpotOrders(ctx context.Context, request CancelMultipleSpotOrdersRequest) (resp map[string][]CancelMultipleSpotOrdersResponse, err error)
- func (o *OKGroup) CancelOrder(ctx context.Context, cancel *order.Cancel) (err error)
- func (o *OKGroup) CancelSpotOrder(ctx context.Context, request CancelSpotOrderRequest) (resp CancelSpotOrderResponse, _ error)
- func (o *OKGroup) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (o *OKGroup) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (o *OKGroup) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
- func (o *OKGroup) GetAccountBillDetails(ctx context.Context, request GetAccountBillDetailsRequest) (resp []GetAccountBillDetailsResponse, _ error)
- func (o *OKGroup) GetAccountCurrencies(ctx context.Context) (resp []GetAccountCurrenciesResponse, _ error)
- func (o *OKGroup) GetAccountDepositAddressForCurrency(ctx context.Context, currency string) (resp []GetDepositAddressResponse, _ error)
- func (o *OKGroup) GetAccountDepositHistory(ctx context.Context, currency string) (resp []GetAccountDepositHistoryResponse, _ error)
- func (o *OKGroup) GetAccountWalletInformation(ctx context.Context, currency string) (resp []WalletInformationResponse, _ error)
- func (o *OKGroup) GetAccountWithdrawalFee(ctx context.Context, currency string) (resp []GetAccountWithdrawalFeeResponse, _ error)
- func (o *OKGroup) GetAccountWithdrawalHistory(ctx context.Context, currency string) (resp []WithdrawalHistoryResponse, _ error)
- func (o *OKGroup) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) (resp []order.Detail, err error)
- func (o *OKGroup) GetAssetTypeFromTableName(table string) asset.Item
- func (o *OKGroup) GetDepositAddress(ctx context.Context, p currency.Code, _, _ string) (*deposit.Address, error)
- func (o *OKGroup) GetErrorCode(code interface{}) error
- func (o *OKGroup) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (fee float64, _ error)
- func (o *OKGroup) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (o *OKGroup) GetFundingHistory(ctx context.Context) (resp []exchange.FundHistory, err error)
- func (o *OKGroup) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (o *OKGroup) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (o *OKGroup) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
- func (o *OKGroup) GetMarginAccountSettings(ctx context.Context, currency string) (resp []GetMarginAccountSettingsResponse, _ error)
- func (o *OKGroup) GetMarginBillDetails(ctx context.Context, request GetMarginBillDetailsRequest) (resp []GetSpotBillDetailsForCurrencyResponse, _ error)
- func (o *OKGroup) GetMarginLoanHistory(ctx context.Context, request GetMarginLoanHistoryRequest) (resp []GetMarginLoanHistoryResponse, _ error)
- func (o *OKGroup) GetMarginOpenOrders(ctx context.Context, request GetSpotOpenOrdersRequest) (resp []GetSpotOrderResponse, _ error)
- func (o *OKGroup) GetMarginOrder(ctx context.Context, request GetSpotOrderRequest) (resp GetSpotOrderResponse, _ error)
- func (o *OKGroup) GetMarginOrders(ctx context.Context, request GetSpotOrdersRequest) (resp []GetSpotOrderResponse, _ error)
- func (o *OKGroup) GetMarginTradingAccounts(ctx context.Context) (resp []GetMarginAccountsResponse, _ error)
- func (o *OKGroup) GetMarginTradingAccountsForCurrency(ctx context.Context, currency string) (resp GetMarginAccountsResponse, _ error)
- func (o *OKGroup) GetMarginTransactionDetails(ctx context.Context, request GetSpotTransactionDetailsRequest) (resp []GetSpotTransactionDetailsResponse, _ error)
- func (o *OKGroup) GetMarketData(ctx context.Context, request *GetMarketDataRequest) (resp GetMarketDataResponse, err error)
- func (o *OKGroup) GetOrderBook(ctx context.Context, request GetOrderBookRequest, a asset.Item) (resp GetOrderBookResponse, _ error)
- func (o *OKGroup) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) (resp []order.Detail, err error)
- func (o *OKGroup) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (resp order.Detail, err error)
- func (o *OKGroup) GetSpotAllTokenPairsInformation(ctx context.Context) (resp []GetSpotTokenPairsInformationResponse, _ error)
- func (o *OKGroup) GetSpotAllTokenPairsInformationForCurrency(ctx context.Context, currency string) (resp GetSpotTokenPairsInformationResponse, _ error)
- func (o *OKGroup) GetSpotBillDetailsForCurrency(ctx context.Context, request GetSpotBillDetailsForCurrencyRequest) (resp []GetSpotBillDetailsForCurrencyResponse, _ error)
- func (o *OKGroup) GetSpotFilledOrdersInformation(ctx context.Context, request GetSpotFilledOrdersInformationRequest) (resp []GetSpotFilledOrdersInformationResponse, _ error)
- func (o *OKGroup) GetSpotOpenOrders(ctx context.Context, request GetSpotOpenOrdersRequest) (resp []GetSpotOrderResponse, _ error)
- func (o *OKGroup) GetSpotOrder(ctx context.Context, request GetSpotOrderRequest) (resp GetSpotOrderResponse, _ error)
- func (o *OKGroup) GetSpotOrders(ctx context.Context, request GetSpotOrdersRequest) (resp []GetSpotOrderResponse, _ error)
- func (o *OKGroup) GetSpotTokenPairDetails(ctx context.Context) (resp []GetSpotTokenPairDetailsResponse, _ error)
- func (o *OKGroup) GetSpotTradingAccountForCurrency(ctx context.Context, currency string) (resp GetSpotTradingAccountResponse, _ error)
- func (o *OKGroup) GetSpotTradingAccounts(ctx context.Context) (resp []GetSpotTradingAccountResponse, _ error)
- func (o *OKGroup) GetSpotTransactionDetails(ctx context.Context, request GetSpotTransactionDetailsRequest) (resp []GetSpotTransactionDetailsResponse, _ error)
- func (o *OKGroup) GetWithdrawCapabilities() uint32
- func (o *OKGroup) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
- func (o *OKGroup) GetWsChannelWithoutOrderType(table string) string
- func (o *OKGroup) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)
- func (o *OKGroup) OpenMarginLoan(ctx context.Context, request OpenMarginLoanRequest) (resp OpenMarginLoanResponse, _ error)
- func (o *OKGroup) PlaceMarginOrder(ctx context.Context, request *PlaceOrderRequest) (resp PlaceOrderResponse, _ error)
- func (o *OKGroup) PlaceMultipleMarginOrders(ctx context.Context, request []PlaceOrderRequest) (map[string][]PlaceOrderResponse, []error)
- func (o *OKGroup) PlaceMultipleSpotOrders(ctx context.Context, request []PlaceOrderRequest) (map[string][]PlaceOrderResponse, []error)
- func (o *OKGroup) PlaceSpotOrder(ctx context.Context, request *PlaceOrderRequest) (resp PlaceOrderResponse, _ error)
- func (o *OKGroup) RepayMarginLoan(ctx context.Context, request RepayMarginLoanRequest) (resp RepayMarginLoanResponse, _ error)
- func (o *OKGroup) SendHTTPRequest(ctx context.Context, ep exchange.URL, ...) (err error)
- func (o *OKGroup) SetCheckVarDefaults()
- func (o *OKGroup) SetErrorDefaults()
- func (o *OKGroup) Setup(exch *config.Exchange) error
- func (o *OKGroup) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)
- func (o *OKGroup) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
- func (o *OKGroup) TransferAccountFunds(ctx context.Context, request TransferAccountFundsRequest) (resp TransferAccountFundsResponse, _ error)
- func (o *OKGroup) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
- func (o *OKGroup) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (o *OKGroup) UpdateOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error)
- func (o *OKGroup) ValidateCredentials(ctx context.Context, assetType asset.Item) error
- func (o *OKGroup) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (o *OKGroup) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (o *OKGroup) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (o *OKGroup) WsConnect() error
- func (o *OKGroup) WsHandleData(respRaw []byte) error
- func (o *OKGroup) WsLogin() error
- func (o *OKGroup) WsProcessOrderBook(respRaw []byte) error
- func (o *OKGroup) WsProcessPartialOrderBook(wsEventData *WebsocketOrderBook, instrument currency.Pair, a asset.Item) error
- func (o *OKGroup) WsProcessUpdateOrderbook(wsEventData *WebsocketOrderBook, instrument currency.Pair, a asset.Item) error
- func (o *OKGroup) WsReadData()
- type OpenMarginLoanRequest
- type OpenMarginLoanResponse
- type PerpSwapFundingRates
- type PerpSwapInstrumentData
- type PlaceETTOrderRequest
- type PlaceETTOrderResponse
- type PlaceFuturesOrderBatchRequest
- type PlaceFuturesOrderBatchRequestDetails
- type PlaceFuturesOrderBatchResponse
- type PlaceFuturesOrderBatchResponseData
- type PlaceFuturesOrderRequest
- type PlaceFuturesOrderResponse
- type PlaceMultipleSwapOrderData
- type PlaceMultipleSwapOrdersRequest
- type PlaceMultipleSwapOrdersResponse
- type PlaceMultipleSwapOrdersResponseInfo
- type PlaceOrderRequest
- type PlaceOrderResponse
- type PlaceSwapOrderRequest
- type PlaceSwapOrderResponse
- type RepayMarginLoanRequest
- type RepayMarginLoanResponse
- type SetFutureLeverageShortLongData
- type SetFuturesLeverageRequest
- type SetFuturesLeverageResponse
- type SetSwapLeverageLevelOfAContractRequest
- type SetSwapLeverageLevelOfAContractResponse
- type SpotBillDetails
- type SpotInstrument
- type SwapInstrumentsData
- type TickerData
- type TradingPairData
- type TransferAccountFundsRequest
- type TransferAccountFundsResponse
- type WalletInformationResponse
- type WebsocketCandleResponse
- type WebsocketDataResponse
- type WebsocketErrorResponse
- type WebsocketEventRequest
- type WebsocketEventResponse
- type WebsocketOrderBook
- type WebsocketOrderBooksData
- type WebsocketSpotOrderResponse
- type WebsocketTickerData
- type WebsocketTradeResponse
- type WebsocketUserSwapPositionHoldingData
- type WebsocketUserSwapPositionResponse
- type WithdrawalHistoryResponse
Constants ¶
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" )
const ( NormalOrder = iota PostOnlyOrder FillOrKillOrder ImmediateOrCancelOrder )
Order types
Variables ¶
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 ¶
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 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 { Name string `json:"name"` Currency string `json:"currency"` CanDeposit int `json:"can_deposit,string"` CanWithdraw int `json:"can_withdraw,string"` MinWithdrawal float64 `json:"min_withdrawal,string"` }
GetAccountCurrenciesResponse response data for GetAccountCurrencies
type GetAccountDepositHistoryResponse ¶
type GetAccountDepositHistoryResponse struct { Amount float64 `json:"amount,string"` Currency string `json:"currency"` From string `json:"from"` To string `json:"to"` Timestamp time.Time `json:"timestamp"` Status int64 `json:"status,string"` TransactionID string `json:"txid"` }
GetAccountDepositHistoryResponse response data for GetAccountDepositHistory
type GetAccountWithdrawalFeeResponse ¶
type GetAccountWithdrawalFeeResponse struct { Currency string `json:"currency"` MinFee float64 `json:"min_fee,string"` MaxFee float64 `json:"max_fee,string"` }
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 { ContractValue float64 `json:"contract_val,string"` Alias string `json:"alias"` BaseCurrency string `json:"base_currency"` SettlementCurrency string `json:"settlement_currency"` ContractValueCurrency string `json:"contract_val_currency"` Delivery string `json:"delivery"` InstrumentID string `json:"instrument_id"` Listing string `json:"listing"` QuoteCurrency string `json:"quote_currency"` IsInverse bool `json:"is_inverse,string"` TickSize float64 `json:"tick_size,string"` TradeIncrement int64 `json:"trade_increment,string"` Underlying string `json:"underlying"` 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 float64 `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 GetMarketDataRequest 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 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 float64 `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 GetMarketDataRequest ¶
type GetMarketDataRequest struct { Asset asset.Item Start string `url:"start,omitempty"` // [optional] start time in ISO 8601 End string `url:"end,omitempty"` // [optional] end time in ISO 8601 Granularity string `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 }
GetMarketDataRequest request data for GetMarketData
type GetMarketDataResponse ¶
type GetMarketDataResponse []interface{}
GetMarketDataResponse response data for GetMarketData 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 GetOrderBookRequest ¶
type GetOrderBookRequest 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 }
GetOrderBookRequest request data for GetOrderBook
type GetOrderBookResponse ¶
type GetOrderBookResponse 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"], ... }
GetOrderBookResponse response data
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 float64 `json:"price,string"` Side string `json:"side"` Size float64 `json:"size,string"` Timestamp time.Time `json:"timestamp"` TradeID string `json:"trade_id"` }
GetSpotFilledOrdersInformationResponse response data for GetSpotFilledOrdersInformation
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 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"` PriceAvg float64 `json:"price_avg,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 currency.Pair `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 MarginCurrencyData ¶
type MarginCurrencyData struct { Data map[string]MarginData InstrumentID string `json:"instrument_id"` ProductID string `json:"product_id"` }
MarginCurrencyData stores currency data for margin trading
type MarginData ¶
type MarginData struct { Available float64 `json:"available,string"` Leverage float64 `json:"leverage,string"` LeverageRatio float64 `json:"leverage_ratio,string"` Rate float64 `json:"rate,string"` }
MarginData stores margin trading data for a currency
type OKGroup ¶
type OKGroup struct { exchange.Base ExchangeName string // 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 CurrencyPairsDefaults []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(ctx context.Context, request AccountWithdrawRequest) (resp AccountWithdrawResponse, _ error)
AccountWithdraw withdrawal of tokens to OKCoin International, other OKEx accounts or other addresses.
func (*OKGroup) AppendWsOrderbookItems ¶
AppendWsOrderbookItems adds websocket orderbook data bid/asks into an orderbook item array
func (*OKGroup) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*OKGroup) CalculatePartialOrderbookChecksum ¶
func (o *OKGroup) CalculatePartialOrderbookChecksum(orderbookData *WebsocketOrderBook) 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 ¶
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(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*OKGroup) CancelMarginOrder ¶
func (o *OKGroup) CancelMarginOrder(ctx context.Context, request CancelSpotOrderRequest) (resp CancelSpotOrderResponse, _ error)
CancelMarginOrder Cancelling an unfilled order.
func (*OKGroup) CancelMultipleMarginOrders ¶
func (o *OKGroup) CancelMultipleMarginOrders(ctx context.Context, request CancelMultipleSpotOrdersRequest) (map[string][]CancelMultipleSpotOrdersResponse, []error)
CancelMultipleMarginOrders Cancelling multiple unfilled orders.
func (*OKGroup) CancelMultipleSpotOrders ¶
func (o *OKGroup) CancelMultipleSpotOrders(ctx context.Context, request CancelMultipleSpotOrdersRequest) (resp map[string][]CancelMultipleSpotOrdersResponse, err error)
CancelMultipleSpotOrders Cancelling multiple unfilled orders.
func (*OKGroup) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
func (*OKGroup) CancelSpotOrder ¶
func (o *OKGroup) CancelSpotOrder(ctx context.Context, request CancelSpotOrderRequest) (resp CancelSpotOrderResponse, _ error)
CancelSpotOrder Cancelling an unfilled order.
func (*OKGroup) FetchAccountInfo ¶
func (o *OKGroup) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
FetchAccountInfo retrieves balances for all enabled currencies
func (*OKGroup) FetchOrderbook ¶
func (o *OKGroup) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
FetchOrderbook returns orderbook base on the currency pair
func (*OKGroup) GenerateDefaultSubscriptions ¶
func (o *OKGroup) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*OKGroup) GetAccountBillDetails ¶
func (o *OKGroup) GetAccountBillDetails(ctx context.Context, 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(ctx context.Context) (resp []GetAccountCurrenciesResponse, _ error)
GetAccountCurrencies returns a list of tradable spot instruments and their properties
func (*OKGroup) GetAccountDepositAddressForCurrency ¶
func (o *OKGroup) GetAccountDepositAddressForCurrency(ctx context.Context, currency string) (resp []GetDepositAddressResponse, _ error)
GetAccountDepositAddressForCurrency retrieves the deposit addresses of different tokens, including previously used addresses.
func (*OKGroup) GetAccountDepositHistory ¶
func (o *OKGroup) GetAccountDepositHistory(ctx context.Context, currency string) (resp []GetAccountDepositHistoryResponse, _ error)
GetAccountDepositHistory retrieves the deposit history of all tokens.100 recent records will be returned at maximum
func (*OKGroup) GetAccountWalletInformation ¶
func (o *OKGroup) GetAccountWalletInformation(ctx context.Context, currency string) (resp []WalletInformationResponse, _ error)
GetAccountWalletInformation returns a list of wallets and their properties
func (*OKGroup) GetAccountWithdrawalFee ¶
func (o *OKGroup) GetAccountWithdrawalFee(ctx context.Context, 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(ctx context.Context, currency string) (resp []WithdrawalHistoryResponse, _ error)
GetAccountWithdrawalHistory retrieves all recent withdrawal records.
func (*OKGroup) GetActiveOrders ¶
func (o *OKGroup) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) (resp []order.Detail, err error)
GetActiveOrders retrieves any orders that are active/open
func (*OKGroup) GetAssetTypeFromTableName ¶
GetAssetTypeFromTableName gets the asset type from the table name eg "spot/ticker:BTCUSD" results in "SPOT"
func (*OKGroup) GetDepositAddress ¶
func (o *OKGroup) GetDepositAddress(ctx context.Context, p currency.Code, _, _ string) (*deposit.Address, error)
GetDepositAddress returns a deposit address for a specified currency
func (*OKGroup) GetErrorCode ¶
GetErrorCode returns an error code
func (*OKGroup) GetFee ¶
func (o *OKGroup) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (fee float64, _ error)
GetFee returns an estimate of fee based on type of transaction
func (*OKGroup) GetFeeByType ¶
func (o *OKGroup) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*OKGroup) GetFundingHistory ¶
GetFundingHistory returns funding history, deposits and withdrawals
func (*OKGroup) GetHistoricCandles ¶
func (o *OKGroup) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*OKGroup) GetHistoricCandlesExtended ¶
func (o *OKGroup) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (*OKGroup) GetHistoricTrades ¶
func (o *OKGroup) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
GetHistoricTrades returns historic trade data within the timeframe provided
func (*OKGroup) GetMarginAccountSettings ¶
func (o *OKGroup) GetMarginAccountSettings(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, request GetSpotOrderRequest) (resp GetSpotOrderResponse, _ error)
GetMarginOrder Get order details by order ID.
func (*OKGroup) GetMarginOrders ¶
func (o *OKGroup) GetMarginOrders(ctx context.Context, 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(ctx context.Context) (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(ctx context.Context, currency string) (resp GetMarginAccountsResponse, _ error)
GetMarginTradingAccountsForCurrency Get the balance, amount on hold and more useful information.
func (*OKGroup) GetMarginTransactionDetails ¶
func (o *OKGroup) GetMarginTransactionDetails(ctx context.Context, 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) GetMarketData ¶
func (o *OKGroup) GetMarketData(ctx context.Context, request *GetMarketDataRequest) (resp GetMarketDataResponse, err error)
GetMarketData Get the charts of the trading pairs. Charts are returned in grouped buckets based on requested granularity.
func (*OKGroup) GetOrderBook ¶
func (o *OKGroup) GetOrderBook(ctx context.Context, request GetOrderBookRequest, a asset.Item) (resp GetOrderBookResponse, _ error)
GetOrderBook 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) GetOrderHistory ¶
func (o *OKGroup) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) (resp []order.Detail, err error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*OKGroup) GetOrderInfo ¶
func (o *OKGroup) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (resp order.Detail, err error)
GetOrderInfo returns order information based on order ID
func (*OKGroup) GetSpotAllTokenPairsInformation ¶
func (o *OKGroup) GetSpotAllTokenPairsInformation(ctx context.Context) (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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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) GetSpotOpenOrders ¶
func (o *OKGroup) GetSpotOpenOrders(ctx context.Context, 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(ctx context.Context, request GetSpotOrderRequest) (resp GetSpotOrderResponse, _ error)
GetSpotOrder Get order details by order ID.
func (*OKGroup) GetSpotOrders ¶
func (o *OKGroup) GetSpotOrders(ctx context.Context, 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(ctx context.Context) (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(ctx context.Context, 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(ctx context.Context) (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(ctx context.Context, 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) GetWithdrawCapabilities ¶
GetWithdrawCapabilities returns the types of withdrawal methods permitted by the exchange
func (*OKGroup) GetWithdrawalsHistory ¶
func (o *OKGroup) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
GetWithdrawalsHistory returns previous withdrawals data
func (*OKGroup) GetWsChannelWithoutOrderType ¶
GetWsChannelWithoutOrderType takes WebsocketDataResponse.Table and returns The base channel name eg receive "spot/depth5:BTC-USDT" return "depth5"
func (*OKGroup) ModifyOrder ¶
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*OKGroup) OpenMarginLoan ¶
func (o *OKGroup) OpenMarginLoan(ctx context.Context, request OpenMarginLoanRequest) (resp OpenMarginLoanResponse, _ error)
OpenMarginLoan Borrowing tokens in a margin trading account.
func (*OKGroup) PlaceMarginOrder ¶
func (o *OKGroup) PlaceMarginOrder(ctx context.Context, request *PlaceOrderRequest) (resp PlaceOrderResponse, _ 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(ctx context.Context, request []PlaceOrderRequest) (map[string][]PlaceOrderResponse, []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(ctx context.Context, request []PlaceOrderRequest) (map[string][]PlaceOrderResponse, []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(ctx context.Context, request *PlaceOrderRequest) (resp PlaceOrderResponse, _ 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(ctx context.Context, request RepayMarginLoanRequest) (resp RepayMarginLoanResponse, _ error)
RepayMarginLoan Repaying tokens in a margin trading account.
func (*OKGroup) SendHTTPRequest ¶
func (o *OKGroup) SendHTTPRequest(ctx context.Context, ep exchange.URL, 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) SubmitOrder ¶
SubmitOrder submits a new order
func (*OKGroup) Subscribe ¶
func (o *OKGroup) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*OKGroup) TransferAccountFunds ¶
func (o *OKGroup) TransferAccountFunds(ctx context.Context, 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(channelsToUnsubscribe []stream.ChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*OKGroup) UpdateAccountInfo ¶
func (o *OKGroup) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
UpdateAccountInfo retrieves balances for all enabled currencies
func (*OKGroup) UpdateOrderbook ¶
func (o *OKGroup) UpdateOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*OKGroup) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*OKGroup) WithdrawCryptocurrencyFunds ¶
func (o *OKGroup) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*OKGroup) WithdrawFiatFunds ¶
func (o *OKGroup) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*OKGroup) WithdrawFiatFundsToInternationalBank ¶
func (o *OKGroup) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*OKGroup) WsHandleData ¶
WsHandleData will read websocket raw data and pass to appropriate handler
func (*OKGroup) WsLogin ¶
WsLogin sends a login request to websocket to enable access to authenticated endpoints
func (*OKGroup) WsProcessOrderBook ¶
WsProcessOrderBook Validates the checksum and updates internal orderbook values
func (*OKGroup) WsProcessPartialOrderBook ¶
func (o *OKGroup) WsProcessPartialOrderBook(wsEventData *WebsocketOrderBook, instrument currency.Pair, a asset.Item) 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 *WebsocketOrderBook, instrument currency.Pair, a asset.Item) error
WsProcessUpdateOrderbook updates an existing orderbook using websocket data After merging WS data, it will sort, validate and finally update the existing orderbook
func (*OKGroup) WsReadData ¶
func (o *OKGroup) WsReadData()
WsReadData receives and passes on websocket messages for processing
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 PerpSwapFundingRates ¶
type PerpSwapFundingRates struct { InstrumentID string `json:"instrument_id"` FundingRate float64 `json:"funding_rate,string"` RealizedRate float64 `json:"realized_rate,string"` InterestRate float64 `json:"interest_rate,string"` FundingTime time.Time `json:"funding_time"` }
PerpSwapFundingRates stores funding rates data
type PerpSwapInstrumentData ¶
type PerpSwapInstrumentData struct { InstrumentID string `json:"instrument_id"` UnderlyingIndex string `json:"underlying_index"` QuoteCurrency string `json:"quote_currency"` Coin string `json:"coin"` ContractValue 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"` BaseCurrency string `json:"base_currency"` Underlying string `json:"underlying"` SettlementCurrency string `json:"settlement_currency"` IsInverse bool `json:"is_inverse,string"` Category float64 `json:"category,string"` ContractValCurrency string `json:"contract_val_currency"` }
PerpSwapInstrumentData stores instrument data for perpetual swap contracts
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 PlaceOrderRequest ¶
type PlaceOrderRequest 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"` // margin trading OrderType string `json:"order_type"` // order type (0: Normal order (Unfilled and 0 imply normal limit order) 1: Post only 2: Fill or Kill 3: Immediate Or Cancel Size string `json:"size"` Notional string `json:"notional,omitempty"` // Price string `json:"price,omitempty"` // price (Limit order only) }
PlaceOrderRequest request data for placing an order
type PlaceOrderResponse ¶
type PlaceOrderResponse struct { ClientOid string `json:"client_oid"` OrderID string `json:"order_id"` Result bool `json:"result"` }
PlaceOrderResponse 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 ¶
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 SwapInstrumentsData ¶
type SwapInstrumentsData struct { InstrumentID string `json:"instrument_id"` UnderlyingIndex string `json:"underlying_index"` QuoteCurrency string `json:"quote_currency"` Coin string `json:"coin"` ContractValue 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"` BaseCurrency string `json:"base_currency"` Underlying string `json:"underlying"` SettlementCurrency string `json:"settlement_currency"` IsInverse bool `json:"is_inverse,string"` Category int64 `json:"category,string"` ContractValueCurrency string `json:"contract_val_currency"` }
SwapInstrumentsData stores instruments data for perpetual swap contracts
type TickerData ¶
type TickerData struct { InstrumentID string `json:"instrument_id"` BestAsk float64 `json:"best_ask,string"` BestBid float64 `json:"best_bid,string"` Last float64 `json:"last,string"` High24H float64 `json:"high_24h,string"` Low24H float64 `json:"low_24h,string"` Volume24H float64 `json:"volume_24h,string"` Timestamp time.Time `json:"timestamp"` LastQty float64 `json:"last_qty,string"` BestAskSize float64 `json:"best_ask_size,string"` BestBidSize float64 `json:"best_bid_size,string"` }
TickerData stores ticker data
type TradingPairData ¶
type TradingPairData struct { BaseCurrency string `json:"base_currency"` InstrumentID string `json:"instrument_id"` MinSize float64 `json:"min_size,string"` QuoteCurrency string `json:"quote_currency"` SizeIncrement string `json:"size_increment"` TickSize float64 `json:"tick_size,string"` }
TradingPairData stores data about a trading pair
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 { Table string `json:"table"` Data []struct { Candle []string `json:"candle"` // [0]timestamp, [1]open, [2]high, [3]low, [4]close, [5]volume, [6]currencyVolume InstrumentID string `json:"instrument_id"` } `json:"data"` }
WebsocketCandleResponse contains formatted data for candle related websocket responses
type WebsocketDataResponse ¶
type WebsocketDataResponse struct { Table string `json:"table"` Action string `json:"action,omitempty"` Data []interface{} `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 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 WebsocketOrderBook ¶
type WebsocketOrderBook struct { Checksum int32 `json:"checksum,omitempty"` InstrumentID string `json:"instrument_id"` Timestamp time.Time `json:"timestamp,omitempty"` 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 }
WebsocketOrderBook holds orderbook data
type WebsocketOrderBooksData ¶
type WebsocketOrderBooksData struct { Table string `json:"table"` Action string `json:"action"` Data []WebsocketOrderBook `json:"data"` }
WebsocketOrderBooksData is the full websocket response containing orderbook data
type WebsocketSpotOrderResponse ¶
type WebsocketSpotOrderResponse struct { Table string `json:"table"` Data []struct { ClientOid string `json:"client_oid"` CreatedAt time.Time `json:"created_at"` FilledNotional float64 `json:"filled_notional,string"` FilledSize float64 `json:"filled_size,string"` InstrumentID string `json:"instrument_id"` LastFillPx float64 `json:"last_fill_px,string"` LastFillQty float64 `json:"last_fill_qty,string"` LastFillTime time.Time `json:"last_fill_time"` MarginTrading int64 `json:"margin_trading,string"` Notional string `json:"notional"` OrderID string `json:"order_id"` OrderType int64 `json:"order_type,string"` Price float64 `json:"price,string"` Side string `json:"side"` Size float64 `json:"size,string"` State int64 `json:"state,string"` Status string `json:"status"` Timestamp time.Time `json:"timestamp"` Type string `json:"type"` } `json:"data"` }
WebsocketSpotOrderResponse contains formatted data for spot user orders
type WebsocketTickerData ¶
type WebsocketTickerData struct { Table string `json:"table"` Data []struct { BaseVolume24h float64 `json:"base_volume_24h,string"` BestAsk float64 `json:"best_ask,string"` BestAskSize float64 `json:"best_ask_size,string"` BestBid float64 `json:"best_bid,string"` BestBidSize float64 `json:"best_bid_size,string"` High24h float64 `json:"high_24h,string"` InstrumentID string `json:"instrument_id"` Last float64 `json:"last,string"` LastQty float64 `json:"last_qty,string"` Low24h float64 `json:"low_24h,string"` Open24h float64 `json:"open_24h,string"` QuoteVolume24h float64 `json:"quote_volume_24h,string"` Timestamp time.Time `json:"timestamp"` ContractVolume24h float64 `json:"volume_24h,string"` TokenVolume24h float64 `json:"volume_token_24h,string"` OpenInterest float64 `json:"open_interest,string"` } `json:"data"` }
WebsocketTickerData contains formatted data for ticker related websocket responses
type WebsocketTradeResponse ¶
type WebsocketTradeResponse struct { Table string `json:"table"` Data []struct { Price float64 `json:"price,string"` Size float64 `json:"size,string"` InstrumentID string `json:"instrument_id"` Side string `json:"side"` Timestamp time.Time `json:"timestamp"` TradeID string `json:"trade_id"` // Quantity - Futures amount is sent as a separate json field Quantity float64 `json:"qty,string"` } `json:"data"` }
WebsocketTradeResponse contains formatted data for trade related websocket responses
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 { InstrumentID string `json:"instrument_id"` Timestamp time.Time `json:"timestamp,omitempty"` Holding []WebsocketUserSwapPositionHoldingData `json:"holding,omitempty"` }
WebsocketUserSwapPositionResponse contains formatted data for user position data
type WithdrawalHistoryResponse ¶
type WithdrawalHistoryResponse struct { Amount float64 `json:"amount,string"` Currency string `json:"currency"` Fee string `json:"fee"` From string `json:"from"` Status int64 `json:"status,string"` Timestamp time.Time `json:"timestamp"` To string `json:"to"` TransactionID string `json:"txid"` PaymentID string `json:"payment_id"` Tag string `json:"tag"` }
WithdrawalHistoryResponse response data for WithdrawalHistoryResponse