Documentation ¶
Index ¶
- Constants
- Variables
- func GetAssetTypeFromInstrumentType(instrumentType string) asset.Item
- func GetRateLimit() request.RateLimitDefinitions
- type Account
- type AccountAndPositionRisk
- type AccountAssetValuation
- type AccountBalanceData
- type AccountConfigurationResponse
- type AccountDetail
- type AccountPosition
- type AccountPositionHistory
- type AccountRiskState
- type ActiveFundingOrder
- type AdjustMarginBalanceResponse
- type AlgoOrder
- type AlgoOrderCancelParams
- type AlgoOrderParams
- type AlgoOrderPosition
- type AlgoOrderResponse
- type AlgoOrderWithdrawalProfit
- type AmendOrderRequestParams
- type AssetBalance
- type AssetBillDetail
- type BalanceAndPositionData
- type BalanceData
- type BillsDetailQueryParameter
- type BillsDetailResponse
- type BlockTicker
- type BlockTrade
- type BlockTradeLeg
- type Book5Data
- type BorrowInterestAndLimitResponse
- type BorrowRepayHistory
- type CancelFundingParam
- type CancelOrderRequestParam
- type CancelQuoteRequestParams
- type CancelQuoteResponse
- type CancelQuotesRequestParams
- type CancelRfqRequestParam
- type CancelRfqRequestsParam
- type CancelRfqResponse
- type CandleStick
- type CandlestickMarkPrice
- type ClosePositionResponse
- type ClosePositionsRequestParams
- type ComputeMarginBalance
- type ContractGridAlgoOrder
- type ConvertCurrency
- type ConvertCurrencyPair
- type ConvertHistory
- type ConvertTradeInput
- type ConvertTradeResponse
- type CounterpartiesResponse
- type CreateQuoteParams
- type CreateRfqInput
- type CurrencyDebtAmount
- type CurrencyDepositResponseItem
- type CurrencyOneClickRepay
- type CurrencyRepayAmount
- type CurrencyResponse
- type CurrencyTakerFlow
- type DeliveryEstimatedPrice
- type DeliveryHistory
- type DeliveryHistoryDetail
- type DepositHistoryResponseItem
- type DiscountRate
- type DiscountRateInfoItem
- type EasyConvertDetail
- type EasyConvertFromData
- type EasyConvertItem
- type EstimateQuoteRequestInput
- type EstimateQuoteResponse
- type ExecuteQuoteParams
- type ExecuteQuoteResponse
- type ExpiryOpenInterestAndVolume
- type FundingBalance
- type FundingOrder
- type FundingRateResponse
- type FundingTransferRequestInput
- type FundingTransferResponse
- type GreeksItem
- type GreeksType
- type GridAIParameterResponse
- type GridAlgoOrder
- type GridAlgoOrderAmend
- type GridAlgoOrderIDResponse
- type GridAlgoOrderResponse
- type GridAlgoSuborder
- type GridPositionData
- type GridSubOrderData
- type IncreaseDecreaseMargin
- type IncreaseDecreaseMarginInput
- type IndexComponent
- type IndexComponentItem
- type IndexTicker
- type Instrument
- type InstrumentsFetchParams
- type InsuranceFundInformation
- type InsuranceFundInformationDetail
- type InsuranceFundInformationRequestParams
- type InterestAccruedData
- type InterestRateLoanQuotaBasic
- type InterestRateLoanQuotaItem
- type InterestRateResponse
- type IsolatedMode
- type LendingHistory
- type LendingRate
- type LeverageResponse
- type LightningDepositItem
- type LightningWithdrawalRequestInput
- type LightningWithdrawalResponse
- type LimitPriceResponse
- type LiquidationOrder
- type LiquidationOrderDetailItem
- type LiquidationOrderRequestParams
- type LoanBorrowAndReplay
- type LoanBorrowAndReplayInput
- type LongShortRatio
- type MakerInstrumentSetting
- type MarginBalanceParam
- type MarginLendRatioItem
- type MarkPrice
- type MaximumBuyAndSell
- type MaximumLoanInstrument
- type MaximumTradableAmount
- type MaximumWithdrawal
- type Offer
- type OfferInvestData
- type Okx
- func (ok *Okx) AccountBalance(ctx context.Context, currency string) ([]Account, error)
- func (ok *Okx) AccountGreeksSubscription(operation string, pair currency.Pair) error
- func (ok *Okx) AdjustMarginBalance(ctx context.Context, arg MarginBalanceParam) (*AdjustMarginBalanceResponse, error)
- func (ok *Okx) AdvanceAlgoOrdersSubscription(operation string, assetType asset.Item, pair currency.Pair, algoID string) error
- func (ok *Okx) AlgoOrdersSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) AmendGridAlgoOrder(ctx context.Context, arg GridAlgoOrderAmend) (*GridAlgoOrderIDResponse, error)
- func (ok *Okx) AmendMultipleOrders(ctx context.Context, args []AmendOrderRequestParams) ([]OrderData, error)
- func (ok *Okx) AmendOrder(ctx context.Context, arg *AmendOrderRequestParams) (*OrderData, error)
- func (ok *Okx) AppendWsOrderbookItems(entries [][4]string) ([]orderbook.Tranche, error)
- func (ok *Okx) BalanceAndPositionSubscription(operation, uid string) error
- func (ok *Okx) BlockTickerSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) CalculateOrderbookChecksum(orderbookData WsOrderBookData) (int32, error)
- func (ok *Okx) CalculateUpdateOrderbookChecksum(orderbookData *orderbook.Base, checksumVal uint32) error
- func (ok *Okx) CancelAdvanceAlgoOrder(ctx context.Context, args []AlgoOrderCancelParams) ([]AlgoOrder, error)
- func (ok *Okx) CancelAlgoOrder(ctx context.Context, args []AlgoOrderCancelParams) ([]AlgoOrder, error)
- func (ok *Okx) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)
- func (ok *Okx) CancelAllQuotes(ctx context.Context) (time.Time, error)
- func (ok *Okx) CancelAllRfqs(ctx context.Context) (time.Time, error)
- func (ok *Okx) CancelBatchOrders(ctx context.Context, o []order.Cancel) (*order.CancelBatchResponse, error)
- func (ok *Okx) CancelMultipleOrders(ctx context.Context, args []CancelOrderRequestParam) ([]OrderData, error)
- func (ok *Okx) CancelMultipleQuote(ctx context.Context, arg CancelQuotesRequestParams) ([]CancelQuoteResponse, error)
- func (ok *Okx) CancelMultipleRfqs(ctx context.Context, arg CancelRfqRequestsParam) ([]CancelRfqResponse, error)
- func (ok *Okx) CancelOrder(ctx context.Context, ord *order.Cancel) error
- func (ok *Okx) CancelPurchaseOrRedemption(ctx context.Context, arg CancelFundingParam) (*OrderIDResponse, error)
- func (ok *Okx) CancelQuote(ctx context.Context, arg CancelQuoteRequestParams) (*CancelQuoteResponse, error)
- func (ok *Okx) CancelRfq(ctx context.Context, arg CancelRfqRequestParam) (*CancelRfqResponse, error)
- func (ok *Okx) CancelSingleOrder(ctx context.Context, arg CancelOrderRequestParam) (*OrderData, error)
- func (ok *Okx) CancelWithdrawal(ctx context.Context, withdrawalID string) (string, error)
- func (ok *Okx) CandlesticksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) ChangePositionMargin(ctx context.Context, req *margin.PositionChangeRequest) (*margin.PositionChangeResponse, error)
- func (ok *Okx) ClosePositions(ctx context.Context, arg *ClosePositionsRequestParams) (*ClosePositionResponse, error)
- func (ok *Okx) ComputeMarginBalance(ctx context.Context, arg MarginBalanceParam) (*ComputeMarginBalance, error)
- func (ok *Okx) ContractGridAlgoOrders(operation string, assetType asset.Item, pair currency.Pair, algoID string) error
- func (ok *Okx) ConvertTrade(ctx context.Context, arg *ConvertTradeInput) (*ConvertTradeResponse, error)
- func (ok *Okx) CreateQuote(ctx context.Context, arg CreateQuoteParams) (*QuoteResponse, error)
- func (ok *Okx) CreateRfq(ctx context.Context, arg CreateRfqInput) (*RfqResponse, error)
- func (ok *Okx) CurrencyUnitConvert(ctx context.Context, instrumentID string, quantity, orderPrice float64, ...) (*UnitConvertResponse, error)
- func (ok *Okx) EstimateQuote(ctx context.Context, arg *EstimateQuoteRequestInput) (*EstimateQuoteResponse, error)
- func (ok *Okx) EstimatedDeliveryExercisePriceSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) ExecuteQuote(ctx context.Context, arg ExecuteQuoteParams) (*ExecuteQuoteResponse, error)
- func (ok *Okx) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (ok *Okx) FetchOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (ok *Okx) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (ok *Okx) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error)
- func (ok *Okx) FundingRateSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) FundingTransfer(ctx context.Context, arg *FundingTransferRequestInput) ([]FundingTransferResponse, error)
- func (ok *Okx) Get24HTotalVolume(ctx context.Context) (*TradingVolumeIn24HR, error)
- func (ok *Okx) Get3MonthOrderHistory(ctx context.Context, arg *OrderHistoryRequestParams) ([]OrderDetail, error)
- func (ok *Okx) Get7DayOrderHistory(ctx context.Context, arg *OrderHistoryRequestParams) ([]OrderDetail, error)
- func (ok *Okx) GetAccountAndPositionRisk(ctx context.Context, instrumentType string) ([]AccountAndPositionRisk, error)
- func (ok *Okx) GetAccountAssetValuation(ctx context.Context, currency string) ([]AccountAssetValuation, error)
- func (ok *Okx) GetAccountConfiguration(ctx context.Context) ([]AccountConfigurationResponse, error)
- func (ok *Okx) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error)
- func (ok *Okx) GetAccountRiskState(ctx context.Context) ([]AccountRiskState, error)
- func (ok *Okx) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
- func (ok *Okx) GetAlgoOrderHistory(ctx context.Context, ...) ([]AlgoOrderResponse, error)
- func (ok *Okx) GetAlgoOrderList(ctx context.Context, ...) ([]AlgoOrderResponse, error)
- func (ok *Okx) GetAssetBillsDetails(ctx context.Context, currency, clientID string, after, before time.Time, ...) ([]AssetBillDetail, error)
- func (ok *Okx) GetAssetsFromInstrumentTypeOrID(instType, instrumentID string) ([]asset.Item, error)
- func (ok *Okx) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
- func (ok *Okx) GetBalance(ctx context.Context, currency string) ([]AssetBalance, error)
- func (ok *Okx) GetBillsDetail(ctx context.Context, arg *BillsDetailQueryParameter, route string) ([]BillsDetailResponse, error)
- func (ok *Okx) GetBillsDetail3Months(ctx context.Context, arg *BillsDetailQueryParameter) ([]BillsDetailResponse, error)
- func (ok *Okx) GetBillsDetailLast7Days(ctx context.Context, arg *BillsDetailQueryParameter) ([]BillsDetailResponse, error)
- func (ok *Okx) GetBlockTicker(ctx context.Context, instrumentID string) (*BlockTicker, error)
- func (ok *Okx) GetBlockTickers(ctx context.Context, instrumentType, underlying string) ([]BlockTicker, error)
- func (ok *Okx) GetBlockTrades(ctx context.Context, instrumentID string) ([]BlockTrade, error)
- func (ok *Okx) GetBorrowAndRepayHistoryForVIPLoans(ctx context.Context, currency string, after, before time.Time, limit int64) ([]BorrowRepayHistory, error)
- func (ok *Okx) GetBorrowInterestAndLimit(ctx context.Context, loanType int64, currency string) ([]BorrowInterestAndLimitResponse, error)
- func (ok *Okx) GetCandlestickData(ctx context.Context, instrumentID string, interval kline.Interval, ...) ([]CandleStick, error)
- func (ok *Okx) GetCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, ...) ([]CandleStick, error)
- func (ok *Okx) GetCandlesticksHistory(ctx context.Context, instrumentID string, interval kline.Interval, ...) ([]CandleStick, error)
- func (ok *Okx) GetCollateralMode(ctx context.Context, item asset.Item) (collateral.Mode, error)
- func (ok *Okx) GetContractsOpenInterestAndVolume(ctx context.Context, currency string, begin, end time.Time, ...) ([]OpenInterestVolume, error)
- func (ok *Okx) GetConvertCurrencies(ctx context.Context) ([]ConvertCurrency, error)
- func (ok *Okx) GetConvertCurrencyPair(ctx context.Context, fromCurrency, toCurrency string) (*ConvertCurrencyPair, error)
- func (ok *Okx) GetConvertHistory(ctx context.Context, before, after time.Time, limit int64, tag string) ([]ConvertHistory, error)
- func (ok *Okx) GetCounterparties(ctx context.Context) ([]CounterpartiesResponse, error)
- func (ok *Okx) GetCurrencyDepositAddress(ctx context.Context, currency string) ([]CurrencyDepositResponseItem, error)
- func (ok *Okx) GetCurrencyDepositHistory(ctx context.Context, currency, depositID, transactionID string, ...) ([]DepositHistoryResponseItem, error)
- func (ok *Okx) GetCurrencyTradeURL(ctx context.Context, a asset.Item, cp currency.Pair) (string, error)
- func (ok *Okx) GetCustodyTradingSubaccountList(ctx context.Context, subaccountName string) ([]SubaccountName, error)
- func (ok *Okx) GetDeliveryHistory(ctx context.Context, instrumentType, underlying string, ...) ([]DeliveryHistory, error)
- func (ok *Okx) GetDepositAddress(ctx context.Context, c currency.Code, _, chain string) (*deposit.Address, error)
- func (ok *Okx) GetDiscountRateAndInterestFreeQuota(ctx context.Context, currency string, discountLevel int8) ([]DiscountRate, error)
- func (ok *Okx) GetEarnActiveOrders(ctx context.Context, productID, protocolType, currency, state string) ([]ActiveFundingOrder, error)
- func (ok *Okx) GetEasyConvertCurrencyList(ctx context.Context) (*EasyConvertDetail, error)
- func (ok *Okx) GetEasyConvertHistory(ctx context.Context, after, before time.Time, limit int64) ([]EasyConvertItem, error)
- func (ok *Okx) GetEstimatedDeliveryPrice(ctx context.Context, instrumentID string) ([]DeliveryEstimatedPrice, error)
- func (ok *Okx) GetExchangeRate(ctx context.Context) (*UsdCnyExchangeRate, error)
- func (ok *Okx) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (ok *Okx) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (ok *Okx) GetFundingCurrencies(ctx context.Context) ([]CurrencyResponse, error)
- func (ok *Okx) GetFundingOrderHistory(ctx context.Context, productID, protocolType, currency string, ...) ([]ActiveFundingOrder, error)
- func (ok *Okx) GetFundingRateHistory(ctx context.Context, instrumentID string, before, after time.Time, limit int64) ([]FundingRateResponse, error)
- func (ok *Okx) GetFundsTransferState(ctx context.Context, transferID, clientID string, transferType int64) ([]TransferFundRateResponse, error)
- func (ok *Okx) GetFuturesContractDetails(ctx context.Context, item asset.Item) ([]futures.Contract, error)
- func (ok *Okx) GetFuturesPositionOrders(ctx context.Context, req *futures.PositionsRequest) ([]futures.PositionResponse, error)
- func (ok *Okx) GetFuturesPositionSummary(ctx context.Context, req *futures.PositionSummaryRequest) (*futures.PositionSummary, error)
- func (ok *Okx) GetGreeks(ctx context.Context, currency string) ([]GreeksItem, error)
- func (ok *Okx) GetGridAIParameter(ctx context.Context, algoOrderType, instrumentID, direction, duration string) ([]GridAIParameterResponse, error)
- func (ok *Okx) GetGridAlgoOrderDetails(ctx context.Context, algoOrderType, algoID string) (*GridAlgoOrderResponse, error)
- func (ok *Okx) GetGridAlgoOrderHistory(ctx context.Context, ...) ([]GridAlgoOrderResponse, error)
- func (ok *Okx) GetGridAlgoOrderPositions(ctx context.Context, algoOrderType, algoID string) ([]AlgoOrderPosition, error)
- func (ok *Okx) GetGridAlgoOrdersList(ctx context.Context, ...) ([]GridAlgoOrderResponse, error)
- func (ok *Okx) GetGridAlgoSubOrders(ctx context.Context, ...) ([]GridAlgoOrderResponse, error)
- func (ok *Okx) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, ...) (*kline.Item, error)
- func (ok *Okx) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, ...) (*kline.Item, error)
- func (ok *Okx) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, ...) ([]trade.Data, error)
- func (ok *Okx) GetHistoricalFundingRates(ctx context.Context, r *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)
- func (ok *Okx) GetIndexCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, ...) ([]CandleStick, error)
- func (ok *Okx) GetIndexComponents(ctx context.Context, index string) (*IndexComponent, error)
- func (ok *Okx) GetIndexTickers(ctx context.Context, quoteCurrency, instID string) ([]IndexTicker, error)
- func (ok *Okx) GetInstrumentTypeFromAssetItem(a asset.Item) string
- func (ok *Okx) GetInstruments(ctx context.Context, arg *InstrumentsFetchParams) ([]Instrument, error)
- func (ok *Okx) GetInsuranceFundInformation(ctx context.Context, arg *InsuranceFundInformationRequestParams) (*InsuranceFundInformation, error)
- func (ok *Okx) GetInterestAccruedData(ctx context.Context, loanType, limit int64, ...) ([]InterestAccruedData, error)
- func (ok *Okx) GetInterestRate(ctx context.Context, currency string) ([]InterestRateResponse, error)
- func (ok *Okx) GetInterestRateAndLoanQuota(ctx context.Context) (map[string][]InterestRateLoanQuotaItem, error)
- func (ok *Okx) GetInterestRateAndLoanQuotaForVIPLoans(ctx context.Context) ([]VIPInterestRateAndLoanQuotaInformation, error)
- func (ok *Okx) GetIntervalEnum(interval kline.Interval, appendUTC bool) string
- func (ok *Okx) GetLatestFundingRates(ctx context.Context, r *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)
- func (ok *Okx) GetLendingHistory(ctx context.Context, currency string, before, after time.Time, limit int64) ([]LendingHistory, error)
- func (ok *Okx) GetLeverage(ctx context.Context, item asset.Item, pair currency.Pair, ...) (float64, error)
- func (ok *Okx) GetLeverageRate(ctx context.Context, instrumentID, marginMode string) ([]LeverageResponse, error)
- func (ok *Okx) GetLightningDeposits(ctx context.Context, currency string, amount float64, to int64) ([]LightningDepositItem, error)
- func (ok *Okx) GetLimitPrice(ctx context.Context, instrumentID string) (*LimitPriceResponse, error)
- func (ok *Okx) GetLiquidationOrders(ctx context.Context, arg *LiquidationOrderRequestParams) (*LiquidationOrder, error)
- func (ok *Okx) GetLongShortRatio(ctx context.Context, currency string, begin, end time.Time, ...) ([]LongShortRatio, error)
- func (ok *Okx) GetMarginLendingRatio(ctx context.Context, currency string, begin, end time.Time, ...) ([]MarginLendRatioItem, error)
- func (ok *Okx) GetMarkPrice(ctx context.Context, instrumentType, underlying, instrumentID string) ([]MarkPrice, error)
- func (ok *Okx) GetMarkPriceCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, ...) ([]CandleStick, error)
- func (ok *Okx) GetMaximumAvailableTradableAmount(ctx context.Context, instrumentID, currency, tradeMode string, reduceOnly bool, ...) ([]MaximumTradableAmount, error)
- func (ok *Okx) GetMaximumBuySellAmountOROpenAmount(ctx context.Context, instrumentID, tradeMode, currency, leverage string, ...) ([]MaximumBuyAndSell, error)
- func (ok *Okx) GetMaximumLoanOfInstrument(ctx context.Context, instrumentID, marginMode, mgnCurrency string) ([]MaximumLoanInstrument, error)
- func (ok *Okx) GetMaximumWithdrawals(ctx context.Context, currency string) ([]MaximumWithdrawal, error)
- func (ok *Okx) GetOffers(ctx context.Context, productID, protocolType, currency string) ([]Offer, error)
- func (ok *Okx) GetOneClickRepayCurrencyList(ctx context.Context, debtType string) ([]CurrencyOneClickRepay, error)
- func (ok *Okx) GetOneClickRepayHistory(ctx context.Context, after, before time.Time, limit int64) ([]CurrencyOneClickRepay, error)
- func (ok *Okx) GetOpenInterest(ctx context.Context, k ...key.PairAsset) ([]futures.OpenInterest, error)
- func (ok *Okx) GetOpenInterestAndVolumeExpiry(ctx context.Context, currency string, period kline.Interval) ([]ExpiryOpenInterestAndVolume, error)
- func (ok *Okx) GetOpenInterestAndVolumeStrike(ctx context.Context, currency string, expTime time.Time, period kline.Interval) ([]StrikeOpenInterestAndVolume, error)
- func (ok *Okx) GetOpenInterestData(ctx context.Context, instType, uly, instID string) ([]OpenInterest, error)
- func (ok *Okx) GetOptionMarketData(ctx context.Context, underlying string, expTime time.Time) ([]OptionMarketDataResponse, error)
- func (ok *Okx) GetOptionsOpenInterestAndVolume(ctx context.Context, currency string, period kline.Interval) ([]OpenInterestVolume, error)
- func (ok *Okx) GetOracle(ctx context.Context) (*OracleSmartContractResponse, error)
- func (ok *Okx) GetOrderBookDepth(ctx context.Context, instrumentID string, depth int64) (*OrderBookResponse, error)
- func (ok *Okx) GetOrderDetail(ctx context.Context, arg *OrderDetailRequestParam) (*OrderDetail, error)
- func (ok *Okx) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
- func (ok *Okx) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (*order.Detail, error)
- func (ok *Okx) GetOrderList(ctx context.Context, arg *OrderListRequestParams) ([]OrderDetail, error)
- func (ok *Okx) GetPMLimitation(ctx context.Context, instrumentType, underlying string) ([]PMLimitationResponse, error)
- func (ok *Okx) GetPositionTiers(ctx context.Context, ...) ([]PositionTiers, error)
- func (ok *Okx) GetPositions(ctx context.Context, instrumentType, instrumentID, positionID string) ([]AccountPosition, error)
- func (ok *Okx) GetPositionsHistory(ctx context.Context, instrumentType, instrumentID, marginMode string, ...) ([]AccountPositionHistory, error)
- func (ok *Okx) GetPublicBlockTrades(ctx context.Context, beginID, endID string, limit int64) ([]PublicBlockTradesResponse, error)
- func (ok *Okx) GetPublicBorrowHistory(ctx context.Context, currency string, before, after time.Time, limit int64) ([]PublicBorrowHistory, error)
- func (ok *Okx) GetPublicBorrowInfo(ctx context.Context, currency string) ([]PublicBorrowInfo, error)
- func (ok *Okx) GetPublicUnderlyings(ctx context.Context, instrumentType string) ([]string, error)
- func (ok *Okx) GetPutCallRatio(ctx context.Context, currency string, period kline.Interval) ([]OpenInterestVolumeRatio, error)
- func (ok *Okx) GetQuotes(ctx context.Context, arg *QuoteRequestParams) ([]QuoteResponse, error)
- func (ok *Okx) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
- func (ok *Okx) GetRfqTrades(ctx context.Context, arg *RfqTradesRequestParams) ([]RfqTradeResponse, error)
- func (ok *Okx) GetRfqs(ctx context.Context, arg *RfqRequestParams) ([]RfqResponse, error)
- func (ok *Okx) GetSavingBalance(ctx context.Context, currency string) ([]SavingBalanceResponse, error)
- func (ok *Okx) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)
- func (ok *Okx) GetSingleFundingRate(ctx context.Context, instrumentID string) (*FundingRateResponse, error)
- func (ok *Okx) GetSubaccountFundingBalance(ctx context.Context, subaccountName, currency string) ([]FundingBalance, error)
- func (ok *Okx) GetSubaccountTradingBalance(ctx context.Context, subaccountName string) ([]SubaccountBalanceResponse, error)
- func (ok *Okx) GetSubscriptionTemplate(_ *subscription.Subscription) (*template.Template, error)
- func (ok *Okx) GetSupportCoins(ctx context.Context) (*SupportedCoinsData, error)
- func (ok *Okx) GetSystemTime(ctx context.Context) (time.Time, error)
- func (ok *Okx) GetTakerFlow(ctx context.Context, currency string, period kline.Interval) (*CurrencyTakerFlow, error)
- func (ok *Okx) GetTakerVolume(ctx context.Context, currency, instrumentType string, begin, end time.Time, ...) ([]TakerVolume, error)
- func (ok *Okx) GetTicker(ctx context.Context, instrumentID string) (*TickerResponse, error)
- func (ok *Okx) GetTickers(ctx context.Context, instType, uly, instID string) ([]TickerResponse, error)
- func (ok *Okx) GetTradeFee(ctx context.Context, instrumentType, instrumentID, underlying string) ([]TradeFeeRate, error)
- func (ok *Okx) GetTrades(ctx context.Context, instrumentID string, limit int64) ([]TradeResponse, error)
- func (ok *Okx) GetTradesHistory(ctx context.Context, instrumentID, before, after string, limit int64) ([]TradeResponse, error)
- func (ok *Okx) GetTransactionDetailsLast3Days(ctx context.Context, arg *TransactionDetailRequestParams) ([]TransactionDetail, error)
- func (ok *Okx) GetTransactionDetailsLast3Months(ctx context.Context, arg *TransactionDetailRequestParams) ([]TransactionDetail, error)
- func (ok *Okx) GetUnderlying(pair currency.Pair, a asset.Item) (string, error)
- func (ok *Okx) GetWithdrawalHistory(ctx context.Context, ...) ([]WithdrawalHistoryResponse, error)
- func (ok *Okx) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)
- func (ok *Okx) GridPositionsSubscription(operation, algoID string) error
- func (ok *Okx) GridSubOrders(operation, algoID string) error
- func (ok *Okx) HistoryOfSubaccountTransfer(ctx context.Context, currency, subaccountType, subaccountName string, ...) ([]SubaccountBillItem, error)
- func (ok *Okx) IncreaseDecreaseMargin(ctx context.Context, arg *IncreaseDecreaseMarginInput) (*IncreaseDecreaseMargin, error)
- func (ok *Okx) IndexCandlesticksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) IndexTickerChannel(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) InstrumentsSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) IsPerpetualFutureCurrency(a asset.Item, _ currency.Pair) (bool, error)
- func (ok *Okx) IsolatedMarginTradingSettings(ctx context.Context, arg IsolatedMode) (*IsolatedMode, error)
- func (ok *Okx) LightningWithdrawal(ctx context.Context, arg LightningWithdrawalRequestInput) (*LightningWithdrawalResponse, error)
- func (ok *Okx) MarkPriceCandlesticksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) MarkPriceSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) MasterAccountsManageTransfersBetweenSubaccounts(ctx context.Context, arg *SubAccountAssetTransferParams) ([]TransferIDInfo, error)
- func (ok *Okx) ModifyOrder(ctx context.Context, action *order.Modify) (*order.ModifyResponse, error)
- func (ok *Okx) OpenInterestSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) OptionSummarySubscription(operation string, pair currency.Pair) error
- func (ok *Okx) OrderBooksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) OrderTypeFromString(orderType string) (order.Type, error)
- func (ok *Okx) OrderTypeString(orderType order.Type) (string, error)
- func (ok *Okx) PlaceAlgoOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
- func (ok *Okx) PlaceEasyConvert(ctx context.Context, arg PlaceEasyConvertParam) ([]EasyConvertItem, error)
- func (ok *Okx) PlaceGridAlgoOrder(ctx context.Context, arg *GridAlgoOrder) (*GridAlgoOrderIDResponse, error)
- func (ok *Okx) PlaceIcebergOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
- func (ok *Okx) PlaceMultipleOrders(ctx context.Context, args []PlaceOrderRequestParam) ([]OrderData, error)
- func (ok *Okx) PlaceOrder(ctx context.Context, arg *PlaceOrderRequestParam, a asset.Item) (*OrderData, error)
- func (ok *Okx) PlaceStopOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
- func (ok *Okx) PlaceTWAPOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
- func (ok *Okx) PlaceTrailingStopOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
- func (ok *Okx) PositionBuilder(ctx context.Context, arg PositionBuilderInput) ([]PositionBuilderResponse, error)
- func (ok *Okx) PositionRiskWarningSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) PriceLimitSubscription(operation string, pair currency.Pair) error
- func (ok *Okx) PublicStructureBlockTradesSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) Purchase(ctx context.Context, arg PurchaseRequestParam) (*OrderIDResponse, error)
- func (ok *Okx) QuotesSubscription(operation string) error
- func (ok *Okx) Redeem(ctx context.Context, arg RedeemRequestParam) (*OrderIDResponse, error)
- func (ok *Okx) ResetMMPStatus(ctx context.Context) (time.Time, error)
- func (ok *Okx) ResetSubAccountAPIKey(ctx context.Context, arg *SubAccountAPIKeyParam) (*SubAccountAPIKeyResponse, error)
- func (ok *Okx) RfqSubscription(operation, uid string) error
- func (ok *Okx) SavingsPurchaseOrRedemption(ctx context.Context, arg *SavingsPurchaseRedemptionInput) (*SavingsPurchaseRedemptionResponse, error)
- func (ok *Okx) SendHTTPRequest(ctx context.Context, ep exchange.URL, f request.EndpointLimit, ...) (err error)
- func (ok *Okx) SetCollateralMode(_ context.Context, _ asset.Item, _ collateral.Mode) error
- func (ok *Okx) SetDefaults()
- func (ok *Okx) SetGreeks(ctx context.Context, greeksType string) (*GreeksType, error)
- func (ok *Okx) SetLendingRate(ctx context.Context, arg LendingRate) (*LendingRate, error)
- func (ok *Okx) SetLeverage(ctx context.Context, item asset.Item, pair currency.Pair, ...) error
- func (ok *Okx) SetLeverageRate(ctx context.Context, arg SetLeverageInput) (*SetLeverageResponse, error)
- func (ok *Okx) SetMarginType(_ context.Context, _ asset.Item, _ currency.Pair, _ margin.Type) error
- func (ok *Okx) SetPermissionOfTransferOut(ctx context.Context, arg PermissionOfTransfer) ([]PermissionOfTransfer, error)
- func (ok *Okx) SetPositionMode(ctx context.Context, positionMode string) (string, error)
- func (ok *Okx) SetQuoteProducts(ctx context.Context, args []SetQuoteProductParam) (*SetQuoteProductsResult, error)
- func (ok *Okx) Setup(exch *config.Exchange) error
- func (ok *Okx) Shutdown() error
- func (ok *Okx) SmallAssetsConvert(ctx context.Context, currency []string) (*SmallAssetConvertResponse, error)
- func (ok *Okx) SpotGridAlgoOrdersSubscription(operation string, assetType asset.Item, pair currency.Pair, algoID string) error
- func (ok *Okx) SpotGridWithdrawProfit(ctx context.Context, algoID string) (*AlgoOrderWithdrawalProfit, error)
- func (ok *Okx) StatusSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) StopGridAlgoOrder(ctx context.Context, arg []StopGridAlgoOrderRequest) ([]GridAlgoOrderIDResponse, error)
- func (ok *Okx) StructureBlockTradesSubscription(operation string) error
- func (ok *Okx) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)
- func (ok *Okx) Subscribe(channelsToSubscribe subscription.List) error
- func (ok *Okx) SystemStatusResponse(ctx context.Context, state string) ([]SystemStatusResponse, error)
- func (ok *Okx) TickersSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) TradeOneClickRepay(ctx context.Context, arg TradeOneClickRepayParam) ([]CurrencyOneClickRepay, error)
- func (ok *Okx) TradesSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) TriggerAlgoOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
- func (ok *Okx) Unsubscribe(channelsToUnsubscribe subscription.List) error
- func (ok *Okx) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (ok *Okx) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error
- func (ok *Okx) UpdateOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (ok *Okx) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
- func (ok *Okx) UpdateTickers(ctx context.Context, assetType asset.Item) error
- func (ok *Okx) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
- func (ok *Okx) VIPLoansBorrowAndRepay(ctx context.Context, arg LoanBorrowAndReplayInput) (*LoanBorrowAndReplay, error)
- func (ok *Okx) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error
- func (ok *Okx) ViewSubAccountList(ctx context.Context, enable bool, subaccountName string, ...) ([]SubaccountInfo, error)
- func (ok *Okx) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (ok *Okx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (ok *Okx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (ok *Okx) Withdrawal(ctx context.Context, input *WithdrawalInput) (*WithdrawalResponse, error)
- func (ok *Okx) WsAccountSubscription(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) WsAmendMultipleOrders(args []AmendOrderRequestParams) ([]OrderData, error)
- func (ok *Okx) WsAmendOrder(arg *AmendOrderRequestParams) (*OrderData, error)
- func (ok *Okx) WsAuth(ctx context.Context, dialer *websocket.Dialer) error
- func (ok *Okx) WsCancelMultipleOrder(args []CancelOrderRequestParam) ([]OrderData, error)
- func (ok *Okx) WsCancelOrder(arg CancelOrderRequestParam) (*OrderData, error)
- func (ok *Okx) WsConnect() error
- func (ok *Okx) WsHandleData(respRaw []byte) error
- func (ok *Okx) WsOrderChannel(operation string, assetType asset.Item, pair currency.Pair, _ string) error
- func (ok *Okx) WsPlaceMultipleOrder(args []PlaceOrderRequestParam) ([]OrderData, error)
- func (ok *Okx) WsPlaceOrder(arg *PlaceOrderRequestParam) (*OrderData, error)
- func (ok *Okx) WsPositionChannel(operation string, assetType asset.Item, pair currency.Pair) error
- func (ok *Okx) WsProcessSnapshotOrderBook(data WsOrderBookData, pair currency.Pair, assets []asset.Item) error
- func (ok *Okx) WsProcessUpdateOrderbook(data WsOrderBookData, pair currency.Pair, assets []asset.Item) error
- type OneClickRepayCurrencyItem
- type OpenInterest
- type OpenInterestVolume
- type OpenInterestVolumeRatio
- type OptionMarketDataResponse
- type OracleSmartContractResponse
- type OrderAsk
- type OrderBid
- type OrderBookResponse
- type OrderBookResponseDetail
- type OrderData
- type OrderDetail
- type OrderDetailRequestParam
- type OrderHistoryRequestParams
- type OrderIDResponse
- type OrderLeg
- type OrderListRequestParams
- type PMLimitationResponse
- type PendingOrderItem
- type PermissionOfTransfer
- type PlaceEasyConvertParam
- type PlaceOrderRequestParam
- type PositionBuilderData
- type PositionBuilderInput
- type PositionBuilderResponse
- type PositionData
- type PositionDataDetail
- type PositionItem
- type PositionMode
- type PositionTiers
- type PublicBlockTradesResponse
- type PublicBorrowHistory
- type PublicBorrowInfo
- type PurchaseInvestDataItem
- type PurchaseRequestParam
- type QuoteLeg
- type QuoteRequestParams
- type QuoteResponse
- type RedeemRequestParam
- type RfqOrderLeg
- type RfqRequestParams
- type RfqResponse
- type RfqTradeResponse
- type RfqTradesRequestParams
- type SavingBalanceResponse
- type SavingsPurchaseRedemptionInput
- type SavingsPurchaseRedemptionResponse
- type ServerTime
- type SetLeverageInput
- type SetLeverageResponse
- type SetQuoteProductParam
- type SetQuoteProductsResult
- type SmallAssetConvertResponse
- type SpotGridAlgoData
- type StopGridAlgoOrderRequest
- type StopOrderParams
- type StrikeOpenInterestAndVolume
- type SubAccountAPIKeyParam
- type SubAccountAPIKeyResponse
- type SubAccountAssetTransferParams
- type SubaccountBalanceDetail
- type SubaccountBalanceResponse
- type SubaccountBillItem
- type SubaccountInfo
- type SubaccountName
- type SubscriptionInfo
- type SubscriptionOperationInput
- type SubscriptionOperationResponse
- type SupportedCoinsData
- type SystemStatusResponse
- type TakerVolume
- type TickerResponse
- type TimestampResponse
- type TradeFeeRate
- type TradeOneClickRepayParam
- type TradeResponse
- type TradingVolumeIn24HR
- type TransactionDetail
- type TransactionDetailRequestParams
- type TransferFundRateResponse
- type TransferIDInfo
- type UnitConvertResponse
- type UsdCnyExchangeRate
- type VIPInterestRateAndLoanQuotaInformation
- type WSCandlestickData
- type WSCandlestickResponse
- type WSInstrumentResponse
- type WSInstrumentsResponse
- type WSLoginResponse
- type WSMarketDataResponse
- type WSOpenInterestResponse
- type WSOrderResponse
- type WSPlaceOrder
- type WSPlaceOrderData
- type WSPlaceOrderInput
- type WSSubscriptionInformation
- type WSSubscriptionInformationList
- type WSSubscriptionResponse
- type WSTickerResponse
- type WSTradeData
- type WebsocketDataResponse
- type WebsocketEventRequest
- type WebsocketLoginData
- type WithdrawalHistoryResponse
- type WithdrawalInput
- type WithdrawalResponse
- type WsAccountChannelPushData
- type WsAdvancedAlgoOrder
- type WsAdvancedAlgoOrderDetail
- type WsAlgoOrder
- type WsAlgoOrderDetail
- type WsAmendOrderInput
- type WsBalanceAndPosition
- type WsBlockTicker
- type WsBlockTradeResponse
- type WsCancelOrderInput
- type WsContractGridAlgoOrder
- type WsDeliveryEstimatedPrice
- type WsFundingRate
- type WsGreekData
- type WsGreeks
- type WsGridPosition
- type WsGridSubOrderData
- type WsIndexTicker
- type WsMarkPrice
- type WsOptionSummary
- type WsOrder
- type WsOrderActionResponse
- type WsOrderBook
- type WsOrderBookData
- type WsOrderResponse
- type WsOrderbook5
- type WsPlaceOrderInput
- type WsPositionResponse
- type WsPublicTradesResponse
- type WsQuote
- type WsQuoteData
- type WsRfq
- type WsRfqData
- type WsSpotGridAlgoOrder
- type WsStructureBlocTrade
- type WsSystemStatusResponse
- type WsTradeOrder
Constants ¶
const ( // TradeModeCross trade mode, cross TradeModeCross = "cross" // TradeModeIsolated trade mode, isolated TradeModeIsolated = "isolated" // TradeModeCash trade mode, cash TradeModeCash = "cash" // AlgoOrdTypeGrid algo order type,grid AlgoOrdTypeGrid = "grid" // AlgoOrdTypeContractGrid algo order type, contract_grid AlgoOrdTypeContractGrid = "contract_grid" )
const ( // OkxOrderLimit Limit order OkxOrderLimit = "limit" // OkxOrderMarket Market order OkxOrderMarket = "market" // OkxOrderPostOnly POST_ONLY order type OkxOrderPostOnly = "post_only" // OkxOrderFOK fill or kill order type OkxOrderFOK = "fok" // OkxOrderIOC IOC (immediate or cancel) OkxOrderIOC = "ioc" // OkxOrderOptimalLimitIOC OPTIMAL_LIMIT_IOC OkxOrderOptimalLimitIOC = "optimal_limit_ioc" )
Variables ¶
var (
ErrorCodes = map[string]error{}/* 515 elements not displayed */
)
ErrorCodes and their corresponding error messages
Functions ¶
func GetAssetTypeFromInstrumentType ¶
GetAssetTypeFromInstrumentType returns an asset Item instance given and Instrument Type string.
func GetRateLimit ¶
func GetRateLimit() request.RateLimitDefinitions
GetRateLimit returns a RateLimit instance, which implements the request.Limiter interface.
Types ¶
type Account ¶
type Account struct { AdjEq types.Number `json:"adjEq"` Details []AccountDetail `json:"details"` Imr types.Number `json:"imr"` // Frozen equity for open positions and pending orders in USD level Applicable to Multi-currency margin and Portfolio margin IsoEq types.Number `json:"isoEq"` MgnRatio types.Number `json:"mgnRatio"` Mmr types.Number `json:"mmr"` // Maintenance margin requirement in USD level Applicable to Multi-currency margin and Portfolio margin NotionalUsd types.Number `json:"notionalUsd"` OrdFroz types.Number `json:"ordFroz"` // Margin frozen for pending orders in USD level Applicable to Multi-currency margin and Portfolio margin TotalEquity types.Number `json:"totalEq"` // Total Equity in USD level UpdateTime okxUnixMilliTime `json:"uTime"` // UpdateTime }
Account holds currency account balance and related information
type AccountAndPositionRisk ¶
type AccountAndPositionRisk struct { AdjEq string `json:"adjEq"` AccountBalanceData []AccountBalanceData `json:"balData"` PosData []PositionData `json:"posData"` Timestamp okxUnixMilliTime `json:"ts"` }
AccountAndPositionRisk holds information.
type AccountAssetValuation ¶
type AccountAssetValuation struct { Details struct { Classic types.Number `json:"classic"` Earn types.Number `json:"earn"` Funding types.Number `json:"funding"` Trading types.Number `json:"trading"` } `json:"details"` TotalBalance types.Number `json:"totalBal"` Timestamp okxUnixMilliTime `json:"ts"` }
AccountAssetValuation represents view account asset valuation data
type AccountBalanceData ¶
type AccountBalanceData struct { Currency string `json:"ccy"` DiscountEquity string `json:"disEq"` // discount equity of the currency in USD level. Equity string `json:"eq"` // Equity of the currency }
AccountBalanceData represents currency account balance.
type AccountConfigurationResponse ¶
type AccountConfigurationResponse struct { AccountLevel uint `json:"acctLv,string"` // 1: Simple 2: Single-currency margin 3: Multi-currency margin 4:Portfolio margin AutoLoan bool `json:"autoLoan"` // Whether to borrow coins automatically true: borrow coins automatically false: not borrow coins automatically ContractIsolatedMode string `json:"ctIsoMode"` // Contract isolated margin trading settings automatic:Auto transfers autonomy:Manual transfers GreeksType string `json:"greeksType"` // Current display type of Greeks PA: Greeks in coins BS: Black-Scholes Greeks in dollars Level string `json:"level"` // The user level of the current real trading volume on the platform, e.g lv1 LevelTemporary string `json:"levelTmp"` MarginIsolatedMode string `json:"mgnIsoMode"` // Margin isolated margin trading settings automatic:Auto transfers autonomy:Manual transfers PositionMode string `json:"posMode"` AccountID string `json:"uid"` }
AccountConfigurationResponse represents account configuration response.
type AccountDetail ¶
type AccountDetail struct { AvailableBalance types.Number `json:"availBal"` AvailableEquity types.Number `json:"availEq"` CashBalance types.Number `json:"cashBal"` // Cash Balance Currency currency.Code `json:"ccy"` CrossLiab types.Number `json:"crossLiab"` DiscountEquity types.Number `json:"disEq"` EquityOfCurrency types.Number `json:"eq"` EquityUsd types.Number `json:"eqUsd"` FrozenBalance types.Number `json:"frozenBal"` Interest types.Number `json:"interest"` IsoEquity types.Number `json:"isoEq"` IsolatedLiabilities types.Number `json:"isoLiab"` IsoUpl types.Number `json:"isoUpl"` // Isolated unrealized profit and loss of the currency applicable to Single-currency margin and Multi-currency margin and Portfolio margin LiabilitiesOfCurrency types.Number `json:"liab"` MaxLoan types.Number `json:"maxLoan"` MarginRatio types.Number `json:"mgnRatio"` // Equity of the currency NotionalLever types.Number `json:"notionalLever"` // Leverage of the currency applicable to Single-currency margin OpenOrdersMarginFrozen types.Number `json:"ordFrozen"` Twap types.Number `json:"twap"` UpdateTime okxUnixMilliTime `json:"uTime"` UnrealizedProfit types.Number `json:"upl"` UnrealizedCurrencyLiabilities types.Number `json:"uplLiab"` StrategyEquity types.Number `json:"stgyEq"` // strategy equity TotalEquity types.Number `json:"totalEq"` // Total equity in USD level. Appears unused }
AccountDetail account detail information.
type AccountPosition ¶
type AccountPosition struct { AutoDeleveraging string `json:"adl"` // Auto-deleveraging (ADL) indicator Divided into 5 levels, from 1 to 5, the smaller the number, the weaker the adl intensity. AvailablePosition string `json:"availPos"` // Position that can be closed Only applicable to MARGIN, FUTURES/SWAP in the long-short mode, OPTION in Simple and isolated OPTION in margin Account. AveragePrice types.Number `json:"avgPx"` CreationTime okxUnixMilliTime `json:"cTime"` Currency currency.Code `json:"ccy"` DeltaBS string `json:"deltaBS"` // delta:Black-Scholes Greeks in dollars,only applicable to OPTION DeltaPA string `json:"deltaPA"` // delta:Greeks in coins,only applicable to OPTION GammaBS string `json:"gammaBS"` // gamma:Black-Scholes Greeks in dollars,only applicable to OPTION GammaPA string `json:"gammaPA"` // gamma:Greeks in coins,only applicable to OPTION InitialMarginRequirement types.Number `json:"imr"` // Initial margin requirement, only applicable to cross. InstrumentID string `json:"instId"` InstrumentType asset.Item `json:"instType"` Interest types.Number `json:"interest"` USDPrice types.Number `json:"usdPx"` LastTradePrice types.Number `json:"last"` Leverage types.Number `json:"lever"` // Leverage, not applicable to OPTION seller Liabilities string `json:"liab"` // Liabilities, only applicable to MARGIN. LiabilitiesCurrency string `json:"liabCcy"` // Liabilities currency, only applicable to MARGIN. LiquidationPrice types.Number `json:"liqPx"` // Estimated liquidation price Not applicable to OPTION MarkPrice types.Number `json:"markPx"` Margin types.Number `json:"margin"` MarginMode string `json:"mgnMode"` MarginRatio types.Number `json:"mgnRatio"` MaintenanceMarginRequirement types.Number `json:"mmr"` // Maintenance margin requirement in USD level Applicable to Multi-currency margin and Portfolio margin NotionalUsd types.Number `json:"notionalUsd"` // Quality of Positions -- usd OptionValue types.Number `json:"optVal"` // Option Value, only application to position. QuantityOfPosition types.Number `json:"pos"` // Quantity of positions,In the mode of autonomous transfer from position to position, after the deposit is transferred, a position with pos of 0 will be generated PositionCurrency string `json:"posCcy"` PositionID string `json:"posId"` PositionSide string `json:"posSide"` ThetaBS string `json:"thetaBS"` // theta:Black-Scholes Greeks in dollars,only applicable to OPTION ThetaPA string `json:"thetaPA"` // theta:Greeks in coins,only applicable to OPTION TradeID string `json:"tradeId"` UpdatedTime okxUnixMilliTime `json:"uTime"` // Latest time position was adjusted, UPNL types.Number `json:"upl"` // Unrealized profit and loss UPLRatio types.Number `json:"uplRatio"` // Unrealized profit and loss ratio VegaBS string `json:"vegaBS"` // vega:Black-Scholes Greeks in dollars,only applicable to OPTION VegaPA string `json:"vegaPA"` // vega:Greeks in coins,only applicable to OPTION PushTime okxUnixMilliTime `json:"pTime"` // The time when the account position data is pushed. }
AccountPosition account position.
type AccountPositionHistory ¶
type AccountPositionHistory struct { CreationTime okxUnixMilliTime `json:"cTime"` Currency string `json:"ccy"` CloseAveragePrice types.Number `json:"closeAvgPx,omitempty"` CloseTotalPosition types.Number `json:"closeTotalPos,omitempty"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Leverage string `json:"lever"` ManagementMode string `json:"mgnMode"` OpenAveragePrice string `json:"openAvgPx"` OpenMaxPosition string `json:"openMaxPos"` ProfitAndLoss types.Number `json:"pnl,omitempty"` ProfitAndLossRatio types.Number `json:"pnlRatio,omitempty"` PositionID string `json:"posId"` PositionSide string `json:"posSide"` TriggerPrice string `json:"triggerPx"` Type string `json:"type"` UpdateTime okxUnixMilliTime `json:"uTime"` Underlying string `json:"uly"` }
AccountPositionHistory hold account position history.
type AccountRiskState ¶
type AccountRiskState struct { IsTheAccountAtRisk bool `json:"atRisk"` AtRiskIdx []interface{} `json:"atRiskIdx"` // derivatives risk unit list AtRiskMgn []interface{} `json:"atRiskMgn"` // margin risk unit list Timestamp okxUnixMilliTime `json:"ts"` }
AccountRiskState represents account risk state.
type ActiveFundingOrder ¶
type ActiveFundingOrder struct { OrderID string `json:"ordId"` State string `json:"state"` Currency string `json:"ccy"` Protocol string `json:"protocol"` ProtocolType string `json:"protocolType"` Term string `json:"term"` Apy string `json:"apy"` InvestData []struct { Currency string `json:"ccy"` Amount types.Number `json:"amt"` } `json:"investData"` EarningData []struct { Ccy string `json:"ccy"` EarningType string `json:"earningType"` Earnings types.Number `json:"earnings"` } `json:"earningData"` PurchasedTime okxUnixMilliTime `json:"purchasedTime"` }
ActiveFundingOrder represents active purchase orders
type AdjustMarginBalanceResponse ¶
type AdjustMarginBalanceResponse struct {
AlgoID string `json:"algoId"`
}
AdjustMarginBalanceResponse represents algo id for response for margin balance adjust request.
type AlgoOrder ¶
type AlgoOrder struct { AlgoID string `json:"algoId"` StatusCode string `json:"sCode"` StatusMsg string `json:"sMsg"` }
AlgoOrder algo order requests response.
type AlgoOrderCancelParams ¶
type AlgoOrderCancelParams struct { AlgoOrderID string `json:"algoId"` InstrumentID string `json:"instId"` }
AlgoOrderCancelParams algo order request parameter
type AlgoOrderParams ¶
type AlgoOrderParams struct { InstrumentID string `json:"instId"` // Required TradeMode string `json:"tdMode"` // Required Currency string `json:"ccy,omitempty"` Side order.Side `json:"side"` // Required PositionSide string `json:"posSide,omitempty"` OrderType string `json:"ordType"` // Required Size float64 `json:"sz,string"` // Required ReduceOnly bool `json:"reduceOnly,omitempty"` OrderTag string `json:"tag,omitempty"` QuantityType string `json:"tgtCcy,omitempty"` // Place Stop Order params TakeProfitTriggerPrice float64 `json:"tpTriggerPx,string,omitempty"` TakeProfitOrderPrice float64 `json:"tpOrdPx,string,omitempty"` StopLossTriggerPrice float64 `json:"slTriggerPx,string,omitempty"` StopLossOrderPrice float64 `json:"slOrdPx,string,omitempty"` StopLossTriggerPriceType string `json:"slTriggerPxType,omitempty"` TakeProfitTriggerPriceType string `json:"tpTriggerPxType,omitempty"` // Trigger Price Or TrailingStopOrderRequestParam CallbackRatio float64 `json:"callbackRatio,omitempty,string"` ActivePrice float64 `json:"activePx,string,omitempty"` CallbackSpreadVariance string `json:"callbackSpread,omitempty"` // trigger algo orders params. // notice: Trigger orders are not available in the net mode of futures and perpetual swaps TriggerPrice float64 `json:"triggerPx,string,omitempty"` OrderPrice float64 `json:"orderPx,string,omitempty"` // if the price i -1, then the order will be executed on the market. TriggerPriceType string `json:"triggerPxType,omitempty"` // last, index, and mark PriceVariance string `json:"pxVar,omitempty"` // Optional PriceSpread string `json:"pxSpread,omitempty"` // Optional SizeLimit float64 `json:"szLimit,string,omitempty"` // Required PriceLimit float64 `json:"pxLimit,string,omitempty"` // Required // TWAPOrder TimeInterval kline.Interval `json:"interval,omitempty"` // Required }
AlgoOrderParams holds algo order information.
type AlgoOrderPosition ¶
type AlgoOrderPosition struct { AutoDecreasingLine string `json:"adl"` AlgoID string `json:"algoId"` AveragePrice string `json:"avgPx"` Currency string `json:"ccy"` InitialMarginRequirement string `json:"imr"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` LastTradedPrice string `json:"last"` Leverage string `json:"lever"` LiquidationPrice string `json:"liqPx"` MarkPrice string `json:"markPx"` MarginMode string `json:"mgnMode"` MarginRatio string `json:"mgnRatio"` MaintenanceMarginRequirement string `json:"mmr"` NotionalUSD string `json:"notionalUsd"` QuantityPosition string `json:"pos"` PositionSide string `json:"posSide"` UnrealizedProfitAndLoss string `json:"upl"` UnrealizedProfitAndLossRatio string `json:"uplRatio"` UpdateTime okxUnixMilliTime `json:"uTime"` CreationTime okxUnixMilliTime `json:"cTime"` }
AlgoOrderPosition represents algo order position detailed data.
type AlgoOrderResponse ¶
type AlgoOrderResponse struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` OrderID string `json:"ordId"` Currency string `json:"ccy"` AlgoOrderID string `json:"algoId"` Quantity string `json:"sz"` OrderType string `json:"ordType"` Side order.Side `json:"side"` PositionSide string `json:"posSide"` TradeMode string `json:"tdMode"` QuantityType string `json:"tgtCcy"` State string `json:"state"` Lever string `json:"lever"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` TakeProfitTriggerPriceType string `json:"tpTriggerPxType"` TakeProfitOrdPrice string `json:"tpOrdPx"` StopLossTriggerPriceType string `json:"slTriggerPxType"` StopLossTriggerPrice string `json:"slTriggerPx"` TriggerPrice string `json:"triggerPx"` TriggerPriceType string `json:"triggerPxType"` OrdPrice string `json:"ordPx"` ActualSize string `json:"actualSz"` ActualPrice string `json:"actualPx"` ActualSide string `json:"actualSide"` PriceVar string `json:"pxVar"` PriceSpread string `json:"pxSpread"` PriceLimit string `json:"pxLimit"` SizeLimit string `json:"szLimit"` TimeInterval string `json:"timeInterval"` TriggerTime okxUnixMilliTime `json:"triggerTime"` CallbackRatio string `json:"callbackRatio"` CallbackSpread string `json:"callbackSpread"` ActivePrice string `json:"activePx"` MoveTriggerPrice string `json:"moveTriggerPx"` CreationTime okxUnixMilliTime `json:"cTime"` }
AlgoOrderResponse holds algo order information.
type AlgoOrderWithdrawalProfit ¶
type AlgoOrderWithdrawalProfit struct { AlgoID string `json:"algoId"` WithdrawProfit string `json:"profit"` }
AlgoOrderWithdrawalProfit algo withdrawal order profit info.
type AmendOrderRequestParams ¶
type AmendOrderRequestParams struct { InstrumentID string `json:"instId"` CancelOnFail bool `json:"cxlOnFail,omitempty"` OrderID string `json:"ordId,omitempty"` ClientOrderID string `json:"clOrdId,omitempty"` ClientRequestID string `json:"reqId,omitempty"` NewQuantity float64 `json:"newSz,string,omitempty"` NewPrice float64 `json:"newPx,string,omitempty"` }
AmendOrderRequestParams represents amend order requesting parameters.
type AssetBalance ¶
type AssetBalance struct { AvailBal types.Number `json:"availBal"` Balance types.Number `json:"bal"` Currency string `json:"ccy"` FrozenBalance types.Number `json:"frozenBal"` }
AssetBalance represents account owner asset balance
type AssetBillDetail ¶
type AssetBillDetail struct { BillID string `json:"billId"` Currency string `json:"ccy"` ClientID string `json:"clientId"` BalanceChange string `json:"balChg"` AccountBalance string `json:"bal"` Type int `json:"type,string"` Timestamp okxUnixMilliTime `json:"ts"` }
AssetBillDetail represents the billing record
type BalanceAndPositionData ¶
type BalanceAndPositionData struct { PushTime okxUnixMilliTime `json:"pTime"` EventType string `json:"eventType"` BalanceData []BalanceData `json:"balData"` PositionData []PositionDataDetail `json:"posData"` }
BalanceAndPositionData represents balance and position data with the push time.
type BalanceData ¶
type BalanceData struct { Currency string `json:"ccy"` CashBalance string `json:"cashBal"` UpdateTime okxUnixMilliTime `json:"uTime"` }
BalanceData represents currency and it's Cash balance with the update time.
type BillsDetailQueryParameter ¶
type BillsDetailQueryParameter struct { InstrumentType string // Instrument type "SPOT" "MARGIN" "SWAP" "FUTURES" "OPTION" Currency string MarginMode string // Margin mode "isolated" "cross" ContractType string // Contract type "linear" & "inverse" Only applicable to FUTURES/SWAP BillType uint // Bill type 1: Transfer 2: Trade 3: Delivery 4: Auto token conversion 5: Liquidation 6: Margin transfer 7: Interest deduction 8: Funding fee 9: ADL 10: Clawback 11: System token conversion 12: Strategy transfer 13: ddh BillSubType int // allowed bill subtype values are [ 1,2,3,4,5,6,9,11,12,14,160,161,162,110,111,118,119,100,101,102,103,104,105,106,110,125,126,127,128,131,132,170,171,172,112,113,117,173,174,200,201,202,203 ], link: https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days After string Before string BeginTime time.Time EndTime time.Time Limit int64 }
BillsDetailQueryParameter represents bills detail query parameter
type BillsDetailResponse ¶
type BillsDetailResponse struct { Balance types.Number `json:"bal"` BalanceChange string `json:"balChg"` BillID string `json:"billId"` Currency string `json:"ccy"` ExecType string `json:"execType"` // Order flow type, T:taker M:maker Fee types.Number `json:"fee"` // Fee Negative number represents the user transaction fee charged by the platform. Positive number represents rebate. From string `json:"from"` // The remitting account 6: FUNDING 18: Trading account When bill type is not transfer, the field returns "". InstrumentID string `json:"instId"` InstrumentType asset.Item `json:"instType"` MarginMode string `json:"mgnMode"` Notes string `json:"notes"` // notes When bill type is not transfer, the field returns "". OrderID string `json:"ordId"` ProfitAndLoss types.Number `json:"pnl"` PositionLevelBalance types.Number `json:"posBal"` PositionLevelBalanceChange types.Number `json:"posBalChg"` SubType string `json:"subType"` Size types.Number `json:"sz"` To string `json:"to"` Timestamp okxUnixMilliTime `json:"ts"` Type string `json:"type"` }
BillsDetailResponse represents account bills information.
type BlockTicker ¶
type BlockTicker struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` TradingVolumeInCCY24Hour types.Number `json:"volCcy24h"` TradingVolumeInUSD24Hour types.Number `json:"vol24h"` Timestamp okxUnixMilliTime `json:"ts"` }
BlockTicker holds block trading information.
func (*BlockTicker) UnmarshalJSON ¶
func (a *BlockTicker) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type BlockTrade ¶
type BlockTrade struct { InstrumentID string `json:"instId"` TradeID string `json:"tradeId"` Price types.Number `json:"px"` Size types.Number `json:"sz"` Side order.Side `json:"side"` FillVolatility types.Number `json:"fillVol"` ForwardPrice types.Number `json:"fwdPx"` IndexPrice types.Number `json:"idxPx"` MarkPrice types.Number `json:"markPx"` Timestamp types.Time `json:"ts"` }
BlockTrade represents a block trade.
type BlockTradeLeg ¶
type BlockTradeLeg struct { TradeID string `json:"tradeId"` InstrumentID string `json:"instId"` Side order.Side `json:"side"` Size types.Number `json:"sz"` Price types.Number `json:"px"` Fee types.Number `json:"fee,omitempty"` FeeCurrency string `json:"feeCcy,omitempty"` }
BlockTradeLeg Rfq trade response leg.
type Book5Data ¶
type Book5Data struct { Asks [][4]string `json:"asks"` Bids [][4]string `json:"bids"` InstrumentID string `json:"instId"` TimestampMilli int64 `json:"ts,string"` SequenceID int64 `json:"seqId"` }
Book5Data stores the orderbook data for orderbook 5 websocket
type BorrowInterestAndLimitResponse ¶
type BorrowInterestAndLimitResponse struct { Debt string `json:"debt"` Interest string `json:"interest"` NextDiscountTime okxUnixMilliTime `json:"nextDiscountTime"` NextInterestTime okxUnixMilliTime `json:"nextInterestTime"` Records []struct { AvailLoan string `json:"availLoan"` Currency string `json:"ccy"` Interest string `json:"interest"` LoanQuota string `json:"loanQuota"` PosLoan string `json:"posLoan"` // Frozen amount for current account Only applicable to VIP loans Rate string `json:"rate"` SurplusLmt string `json:"surplusLmt"` UsedLmt string `json:"usedLmt"` UsedLoan string `json:"usedLoan"` } `json:"records"` }
BorrowInterestAndLimitResponse represents borrow interest and limit rate for different loan type.
type BorrowRepayHistory ¶
type BorrowRepayHistory struct { Currency string `json:"ccy"` TradedLoan string `json:"tradedLoan"` Timestamp okxUnixMilliTime `json:"ts"` Type string `json:"type"` UsedLoan string `json:"usedLoan"` }
BorrowRepayHistory represents borrow and repay history item data
type CancelFundingParam ¶
type CancelFundingParam struct { OrderID string `json:"ordId"` ProtocolType string `json:"protocolType"` }
CancelFundingParam cancel purchase or redemption request
type CancelOrderRequestParam ¶
type CancelOrderRequestParam struct { InstrumentID string `json:"instId"` OrderID string `json:"ordId"` ClientOrderID string `json:"clOrdId,omitempty"` }
CancelOrderRequestParam represents order parameters to cancel an order.
type CancelQuoteRequestParams ¶
type CancelQuoteRequestParams struct { QuoteID string `json:"quoteId"` ClientQuoteID string `json:"clQuoteId"` }
CancelQuoteRequestParams represents cancel quote request params
type CancelQuoteResponse ¶
type CancelQuoteResponse struct { QuoteID string `json:"quoteId"` ClientQuoteID string `json:"clQuoteId"` SCode string `json:"sCode"` SMsg string `json:"sMsg"` }
CancelQuoteResponse represents cancel quote response
type CancelQuotesRequestParams ¶
type CancelQuotesRequestParams struct { QuoteIDs []string `json:"quoteIds,omitempty"` ClientQuoteIDs []string `json:"clQuoteIds,omitempty"` }
CancelQuotesRequestParams represents cancel multiple quotes request params
type CancelRfqRequestParam ¶
type CancelRfqRequestParam struct { RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` }
CancelRfqRequestParam represents cancel Rfq order request params
type CancelRfqRequestsParam ¶
type CancelRfqRequestsParam struct { RfqIDs []string `json:"rfqIds"` ClientRfqIDs []string `json:"clRfqIds"` }
CancelRfqRequestsParam represents cancel multiple Rfq orders request params
type CancelRfqResponse ¶
type CancelRfqResponse struct { RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` StatusCode string `json:"sCode"` StatusMsg string `json:"sMsg"` }
CancelRfqResponse represents cancel Rfq orders response
type CandleStick ¶
type CandleStick struct { OpenTime time.Time OpenPrice float64 HighestPrice float64 LowestPrice float64 ClosePrice float64 Volume float64 QuoteAssetVolume float64 }
CandleStick holds candlestick price data
type CandlestickMarkPrice ¶
type CandlestickMarkPrice struct { Timestamp time.Time `json:"ts"` OpenPrice float64 `json:"o"` HighestPrice float64 `json:"h"` LowestPrice float64 `json:"l"` ClosePrice float64 `json:"s"` }
CandlestickMarkPrice represents candlestick mark price push data as a result of subscription to "mark-price-candle*" channel.
type ClosePositionResponse ¶
type ClosePositionResponse struct { InstrumentID string `json:"instId"` PositionSide string `json:"posSide"` }
ClosePositionResponse response data for close position.
type ClosePositionsRequestParams ¶
type ClosePositionsRequestParams struct { InstrumentID string `json:"instId"` // REQUIRED PositionSide string `json:"posSide"` MarginMode string `json:"mgnMode"` // cross or isolated Currency string `json:"ccy"` AutomaticallyCanceled bool `json:"autoCxl"` ClientID string `json:"clOrdId,omitempty"` Tag string `json:"tag,omitempty"` }
ClosePositionsRequestParams input parameters for close position endpoints
type ComputeMarginBalance ¶
type ComputeMarginBalance struct { Leverage types.Number `json:"lever"` MaximumAmount types.Number `json:"maxAmt"` }
ComputeMarginBalance represents compute margin amount request response
type ContractGridAlgoOrder ¶
type ContractGridAlgoOrder struct { ActualLever string `json:"actualLever"` AlgoID string `json:"algoId"` AlgoOrderType string `json:"algoOrdType"` AnnualizedRate string `json:"annualizedRate"` ArbitrageNumber string `json:"arbitrageNum"` BasePosition bool `json:"basePos"` CancelType string `json:"cancelType"` Direction string `json:"direction"` Eq string `json:"eq"` FloatProfit string `json:"floatProfit"` GridQuantity string `json:"gridNum"` GridProfit string `json:"gridProfit"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Investment string `json:"investment"` Leverage string `json:"lever"` LiqPrice string `json:"liqPx"` MaxPrice string `json:"maxPx"` MinPrice string `json:"minPx"` CreationTime okxUnixMilliTime `json:"cTime"` PushTime okxUnixMilliTime `json:"pTime"` PerMaxProfitRate string `json:"perMaxProfitRate"` PerMinProfitRate string `json:"perMinProfitRate"` ProfitAndLossRatio string `json:"pnlRatio"` RunPrice string `json:"runPx"` RunType string `json:"runType"` SingleAmount string `json:"singleAmt"` SlTriggerPx string `json:"slTriggerPx"` State string `json:"state"` StopType string `json:"stopType"` Size string `json:"sz"` Tag string `json:"tag"` TotalAnnualizedRate string `json:"totalAnnualizedRate"` TotalProfitAndLoss string `json:"totalPnl"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` TradeNumber string `json:"tradeNum"` TriggerTime string `json:"triggerTime"` UpdateTime string `json:"uTime"` Underlying string `json:"uly"` }
ContractGridAlgoOrder represents contract grid algo order
type ConvertCurrency ¶
type ConvertCurrency struct { Currency string `json:"currency"` Min types.Number `json:"min"` Max types.Number `json:"max"` }
ConvertCurrency represents currency conversion detailed data.
type ConvertCurrencyPair ¶
type ConvertCurrencyPair struct { InstrumentID string `json:"instId"` BaseCurrency string `json:"baseCcy"` BaseCurrencyMax types.Number `json:"baseCcyMax,omitempty"` BaseCurrencyMin types.Number `json:"baseCcyMin,omitempty"` QuoteCurrency string `json:"quoteCcy,omitempty"` QuoteCurrencyMax types.Number `json:"quoteCcyMax,omitempty"` QuoteCurrencyMin types.Number `json:"quoteCcyMin,omitempty"` }
ConvertCurrencyPair holds information related to conversion between two pairs.
type ConvertHistory ¶
type ConvertHistory struct { InstrumentID string `json:"instId"` Side order.Side `json:"side"` FillPrice types.Number `json:"fillPx"` BaseCurrency string `json:"baseCcy"` QuoteCurrency string `json:"quoteCcy"` FillBaseSize types.Number `json:"fillBaseSz"` State string `json:"state"` TradeID string `json:"tradeId"` FillQuoteSize types.Number `json:"fillQuoteSz"` Timestamp okxUnixMilliTime `json:"ts"` }
ConvertHistory holds convert trade history response
type ConvertTradeInput ¶
type ConvertTradeInput struct { BaseCurrency string `json:"baseCcy"` QuoteCurrency string `json:"quoteCcy"` Side string `json:"side"` Size float64 `json:"sz,string"` SizeCurrency string `json:"szCcy"` QuoteID string `json:"quoteId"` ClientOrderID string `json:"clTReqId"` Tag string `json:"tag"` }
ConvertTradeInput represents convert trade request input
type ConvertTradeResponse ¶
type ConvertTradeResponse struct { BaseCurrency string `json:"baseCcy"` ClientOrderID string `json:"clTReqId"` FillBaseSize types.Number `json:"fillBaseSz"` FillPrice string `json:"fillPx"` FillQuoteSize types.Number `json:"fillQuoteSz"` InstrumentID string `json:"instId"` QuoteCurrency string `json:"quoteCcy"` QuoteID string `json:"quoteId"` Side order.Side `json:"side"` State string `json:"state"` TradeID string `json:"tradeId"` Timestamp okxUnixMilliTime `json:"ts"` }
ConvertTradeResponse represents convert trade response
type CounterpartiesResponse ¶
type CounterpartiesResponse struct { TraderName string `json:"traderName"` TraderCode string `json:"traderCode"` Type string `json:"type"` }
CounterpartiesResponse represents
type CreateQuoteParams ¶
type CreateQuoteParams struct { RfqID string `json:"rfqId"` ClientQuoteID string `json:"clQuoteId"` QuoteSide order.Side `json:"quoteSide"` Legs []QuoteLeg `json:"legs"` }
CreateQuoteParams holds information related to create quote.
func (*CreateQuoteParams) MarshalJSON ¶
func (a *CreateQuoteParams) MarshalJSON() ([]byte, error)
MarshalJSON serialized CreateQuoteParams instance into bytes
type CreateRfqInput ¶
type CreateRfqInput struct { Anonymous bool `json:"anonymous"` CounterParties []string `json:"counterparties"` ClientRfqID string `json:"clRfqId"` Legs []RfqOrderLeg `json:"legs"` }
CreateRfqInput Rfq create method input.
type CurrencyDebtAmount ¶
type CurrencyDebtAmount struct { DebtAmount types.Number `json:"debtAmt"` DebtCurrency string `json:"debtCcy"` }
CurrencyDebtAmount represents debt currency data
type CurrencyDepositResponseItem ¶
type CurrencyDepositResponseItem struct { Tag string `json:"tag"` Chain string `json:"chain"` ContractAddress string `json:"ctAddr"` Currency string `json:"ccy"` ToBeneficiaryAccount string `json:"to"` Address string `json:"addr"` Selected bool `json:"selected"` Memo string `json:"memo"` DepositAddressAttachment map[string]string `json:"addrEx"` PaymentID string `json:"pmtId"` }
CurrencyDepositResponseItem represents the deposit address information item.
type CurrencyOneClickRepay ¶
type CurrencyOneClickRepay struct { DebtCurrency string `json:"debtCcy"` FillFromSize types.Number `json:"fillFromSz"` FillRepaySize types.Number `json:"fillRepaySz"` FillToSize types.Number `json:"fillToSz"` RepayCurrency string `json:"repayCcy"` Status string `json:"status"` UpdateTime time.Time `json:"uTime"` }
CurrencyOneClickRepay represents one click repay currency
func (*CurrencyOneClickRepay) UnmarshalJSON ¶
func (a *CurrencyOneClickRepay) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type CurrencyRepayAmount ¶
type CurrencyRepayAmount struct { RepayAmount types.Number `json:"repayAmt"` RepayCurrency string `json:"repayCcy"` }
CurrencyRepayAmount represents rebat currency amount.
type CurrencyResponse ¶
type CurrencyResponse struct { CanDeposit bool `json:"canDep"` // Availability to deposit from chain. false: not available true: available CanInternalTransfer bool `json:"canInternal"` // Availability to internal transfer. CanWithdraw bool `json:"canWd"` // Availability to withdraw to chain. Currency string `json:"ccy"` // Chain string `json:"chain"` // LogoLink string `json:"logoLink"` // Logo link of currency MainNet bool `json:"mainNet"` // If current chain is main net then return true, otherwise return false MaxFee types.Number `json:"maxFee"` // Minimum withdrawal fee MaxWithdrawal types.Number `json:"maxWd"` // Minimum amount of currency withdrawal in a single transaction MinFee types.Number `json:"minFee"` // Minimum withdrawal fee MinWithdrawal string `json:"minWd"` // Minimum amount of currency withdrawal in a single transaction Name string `json:"name"` // Chinese name of currency UsedWithdrawalQuota string `json:"usedWdQuota"` // Amount of currency withdrawal used in the past 24 hours, unit in BTC WithdrawalQuota string `json:"wdQuota"` // Minimum amount of currency withdrawal in a single transaction WithdrawalTickSize string `json:"wdTickSz"` // Withdrawal precision, indicating the number of digits after the decimal point }
CurrencyResponse represents a currency item detail response data.
type CurrencyTakerFlow ¶
type CurrencyTakerFlow struct { Timestamp time.Time CallBuyVolume float64 CallSellVolume float64 PutBuyVolume float64 PutSellVolume float64 CallBlockVolume float64 PutBlockVolume float64 }
CurrencyTakerFlow holds the taker volume information for a single currency.
type DeliveryEstimatedPrice ¶
type DeliveryEstimatedPrice struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` EstimatedDeliveryPrice string `json:"settlePx"` Timestamp okxUnixMilliTime `json:"ts"` }
DeliveryEstimatedPrice holds an estimated delivery or exercise price response.
type DeliveryHistory ¶
type DeliveryHistory struct { Timestamp okxUnixMilliTime `json:"ts"` Details []DeliveryHistoryDetail `json:"details"` }
DeliveryHistory represents list of delivery history detail items and timestamp information
type DeliveryHistoryDetail ¶
type DeliveryHistoryDetail struct { Type string `json:"type"` InstrumentID string `json:"insId"` DeliveryPrice types.Number `json:"px"` }
DeliveryHistoryDetail holds instrument id and delivery price information detail
type DepositHistoryResponseItem ¶
type DepositHistoryResponseItem struct { Amount types.Number `json:"amt"` TransactionID string `json:"txId"` // Hash record of the deposit Currency string `json:"ccy"` Chain string `json:"chain"` From string `json:"from"` ToDepositAddress string `json:"to"` Timestamp okxUnixMilliTime `json:"ts"` State int `json:"state,string"` DepositID string `json:"depId"` }
DepositHistoryResponseItem deposit history response item.
type DiscountRate ¶
type DiscountRate struct { Amount string `json:"amt"` Currency string `json:"ccy"` DiscountInfo []DiscountRateInfoItem `json:"discountInfo"` DiscountRateLevel string `json:"discountLv"` }
DiscountRate represents the discount rate amount, currency, and other discount related information.
type DiscountRateInfoItem ¶
type DiscountRateInfoItem struct { DiscountRate string `json:"discountRate"` MaxAmount types.Number `json:"maxAmt"` MinAmount types.Number `json:"minAmt"` }
DiscountRateInfoItem represents discount info list item for discount rate response
type EasyConvertDetail ¶
type EasyConvertDetail struct { FromData []EasyConvertFromData `json:"fromData"` ToCurrency []string `json:"toCcy"` }
EasyConvertDetail represents easy convert currencies list and their detail.
type EasyConvertFromData ¶
type EasyConvertFromData struct { FromAmount types.Number `json:"fromAmt"` FromCurrency string `json:"fromCcy"` }
EasyConvertFromData represents convert currency from detail
type EasyConvertItem ¶
type EasyConvertItem struct { FilFromSize types.Number `json:"fillFromSz"` FillToSize types.Number `json:"fillToSz"` FromCurrency string `json:"fromCcy"` Status string `json:"status"` ToCurrency string `json:"toCcy"` UpdateTime okxUnixMilliTime `json:"uTime"` }
EasyConvertItem represents easy convert place order response.
type EstimateQuoteRequestInput ¶
type EstimateQuoteRequestInput struct { BaseCurrency string `json:"baseCcy,omitempty"` QuoteCurrency string `json:"quoteCcy,omitempty"` Side string `json:"side,omitempty"` RfqAmount float64 `json:"rfqSz,omitempty"` RfqSzCurrency string `json:"rfqSzCcy,omitempty"` ClientRequestOrderID string `json:"clQReqId,string,omitempty"` Tag string `json:"tag,omitempty"` }
EstimateQuoteRequestInput represents estimate quote request parameters
type EstimateQuoteResponse ¶
type EstimateQuoteResponse struct { BaseCurrency string `json:"baseCcy"` BaseSize string `json:"baseSz"` ClientRequestID string `json:"clQReqId"` ConvertPrice string `json:"cnvtPx"` OrigRfqSize string `json:"origRfqSz"` QuoteCurrency string `json:"quoteCcy"` QuoteID string `json:"quoteId"` QuoteSize string `json:"quoteSz"` QuoteTime okxUnixMilliTime `json:"quoteTime"` RfqSize string `json:"rfqSz"` RfqSizeCurrency string `json:"rfqSzCcy"` Side order.Side `json:"side"` TTLMs string `json:"ttlMs"` // Validity period of quotation in milliseconds }
EstimateQuoteResponse represents estimate quote response data.
type ExecuteQuoteParams ¶
ExecuteQuoteParams represents Execute quote request params
type ExecuteQuoteResponse ¶
type ExecuteQuoteResponse struct { BlockTradedID string `json:"blockTdId"` RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` QuoteID string `json:"quoteId"` ClientQuoteID string `json:"clQuoteId"` TraderCode string `json:"tTraderCode"` MakerTraderCode string `json:"mTraderCode"` CreationTime okxUnixMilliTime `json:"cTime"` Legs []OrderLeg `json:"legs"` }
ExecuteQuoteResponse represents execute quote response.
type ExpiryOpenInterestAndVolume ¶
type ExpiryOpenInterestAndVolume struct { Timestamp time.Time ExpiryTime time.Time CallOpenInterest float64 PutOpenInterest float64 CallVolume float64 PutVolume float64 }
ExpiryOpenInterestAndVolume represents open interest and trading volume of calls and puts for each upcoming expiration.
type FundingBalance ¶
type FundingBalance struct { AvailableBalance string `json:"availBal"` Balance string `json:"bal"` Currency string `json:"ccy"` FrozenBalance string `json:"frozenBal"` }
FundingBalance holds function balance.
type FundingOrder ¶
type FundingOrder struct { OrderID string `json:"ordId"` State string `json:"state"` Currency string `json:"ccy"` Protocol string `json:"protocol"` ProtocolType string `json:"protocolType"` Term string `json:"term"` Apy types.Number `json:"apy"` InvestData []struct { Currency string `json:"ccy"` Amount types.Number `json:"amt"` } `json:"investData"` EarningData []struct { Currency string `json:"ccy"` EarningType string `json:"earningType"` RealizedEarnings types.Number `json:"realizedEarnings"` } `json:"earningData"` PurchasedTime okxUnixMilliTime `json:"purchasedTime"` RedeemedTime okxUnixMilliTime `json:"redeemedTime"` EarningCcy []string `json:"earningCcy,omitempty"` }
FundingOrder represents orders of earning, purchase, and redeem
type FundingRateResponse ¶
type FundingRateResponse struct { FundingRate types.Number `json:"fundingRate"` RealisedRate types.Number `json:"realizedRate"` FundingTime okxUnixMilliTime `json:"fundingTime"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` NextFundingRate types.Number `json:"nextFundingRate"` NextFundingTime okxUnixMilliTime `json:"nextFundingTime"` }
FundingRateResponse response data for the Funding Rate for an instruction type
type FundingTransferRequestInput ¶
type FundingTransferRequestInput struct { Currency string `json:"ccy"` Type int `json:"type,string"` Amount float64 `json:"amt,string"` From string `json:"from"` // "6": Funding account, "18": Trading account To string `json:"to"` SubAccount string `json:"subAcct"` LoanTransfer bool `json:"loanTrans,string"` ClientID string `json:"clientId"` // Client-supplied ID A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters. }
FundingTransferRequestInput represents funding account request input.
type FundingTransferResponse ¶
type FundingTransferResponse struct { TransferID string `json:"transId"` Currency string `json:"ccy"` ClientID string `json:"clientId"` From int64 `json:"from,string"` Amount types.Number `json:"amt"` To int64 `json:"to,string"` }
FundingTransferResponse represents funding transfer and trading account transfer response.
type GreeksItem ¶
type GreeksItem struct { ThetaBS string `json:"thetaBS"` ThetaPA string `json:"thetaPA"` DeltaBS string `json:"deltaBS"` DeltaPA string `json:"deltaPA"` GammaBS string `json:"gammaBS"` GammaPA string `json:"gammaPA"` VegaBS string `json:"vegaBS"` VegaPA string `json:"vegaPA"` Currency string `json:"ccy"` Timestamp okxUnixMilliTime `json:"ts"` }
GreeksItem represents greeks response
type GreeksType ¶
type GreeksType struct {
GreeksType string `json:"greeksType"` // Display type of Greeks. PA: Greeks in coins BS: Black-Scholes Greeks in dollars
}
GreeksType represents for greeks type response
type GridAIParameterResponse ¶
type GridAIParameterResponse struct { AlgoOrderType string `json:"algoOrdType"` AnnualizedRate string `json:"annualizedRate"` Currency string `json:"ccy"` Direction string `json:"direction"` Duration string `json:"duration"` GridNum string `json:"gridNum"` InstrumentID string `json:"instId"` Leverage types.Number `json:"lever"` MaximumPrice types.Number `json:"maxPx"` MinimumInvestment types.Number `json:"minInvestment"` MinimumPrice types.Number `json:"minPx"` PerMaximumProfitRate types.Number `json:"perMaxProfitRate"` PerMinimumProfitRate types.Number `json:"perMinProfitRate"` RunType string `json:"runType"` }
GridAIParameterResponse represents gri AI parameter response.
type GridAlgoOrder ¶
type GridAlgoOrder struct { InstrumentID string `json:"instId"` AlgoOrdType string `json:"algoOrdType"` MaxPrice types.Number `json:"maxPx"` MinPrice types.Number `json:"minPx"` GridQuantity types.Number `json:"gridNum"` GridType string `json:"runType"` // "1": Arithmetic, "2": Geometric Default is Arithmetic // Spot Grid Order QuoteSize types.Number `json:"quoteSz"` // Invest amount for quote currency Either "instId" or "ccy" is required BaseSize types.Number `json:"baseSz"` // Invest amount for base currency Either "instId" or "ccy" is required // Contract Grid Order BasePosition bool `json:"basePos"` // Whether or not open a position when strategy actives Default is false Neutral contract grid should omit the parameter Size types.Number `json:"sz"` Direction string `json:"direction"` Lever string `json:"lever"` }
GridAlgoOrder represents grid algo order.
type GridAlgoOrderAmend ¶
type GridAlgoOrderAmend struct { AlgoID string `json:"algoId"` InstrumentID string `json:"instId"` StopLossTriggerPrice string `json:"slTriggerPx"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` }
GridAlgoOrderAmend represents amend algo order response
type GridAlgoOrderIDResponse ¶
type GridAlgoOrderIDResponse struct { AlgoOrderID string `json:"algoId"` SCode string `json:"sCode"` SMsg string `json:"sMsg"` }
GridAlgoOrderIDResponse represents grid algo order
type GridAlgoOrderResponse ¶
type GridAlgoOrderResponse struct { ActualLever string `json:"actualLever"` AlgoID string `json:"algoId"` AlgoOrderType string `json:"algoOrdType"` ArbitrageNumber string `json:"arbitrageNum"` BasePosition bool `json:"basePos"` BaseSize string `json:"baseSz"` CancelType string `json:"cancelType"` Direction string `json:"direction"` FloatProfit string `json:"floatProfit"` GridQuantity string `json:"gridNum"` GridProfit string `json:"gridProfit"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Investment string `json:"investment"` Leverage string `json:"lever"` EstimatedLiquidationPrice string `json:"liqPx"` MaximumPrice string `json:"maxPx"` MinimumPrice string `json:"minPx"` ProfitAndLossRatio string `json:"pnlRatio"` QuoteSize string `json:"quoteSz"` RunType string `json:"runType"` StopLossTriggerPx string `json:"slTriggerPx"` State string `json:"state"` StopResult string `json:"stopResult,omitempty"` StopType string `json:"stopType"` Size string `json:"sz"` Tag string `json:"tag"` TotalProfitAndLoss string `json:"totalPnl"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` CreationTime okxUnixMilliTime `json:"cTime"` UpdateTime okxUnixMilliTime `json:"uTime"` Underlying string `json:"uly"` EquityOfStrength string `json:"eq,omitempty"` PerMaxProfitRate string `json:"perMaxProfitRate,omitempty"` PerMinProfitRate string `json:"perMinProfitRate,omitempty"` Profit string `json:"profit,omitempty"` Runpx string `json:"runpx,omitempty"` SingleAmt string `json:"singleAmt,omitempty"` TotalAnnualizedRate string `json:"totalAnnualizedRate,omitempty"` TradeNumber string `json:"tradeNum,omitempty"` AnnualizedRate string `json:"annualizedRate,omitempty"` CurBaseSz string `json:"curBaseSz,omitempty"` CurQuoteSz string `json:"curQuoteSz,omitempty"` }
GridAlgoOrderResponse a complete information of grid algo order item response.
type GridAlgoSuborder ¶
type GridAlgoSuborder struct { ActualLeverage string `json:"actualLever"` AlgoID string `json:"algoId"` AlgoOrderType string `json:"algoOrdType"` AnnualizedRate string `json:"annualizedRate"` ArbitrageNum string `json:"arbitrageNum"` BasePosition bool `json:"basePos"` BaseSize string `json:"baseSz"` CancelType string `json:"cancelType"` CurBaseSz string `json:"curBaseSz"` CurQuoteSz string `json:"curQuoteSz"` Direction string `json:"direction"` EquityOfStrength string `json:"eq"` FloatProfit string `json:"floatProfit"` GridQuantity string `json:"gridNum"` GridProfit string `json:"gridProfit"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Investment string `json:"investment"` Leverage string `json:"lever"` LiquidationPx string `json:"liqPx"` MaximumPrice string `json:"maxPx"` MinimumPrice string `json:"minPx"` PerMaxProfitRate string `json:"perMaxProfitRate"` PerMinProfitRate string `json:"perMinProfitRate"` ProfitAndLossRatio string `json:"pnlRatio"` Profit string `json:"profit"` QuoteSize string `json:"quoteSz"` RunType string `json:"runType"` Runpx string `json:"runpx"` SingleAmount string `json:"singleAmt"` StopLossTriggerPx string `json:"slTriggerPx"` State string `json:"state"` StopResult string `json:"stopResult"` StopType string `json:"stopType"` Size string `json:"sz"` Tag string `json:"tag"` TotalAnnualizedRate string `json:"totalAnnualizedRate"` TotalProfitAndLoss string `json:"totalPnl"` TakeProfitTriggerPx string `json:"tpTriggerPx"` TradeNum string `json:"tradeNum"` UpdateTime okxUnixMilliTime `json:"uTime"` CreationTime okxUnixMilliTime `json:"cTime"` }
GridAlgoSuborder represents a grid algo suborder item.
type GridPositionData ¶
type GridPositionData struct { AutoDeleveraging string `json:"adl"` AlgoID string `json:"algoId"` AveragePrice string `json:"avgPx"` Currency string `json:"ccy"` InitialMarginRequirement string `json:"imr"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Last string `json:"last"` Leverage string `json:"lever"` LiquidationPrice string `json:"liqPx"` MarkPrice string `json:"markPx"` MarginMode string `json:"mgnMode"` MarginRatio string `json:"mgnRatio"` MaintenanceMarginRequirement string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` QuantityOfPositions string `json:"pos"` PositionSide string `json:"posSide"` UnrealizedProfitAndLoss string `json:"upl"` UnrealizedProfitAndLossRatio string `json:"uplRatio"` PushTime okxUnixMilliTime `json:"pTime"` UpdateTime okxUnixMilliTime `json:"uTime"` CreationTime okxUnixMilliTime `json:"cTime"` }
GridPositionData represents a position data
type GridSubOrderData ¶
type GridSubOrderData struct { AccumulatedFillSize string `json:"accFillSz"` AlgoID string `json:"algoId"` AlgoOrderType string `json:"algoOrdType"` AveragePrice string `json:"avgPx"` CreationTime string `json:"cTime"` ContractValue string `json:"ctVal"` Fee string `json:"fee"` FeeCurrency string `json:"feeCcy"` GroupID string `json:"groupId"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Leverage string `json:"lever"` OrderID string `json:"ordId"` OrderType string `json:"ordType"` PushTime okxUnixMilliTime `json:"pTime"` ProfitAdLoss string `json:"pnl"` PositionSide string `json:"posSide"` Price string `json:"px"` Side order.Side `json:"side"` State string `json:"state"` Size string `json:"sz"` Tag string `json:"tag"` TradeMode string `json:"tdMode"` UpdateTime okxUnixMilliTime `json:"uTime"` }
GridSubOrderData represents a single sub order detailed info
type IncreaseDecreaseMargin ¶
type IncreaseDecreaseMargin struct { Amount types.Number `json:"amt"` Ccy string `json:"ccy"` InstrumentID string `json:"instId"` Leverage types.Number `json:"leverage"` PosSide string `json:"posSide"` Type string `json:"type"` }
IncreaseDecreaseMargin represents increase or decrease the margin of the isolated position response
type IncreaseDecreaseMarginInput ¶
type IncreaseDecreaseMarginInput struct { InstrumentID string `json:"instId"` PositionSide string `json:"posSide"` Type string `json:"type"` Amount float64 `json:"amt,string"` Currency string `json:"ccy"` AutoLoadTransfer bool `json:"auto"` LoadTransfer bool `json:"loanTrans"` }
IncreaseDecreaseMarginInput represents increase or decrease the margin of the isolated position.
type IndexComponent ¶
type IndexComponent struct { Components []IndexComponentItem `json:"components"` Last types.Number `json:"last"` Index string `json:"index"` Timestamp okxUnixMilliTime `json:"ts"` }
IndexComponent represents index component data on the market
type IndexComponentItem ¶
type IndexComponentItem struct { Symbol string `json:"symbol"` SymbolPairPrice string `json:"symbolPx"` Weights string `json:"wgt"` ConvertToPrice string `json:"cnvPx"` ExchangeName string `json:"exch"` }
IndexComponentItem an item representing the index component item
type IndexTicker ¶
type IndexTicker struct { InstID string `json:"instId"` IdxPx types.Number `json:"idxPx"` High24H types.Number `json:"high24h"` SodUtc0 types.Number `json:"sodUtc0"` Open24H types.Number `json:"open24h"` Low24H types.Number `json:"low24h"` SodUtc8 types.Number `json:"sodUtc8"` Timestamp okxUnixMilliTime `json:"ts"` }
IndexTicker represents Index ticker data.
type Instrument ¶
type Instrument struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` InstrumentFamily string `json:"instFamily"` Underlying string `json:"uly"` Category string `json:"category"` BaseCurrency string `json:"baseCcy"` QuoteCurrency string `json:"quoteCcy"` SettlementCurrency string `json:"settleCcy"` ContractValue types.Number `json:"ctVal"` ContractMultiplier types.Number `json:"ctMult"` ContractValueCurrency string `json:"ctValCcy"` OptionType string `json:"optType"` StrikePrice string `json:"stk"` ListTime okxTime `json:"listTime"` ExpTime okxTime `json:"expTime"` MaxLeverage types.Number `json:"lever"` TickSize types.Number `json:"tickSz"` LotSize types.Number `json:"lotSz"` MinimumOrderSize types.Number `json:"minSz"` ContractType string `json:"ctType"` Alias string `json:"alias"` State string `json:"state"` MaxQuantityOfSpotLimitOrder types.Number `json:"maxLmtSz"` MaxQuantityOfMarketLimitOrder types.Number `json:"maxMktSz"` MaxQuantityOfSpotTwapLimitOrder types.Number `json:"maxTwapSz"` MaxSpotIcebergSize types.Number `json:"maxIcebergSz"` MaxTriggerSize types.Number `json:"maxTriggerSz"` MaxStopSize types.Number `json:"maxStopSz"` }
Instrument representing an instrument with open contract.
type InstrumentsFetchParams ¶
type InstrumentsFetchParams struct { InstrumentType string // Mandatory Underlying string // Optional InstrumentID string // Optional }
InstrumentsFetchParams request params for requesting list of instruments
type InsuranceFundInformation ¶
type InsuranceFundInformation struct { Details []InsuranceFundInformationDetail `json:"details"` Total types.Number `json:"total"` }
InsuranceFundInformation holds insurance fund information data.
type InsuranceFundInformationDetail ¶
type InsuranceFundInformationDetail struct { Amount types.Number `json:"amt"` Balance types.Number `json:"balance"` Currency string `json:"ccy"` Timestamp okxUnixMilliTime `json:"ts"` Type string `json:"type"` }
InsuranceFundInformationDetail represents an Insurance fund information item for a single currency and type
type InsuranceFundInformationRequestParams ¶
type InsuranceFundInformationRequestParams struct { InstrumentType string `json:"instType"` Type string `json:"type"` // Type values allowed are `liquidation_balance_deposit, bankruptcy_loss, and platform_revenue` Underlying string `json:"uly"` Currency string `json:"ccy"` Before time.Time `json:"before"` After time.Time `json:"after"` Limit int64 `json:"limit"` }
InsuranceFundInformationRequestParams insurance fund balance information.
type InterestAccruedData ¶
type InterestAccruedData struct { Currency string `json:"ccy"` InstrumentID string `json:"instId"` Interest string `json:"interest"` InterestRate string `json:"interestRate"` // Interest rate in an hour. Liability string `json:"liab"` MarginMode string `json:"mgnMode"` // Margin mode "cross" "isolated" Timestamp okxUnixMilliTime `json:"ts"` LoanType string `json:"type"` }
InterestAccruedData represents interest rate accrued response
type InterestRateLoanQuotaBasic ¶
type InterestRateLoanQuotaBasic struct { Currency string `json:"ccy"` LoanQuota string `json:"quota"` InterestRate types.Number `json:"rate"` }
InterestRateLoanQuotaBasic holds the basic Currency, loan,and interest rate information.
type InterestRateLoanQuotaItem ¶
type InterestRateLoanQuotaItem struct { InterestRateLoanQuotaBasic InterestRateDiscount types.Number `json:"0.7"` LoanQuotaCoefficient types.Number `json:"loanQuotaCoef"` Level string `json:"level"` }
InterestRateLoanQuotaItem holds the basic Currency, loan,interest rate, and other level and VIP related information.
type InterestRateResponse ¶
type InterestRateResponse struct { InterestRate types.Number `json:"interestRate"` Currency string `json:"ccy"` }
InterestRateResponse represents interest rate response.
type IsolatedMode ¶
type IsolatedMode struct { IsoMode string `json:"isoMode"` // "automatic":Auto transfers "autonomy":Manual transfers InstrumentType string `json:"type"` // Instrument type "MARGIN" "CONTRACTS" }
IsolatedMode represents Isolated margin trading settings
type LendingHistory ¶
type LendingHistory struct { Currency string `json:"ccy"` Amount types.Number `json:"amt"` Earnings types.Number `json:"earnings,omitempty"` Rate types.Number `json:"rate"` Timestamp okxUnixMilliTime `json:"ts"` }
LendingHistory holds lending history responses
type LendingRate ¶
LendingRate represents lending rate response
type LeverageResponse ¶
type LeverageResponse struct { InstrumentID string `json:"instId"` MarginMode string `json:"mgnMode"` PositionSide string `json:"posSide"` Leverage types.Number `json:"lever"` }
LeverageResponse instrument id leverage response.
type LightningDepositItem ¶
type LightningDepositItem struct { CreationTime okxUnixMilliTime `json:"cTime"` Invoice string `json:"invoice"` }
LightningDepositItem for creating an invoice.
type LightningWithdrawalRequestInput ¶
type LightningWithdrawalRequestInput struct { Currency string `json:"ccy"` // REQUIRED Token symbol. Currently only BTC is supported. Invoice string `json:"invoice"` // REQUIRED Invoice text Memo string `json:"memo"` // Lightning withdrawal memo }
LightningWithdrawalRequestInput to request Lightning Withdrawal requests.
type LightningWithdrawalResponse ¶
type LightningWithdrawalResponse struct { WithdrawalID string `json:"wdId"` CreationTime okxUnixMilliTime `json:"cTime"` }
LightningWithdrawalResponse response item for holding lightning withdrawal requests.
type LimitPriceResponse ¶
type LimitPriceResponse struct { InstrumentType string `json:"instType"` InstID string `json:"instId"` BuyLimit types.Number `json:"buyLmt"` SellLimit types.Number `json:"sellLmt"` Timestamp okxUnixMilliTime `json:"ts"` }
LimitPriceResponse hold an information for
func (*LimitPriceResponse) UnmarshalJSON ¶
func (a *LimitPriceResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type LiquidationOrder ¶
type LiquidationOrder struct { Details []LiquidationOrderDetailItem `json:"details"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` TotalLoss string `json:"totalLoss"` Underlying string `json:"uly"` }
LiquidationOrder represents liquidation order item detailed information
type LiquidationOrderDetailItem ¶
type LiquidationOrderDetailItem struct { BankruptcyLoss string `json:"bkLoss"` BankruptcyPx string `json:"bkPx"` Currency string `json:"ccy"` PosSide string `json:"posSide"` Side string `json:"side"` // May be empty QuantityOfLiquidation types.Number `json:"sz"` Timestamp okxUnixMilliTime `json:"ts"` }
LiquidationOrderDetailItem represents the detail information of liquidation order
type LiquidationOrderRequestParams ¶
type LiquidationOrderRequestParams struct { InstrumentType string MarginMode string // values are either isolated or crossed InstrumentID string Currency currency.Code Underlying string Alias string State string Before time.Time After time.Time Limit int64 }
LiquidationOrderRequestParams holds information to request liquidation orders
type LoanBorrowAndReplay ¶
type LoanBorrowAndReplay struct { Amount string `json:"amt"` AvailableLoan string `json:"availLoan"` Currency string `json:"ccy"` LoanQuota string `json:"loanQuota"` PosLoan string `json:"posLoan"` Side string `json:"side"` // borrow or repay UsedLoan string `json:"usedLoan"` }
LoanBorrowAndReplay loans borrow and repay
type LoanBorrowAndReplayInput ¶
type LoanBorrowAndReplayInput struct { Currency string `json:"ccy"` Side string `json:"side,omitempty"` Amount types.Number `json:"amt,omitempty"` }
LoanBorrowAndReplayInput represents currency VIP borrow or repay request params.
type LongShortRatio ¶
type LongShortRatio struct { Timestamp time.Time `json:"ts"` MarginLendRatio float64 `json:"ratio"` }
LongShortRatio represents the ratio of users with net long vs net short positions for futures and perpetual swaps.
type MakerInstrumentSetting ¶
type MakerInstrumentSetting struct { Underlying string `json:"uly"` InstrumentID string `json:"instId"` MaxBlockSize types.Number `json:"maxBlockSz"` MakerPriceBand types.Number `json:"makerPxBand"` }
MakerInstrumentSetting represents set quote product setting info
type MarginBalanceParam ¶
type MarginBalanceParam struct { AlgoID string `json:"algoId"` Type string `json:"type"` Amount float64 `json:"amt,string"` // Adjust margin balance amount Either amt or percent is required. Percentage float64 `json:"percent,string,omitempty"` // Adjust margin balance percentage, used In Adjusting margin balance }
MarginBalanceParam represents compute margin balance request param
type MarginLendRatioItem ¶
type MarginLendRatioItem struct { Timestamp time.Time `json:"ts"` MarginLendRatio float64 `json:"ratio"` }
MarginLendRatioItem represents margin lend ration information and creation timestamp
type MarkPrice ¶
type MarkPrice struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` MarkPrice string `json:"markPx"` Timestamp okxUnixMilliTime `json:"ts"` }
MarkPrice represents a mark price information for a single instrument id
type MaximumBuyAndSell ¶
type MaximumBuyAndSell struct { Currency string `json:"ccy"` InstrumentID string `json:"instId"` MaximumBuy string `json:"maxBuy"` MaximumSell string `json:"maxSell"` }
MaximumBuyAndSell get maximum buy , sell amount or open amount
type MaximumLoanInstrument ¶
type MaximumLoanInstrument struct { InstrumentID string `json:"instId"` MgnMode string `json:"mgnMode"` MgnCcy string `json:"mgnCcy"` MaxLoan string `json:"maxLoan"` Ccy string `json:"ccy"` Side order.Side `json:"side"` }
MaximumLoanInstrument represents maximum loan of an instrument id.
type MaximumTradableAmount ¶
type MaximumTradableAmount struct { InstrumentID string `json:"instId"` AvailBuy string `json:"availBuy"` AvailSell string `json:"availSell"` }
MaximumTradableAmount represents get maximum tradable amount response
type MaximumWithdrawal ¶
type MaximumWithdrawal struct { Currency string `json:"ccy"` MaximumWithdrawal string `json:"maxWd"` // Max withdrawal (not allowing borrowed crypto transfer out under Multi-currency margin) MaximumWithdrawalEx string `json:"maxWdEx"` // Max withdrawal (allowing borrowed crypto transfer out under Multi-currency margin) }
MaximumWithdrawal represents maximum withdrawal amount query response.
type Offer ¶
type Offer struct { Currency string `json:"ccy"` ProductID string `json:"productId"` Protocol string `json:"protocol"` ProtocolType string `json:"protocolType"` EarningCcy []string `json:"earningCcy"` Term string `json:"term"` Apy types.Number `json:"apy"` EarlyRedeem bool `json:"earlyRedeem"` InvestData []OfferInvestData `json:"investData"` EarningData []struct { Currency string `json:"ccy"` EarningType string `json:"earningType"` } `json:"earningData"` }
Offer represents an investment offer information for different 'staking' and 'defi' protocols
type OfferInvestData ¶
type OfferInvestData struct { Currency string `json:"ccy"` Balance types.Number `json:"bal"` MinimumAmount types.Number `json:"minAmt"` MaximumAmount types.Number `json:"maxAmt"` }
OfferInvestData represents currencies invest data information for an offer
type Okx ¶
type Okx struct { exchange.Base WsResponseMultiplexer wsRequestDataChannelsMultiplexer // WsRequestSemaphore channel is used to block write operation on the websocket connection to reduce contention; a kind of bounded parallelism. // it is made to hold up to 20 integers so that up to 20 write operations can be called over the websocket connection at a time. // and when the operation is completed the thread releases (consumes) one value from the channel so that the other waiting operation can enter. // ok.WsRequestSemaphore <- 1 // defer func() { <-ok.WsRequestSemaphore }() WsRequestSemaphore chan int }
Okx is the overarching type across this package
func (*Okx) AccountBalance ¶
AccountBalance retrieves a list of assets (with non-zero balance), remaining balance, and available amount in the trading account. Interest-free quota and discount rates are public data and not displayed on the account interface.
func (*Okx) AccountGreeksSubscription ¶
AccountGreeksSubscription algo order subscription to retrieve account greeks information. Data will be pushed when triggered by events such as increase/decrease positions or cash balance in account, and will also be pushed in regular interval according to subscription granularity.
func (*Okx) AdjustMarginBalance ¶
func (ok *Okx) AdjustMarginBalance(ctx context.Context, arg MarginBalanceParam) (*AdjustMarginBalanceResponse, error)
AdjustMarginBalance retrieves adjust margin balance with 'add' and 'reduce' balance type
func (*Okx) AdvanceAlgoOrdersSubscription ¶
func (ok *Okx) AdvanceAlgoOrdersSubscription(operation string, assetType asset.Item, pair currency.Pair, algoID string) error
AdvanceAlgoOrdersSubscription algo order subscription to retrieve advance algo orders (including Iceberg order, TWAP order, Trailing order). Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing/canceling order.
func (*Okx) AlgoOrdersSubscription ¶
func (ok *Okx) AlgoOrdersSubscription(operation string, assetType asset.Item, pair currency.Pair) error
AlgoOrdersSubscription for subscribing to algo - order channels
func (*Okx) AmendGridAlgoOrder ¶
func (ok *Okx) AmendGridAlgoOrder(ctx context.Context, arg GridAlgoOrderAmend) (*GridAlgoOrderIDResponse, error)
AmendGridAlgoOrder supported contract grid algo order amendment.
func (*Okx) AmendMultipleOrders ¶
func (ok *Okx) AmendMultipleOrders(ctx context.Context, args []AmendOrderRequestParams) ([]OrderData, error)
AmendMultipleOrders amend incomplete orders in batches. Maximum 20 orders can be amended at a time. Request parameters should be passed in the form of an array.
func (*Okx) AmendOrder ¶
AmendOrder an incomplete order.
func (*Okx) AppendWsOrderbookItems ¶
AppendWsOrderbookItems adds websocket orderbook data bid/asks into an orderbook item array
func (*Okx) BalanceAndPositionSubscription ¶
BalanceAndPositionSubscription retrieve account balance and position information. Data will be pushed when triggered by events such as filled order, funding transfer.
func (*Okx) BlockTickerSubscription ¶
func (ok *Okx) BlockTickerSubscription(operation string, assetType asset.Item, pair currency.Pair) error
BlockTickerSubscription a method to subscribe and unsubscribe to a "block-tickers" channel to retrieve the latest block trading volume in the last 24 hours. The data will be pushed when triggered by transaction execution event. In addition, it will also be pushed in 5 minutes interval according to subscription granularity.
func (*Okx) CalculateOrderbookChecksum ¶
func (ok *Okx) CalculateOrderbookChecksum(orderbookData WsOrderBookData) (int32, error)
CalculateOrderbookChecksum alternates over the first 25 bid and ask entries from websocket data.
func (*Okx) CalculateUpdateOrderbookChecksum ¶
func (ok *Okx) CalculateUpdateOrderbookChecksum(orderbookData *orderbook.Base, checksumVal uint32) error
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 (*Okx) CancelAdvanceAlgoOrder ¶
func (ok *Okx) CancelAdvanceAlgoOrder(ctx context.Context, args []AlgoOrderCancelParams) ([]AlgoOrder, error)
CancelAdvanceAlgoOrder Cancel unfilled algo orders A maximum of 10 orders can be canceled at a time. Request parameters should be passed in the form of an array.
func (*Okx) CancelAlgoOrder ¶
func (ok *Okx) CancelAlgoOrder(ctx context.Context, args []AlgoOrderCancelParams) ([]AlgoOrder, error)
CancelAlgoOrder to cancel unfilled algo orders (not including Iceberg order, TWAP order, Trailing Stop order). A maximum of 10 orders can be canceled at a time. Request parameters should be passed in the form of an array.
func (*Okx) CancelAllOrders ¶
func (ok *Okx) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*Okx) CancelAllQuotes ¶
CancelAllQuotes cancels all active Quotes.
func (*Okx) CancelAllRfqs ¶
CancelAllRfqs cancels all active Rfqs.
func (*Okx) CancelBatchOrders ¶
func (ok *Okx) CancelBatchOrders(ctx context.Context, o []order.Cancel) (*order.CancelBatchResponse, error)
CancelBatchOrders cancels orders by their corresponding ID numbers
func (*Okx) CancelMultipleOrders ¶
func (ok *Okx) CancelMultipleOrders(ctx context.Context, args []CancelOrderRequestParam) ([]OrderData, error)
CancelMultipleOrders cancel incomplete orders in batches. Maximum 20 orders can be canceled at a time. Request parameters should be passed in the form of an array.
func (*Okx) CancelMultipleQuote ¶
func (ok *Okx) CancelMultipleQuote(ctx context.Context, arg CancelQuotesRequestParams) ([]CancelQuoteResponse, error)
CancelMultipleQuote cancel multiple active Quotes in a single batch. Maximum 100 quote orders can be canceled at a time.
func (*Okx) CancelMultipleRfqs ¶
func (ok *Okx) CancelMultipleRfqs(ctx context.Context, arg CancelRfqRequestsParam) ([]CancelRfqResponse, error)
CancelMultipleRfqs cancel multiple active Rfqs in a single batch. Maximum 100 Rfq orders can be canceled at a time.
func (*Okx) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
func (*Okx) CancelPurchaseOrRedemption ¶
func (ok *Okx) CancelPurchaseOrRedemption(ctx context.Context, arg CancelFundingParam) (*OrderIDResponse, error)
CancelPurchaseOrRedemption cancels Purchases or Redemptions after cancelling, returning funds will go to the funding account.
func (*Okx) CancelQuote ¶
func (ok *Okx) CancelQuote(ctx context.Context, arg CancelQuoteRequestParams) (*CancelQuoteResponse, error)
CancelQuote cancels an existing active quote you have created in response to an Rfq. rfqCancelQuote = "rfq/cancel-quote"
func (*Okx) CancelRfq ¶
func (ok *Okx) CancelRfq(ctx context.Context, arg CancelRfqRequestParam) (*CancelRfqResponse, error)
CancelRfq Cancel an existing active Rfq that you has previously created.
func (*Okx) CancelSingleOrder ¶
func (ok *Okx) CancelSingleOrder(ctx context.Context, arg CancelOrderRequestParam) (*OrderData, error)
CancelSingleOrder cancel an incomplete order.
func (*Okx) CancelWithdrawal ¶
CancelWithdrawal You can cancel normal withdrawal, but can not cancel the withdrawal on Lightning.
func (*Okx) CandlesticksSubscription ¶
func (ok *Okx) CandlesticksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
CandlesticksSubscription to subscribe or unsubscribe to "candle" channels to retrieve the candlesticks data of an instrument. the push frequency is the fastest interval 500ms push the data.
func (*Okx) ChangePositionMargin ¶
func (ok *Okx) ChangePositionMargin(ctx context.Context, req *margin.PositionChangeRequest) (*margin.PositionChangeResponse, error)
ChangePositionMargin will modify a position/currencies margin parameters
func (*Okx) ClosePositions ¶
func (ok *Okx) ClosePositions(ctx context.Context, arg *ClosePositionsRequestParams) (*ClosePositionResponse, error)
ClosePositions Close all positions of an instrument via a market order.
func (*Okx) ComputeMarginBalance ¶
func (ok *Okx) ComputeMarginBalance(ctx context.Context, arg MarginBalanceParam) (*ComputeMarginBalance, error)
ComputeMarginBalance computes margin balance with 'add' and 'reduce' balance type
func (*Okx) ContractGridAlgoOrders ¶
func (ok *Okx) ContractGridAlgoOrders(operation string, assetType asset.Item, pair currency.Pair, algoID string) error
ContractGridAlgoOrders to retrieve contract grid algo orders. Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing/canceling order.
func (*Okx) ConvertTrade ¶
func (ok *Okx) ConvertTrade(ctx context.Context, arg *ConvertTradeInput) (*ConvertTradeResponse, error)
ConvertTrade converts a base currency to quote currency.
func (*Okx) CreateQuote ¶
func (ok *Okx) CreateQuote(ctx context.Context, arg CreateQuoteParams) (*QuoteResponse, error)
CreateQuote allows the user to Quote an Rfq that they are a counterparty to. The user MUST quote the entire Rfq and not part of the legs or part of the quantity. Partial quoting or partial fills are not allowed.
func (*Okx) CreateRfq ¶
func (ok *Okx) CreateRfq(ctx context.Context, arg CreateRfqInput) (*RfqResponse, error)
CreateRfq Creates a new Rfq
func (*Okx) CurrencyUnitConvert ¶
func (ok *Okx) CurrencyUnitConvert(ctx context.Context, instrumentID string, quantity, orderPrice float64, convertType uint, unitOfCurrency string) (*UnitConvertResponse, error)
CurrencyUnitConvert convert currency to contract, or contract to currency.
func (*Okx) EstimateQuote ¶
func (ok *Okx) EstimateQuote(ctx context.Context, arg *EstimateQuoteRequestInput) (*EstimateQuoteResponse, error)
EstimateQuote retrieves quote estimation detail result given the base and quote currency.
func (*Okx) EstimatedDeliveryExercisePriceSubscription ¶
func (ok *Okx) EstimatedDeliveryExercisePriceSubscription(operation string, assetType asset.Item, pair currency.Pair) error
EstimatedDeliveryExercisePriceSubscription to subscribe or unsubscribe to "estimated-price" channel to retrieve the estimated delivery/exercise price of FUTURES contracts and OPTION.
func (*Okx) ExecuteQuote ¶
func (ok *Okx) ExecuteQuote(ctx context.Context, arg ExecuteQuoteParams) (*ExecuteQuoteResponse, error)
ExecuteQuote executes a Quote. It is only used by the creator of the Rfq
func (*Okx) FetchAccountInfo ¶
func (ok *Okx) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
FetchAccountInfo retrieves balances for all enabled currencies
func (*Okx) FetchOrderbook ¶
func (ok *Okx) FetchOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)
FetchOrderbook returns orderbook base on the currency pair
func (*Okx) FetchTicker ¶
func (ok *Okx) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
FetchTicker returns the ticker for a currency pair
func (*Okx) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*Okx) FundingRateSubscription ¶
func (ok *Okx) FundingRateSubscription(operation string, assetType asset.Item, pair currency.Pair) error
FundingRateSubscription a method to subscribe and unsubscribe to "funding-rate" channel. retrieve funding rate. Data will be pushed in 30s to 90s.
func (*Okx) FundingTransfer ¶
func (ok *Okx) FundingTransfer(ctx context.Context, arg *FundingTransferRequestInput) ([]FundingTransferResponse, error)
FundingTransfer transfer of funds between your funding account and trading account, and from the master account to sub-accounts.
func (*Okx) Get24HTotalVolume ¶
func (ok *Okx) Get24HTotalVolume(ctx context.Context) (*TradingVolumeIn24HR, error)
Get24HTotalVolume The 24-hour trading volume is calculated on a rolling basis, using USD as the pricing unit.
func (*Okx) Get3MonthOrderHistory ¶
func (ok *Okx) Get3MonthOrderHistory(ctx context.Context, arg *OrderHistoryRequestParams) ([]OrderDetail, error)
Get3MonthOrderHistory retrieves the completed order data for the last 7 days, and the incomplete orders that have been cancelled are only reserved for 2 hours.
func (*Okx) Get7DayOrderHistory ¶
func (ok *Okx) Get7DayOrderHistory(ctx context.Context, arg *OrderHistoryRequestParams) ([]OrderDetail, error)
Get7DayOrderHistory retrieves the completed order data for the last 7 days, and the incomplete orders that have been cancelled are only reserved for 2 hours.
func (*Okx) GetAccountAndPositionRisk ¶
func (ok *Okx) GetAccountAndPositionRisk(ctx context.Context, instrumentType string) ([]AccountAndPositionRisk, error)
GetAccountAndPositionRisk get account and position risks.
func (*Okx) GetAccountAssetValuation ¶
func (ok *Okx) GetAccountAssetValuation(ctx context.Context, currency string) ([]AccountAssetValuation, error)
GetAccountAssetValuation view account asset valuation
func (*Okx) GetAccountConfiguration ¶
func (ok *Okx) GetAccountConfiguration(ctx context.Context) ([]AccountConfigurationResponse, error)
GetAccountConfiguration retrieves current account configuration.
func (*Okx) GetAccountFundingHistory ¶
GetAccountFundingHistory returns funding history, deposits and withdrawals
func (*Okx) GetAccountRiskState ¶
func (ok *Okx) GetAccountRiskState(ctx context.Context) ([]AccountRiskState, error)
GetAccountRiskState gets the account risk status. only applicable to Portfolio margin account
func (*Okx) GetActiveOrders ¶
func (ok *Okx) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
GetActiveOrders retrieves any orders that are active/open
func (*Okx) GetAlgoOrderHistory ¶
func (ok *Okx) GetAlgoOrderHistory(ctx context.Context, orderType, state, algoOrderID, instrumentType, instrumentID string, after, before time.Time, limit int64) ([]AlgoOrderResponse, error)
GetAlgoOrderHistory load a list of all algo orders under the current account in the last 3 months.
func (*Okx) GetAlgoOrderList ¶
func (ok *Okx) GetAlgoOrderList(ctx context.Context, orderType, algoOrderID, clientOrderID, instrumentType, instrumentID string, after, before time.Time, limit int64) ([]AlgoOrderResponse, error)
GetAlgoOrderList retrieves a list of untriggered Algo orders under the current account.
func (*Okx) GetAssetBillsDetails ¶
func (ok *Okx) GetAssetBillsDetails(ctx context.Context, currency, clientID string, after, before time.Time, billType, limit int64) ([]AssetBillDetail, error)
GetAssetBillsDetails Query the billing record, you can get the latest 1 month historical data
func (*Okx) GetAssetsFromInstrumentTypeOrID ¶
GetAssetsFromInstrumentTypeOrID parses an instrument type and instrument ID and returns a list of assets that the currency pair is associated with.
func (*Okx) GetAvailableTransferChains ¶
func (ok *Okx) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency
func (*Okx) GetBalance ¶
GetBalance retrieves the funding account balances of all the assets and the amount that is available or on hold.
func (*Okx) GetBillsDetail ¶
func (ok *Okx) GetBillsDetail(ctx context.Context, arg *BillsDetailQueryParameter, route string) ([]BillsDetailResponse, error)
GetBillsDetail retrieves the bills of the account.
func (*Okx) GetBillsDetail3Months ¶
func (ok *Okx) GetBillsDetail3Months(ctx context.Context, arg *BillsDetailQueryParameter) ([]BillsDetailResponse, error)
GetBillsDetail3Months retrieves the account’s bills. The bill refers to all transaction records that result in changing the balance of an account. Pagination is supported, and the response is sorted with most recent first. This endpoint can retrieve data from the last 3 months.
func (*Okx) GetBillsDetailLast7Days ¶
func (ok *Okx) GetBillsDetailLast7Days(ctx context.Context, arg *BillsDetailQueryParameter) ([]BillsDetailResponse, error)
GetBillsDetailLast7Days The bill refers to all transaction records that result in changing the balance of an account. Pagination is supported, and the response is sorted with the most recent first. This endpoint can retrieve data from the last 7 days.
func (*Okx) GetBlockTicker ¶
GetBlockTicker retrieves the latest block trading volume in the last 24 hours.
func (*Okx) GetBlockTickers ¶
func (ok *Okx) GetBlockTickers(ctx context.Context, instrumentType, underlying string) ([]BlockTicker, error)
GetBlockTickers retrieves the latest block trading volume in the last 24 hours. Instrument Type Is Mandatory, and Underlying is Optional.
func (*Okx) GetBlockTrades ¶
GetBlockTrades retrieves the recent block trading transactions of an instrument. Descending order by tradeId.
func (*Okx) GetBorrowAndRepayHistoryForVIPLoans ¶
func (ok *Okx) GetBorrowAndRepayHistoryForVIPLoans(ctx context.Context, currency string, after, before time.Time, limit int64) ([]BorrowRepayHistory, error)
GetBorrowAndRepayHistoryForVIPLoans retrieves borrow and repay history for VIP loans.
func (*Okx) GetBorrowInterestAndLimit ¶
func (ok *Okx) GetBorrowInterestAndLimit(ctx context.Context, loanType int64, currency string) ([]BorrowInterestAndLimitResponse, error)
GetBorrowInterestAndLimit borrow interest and limit
func (*Okx) GetCandlestickData ¶
func (ok *Okx) GetCandlestickData(ctx context.Context, instrumentID string, interval kline.Interval, before, after time.Time, limit int64, route string, rateLimit request.EndpointLimit) ([]CandleStick, error)
GetCandlestickData handles fetching the data for both the default GetCandlesticks, GetCandlesticksHistory, and GetIndexCandlesticks() methods.
func (*Okx) GetCandlesticks ¶
func (ok *Okx) GetCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, before, after time.Time, limit int64) ([]CandleStick, error)
GetCandlesticks Retrieve the candlestick charts. This endpoint can retrieve the latest 1,440 data entries. Charts are returned in groups based on the requested bar.
func (*Okx) GetCandlesticksHistory ¶
func (ok *Okx) GetCandlesticksHistory(ctx context.Context, instrumentID string, interval kline.Interval, before, after time.Time, limit int64) ([]CandleStick, error)
GetCandlesticksHistory Retrieve history candlestick charts from recent years.
func (*Okx) GetCollateralMode ¶
GetCollateralMode returns the collateral type for your account
func (*Okx) GetContractsOpenInterestAndVolume ¶
func (ok *Okx) GetContractsOpenInterestAndVolume(ctx context.Context, currency string, begin, end time.Time, period kline.Interval) ([]OpenInterestVolume, error)
GetContractsOpenInterestAndVolume retrieves the open interest and trading volume for futures and perpetual swaps.
func (*Okx) GetConvertCurrencies ¶
func (ok *Okx) GetConvertCurrencies(ctx context.Context) ([]ConvertCurrency, error)
GetConvertCurrencies retrieves the currency conversion information.
func (*Okx) GetConvertCurrencyPair ¶
func (ok *Okx) GetConvertCurrencyPair(ctx context.Context, fromCurrency, toCurrency string) (*ConvertCurrencyPair, error)
GetConvertCurrencyPair retrieves the currency conversion response detail given the 'currency from' and 'currency to'
func (*Okx) GetConvertHistory ¶
func (ok *Okx) GetConvertHistory(ctx context.Context, before, after time.Time, limit int64, tag string) ([]ConvertHistory, error)
GetConvertHistory gets the recent history.
func (*Okx) GetCounterparties ¶
func (ok *Okx) GetCounterparties(ctx context.Context) ([]CounterpartiesResponse, error)
GetCounterparties retrieves the list of counterparties that the user has permissions to trade with.
func (*Okx) GetCurrencyDepositAddress ¶
func (ok *Okx) GetCurrencyDepositAddress(ctx context.Context, currency string) ([]CurrencyDepositResponseItem, error)
GetCurrencyDepositAddress returns the deposit address and related information for the provided currency information.
func (*Okx) GetCurrencyDepositHistory ¶
func (ok *Okx) GetCurrencyDepositHistory(ctx context.Context, currency, depositID, transactionID string, after, before time.Time, state, limit int64) ([]DepositHistoryResponseItem, error)
GetCurrencyDepositHistory retrieves deposit records and withdrawal status information depending on the currency, timestamp, and chronological order.
func (*Okx) GetCurrencyTradeURL ¶
func (ok *Okx) GetCurrencyTradeURL(ctx context.Context, a asset.Item, cp currency.Pair) (string, error)
GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair
func (*Okx) GetCustodyTradingSubaccountList ¶
func (ok *Okx) GetCustodyTradingSubaccountList(ctx context.Context, subaccountName string) ([]SubaccountName, error)
GetCustodyTradingSubaccountList the trading team uses this interface to view the list of sub-accounts currently under escrow usersEntrustSubaccountList ="users/entrust-subaccount-list"
func (*Okx) GetDeliveryHistory ¶
func (ok *Okx) GetDeliveryHistory(ctx context.Context, instrumentType, underlying string, after, before time.Time, limit int64) ([]DeliveryHistory, error)
GetDeliveryHistory retrieves the estimated delivery price of the last 3 months, which will only have a return value one hour before the delivery/exercise.
func (*Okx) GetDepositAddress ¶
func (ok *Okx) GetDepositAddress(ctx context.Context, c currency.Code, _, chain string) (*deposit.Address, error)
GetDepositAddress returns a deposit address for a specified currency
func (*Okx) GetDiscountRateAndInterestFreeQuota ¶
func (ok *Okx) GetDiscountRateAndInterestFreeQuota(ctx context.Context, currency string, discountLevel int8) ([]DiscountRate, error)
GetDiscountRateAndInterestFreeQuota retrieves discount rate level and interest-free quota.
func (*Okx) GetEarnActiveOrders ¶
func (ok *Okx) GetEarnActiveOrders(ctx context.Context, productID, protocolType, currency, state string) ([]ActiveFundingOrder, error)
GetEarnActiveOrders retrieves active orders.
func (*Okx) GetEasyConvertCurrencyList ¶
func (ok *Okx) GetEasyConvertCurrencyList(ctx context.Context) (*EasyConvertDetail, error)
GetEasyConvertCurrencyList retrieve list of small convertibles and mainstream currencies. Only applicable to the crypto balance less than $10.
func (*Okx) GetEasyConvertHistory ¶
func (ok *Okx) GetEasyConvertHistory(ctx context.Context, after, before time.Time, limit int64) ([]EasyConvertItem, error)
GetEasyConvertHistory retrieves the history and status of easy convert trades.
func (*Okx) GetEstimatedDeliveryPrice ¶
func (ok *Okx) GetEstimatedDeliveryPrice(ctx context.Context, instrumentID string) ([]DeliveryEstimatedPrice, error)
GetEstimatedDeliveryPrice retrieves the estimated delivery price which will only have a return value one hour before the delivery/exercise.
func (*Okx) GetExchangeRate ¶
func (ok *Okx) GetExchangeRate(ctx context.Context) (*UsdCnyExchangeRate, error)
GetExchangeRate this interface provides the average exchange rate data for 2 weeks from USD to CNY
func (*Okx) GetFeeByType ¶
GetFeeByType returns an estimate of fee based on the type of transaction
func (*Okx) GetFundingCurrencies ¶
func (ok *Okx) GetFundingCurrencies(ctx context.Context) ([]CurrencyResponse, error)
GetFundingCurrencies Retrieve a list of all currencies.
func (*Okx) GetFundingOrderHistory ¶
func (ok *Okx) GetFundingOrderHistory(ctx context.Context, productID, protocolType, currency string, after, before time.Time, limit int64) ([]ActiveFundingOrder, error)
GetFundingOrderHistory retrieves funding order history valid protocol types are 'staking' and 'defi'
func (*Okx) GetFundingRateHistory ¶
func (ok *Okx) GetFundingRateHistory(ctx context.Context, instrumentID string, before, after time.Time, limit int64) ([]FundingRateResponse, error)
GetFundingRateHistory retrieves funding rate history. This endpoint can retrieve data from the last 3 months.
func (*Okx) GetFundsTransferState ¶
func (ok *Okx) GetFundsTransferState(ctx context.Context, transferID, clientID string, transferType int64) ([]TransferFundRateResponse, error)
GetFundsTransferState get funding rate response.
func (*Okx) GetFuturesContractDetails ¶
func (ok *Okx) GetFuturesContractDetails(ctx context.Context, item asset.Item) ([]futures.Contract, error)
GetFuturesContractDetails returns details about futures contracts
func (*Okx) GetFuturesPositionOrders ¶
func (ok *Okx) GetFuturesPositionOrders(ctx context.Context, req *futures.PositionsRequest) ([]futures.PositionResponse, error)
GetFuturesPositionOrders returns the orders for futures positions
func (*Okx) GetFuturesPositionSummary ¶
func (ok *Okx) GetFuturesPositionSummary(ctx context.Context, req *futures.PositionSummaryRequest) (*futures.PositionSummary, error)
GetFuturesPositionSummary returns position summary details for an active position
func (*Okx) GetGridAIParameter ¶
func (ok *Okx) GetGridAIParameter(ctx context.Context, algoOrderType, instrumentID, direction, duration string) ([]GridAIParameterResponse, error)
GetGridAIParameter retrieves grid AI parameter
func (*Okx) GetGridAlgoOrderDetails ¶
func (ok *Okx) GetGridAlgoOrderDetails(ctx context.Context, algoOrderType, algoID string) (*GridAlgoOrderResponse, error)
GetGridAlgoOrderDetails retrieves grid algo order details
func (*Okx) GetGridAlgoOrderHistory ¶
func (ok *Okx) GetGridAlgoOrderHistory(ctx context.Context, algoOrderType, algoID, instrumentID, instrumentType, after, before string, limit int64) ([]GridAlgoOrderResponse, error)
GetGridAlgoOrderHistory retrieves list of grid algo orders with the complete data including the stopped orders.
func (*Okx) GetGridAlgoOrderPositions ¶
func (ok *Okx) GetGridAlgoOrderPositions(ctx context.Context, algoOrderType, algoID string) ([]AlgoOrderPosition, error)
GetGridAlgoOrderPositions retrieves grid algo order positions.
func (*Okx) GetGridAlgoOrdersList ¶
func (ok *Okx) GetGridAlgoOrdersList(ctx context.Context, algoOrderType, algoID, instrumentID, instrumentType, after, before string, limit int64) ([]GridAlgoOrderResponse, error)
GetGridAlgoOrdersList retrieves list of pending grid algo orders with the complete data.
func (*Okx) GetGridAlgoSubOrders ¶
func (ok *Okx) GetGridAlgoSubOrders(ctx context.Context, algoOrderType, algoID, subOrderType, groupID, after, before string, limit int64) ([]GridAlgoOrderResponse, error)
GetGridAlgoSubOrders retrieves grid algo sub orders
func (*Okx) GetHistoricCandles ¶
func (ok *Okx) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*Okx) GetHistoricCandlesExtended ¶
func (ok *Okx) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (*Okx) GetHistoricTrades ¶
func (ok *Okx) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error)
GetHistoricTrades retrieves historic trade data within the timeframe provided
func (*Okx) GetHistoricalFundingRates ¶
func (ok *Okx) GetHistoricalFundingRates(ctx context.Context, r *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)
GetHistoricalFundingRates returns funding rates for a given asset and currency for a time period
func (*Okx) GetIndexCandlesticks ¶
func (ok *Okx) GetIndexCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, before, after time.Time, limit int64) ([]CandleStick, error)
GetIndexCandlesticks Retrieve the candlestick charts of the index. This endpoint can retrieve the latest 1,440 data entries. Charts are returned in groups based on the requested bar. the response is a list of Candlestick data.
func (*Okx) GetIndexComponents ¶
GetIndexComponents returns the index component information data on the market
func (*Okx) GetIndexTickers ¶
func (ok *Okx) GetIndexTickers(ctx context.Context, quoteCurrency, instID string) ([]IndexTicker, error)
GetIndexTickers Retrieves index tickers.
func (*Okx) GetInstrumentTypeFromAssetItem ¶
GetInstrumentTypeFromAssetItem returns a string representation of asset.Item; which is an equivalent term for InstrumentType in Okx exchange.
func (*Okx) GetInstruments ¶
func (ok *Okx) GetInstruments(ctx context.Context, arg *InstrumentsFetchParams) ([]Instrument, error)
GetInstruments Retrieve a list of instruments with open contracts.
func (*Okx) GetInsuranceFundInformation ¶
func (ok *Okx) GetInsuranceFundInformation(ctx context.Context, arg *InsuranceFundInformationRequestParams) (*InsuranceFundInformation, error)
GetInsuranceFundInformation returns insurance fund balance information.
func (*Okx) GetInterestAccruedData ¶
func (ok *Okx) GetInterestAccruedData(ctx context.Context, loanType, limit int64, currency, instrumentID, marginMode string, after, before time.Time) ([]InterestAccruedData, error)
GetInterestAccruedData returns accrued interest data
func (*Okx) GetInterestRate ¶
func (ok *Okx) GetInterestRate(ctx context.Context, currency string) ([]InterestRateResponse, error)
GetInterestRate get the user's current leveraged currency borrowing interest rate
func (*Okx) GetInterestRateAndLoanQuota ¶
func (ok *Okx) GetInterestRateAndLoanQuota(ctx context.Context) (map[string][]InterestRateLoanQuotaItem, error)
GetInterestRateAndLoanQuota retrieves an interest rate and loan quota information for various currencies.
func (*Okx) GetInterestRateAndLoanQuotaForVIPLoans ¶
func (ok *Okx) GetInterestRateAndLoanQuotaForVIPLoans(ctx context.Context) ([]VIPInterestRateAndLoanQuotaInformation, error)
GetInterestRateAndLoanQuotaForVIPLoans retrieves an interest rate and loan quota information for VIP users of various currencies.
func (*Okx) GetIntervalEnum ¶
GetIntervalEnum allowed interval params by Okx Exchange
func (*Okx) GetLatestFundingRates ¶
func (ok *Okx) GetLatestFundingRates(ctx context.Context, r *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)
GetLatestFundingRates returns the latest funding rates data
func (*Okx) GetLendingHistory ¶
func (ok *Okx) GetLendingHistory(ctx context.Context, currency string, before, after time.Time, limit int64) ([]LendingHistory, error)
GetLendingHistory lending history
func (*Okx) GetLeverage ¶
func (ok *Okx) GetLeverage(ctx context.Context, item asset.Item, pair currency.Pair, marginType margin.Type, orderSide order.Side) (float64, error)
GetLeverage gets the account's initial leverage for the asset type and pair
func (*Okx) GetLeverageRate ¶
func (ok *Okx) GetLeverageRate(ctx context.Context, instrumentID, marginMode string) ([]LeverageResponse, error)
GetLeverageRate retrieves leverage data for different instrument id or margin mode.
func (*Okx) GetLightningDeposits ¶
func (ok *Okx) GetLightningDeposits(ctx context.Context, currency string, amount float64, to int64) ([]LightningDepositItem, error)
GetLightningDeposits users can create up to 10 thousand different invoices within 24 hours. this method fetches list of lightning deposits filtered by a currency and amount.
func (*Okx) GetLimitPrice ¶
GetLimitPrice retrieves the highest buy limit and lowest sell limit of the instrument.
func (*Okx) GetLiquidationOrders ¶
func (ok *Okx) GetLiquidationOrders(ctx context.Context, arg *LiquidationOrderRequestParams) (*LiquidationOrder, error)
GetLiquidationOrders retrieves information on liquidation orders in the last day.
func (*Okx) GetLongShortRatio ¶
func (ok *Okx) GetLongShortRatio(ctx context.Context, currency string, begin, end time.Time, period kline.Interval) ([]LongShortRatio, error)
GetLongShortRatio retrieves the ratio of users with net long vs net short positions for futures and perpetual swaps.
func (*Okx) GetMarginLendingRatio ¶
func (ok *Okx) GetMarginLendingRatio(ctx context.Context, currency string, begin, end time.Time, period kline.Interval) ([]MarginLendRatioItem, error)
GetMarginLendingRatio retrieves the ratio of cumulative amount between currency margin quote currency and base currency.
func (*Okx) GetMarkPrice ¶
func (ok *Okx) GetMarkPrice(ctx context.Context, instrumentType, underlying, instrumentID string) ([]MarkPrice, error)
GetMarkPrice Retrieve mark price.
func (*Okx) GetMarkPriceCandlesticks ¶
func (ok *Okx) GetMarkPriceCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, before, after time.Time, limit int64) ([]CandleStick, error)
GetMarkPriceCandlesticks Retrieve the candlestick charts of mark price. This endpoint can retrieve the latest 1,440 data entries. Charts are returned in groups based on the requested bar.
func (*Okx) GetMaximumAvailableTradableAmount ¶
func (ok *Okx) GetMaximumAvailableTradableAmount(ctx context.Context, instrumentID, currency, tradeMode string, reduceOnly bool, price float64) ([]MaximumTradableAmount, error)
GetMaximumAvailableTradableAmount retrieves the maximum tradable amount for specific instrument id, and/or currency
func (*Okx) GetMaximumBuySellAmountOROpenAmount ¶
func (ok *Okx) GetMaximumBuySellAmountOROpenAmount(ctx context.Context, instrumentID, tradeMode, currency, leverage string, price float64) ([]MaximumBuyAndSell, error)
GetMaximumBuySellAmountOROpenAmount retrieves the maximum buy or sell amount for a specific instrument id
func (*Okx) GetMaximumLoanOfInstrument ¶
func (ok *Okx) GetMaximumLoanOfInstrument(ctx context.Context, instrumentID, marginMode, mgnCurrency string) ([]MaximumLoanInstrument, error)
GetMaximumLoanOfInstrument returns list of maximum loan of instruments.
func (*Okx) GetMaximumWithdrawals ¶
func (ok *Okx) GetMaximumWithdrawals(ctx context.Context, currency string) ([]MaximumWithdrawal, error)
GetMaximumWithdrawals retrieves the maximum transferable amount from trading account to funding account.
func (*Okx) GetOffers ¶
func (ok *Okx) GetOffers(ctx context.Context, productID, protocolType, currency string) ([]Offer, error)
GetOffers retrieves list of offers for different protocols.
func (*Okx) GetOneClickRepayCurrencyList ¶
func (ok *Okx) GetOneClickRepayCurrencyList(ctx context.Context, debtType string) ([]CurrencyOneClickRepay, error)
GetOneClickRepayCurrencyList retrieves list of debt currency data and repay currencies. Debt currencies include both cross and isolated debts. debt level "cross", and "isolated" are allowed
func (*Okx) GetOneClickRepayHistory ¶
func (ok *Okx) GetOneClickRepayHistory(ctx context.Context, after, before time.Time, limit int64) ([]CurrencyOneClickRepay, error)
GetOneClickRepayHistory get the history and status of one-click repay trades.
func (*Okx) GetOpenInterest ¶
func (ok *Okx) GetOpenInterest(ctx context.Context, k ...key.PairAsset) ([]futures.OpenInterest, error)
GetOpenInterest returns the open interest rate for a given asset pair
func (*Okx) GetOpenInterestAndVolumeExpiry ¶
func (ok *Okx) GetOpenInterestAndVolumeExpiry(ctx context.Context, currency string, period kline.Interval) ([]ExpiryOpenInterestAndVolume, error)
GetOpenInterestAndVolumeExpiry retrieves the open interest and trading volume of calls and puts for each upcoming expiration.
func (*Okx) GetOpenInterestAndVolumeStrike ¶
func (ok *Okx) GetOpenInterestAndVolumeStrike(ctx context.Context, currency string, expTime time.Time, period kline.Interval) ([]StrikeOpenInterestAndVolume, error)
GetOpenInterestAndVolumeStrike retrieves the taker volume for both buyers and sellers of calls and puts.
func (*Okx) GetOpenInterestData ¶
func (ok *Okx) GetOpenInterestData(ctx context.Context, instType, uly, instID string) ([]OpenInterest, error)
GetOpenInterestData retrieves the total open interest for contracts on OKX
func (*Okx) GetOptionMarketData ¶
func (ok *Okx) GetOptionMarketData(ctx context.Context, underlying string, expTime time.Time) ([]OptionMarketDataResponse, error)
GetOptionMarketData retrieves option market data.
func (*Okx) GetOptionsOpenInterestAndVolume ¶
func (ok *Okx) GetOptionsOpenInterestAndVolume(ctx context.Context, currency string, period kline.Interval) ([]OpenInterestVolume, error)
GetOptionsOpenInterestAndVolume retrieves the open interest and trading volume for options.
func (*Okx) GetOracle ¶
func (ok *Okx) GetOracle(ctx context.Context) (*OracleSmartContractResponse, error)
GetOracle Get the crypto price of signing using Open Oracle smart contract.
func (*Okx) GetOrderBookDepth ¶
func (ok *Okx) GetOrderBookDepth(ctx context.Context, instrumentID string, depth int64) (*OrderBookResponse, error)
GetOrderBookDepth returns the recent order asks and bids before specified timestamp.
func (*Okx) GetOrderDetail ¶
func (ok *Okx) GetOrderDetail(ctx context.Context, arg *OrderDetailRequestParam) (*OrderDetail, error)
GetOrderDetail retrieves order details given instrument id and order identification
func (*Okx) GetOrderHistory ¶
func (ok *Okx) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*Okx) GetOrderInfo ¶
func (ok *Okx) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (*order.Detail, error)
GetOrderInfo returns order information based on order ID
func (*Okx) GetOrderList ¶
func (ok *Okx) GetOrderList(ctx context.Context, arg *OrderListRequestParams) ([]OrderDetail, error)
GetOrderList retrieves all incomplete orders under the current account.
func (*Okx) GetPMLimitation ¶
func (ok *Okx) GetPMLimitation(ctx context.Context, instrumentType, underlying string) ([]PMLimitationResponse, error)
GetPMLimitation retrieve cross position limitation of SWAP/FUTURES/OPTION under Portfolio margin mode.
func (*Okx) GetPositionTiers ¶
func (ok *Okx) GetPositionTiers(ctx context.Context, instrumentType, tradeMode, underlying, instrumentID, tiers string) ([]PositionTiers, error)
GetPositionTiers retrieves position tiers information,maximum leverage depends on your borrowings and margin ratio.
func (*Okx) GetPositions ¶
func (ok *Okx) GetPositions(ctx context.Context, instrumentType, instrumentID, positionID string) ([]AccountPosition, error)
GetPositions retrieves information on your positions. When the account is in net mode, net positions will be displayed, and when the account is in long/short mode, long or short positions will be displayed.
func (*Okx) GetPositionsHistory ¶
func (ok *Okx) GetPositionsHistory(ctx context.Context, instrumentType, instrumentID, marginMode string, closePositionType, limit int64, after, before time.Time) ([]AccountPositionHistory, error)
GetPositionsHistory retrieves the updated position data for the last 3 months.
func (*Okx) GetPublicBlockTrades ¶
func (ok *Okx) GetPublicBlockTrades(ctx context.Context, beginID, endID string, limit int64) ([]PublicBlockTradesResponse, error)
GetPublicBlockTrades retrieves the recent executed block trades.
func (*Okx) GetPublicBorrowHistory ¶
func (ok *Okx) GetPublicBorrowHistory(ctx context.Context, currency string, before, after time.Time, limit int64) ([]PublicBorrowHistory, error)
GetPublicBorrowHistory return list of publix borrow history.
func (*Okx) GetPublicBorrowInfo ¶
func (ok *Okx) GetPublicBorrowInfo(ctx context.Context, currency string) ([]PublicBorrowInfo, error)
GetPublicBorrowInfo returns the public borrow info.
func (*Okx) GetPublicUnderlyings ¶
GetPublicUnderlyings returns list of underlyings for various instrument types.
func (*Okx) GetPutCallRatio ¶
func (ok *Okx) GetPutCallRatio(ctx context.Context, currency string, period kline.Interval) ([]OpenInterestVolumeRatio, error)
GetPutCallRatio retrieves the open interest ration and trading volume ratio of calls vs puts.
func (*Okx) GetQuotes ¶
func (ok *Okx) GetQuotes(ctx context.Context, arg *QuoteRequestParams) ([]QuoteResponse, error)
GetQuotes retrieves all Quotes that the user is a counterparty to (either as the creator or the receiver).
func (*Okx) GetRecentTrades ¶
func (ok *Okx) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
GetRecentTrades returns the most recent trades for a currency and asset
func (*Okx) GetRfqTrades ¶
func (ok *Okx) GetRfqTrades(ctx context.Context, arg *RfqTradesRequestParams) ([]RfqTradeResponse, error)
GetRfqTrades retrieves the executed trades that the user is a counterparty to (either as the creator or the receiver).
func (*Okx) GetRfqs ¶
func (ok *Okx) GetRfqs(ctx context.Context, arg *RfqRequestParams) ([]RfqResponse, error)
GetRfqs retrieves details of Rfqs that the user is a counterparty to (either as the creator or the receiver of the Rfq).
func (*Okx) GetSavingBalance ¶
func (ok *Okx) GetSavingBalance(ctx context.Context, currency string) ([]SavingBalanceResponse, error)
GetSavingBalance returns saving balance, and only assets in the funding account can be used for saving.
func (*Okx) GetServerTime ¶
GetServerTime returns the current exchange server time.
func (*Okx) GetSingleFundingRate ¶
func (ok *Okx) GetSingleFundingRate(ctx context.Context, instrumentID string) (*FundingRateResponse, error)
GetSingleFundingRate returns the latest funding rate
func (*Okx) GetSubaccountFundingBalance ¶
func (ok *Okx) GetSubaccountFundingBalance(ctx context.Context, subaccountName, currency string) ([]FundingBalance, error)
GetSubaccountFundingBalance query detailed balance info of Funding Account of a sub-account via the master account (applies to master accounts only)
func (*Okx) GetSubaccountTradingBalance ¶
func (ok *Okx) GetSubaccountTradingBalance(ctx context.Context, subaccountName string) ([]SubaccountBalanceResponse, error)
GetSubaccountTradingBalance query detailed balance info of Trading Account of a sub-account via the master account (applies to master accounts only)
func (*Okx) GetSubscriptionTemplate ¶
func (ok *Okx) GetSubscriptionTemplate(_ *subscription.Subscription) (*template.Template, error)
GetSubscriptionTemplate returns a subscription channel template
func (*Okx) GetSupportCoins ¶
func (ok *Okx) GetSupportCoins(ctx context.Context) (*SupportedCoinsData, error)
GetSupportCoins retrieves the currencies supported by the trading data endpoints
func (*Okx) GetSystemTime ¶
GetSystemTime Retrieve API server time.
func (*Okx) GetTakerFlow ¶
func (ok *Okx) GetTakerFlow(ctx context.Context, currency string, period kline.Interval) (*CurrencyTakerFlow, error)
GetTakerFlow shows the relative buy/sell volume for calls and puts. It shows whether traders are bullish or bearish on price and volatility
func (*Okx) GetTakerVolume ¶
func (ok *Okx) GetTakerVolume(ctx context.Context, currency, instrumentType string, begin, end time.Time, period kline.Interval) ([]TakerVolume, error)
GetTakerVolume retrieves the taker volume for both buyers and sellers.
func (*Okx) GetTicker ¶
GetTicker retrieves the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.
func (*Okx) GetTickers ¶
func (ok *Okx) GetTickers(ctx context.Context, instType, uly, instID string) ([]TickerResponse, error)
GetTickers retrieves the latest price snapshots best bid/ ask price, and trading volume in the last 24 hours.
func (*Okx) GetTradeFee ¶
func (ok *Okx) GetTradeFee(ctx context.Context, instrumentType, instrumentID, underlying string) ([]TradeFeeRate, error)
GetTradeFee query trade fee rate of various instrument types and instrument ids.
func (*Okx) GetTrades ¶
func (ok *Okx) GetTrades(ctx context.Context, instrumentID string, limit int64) ([]TradeResponse, error)
GetTrades Retrieve the recent transactions of an instrument.
func (*Okx) GetTradesHistory ¶
func (ok *Okx) GetTradesHistory(ctx context.Context, instrumentID, before, after string, limit int64) ([]TradeResponse, error)
GetTradesHistory retrieves the recent transactions of an instrument from the last 3 months with pagination.
func (*Okx) GetTransactionDetailsLast3Days ¶
func (ok *Okx) GetTransactionDetailsLast3Days(ctx context.Context, arg *TransactionDetailRequestParams) ([]TransactionDetail, error)
GetTransactionDetailsLast3Days retrieves recently-filled transaction details in the last 3 day.
func (*Okx) GetTransactionDetailsLast3Months ¶
func (ok *Okx) GetTransactionDetailsLast3Months(ctx context.Context, arg *TransactionDetailRequestParams) ([]TransactionDetail, error)
GetTransactionDetailsLast3Months Retrieve recently-filled transaction details in the last 3 months.
func (*Okx) GetUnderlying ¶
GetUnderlying returns the instrument ID for the corresponding asset pairs and asset type( Instrument Type )
func (*Okx) GetWithdrawalHistory ¶
func (ok *Okx) GetWithdrawalHistory(ctx context.Context, currency, withdrawalID, clientID, transactionID, state string, after, before time.Time, limit int64) ([]WithdrawalHistoryResponse, error)
GetWithdrawalHistory retrieves the withdrawal records according to the currency, withdrawal status, and time range in reverse chronological order. The 100 most recent records are returned by default.
func (*Okx) GetWithdrawalsHistory ¶
func (ok *Okx) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)
GetWithdrawalsHistory returns previous withdrawals data
func (*Okx) GridPositionsSubscription ¶
GridPositionsSubscription to retrieve grid positions. Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing/canceling order.
func (*Okx) GridSubOrders ¶
GridSubOrders to retrieve grid sub orders. Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing order.
func (*Okx) HistoryOfSubaccountTransfer ¶
func (ok *Okx) HistoryOfSubaccountTransfer(ctx context.Context, currency, subaccountType, subaccountName string, before, after time.Time, limit int64) ([]SubaccountBillItem, error)
HistoryOfSubaccountTransfer retrieves subaccount transfer histories; applies to master accounts only. Retrieve the transfer data for the last 3 months.
func (*Okx) IncreaseDecreaseMargin ¶
func (ok *Okx) IncreaseDecreaseMargin(ctx context.Context, arg *IncreaseDecreaseMarginInput) (*IncreaseDecreaseMargin, error)
IncreaseDecreaseMargin Increase or decrease the margin of the isolated position. Margin reduction may result in the change of the actual leverage.
func (*Okx) IndexCandlesticksSubscription ¶
func (ok *Okx) IndexCandlesticksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
IndexCandlesticksSubscription a method to subscribe and unsubscribe to "index-candle*" channel to retrieve the candlesticks data of the index. Data will be pushed every 500 ms.
func (*Okx) IndexTickerChannel ¶
IndexTickerChannel a method to subscribe and unsubscribe to "index-tickers" channel
func (*Okx) InstrumentsSubscription ¶
func (ok *Okx) InstrumentsSubscription(operation string, assetType asset.Item, pair currency.Pair) error
InstrumentsSubscription to subscribe for instruments. The full instrument list will be pushed for the first time after subscription. Subsequently, the instruments will be pushed if there is any change to the instrument’s state (such as delivery of FUTURES, exercise of OPTION, listing of new contracts / trading pairs, trading suspension, etc.).
func (*Okx) IsPerpetualFutureCurrency ¶
IsPerpetualFutureCurrency ensures a given asset and currency is a perpetual future
func (*Okx) IsolatedMarginTradingSettings ¶
func (ok *Okx) IsolatedMarginTradingSettings(ctx context.Context, arg IsolatedMode) (*IsolatedMode, error)
IsolatedMarginTradingSettings to set the currency margin and futures/perpetual Isolated margin trading mode.
func (*Okx) LightningWithdrawal ¶
func (ok *Okx) LightningWithdrawal(ctx context.Context, arg LightningWithdrawalRequestInput) (*LightningWithdrawalResponse, error)
LightningWithdrawal to withdraw a currency from an invoice.
func (*Okx) MarkPriceCandlesticksSubscription ¶
func (ok *Okx) MarkPriceCandlesticksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
MarkPriceCandlesticksSubscription to subscribe or unsubscribe to "mark-price-candles" channels to retrieve the candlesticks data of the mark price. Data will be pushed every 500 ms.
func (*Okx) MarkPriceSubscription ¶
func (ok *Okx) MarkPriceSubscription(operation string, assetType asset.Item, pair currency.Pair) error
MarkPriceSubscription to subscribe or unsubscribe to the "mark-price" to retrieve the mark price. Data will be pushed every 200 ms when the mark price changes, and will be pushed every 10 seconds when the mark price does not change.
func (*Okx) MasterAccountsManageTransfersBetweenSubaccounts ¶
func (ok *Okx) MasterAccountsManageTransfersBetweenSubaccounts(ctx context.Context, arg *SubAccountAssetTransferParams) ([]TransferIDInfo, error)
MasterAccountsManageTransfersBetweenSubaccounts master accounts manage the transfers between sub-accounts applies to master accounts only
func (*Okx) ModifyOrder ¶
func (ok *Okx) ModifyOrder(ctx context.Context, action *order.Modify) (*order.ModifyResponse, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*Okx) OpenInterestSubscription ¶
func (ok *Okx) OpenInterestSubscription(operation string, assetType asset.Item, pair currency.Pair) error
OpenInterestSubscription to subscribe or unsubscribe to "open-interest" channel to retrieve the open interest. Data will by pushed every 3 seconds.
func (*Okx) OptionSummarySubscription ¶
OptionSummarySubscription a method to subscribe or unsubscribe to "opt-summary" channel to retrieve detailed pricing information of all OPTION contracts. Data will be pushed at once.
func (*Okx) OrderBooksSubscription ¶
func (ok *Okx) OrderBooksSubscription(operation, channel string, assetType asset.Item, pair currency.Pair) error
OrderBooksSubscription subscribe or unsubscribe to "books*" channel to retrieve order book data.
func (*Okx) OrderTypeFromString ¶
OrderTypeFromString returns order.Type instance from string
func (*Okx) OrderTypeString ¶
OrderTypeString returns a string representation of order.Type instance
func (*Okx) PlaceAlgoOrder ¶
PlaceAlgoOrder order includes trigger order, oco order, conditional order,iceberg order, twap order and trailing order.
func (*Okx) PlaceEasyConvert ¶
func (ok *Okx) PlaceEasyConvert(ctx context.Context, arg PlaceEasyConvertParam) ([]EasyConvertItem, error)
PlaceEasyConvert converts small currencies to mainstream currencies. Only applicable to the crypto balance less than $10.
func (*Okx) PlaceGridAlgoOrder ¶
func (ok *Okx) PlaceGridAlgoOrder(ctx context.Context, arg *GridAlgoOrder) (*GridAlgoOrderIDResponse, error)
PlaceGridAlgoOrder place spot grid algo order.
func (*Okx) PlaceIcebergOrder ¶
PlaceIcebergOrder to place iceburg algo order
func (*Okx) PlaceMultipleOrders ¶
func (ok *Okx) PlaceMultipleOrders(ctx context.Context, args []PlaceOrderRequestParam) ([]OrderData, error)
PlaceMultipleOrders to place orders in batches. Maximum 20 orders can be placed at a time. Request parameters should be passed in the form of an array.
func (*Okx) PlaceOrder ¶
func (ok *Okx) PlaceOrder(ctx context.Context, arg *PlaceOrderRequestParam, a asset.Item) (*OrderData, error)
PlaceOrder place an order only if you have sufficient funds.
func (*Okx) PlaceStopOrder ¶
PlaceStopOrder to place stop order
func (*Okx) PlaceTWAPOrder ¶
PlaceTWAPOrder to place TWAP algo orders
func (*Okx) PlaceTrailingStopOrder ¶
func (ok *Okx) PlaceTrailingStopOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)
PlaceTrailingStopOrder to place trailing stop order
func (*Okx) PositionBuilder ¶
func (ok *Okx) PositionBuilder(ctx context.Context, arg PositionBuilderInput) ([]PositionBuilderResponse, error)
PositionBuilder calculates portfolio margin information for simulated position or current position of the user. You can add up to 200 simulated positions in one request. Instrument type SWAP FUTURES, and OPTION are supported
func (*Okx) PositionRiskWarningSubscription ¶
func (ok *Okx) PositionRiskWarningSubscription(operation string, assetType asset.Item, pair currency.Pair) error
PositionRiskWarningSubscription this push channel is only used as a risk warning, and is not recommended as a risk judgment for strategic trading In the case that the market is not moving violently, there may be the possibility that the position has been liquidated at the same time that this message is pushed.
func (*Okx) PriceLimitSubscription ¶
PriceLimitSubscription subscribe or unsubscribe to "price-limit" channel to retrieve the maximum buy price and minimum sell price of the instrument. Data will be pushed every 5 seconds when there are changes in limits, and will not be pushed when there is no changes on limit.
func (*Okx) PublicStructureBlockTradesSubscription ¶
func (ok *Okx) PublicStructureBlockTradesSubscription(operation string, assetType asset.Item, pair currency.Pair) error
PublicStructureBlockTradesSubscription a method to subscribe or unsubscribe to "public-struc-block-trades" channel
func (*Okx) Purchase ¶
func (ok *Okx) Purchase(ctx context.Context, arg PurchaseRequestParam) (*OrderIDResponse, error)
Purchase invest on specific product
func (*Okx) QuotesSubscription ¶
QuotesSubscription subscription to retrieve Quote subscription
func (*Okx) Redeem ¶
func (ok *Okx) Redeem(ctx context.Context, arg RedeemRequestParam) (*OrderIDResponse, error)
Redeem redemption of investment
func (*Okx) ResetMMPStatus ¶
ResetMMPStatus reset the MMP status to be inactive.
func (*Okx) ResetSubAccountAPIKey ¶
func (ok *Okx) ResetSubAccountAPIKey(ctx context.Context, arg *SubAccountAPIKeyParam) (*SubAccountAPIKeyResponse, error)
ResetSubAccountAPIKey applies to master accounts only and master accounts APIKey must be linked to IP addresses.
func (*Okx) RfqSubscription ¶
RfqSubscription subscription to retrieve Rfq updates on Rfq orders.
func (*Okx) SavingsPurchaseOrRedemption ¶
func (ok *Okx) SavingsPurchaseOrRedemption(ctx context.Context, arg *SavingsPurchaseRedemptionInput) (*SavingsPurchaseRedemptionResponse, error)
SavingsPurchaseOrRedemption creates a purchase or redemption instance
func (*Okx) SendHTTPRequest ¶
func (ok *Okx) SendHTTPRequest(ctx context.Context, ep exchange.URL, f request.EndpointLimit, httpMethod, 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 (*Okx) SetCollateralMode ¶
SetCollateralMode sets the collateral type for your account
func (*Okx) SetGreeks ¶
SetGreeks set the display type of Greeks. PA: Greeks in coins BS: Black-Scholes Greeks in dollars
func (*Okx) SetLendingRate ¶
func (ok *Okx) SetLendingRate(ctx context.Context, arg LendingRate) (*LendingRate, error)
SetLendingRate sets an assets lending rate
func (*Okx) SetLeverage ¶
func (ok *Okx) SetLeverage(ctx context.Context, item asset.Item, pair currency.Pair, marginType margin.Type, amount float64, orderSide order.Side) error
SetLeverage sets the account's initial leverage for the asset type and pair
func (*Okx) SetLeverageRate ¶
func (ok *Okx) SetLeverageRate(ctx context.Context, arg SetLeverageInput) (*SetLeverageResponse, error)
SetLeverageRate sets a leverage setting for instrument id.
func (*Okx) SetMarginType ¶
SetMarginType sets the default margin type for when opening a new position okx allows this to be set with an order, however this sets a default
func (*Okx) SetPermissionOfTransferOut ¶
func (ok *Okx) SetPermissionOfTransferOut(ctx context.Context, arg PermissionOfTransfer) ([]PermissionOfTransfer, error)
SetPermissionOfTransferOut set permission of transfer out for sub-account(only applicable to master account). Sub-account can transfer out to master account by default.
func (*Okx) SetPositionMode ¶
SetPositionMode FUTURES and SWAP support both long/short mode and net mode. In net mode, users can only have positions in one direction; In long/short mode, users can hold positions in long and short directions.
func (*Okx) SetQuoteProducts ¶
func (ok *Okx) SetQuoteProducts(ctx context.Context, args []SetQuoteProductParam) (*SetQuoteProductsResult, error)
SetQuoteProducts customize the products which makers want to quote and receive Rfqs for, and the corresponding price and size limit.
func (*Okx) SmallAssetsConvert ¶
func (ok *Okx) SmallAssetsConvert(ctx context.Context, currency []string) (*SmallAssetConvertResponse, error)
SmallAssetsConvert Convert small assets in funding account to OKB. Only one convert is allowed within 24 hours.
func (*Okx) SpotGridAlgoOrdersSubscription ¶
func (ok *Okx) SpotGridAlgoOrdersSubscription(operation string, assetType asset.Item, pair currency.Pair, algoID string) error
SpotGridAlgoOrdersSubscription to retrieve spot grid algo orders. Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing/canceling order.
func (*Okx) SpotGridWithdrawProfit ¶
func (ok *Okx) SpotGridWithdrawProfit(ctx context.Context, algoID string) (*AlgoOrderWithdrawalProfit, error)
SpotGridWithdrawProfit returns the spot grid orders withdrawal profit given an instrument id.
func (*Okx) StatusSubscription ¶
StatusSubscription get the status of system maintenance and push when the system maintenance status changes. First subscription: "Push the latest change data"; every time there is a state change, push the changed content
func (*Okx) StopGridAlgoOrder ¶
func (ok *Okx) StopGridAlgoOrder(ctx context.Context, arg []StopGridAlgoOrderRequest) ([]GridAlgoOrderIDResponse, error)
StopGridAlgoOrder stop a batch of grid algo orders.
func (*Okx) StructureBlockTradesSubscription ¶
StructureBlockTradesSubscription to retrieve Structural block subscription
func (*Okx) SubmitOrder ¶
SubmitOrder submits a new order
func (*Okx) Subscribe ¶
func (ok *Okx) Subscribe(channelsToSubscribe subscription.List) error
Subscribe sends a websocket subscription request to several channels to receive data.
func (*Okx) SystemStatusResponse ¶
func (ok *Okx) SystemStatusResponse(ctx context.Context, state string) ([]SystemStatusResponse, error)
SystemStatusResponse retrieves the system status. state supports valid values 'scheduled', 'ongoing', 'pre_open', 'completed', and 'canceled'.
func (*Okx) TickersSubscription ¶
func (ok *Okx) TickersSubscription(operation string, assetType asset.Item, pair currency.Pair) error
TickersSubscription subscribing to "ticker" channel to retrieve the last traded price, bid price, ask price and 24-hour trading volume of instruments. Data will be pushed every 100 ms.
func (*Okx) TradeOneClickRepay ¶
func (ok *Okx) TradeOneClickRepay(ctx context.Context, arg TradeOneClickRepayParam) ([]CurrencyOneClickRepay, error)
TradeOneClickRepay trade one-click repay to repay cross debts. Isolated debts are not applicable. The maximum repayment amount is based on the remaining available balance of funding and trading accounts.
func (*Okx) TradesSubscription ¶
TradesSubscription to subscribe or unsubscribe to "trades" channel to retrieve the recent trades data. Data will be pushed whenever there is a trade. Every update contain only one trade.
func (*Okx) TriggerAlgoOrder ¶
TriggerAlgoOrder fetches algo trigger orders for SWAP market types.
func (*Okx) Unsubscribe ¶
func (ok *Okx) Unsubscribe(channelsToUnsubscribe subscription.List) error
Unsubscribe sends a websocket unsubscription request to several channels to receive data.
func (*Okx) UpdateAccountInfo ¶
func (ok *Okx) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
UpdateAccountInfo retrieves balances for all enabled currencies.
func (*Okx) UpdateOrderExecutionLimits ¶
UpdateOrderExecutionLimits sets exchange execution order limits for an asset type
func (*Okx) UpdateOrderbook ¶
func (ok *Okx) UpdateOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Okx) UpdateTicker ¶
func (ok *Okx) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
UpdateTicker updates and returns the ticker for a currency pair
func (*Okx) UpdateTickers ¶
UpdateTickers updates all currency pairs of a given asset type
func (*Okx) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*Okx) VIPLoansBorrowAndRepay ¶
func (ok *Okx) VIPLoansBorrowAndRepay(ctx context.Context, arg LoanBorrowAndReplayInput) (*LoanBorrowAndReplay, error)
VIPLoansBorrowAndRepay creates VIP borrow or repay for a currency.
func (*Okx) ValidateAPICredentials ¶
ValidateAPICredentials validates current credentials used for wrapper
func (*Okx) ViewSubAccountList ¶
func (ok *Okx) ViewSubAccountList(ctx context.Context, enable bool, subaccountName string, after, before time.Time, limit int64) ([]SubaccountInfo, error)
ViewSubAccountList applies to master accounts only
func (*Okx) WithdrawCryptocurrencyFunds ¶
func (ok *Okx) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*Okx) WithdrawFiatFunds ¶
func (ok *Okx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*Okx) WithdrawFiatFundsToInternationalBank ¶
func (ok *Okx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*Okx) Withdrawal ¶
func (ok *Okx) Withdrawal(ctx context.Context, input *WithdrawalInput) (*WithdrawalResponse, error)
Withdrawal to perform a withdrawal action. Sub-account does not support withdrawal.
func (*Okx) WsAccountSubscription ¶
func (ok *Okx) WsAccountSubscription(operation string, assetType asset.Item, pair currency.Pair) error
WsAccountSubscription retrieve account information. Data will be pushed when triggered by events such as placing order, canceling order, transaction execution, etc. It will also be pushed in regular interval according to subscription granularity.
func (*Okx) WsAmendMultipleOrders ¶
func (ok *Okx) WsAmendMultipleOrders(args []AmendOrderRequestParams) ([]OrderData, error)
WsAmendMultipleOrders a request through the websocket connection to amend multiple trade orders.
func (*Okx) WsAmendOrder ¶
func (ok *Okx) WsAmendOrder(arg *AmendOrderRequestParams) (*OrderData, error)
WsAmendOrder method to amend trade order using a request thought the websocket channel.
func (*Okx) WsAuth ¶
WsAuth will connect to Okx's Private websocket connection and Authenticate with a login payload.
func (*Okx) WsCancelMultipleOrder ¶
func (ok *Okx) WsCancelMultipleOrder(args []CancelOrderRequestParam) ([]OrderData, error)
WsCancelMultipleOrder cancel multiple order through the websocket channel.
func (*Okx) WsCancelOrder ¶
func (ok *Okx) WsCancelOrder(arg CancelOrderRequestParam) (*OrderData, error)
WsCancelOrder websocket function to cancel a trade order
func (*Okx) WsHandleData ¶
WsHandleData will read websocket raw data and pass to appropriate handler
func (*Okx) WsOrderChannel ¶
func (ok *Okx) WsOrderChannel(operation string, assetType asset.Item, pair currency.Pair, _ string) error
WsOrderChannel for subscribing for orders.
func (*Okx) WsPlaceMultipleOrder ¶
func (ok *Okx) WsPlaceMultipleOrder(args []PlaceOrderRequestParam) ([]OrderData, error)
WsPlaceMultipleOrder creates an order through the websocket stream.
func (*Okx) WsPlaceOrder ¶
func (ok *Okx) WsPlaceOrder(arg *PlaceOrderRequestParam) (*OrderData, error)
WsPlaceOrder places an order thought the websocket connection stream, and returns a SubmitResponse and error message.
func (*Okx) WsPositionChannel ¶
WsPositionChannel retrieve the position data. The first snapshot will be sent in accordance with the granularity of the subscription. Data will be pushed when certain actions, such placing or canceling an order, trigger it. It will also be pushed periodically based on the granularity of the subscription.
func (*Okx) WsProcessSnapshotOrderBook ¶
func (ok *Okx) WsProcessSnapshotOrderBook(data WsOrderBookData, pair currency.Pair, assets []asset.Item) error
WsProcessSnapshotOrderBook processes snapshot order books
func (*Okx) WsProcessUpdateOrderbook ¶
func (ok *Okx) WsProcessUpdateOrderbook(data WsOrderBookData, pair currency.Pair, assets []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
type OneClickRepayCurrencyItem ¶
type OneClickRepayCurrencyItem struct { DebtData []CurrencyDebtAmount `json:"debtData"` DebtType string `json:"debtType"` RepayData []CurrencyRepayAmount `json:"repayData"` }
OneClickRepayCurrencyItem represents debt currency data and repay currencies.
type OpenInterest ¶
type OpenInterest struct { InstrumentType asset.Item `json:"instType"` InstrumentID string `json:"instId"` OpenInterest types.Number `json:"oi"` OpenInterestCurrency types.Number `json:"oiCcy"` Timestamp okxUnixMilliTime `json:"ts"` }
OpenInterest Retrieve the total open interest for contracts on OKX.
func (*OpenInterest) UnmarshalJSON ¶
func (a *OpenInterest) UnmarshalJSON(data []byte) error
UnmarshalJSON decoder for OpenInterestResponse instance.
type OpenInterestVolume ¶
type OpenInterestVolume struct { Timestamp time.Time `json:"ts"` OpenInterest float64 `json:"oi"` Volume float64 `json:"vol"` }
OpenInterestVolume represents open interest and trading volume item for currencies of futures and perpetual swaps.
type OpenInterestVolumeRatio ¶
type OpenInterestVolumeRatio struct { Timestamp time.Time `json:"ts"` OpenInterestRatio float64 `json:"oiRatio"` VolumeRatio float64 `json:"volRatio"` }
OpenInterestVolumeRatio represents open interest and trading volume ratio for currencies of futures and perpetual swaps.
type OptionMarketDataResponse ¶
type OptionMarketDataResponse struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` Underlying string `json:"uly"` Delta types.Number `json:"delta"` Gamma types.Number `json:"gamma"` Theta types.Number `json:"theta"` Vega types.Number `json:"vega"` DeltaBS types.Number `json:"deltaBS"` GammaBS types.Number `json:"gammaBS"` ThetaBS types.Number `json:"thetaBS"` VegaBS types.Number `json:"vegaBS"` RealVol string `json:"realVol"` BidVolatility string `json:"bidVol"` AskVolatility types.Number `json:"askVol"` MarkVolatility types.Number `json:"markVol"` Leverage types.Number `json:"lever"` ForwardPrice string `json:"fwdPx"` Timestamp okxUnixMilliTime `json:"ts"` }
OptionMarketDataResponse holds response data for option market data
type OracleSmartContractResponse ¶
type OracleSmartContractResponse struct { Messages []string `json:"messages"` Prices map[string]string `json:"prices"` Signatures []string `json:"signatures"` Timestamp okxUnixMilliTime `json:"timestamp"` }
OracleSmartContractResponse returns the crypto price of signing using Open Oracle smart contract.
type OrderAsk ¶
type OrderAsk struct { DepthPrice float64 NumberOfContracts float64 LiquidationOrders int64 NumberOfOrders int64 }
OrderAsk represents currencies bid detailed information.
type OrderBid ¶
type OrderBid struct { DepthPrice float64 BaseCurrencies float64 LiquidationOrders int64 NumberOfOrders int64 }
OrderBid represents currencies bid detailed information.
type OrderBookResponse ¶
type OrderBookResponse struct { Asks [][4]string `json:"asks"` Bids [][4]string `json:"bids"` GenerationTimeStamp okxUnixMilliTime `json:"ts"` }
OrderBookResponse holds the order asks and bids at a specific timestamp
func (*OrderBookResponse) GetAsks ¶
func (a *OrderBookResponse) GetAsks() ([]OrderAsk, error)
GetAsks returns list of asks from an order book response instance.
func (*OrderBookResponse) GetBids ¶
func (a *OrderBookResponse) GetBids() ([]OrderBid, error)
GetBids returns list of order bids instance from list of slice.
func (*OrderBookResponse) GetOrderBookResponseDetail ¶
func (a *OrderBookResponse) GetOrderBookResponseDetail() (*OrderBookResponseDetail, error)
GetOrderBookResponseDetail returns the OrderBookResponseDetail instance from OrderBookResponse object.
type OrderBookResponseDetail ¶
type OrderBookResponseDetail struct { Asks []OrderAsk Bids []OrderBid GenerationTimestamp time.Time }
OrderBookResponseDetail holds the order asks and bids in a struct field with the corresponding order generation timestamp.
type OrderData ¶
type OrderData struct { OrderID string `json:"ordId,omitempty"` RequestID string `json:"reqId,omitempty"` ClientOrderID string `json:"clOrdId,omitempty"` Tag string `json:"tag,omitempty"` SCode string `json:"sCode,omitempty"` SMessage string `json:"sMsg,omitempty"` }
OrderData response message for place, cancel, and amend an order requests.
type OrderDetail ¶
type OrderDetail struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` Currency string `json:"ccy"` OrderID string `json:"ordId"` ClientOrderID string `json:"clOrdId"` Tag string `json:"tag"` ProfitAndLoss string `json:"pnl"` OrderType string `json:"ordType"` Side order.Side `json:"side"` PositionSide string `json:"posSide"` TradeMode string `json:"tdMode"` TradeID string `json:"tradeId"` FillTime time.Time `json:"fillTime"` Source string `json:"source"` State string `json:"state"` TakeProfitTriggerPriceType string `json:"tpTriggerPxType"` StopLossTriggerPriceType string `json:"slTriggerPxType"` StopLossOrdPx string `json:"slOrdPx"` RebateCurrency string `json:"rebateCcy"` QuantityType string `json:"tgtCcy"` // base_ccy and quote_ccy Category string `json:"category"` // normal, twap, adl, full_liquidation, partial_liquidation, delivery, ddh AccumulatedFillSize types.Number `json:"accFillSz"` FillPrice types.Number `json:"fillPx"` FillSize types.Number `json:"fillSz"` RebateAmount types.Number `json:"rebate"` FeeCurrency string `json:"feeCcy"` TransactionFee types.Number `json:"fee"` AveragePrice types.Number `json:"avgPx"` Leverage types.Number `json:"lever"` Price types.Number `json:"px"` Size types.Number `json:"sz"` TakeProfitTriggerPrice types.Number `json:"tpTriggerPx"` TakeProfitOrderPrice types.Number `json:"tpOrdPx"` StopLossTriggerPrice types.Number `json:"slTriggerPx"` UpdateTime time.Time `json:"uTime"` CreationTime time.Time `json:"cTime"` }
OrderDetail returns a order detail information
func (*OrderDetail) UnmarshalJSON ¶
func (a *OrderDetail) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type OrderDetailRequestParam ¶
type OrderDetailRequestParam struct { InstrumentID string `json:"instId"` OrderID string `json:"ordId"` ClientOrderID string `json:"clOrdId"` }
OrderDetailRequestParam payload data to request order detail
type OrderHistoryRequestParams ¶
type OrderHistoryRequestParams struct { OrderListRequestParams Category string `json:"category"` // twap, adl, full_liquidation, partial_liquidation, delivery, ddh }
OrderHistoryRequestParams holds parameters to request order data history of last 7 days.
type OrderIDResponse ¶
type OrderIDResponse struct {
OrderID string `json:"orderId"`
}
OrderIDResponse represents purchase order ID
type OrderLeg ¶
type OrderLeg struct { Price string `json:"px"` Size string `json:"sz"` InstrumentID string `json:"instId"` Side string `json:"side"` TargetCurrency string `json:"tgtCcy"` // available in REST only Fee types.Number `json:"fee"` FeeCurrency string `json:"feeCcy"` TradeID string `json:"tradeId"` }
OrderLeg represents legs information for both websocket and REST available Quote information.
type OrderListRequestParams ¶
type OrderListRequestParams struct { InstrumentType string `json:"instType"` // SPOT , MARGIN, SWAP, FUTURES , OPTIONS Underlying string `json:"uly"` InstrumentID string `json:"instId"` OrderType string `json:"orderType"` State string `json:"state"` // live, partially_filled Before string `json:"before,omitempty"` // used for order IDs After string `json:"after,omitempty"` // used for order IDs Start time.Time `json:"begin"` End time.Time `json:"end"` Limit int64 `json:"limit,omitempty"` }
OrderListRequestParams represents order list requesting parameters.
type PMLimitationResponse ¶
type PMLimitationResponse struct { MaximumSize types.Number `json:"maxSz"` PositionType string `json:"postType"` Underlying string `json:"uly"` }
PMLimitationResponse represents portfolio margin mode limitation for specific underlying
type PendingOrderItem ¶
type PendingOrderItem struct { AccumulatedFillSize types.Number `json:"accFillSz"` AveragePrice types.Number `json:"avgPx"` CreationTime okxUnixMilliTime `json:"cTime"` Category string `json:"category"` Currency string `json:"ccy"` ClientOrderID string `json:"clOrdId"` Fee types.Number `json:"fee"` FeeCurrency currency.Code `json:"feeCcy"` LastFilledPrice types.Number `json:"fillPx"` LastFilledSize types.Number `json:"fillSz"` FillTime okxUnixMilliTime `json:"fillTime"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Leverage types.Number `json:"lever"` OrderID string `json:"ordId"` OrderType string `json:"ordType"` ProfitAndLoss string `json:"pnl"` PositionSide string `json:"posSide"` RebateAmount types.Number `json:"rebate"` RebateCurrency string `json:"rebateCcy"` Side order.Side `json:"side"` StopLossOrdPrice types.Number `json:"slOrdPx"` StopLossTriggerPrice types.Number `json:"slTriggerPx"` StopLossTriggerPriceType string `json:"slTriggerPxType"` State string `json:"state"` Price types.Number `json:"px"` Size types.Number `json:"sz"` Tag string `json:"tag"` SizeType string `json:"tgtCcy"` TradeMode string `json:"tdMode"` Source string `json:"source"` TakeProfitOrdPrice types.Number `json:"tpOrdPx"` TakeProfitTriggerPrice types.Number `json:"tpTriggerPx"` TakeProfitTriggerPriceType string `json:"tpTriggerPxType"` TradeID string `json:"tradeId"` UpdateTime okxUnixMilliTime `json:"uTime"` }
PendingOrderItem represents a pending order Item in pending orders list.
type PermissionOfTransfer ¶
type PermissionOfTransfer struct { SubAcct string `json:"subAcct"` CanTransOut bool `json:"canTransOut"` }
PermissionOfTransfer represents subaccount transfer information and it's permission.
type PlaceEasyConvertParam ¶
type PlaceEasyConvertParam struct { FromCurrency []string `json:"fromCcy"` ToCurrency string `json:"toCcy"` }
PlaceEasyConvertParam represents easy convert request params
type PlaceOrderRequestParam ¶
type PlaceOrderRequestParam struct { AssetType asset.Item `json:"-"` InstrumentID string `json:"instId"` TradeMode string `json:"tdMode,omitempty"` // cash isolated ClientOrderID string `json:"clOrdId,omitempty"` Currency string `json:"ccy,omitempty"` // Only applicable to cross MARGIN orders in Single-currency margin. OrderTag string `json:"tag,omitempty"` Side string `json:"side,omitempty"` PositionSide string `json:"posSide,omitempty"` OrderType string `json:"ordType,omitempty"` Amount float64 `json:"sz,string,omitempty"` Price float64 `json:"px,string,omitempty"` ReduceOnly bool `json:"reduceOnly,string,omitempty"` QuantityType string `json:"tgtCcy,omitempty"` // values base_ccy and quote_ccy // Added in the websocket requests BanAmend bool `json:"banAmend,omitempty"` // Whether the SPOT Market Order size can be amended by the system. ExpiryTime okxUnixMilliTime `json:"expTime,omitempty"` }
PlaceOrderRequestParam requesting parameter for placing an order.
type PositionBuilderData ¶
type PositionBuilderData struct { Delta string `json:"delta"` Gamma string `json:"gamma"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` NotionalUsd string `json:"notionalUsd"` // Quantity of positions usd QuantityOfPosition string `json:"pos"` // Quantity of positions Theta string `json:"theta"` // Sensitivity of option price to remaining maturity Vega string `json:"vega"` // Sensitivity of option price to implied volatility }
PositionBuilderData represent a position item.
type PositionBuilderInput ¶
type PositionBuilderInput struct { InstrumentType string `json:"instType,omitempty"` InstrumentID string `json:"instId,omitempty"` ImportExistingPosition bool `json:"inclRealPos,omitempty"` // "true":Import existing positions and hedge with simulated ones "false":Only use simulated positions The default is true ListOfPositions []PositionItem `json:"simPos,omitempty"` PositionsCount uint `json:"pos,omitempty"` }
PositionBuilderInput represents request parameter for position builder item.
type PositionBuilderResponse ¶
type PositionBuilderResponse struct { InitialMarginRequirement string `json:"imr"` // Initial margin requirement of riskUnit dimension MaintenanceMarginRequirement string `json:"mmr"` // Maintenance margin requirement of riskUnit dimension SpotAndVolumeMovement string `json:"mr1"` ThetaDecay string `json:"mr2"` VegaTermStructure string `json:"mr3"` BasicRisk string `json:"mr4"` InterestRateRisk string `json:"mr5"` ExtremeMarketMove string `json:"mr6"` TransactionCostAndSlippage string `json:"mr7"` PositionData []PositionBuilderData `json:"posData"` // List of positions RiskUnit string `json:"riskUnit"` Timestamp okxUnixMilliTime `json:"ts"` }
PositionBuilderResponse represents a position builder endpoint response.
type PositionData ¶
type PositionData struct { BaseBal string `json:"baseBal"` Currency string `json:"ccy"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` ManagementMode string `json:"mgnMode"` NotionalCurrency string `json:"notionalCcy"` NotionalUsd string `json:"notionalUsd"` Position string `json:"pos"` PositionedCcy string `json:"posCcy"` PositionedID string `json:"posId"` PositionedSide string `json:"posSide"` QuoteBalance string `json:"quoteBal"` }
PositionData holds account position data.
type PositionDataDetail ¶
type PositionDataDetail struct { PositionID string `json:"posId"` TradeID string `json:"tradeId"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` MarginMode string `json:"mgnMode"` PositionSide string `json:"posSide"` Position string `json:"pos"` Currency string `json:"ccy"` PositionCurrency string `json:"posCcy"` AveragePrice string `json:"avgPx"` UpdateTime okxUnixMilliTime `json:"uTIme"` }
PositionDataDetail position data information for the websocket push data
type PositionItem ¶
PositionItem represents current position of the user.
type PositionMode ¶
type PositionMode struct {
PositionMode string `json:"posMode"` // "long_short_mode": long/short, only applicable to FUTURES/SWAP "net_mode": net
}
PositionMode represents position mode response
type PositionTiers ¶
type PositionTiers struct { BaseMaxLoan string `json:"baseMaxLoan"` InitialMarginRequirement string `json:"imr"` InstrumentID string `json:"instId"` MaximumLeverage string `json:"maxLever"` MaximumSize types.Number `json:"maxSz"` MinSize types.Number `json:"minSz"` MaintenanceMarginRequirement string `json:"mmr"` OptionalMarginFactor string `json:"optMgnFactor"` QuoteMaxLoan string `json:"quoteMaxLoan"` Tier string `json:"tier"` Underlying string `json:"uly"` }
PositionTiers represents position tier detailed information.
type PublicBlockTradesResponse ¶
type PublicBlockTradesResponse struct { BlockTradeID string `json:"blockTdId"` CreationTime okxUnixMilliTime `json:"cTime"` Legs []BlockTradeLeg `json:"legs"` }
PublicBlockTradesResponse represents data will be pushed whenever there is a block trade.
type PublicBorrowHistory ¶
type PublicBorrowHistory struct { Amount types.Number `json:"amt"` Currency string `json:"ccy"` Rate types.Number `json:"rate"` Timestamp okxUnixMilliTime `json:"ts"` }
PublicBorrowHistory holds a currencies borrow history.
type PublicBorrowInfo ¶
type PublicBorrowInfo struct { Currency string `json:"ccy"` AverageAmount types.Number `json:"avgAmt"` AverageAmountUSD types.Number `json:"avgAmtUsd"` AverageRate types.Number `json:"avgRate"` PreviousRate types.Number `json:"preRate"` EstimatedRate types.Number `json:"estRate"` }
PublicBorrowInfo holds a currency's borrow info.
type PurchaseInvestDataItem ¶
type PurchaseInvestDataItem struct { Currency string `json:"ccy"` Amount types.Number `json:"amt"` }
PurchaseInvestDataItem represents purchase invest data information having the currency and amount information
type PurchaseRequestParam ¶
type PurchaseRequestParam struct { ProductID string `json:"productId"` Term int `json:"term,string,omitempty"` InvestData []PurchaseInvestDataItem `json:"investData"` }
PurchaseRequestParam represents purchase request param specific product
type QuoteLeg ¶
type QuoteLeg struct { Price types.Number `json:"px"` SizeOfQuoteLeg types.Number `json:"sz"` InstrumentID string `json:"instId"` Side order.Side `json:"side"` // TargetCurrency represents target currency TargetCurrency string `json:"tgtCcy,omitempty"` }
QuoteLeg the legs of the Quote.
func (*QuoteLeg) MarshalJSON ¶
MarshalJSON serialized QuoteLeg instance into bytes
type QuoteRequestParams ¶
type QuoteRequestParams struct { RfqID string ClientRfqID string QuoteID string ClientQuoteID string State string BeginID string EndID string Limit int64 }
QuoteRequestParams request params.
type QuoteResponse ¶
type QuoteResponse struct { CreationTime okxUnixMilliTime `json:"cTime"` UpdateTime okxUnixMilliTime `json:"uTime"` ValidUntil okxUnixMilliTime `json:"validUntil"` QuoteID string `json:"quoteId"` ClientQuoteID string `json:"clQuoteId"` RfqID string `json:"rfqId"` QuoteSide string `json:"quoteSide"` ClientRfqID string `json:"clRfqId"` TraderCode string `json:"traderCode"` State string `json:"state"` Legs []QuoteLeg `json:"legs"` }
QuoteResponse holds create quote response variables.
type RedeemRequestParam ¶
type RedeemRequestParam struct { OrderID string `json:"ordId"` ProtocolType string `json:"protocolType"` AllowEarlyRedeem bool `json:"allowEarlyRedeem"` }
RedeemRequestParam represents redeem request input param
type RfqOrderLeg ¶
type RfqOrderLeg struct { Size string `json:"sz"` Side string `json:"side"` InstrumentID string `json:"instId"` TgtCurrency string `json:"tgtCcy,omitempty"` }
RfqOrderLeg represents Rfq Order responses leg.
type RfqRequestParams ¶
type RfqRequestParams struct { RfqID string ClientRfqID string State string BeginningID string EndID string Limit int64 }
RfqRequestParams represents get Rfq orders param
type RfqResponse ¶
type RfqResponse struct { CreateTime okxUnixMilliTime `json:"cTime"` UpdateTime okxUnixMilliTime `json:"uTime"` ValidUntil okxUnixMilliTime `json:"validUntil"` TraderCode string `json:"traderCode"` RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` State string `json:"state"` Counterparties []string `json:"counterparties"` Legs []struct { InstrumentID string `json:"instId"` Size string `json:"sz"` Side string `json:"side"` TgtCcy string `json:"tgtCcy"` } `json:"legs"` }
RfqResponse Rfq response detail.
type RfqTradeResponse ¶
type RfqTradeResponse struct { RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` QuoteID string `json:"quoteId"` ClientQuoteID string `json:"clQuoteId"` BlockTradeID string `json:"blockTdId"` Legs []BlockTradeLeg `json:"legs"` CreationTime time.Time `json:"cTime"` TakerTraderCode string `json:"tTraderCode"` MakerTraderCode string `json:"mTraderCode"` }
RfqTradeResponse Rfq trade response
func (*RfqTradeResponse) UnmarshalJSON ¶
func (a *RfqTradeResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type RfqTradesRequestParams ¶
type RfqTradesRequestParams struct { RfqID string ClientRfqID string QuoteID string BlockTradeID string ClientQuoteID string State string BeginID string EndID string Limit int64 }
RfqTradesRequestParams represents Rfq trades request param
type SavingBalanceResponse ¶
type SavingBalanceResponse struct { Earnings types.Number `json:"earnings"` RedemptAmount types.Number `json:"redemptAmt"` Rate types.Number `json:"rate"` Currency string `json:"ccy"` Amount types.Number `json:"amt"` LoanAmount types.Number `json:"loanAmt"` PendingAmount types.Number `json:"pendingAmt"` }
SavingBalanceResponse returns a saving response.
type SavingsPurchaseRedemptionInput ¶
type SavingsPurchaseRedemptionInput struct { Currency string `json:"ccy"` // REQUIRED: Amount float64 `json:"amt,string"` // REQUIRED: purchase or redemption amount ActionType string `json:"side"` // REQUIRED: action type \"purchase\" or \"redemption\" Rate float64 `json:"rate,string"` // REQUIRED: }
SavingsPurchaseRedemptionInput input json to SavingPurchase Post merthod.
type SavingsPurchaseRedemptionResponse ¶
type SavingsPurchaseRedemptionResponse struct { Currency string `json:"ccy"` Amount types.Number `json:"amt"` ActionType string `json:"side"` Rate types.Number `json:"rate"` }
SavingsPurchaseRedemptionResponse response json to SavingPurchase or SavingRedemption Post method.
type ServerTime ¶
type ServerTime struct {
Timestamp okxUnixMilliTime `json:"ts"`
}
ServerTime returning the server time instance.
type SetLeverageInput ¶
type SetLeverageInput struct { Leverage float64 `json:"lever,string"` // set leverage for isolated MarginMode string `json:"mgnMode"` // Margin Mode "cross" and "isolated" InstrumentID string `json:"instId,omitempty"` // Optional: Currency string `json:"ccy,omitempty"` // Optional: PositionSide string `json:"posSide,omitempty"` }
SetLeverageInput represents set leverage request input
type SetLeverageResponse ¶
type SetLeverageResponse struct { Leverage types.Number `json:"lever"` MarginMode string `json:"mgnMode"` // Margin Mode "cross" and "isolated" InstrumentID string `json:"instId"` PositionSide string `json:"posSide"` // "long", "short", and "net" }
SetLeverageResponse represents set leverage response
type SetQuoteProductParam ¶
type SetQuoteProductParam struct { InstrumentType string `json:"instType"` Data []MakerInstrumentSetting `json:"data"` }
SetQuoteProductParam represents set quote product request param
type SetQuoteProductsResult ¶
type SetQuoteProductsResult struct {
Result bool `json:"result"`
}
SetQuoteProductsResult represents set quote products result
type SmallAssetConvertResponse ¶
type SmallAssetConvertResponse struct { Details []struct { Amount string `json:"amt"` // Quantity of currency assets before conversion Currency string `json:"ccy"` // ConvertAmount string `json:"cnvAmt"` // Quantity of OKB after conversion ConversionFee string `json:"fee"` // Fee for conversion, unit in OKB } `json:"details"` TotalConvertAmount string `json:"totalCnvAmt"` // Total quantity of OKB after conversion }
SmallAssetConvertResponse represents a response of converting a small asset to OKB.
type SpotGridAlgoData ¶
type SpotGridAlgoData struct { AlgoID string `json:"algoId"` AlgoOrderType string `json:"algoOrdType"` AnnualizedRate string `json:"annualizedRate"` ArbitrageNumber string `json:"arbitrageNum"` BaseSize string `json:"baseSz"` // Algo order stop reason 0: None 1: Manual stop 2: Take profit // 3: Stop loss 4: Risk control 5: delivery CancelType string `json:"cancelType"` CurBaseSize string `json:"curBaseSz"` CurQuoteSize string `json:"curQuoteSz"` FloatProfit string `json:"floatProfit"` GridNumber string `json:"gridNum"` GridProfit string `json:"gridProfit"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Investment string `json:"investment"` MaximumPrice string `json:"maxPx"` MinimumPrice string `json:"minPx"` PerMaximumProfitRate string `json:"perMaxProfitRate"` PerMinimumProfitRate string `json:"perMinProfitRate"` ProfitAndLossRatio string `json:"pnlRatio"` QuoteSize string `json:"quoteSz"` RunPrice string `json:"runPx"` RunType string `json:"runType"` SingleAmount string `json:"singleAmt"` StopLossTriggerPrice string `json:"slTriggerPx"` State string `json:"state"` // Stop result of spot grid // 0: default, 1: Successful selling of currency at market price, // -1: Failed to sell currency at market price StopResult string `json:"stopResult"` // Stop type Spot grid 1: Sell base currency 2: Keep base currency // Contract grid 1: Market Close All positions 2: Keep positions StopType string `json:"stopType"` TotalAnnualizedRate string `json:"totalAnnualizedRate"` TotalProfitAndLoss string `json:"totalPnl"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` TradeNum string `json:"tradeNum"` TriggerTime okxUnixMilliTime `json:"triggerTime"` CreationTime okxUnixMilliTime `json:"cTime"` PushTime okxUnixMilliTime `json:"pTime"` UpdateTime okxUnixMilliTime `json:"uTime"` }
SpotGridAlgoData represents spot grid algo orders.
type StopGridAlgoOrderRequest ¶
type StopGridAlgoOrderRequest struct { AlgoID string `json:"algoId"` InstrumentID string `json:"instId"` StopType uint `json:"stopType,string"` // Spot grid "1": Sell base currency "2": Keep base currency | Contract grid "1": Market Close All positions "2": Keep positions AlgoOrderType string `json:"algoOrdType"` }
StopGridAlgoOrderRequest represents stop grid algo order request parameter
type StopOrderParams ¶
type StopOrderParams struct { AlgoOrderParams TakeProfitTriggerPrice string `json:"tpTriggerPx"` TakeProfitTriggerPriceType string `json:"tpTriggerPxType"` TakeProfitOrderType string `json:"tpOrdPx"` StopLossTriggerPrice string `json:"slTriggerPx"` StopLossTriggerPriceType string `json:"slTriggerPxType"` StopLossOrderPrice string `json:"slOrdPx"` }
StopOrderParams holds stop order request payload.
type StrikeOpenInterestAndVolume ¶
type StrikeOpenInterestAndVolume struct { Timestamp time.Time Strike int64 CallOpenInterest float64 PutOpenInterest float64 CallVolume float64 PutVolume float64 }
StrikeOpenInterestAndVolume represents open interest and volume for both buyers and sellers of calls and puts.
type SubAccountAPIKeyParam ¶
type SubAccountAPIKeyParam struct { SubAccountName string `json:"subAcct"` // Sub-account name APIKey string `json:"apiKey"` // Sub-accountAPI public key Label string `json:"label,omitempty"` // Sub-account APIKey label APIKeyPermission string `json:"perm,omitempty"` // Sub-account APIKey permissions IP string `json:"ip,omitempty"` // Sub-account APIKey linked IP addresses, separate with commas if more than Permissions []string `json:"-"` }
SubAccountAPIKeyParam represents Reset the APIKey of a sub-account request param
type SubAccountAPIKeyResponse ¶
type SubAccountAPIKeyResponse struct { SubAccountName string `json:"subAcct"` APIKey string `json:"apiKey"` Label string `json:"label"` APIKeyPermission string `json:"perm"` IP string `json:"ip"` Timestamp okxUnixMilliTime `json:"ts"` }
SubAccountAPIKeyResponse represents sub-account api key reset response
type SubAccountAssetTransferParams ¶
type SubAccountAssetTransferParams struct { Currency string `json:"ccy"` // {REQUIRED} Amount float64 `json:"amt,string"` // {REQUIRED} From int64 `json:"from,string"` // {REQUIRED} 6:Funding Account 18:Trading account To int64 `json:"to,string"` // {REQUIRED} 6:Funding Account 18:Trading account FromSubAccount string `json:"fromSubAccount"` // {REQUIRED} subaccount name. ToSubAccount string `json:"toSubAccount"` // {REQUIRED} destination sub-account LoanTransfer bool `json:"loanTrans,omitempty"` OmitPositionRisk bool `json:"omitPosRisk,omitempty"` }
SubAccountAssetTransferParams represents subaccount asset transfer request parameters.
type SubaccountBalanceDetail ¶
type SubaccountBalanceDetail struct { AvailableBalance string `json:"availBal"` AvailableEquity string `json:"availEq"` CashBalance string `json:"cashBal"` Currency string `json:"ccy"` CrossLiability string `json:"crossLiab"` DiscountEquity string `json:"disEq"` Equity string `json:"eq"` EquityUsd string `json:"eqUsd"` FrozenBalance string `json:"frozenBal"` Interest string `json:"interest"` IsoEquity string `json:"isoEq"` IsolatedLiabilities string `json:"isoLiab"` LiabilitiesOfCurrency string `json:"liab"` MaxLoan string `json:"maxLoan"` MarginRatio string `json:"mgnRatio"` NotionalLeverage string `json:"notionalLever"` OrdFrozen string `json:"ordFrozen"` Twap string `json:"twap"` UpdateTime okxUnixMilliTime `json:"uTime"` UnrealizedProfitAndLoss string `json:"upl"` UnrealizedProfitAndLiabilities string `json:"uplLiab"` }
SubaccountBalanceDetail represents subaccount balance detail
type SubaccountBalanceResponse ¶
type SubaccountBalanceResponse struct { AdjustedEffectiveEquity string `json:"adjEq"` Details []SubaccountBalanceDetail `json:"details"` Imr string `json:"imr"` IsolatedMarginEquity string `json:"isoEq"` MarginRatio string `json:"mgnRatio"` MaintenanceMarginRequirement string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` OrdFroz string `json:"ordFroz"` TotalEq string `json:"totalEq"` UpdateTime okxUnixMilliTime `json:"uTime"` }
SubaccountBalanceResponse represents subaccount balance response
type SubaccountBillItem ¶
type SubaccountBillItem struct { BillID string `json:"billId"` Type string `json:"type"` AccountCurrencyBalance string `json:"ccy"` Amount string `json:"amt"` SubAccount string `json:"subAcct"` Timestamp okxUnixMilliTime `json:"ts"` }
SubaccountBillItem represents subaccount balance bill item
type SubaccountInfo ¶
type SubaccountInfo struct { Enable bool `json:"enable"` SubAccountName string `json:"subAcct"` SubaccountType string `json:"type"` // sub-account note SubaccountLabel string `json:"label"` MobileNumber string `json:"mobile"` // Mobile number that linked with the sub-account. GoogleAuth bool `json:"gAuth"` // If the sub-account switches on the Google Authenticator for login authentication. CanTransferOut bool `json:"canTransOut"` // If can transfer out, false: can not transfer out, true: can transfer. Timestamp okxUnixMilliTime `json:"ts"` }
SubaccountInfo represents subaccount information detail.
type SubaccountName ¶
type SubaccountName struct {
SubaccountName string `json:"subAcct"`
}
SubaccountName represents single subaccount name
type SubscriptionInfo ¶
type SubscriptionInfo struct { Channel string `json:"channel"` InstrumentID string `json:"instId,omitempty"` InstrumentType string `json:"instType,omitempty"` Underlying string `json:"uly,omitempty"` UID string `json:"uid,omitempty"` // user identifier // For Algo Orders AlgoID string `json:"algoId,omitempty"` Currency string `json:"ccy,omitempty"` // Currency: }
SubscriptionInfo holds the channel and instrument IDs.
type SubscriptionOperationInput ¶
type SubscriptionOperationInput struct { Operation string `json:"op"` Arguments []SubscriptionInfo `json:"args"` }
SubscriptionOperationInput represents the account channel input data
type SubscriptionOperationResponse ¶
type SubscriptionOperationResponse struct { Event string `json:"event"` Argument *SubscriptionInfo `json:"arg,omitempty"` Code string `json:"code,omitempty"` Msg string `json:"msg,omitempty"` }
SubscriptionOperationResponse holds account subscription response thought the websocket channel.
type SupportedCoinsData ¶
type SupportedCoinsData struct { Contract []string `json:"contract"` TradingOptions []string `json:"option"` Spot []string `json:"spot"` }
SupportedCoinsData holds information about currencies supported by the trading data endpoints.
type SystemStatusResponse ¶
type SystemStatusResponse struct { Title string `json:"title"` State string `json:"state"` Begin okxUnixMilliTime `json:"begin"` // Begin time of system maintenance, End okxUnixMilliTime `json:"end"` // Time of resuming trading totally. Href string `json:"href"` // Hyperlink for system maintenance details ServiceType string `json:"serviceType"` System string `json:"system"` ScheduleDescription string `json:"scheDesc"` // PushTime timestamp information when the data is pushed PushTime okxUnixMilliTime `json:"ts"` }
SystemStatusResponse represents the system status and other details.
type TakerVolume ¶
TakerVolume represents taker volume information with creation timestamp
type TickerResponse ¶
type TickerResponse struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` LastTradePrice types.Number `json:"last"` LastTradeSize types.Number `json:"lastSz"` BestAskPrice types.Number `json:"askPx"` BestAskSize types.Number `json:"askSz"` BestBidPrice types.Number `json:"bidPx"` BestBidSize types.Number `json:"bidSz"` Open24H types.Number `json:"open24h"` High24H types.Number `json:"high24h"` Low24H types.Number `json:"low24h"` VolCcy24H types.Number `json:"volCcy24h"` Vol24H types.Number `json:"vol24h"` OpenPriceInUTC0 string `json:"sodUtc0"` OpenPriceInUTC8 string `json:"sodUtc8"` TickerDataGenerationTime okxUnixMilliTime `json:"ts"` }
TickerResponse represents the market data endpoint ticker detail
type TimestampResponse ¶
type TimestampResponse struct {
Timestamp okxUnixMilliTime `json:"ts"`
}
TimestampResponse holds timestamp response only.
type TradeFeeRate ¶
type TradeFeeRate struct { Category string `json:"category"` DeliveryFeeRate string `json:"delivery"` Exercise string `json:"exercise"` InstrumentType asset.Item `json:"instType"` FeeRateLevel string `json:"level"` FeeRateMaker types.Number `json:"maker"` FeeRateMakerUSDT types.Number `json:"makerU"` FeeRateMakerUSDC types.Number `json:"makerUSDC"` FeeRateTaker types.Number `json:"taker"` FeeRateTakerUSDT types.Number `json:"takerU"` FeeRateTakerUSDC types.Number `json:"takerUSDC"` Timestamp okxUnixMilliTime `json:"ts"` }
TradeFeeRate holds trade fee rate information for a given instrument type.
type TradeOneClickRepayParam ¶
type TradeOneClickRepayParam struct { DebtCurrency []string `json:"debtCcy"` RepayCurrency string `json:"repayCcy"` }
TradeOneClickRepayParam represents click one repay param
type TradeResponse ¶
type TradeResponse struct { InstrumentID string `json:"instId"` TradeID string `json:"tradeId"` Price types.Number `json:"px"` Quantity types.Number `json:"sz"` Side order.Side `json:"side"` Timestamp okxUnixMilliTime `json:"ts"` }
TradeResponse represents the recent transaction instance.
type TradingVolumeIn24HR ¶
type TradingVolumeIn24HR struct { BlockVolumeInCNY types.Number `json:"blockVolCny"` BlockVolumeInUSD types.Number `json:"blockVolUsd"` TradingVolumeInUSD types.Number `json:"volUsd"` TradingVolumeInCny types.Number `json:"volCny"` Timestamp okxUnixMilliTime `json:"ts"` }
TradingVolumeIn24HR response model.
type TransactionDetail ¶
type TransactionDetail struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` TradeID string `json:"tradeId"` OrderID string `json:"ordId"` ClientOrderID string `json:"clOrdId"` BillID string `json:"billId"` Tag string `json:"tag"` FillPrice types.Number `json:"fillPx"` FillSize types.Number `json:"fillSz"` Side order.Side `json:"side"` PositionSide string `json:"posSide"` ExecType string `json:"execType"` FeeCurrency string `json:"feeCcy"` Fee string `json:"fee"` Timestamp okxUnixMilliTime `json:"ts"` }
TransactionDetail holds ecently-filled transaction detail data.
type TransactionDetailRequestParams ¶
type TransactionDetailRequestParams struct { InstrumentType string `json:"instType"` // SPOT , MARGIN, SWAP, FUTURES , option Underlying string `json:"uly"` InstrumentID string `json:"instId"` OrderID string `json:"ordId"` OrderType string `json:"orderType"` After string `json:"after"` // after billid Before string `json:"before"` // before billid Begin time.Time `json:"begin"` End time.Time `json:"end"` Limit int64 `json:"limit"` }
TransactionDetailRequestParams retrieve recently-filled transaction details in the last 3 day.
type TransferFundRateResponse ¶
type TransferFundRateResponse struct { Amount types.Number `json:"amt"` Currency string `json:"ccy"` ClientID string `json:"clientId"` From string `json:"from"` InstrumentID string `json:"instId"` State string `json:"state"` SubAccount string `json:"subAcct"` To string `json:"to"` ToInstrumentID string `json:"toInstId"` TransferID string `json:"transId"` Type int `json:"type,string"` }
TransferFundRateResponse represents funcing transfer rate response
type TransferIDInfo ¶
type TransferIDInfo struct {
TransferID string `json:"transId"`
}
TransferIDInfo represents master account transfer between subaccount.
type UnitConvertResponse ¶
type UnitConvertResponse struct { InstrumentID string `json:"instId"` Price types.Number `json:"px"` Size types.Number `json:"sz"` ConvertType uint64 `json:"type"` Unit string `json:"unit"` }
UnitConvertResponse unit convert response.
func (*UnitConvertResponse) UnmarshalJSON ¶
func (a *UnitConvertResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type UsdCnyExchangeRate ¶
UsdCnyExchangeRate the exchange rate for converting from USD to CNV
type VIPInterestRateAndLoanQuotaInformation ¶
type VIPInterestRateAndLoanQuotaInformation struct { InterestRateLoanQuotaBasic LevelList []struct { Level string `json:"level"` LoanQuota types.Number `json:"loanQuota"` } `json:"levelList"` }
VIPInterestRateAndLoanQuotaInformation holds interest rate and loan quoata information for VIP users.
type WSCandlestickData ¶
type WSCandlestickData struct { Timestamp time.Time `json:"ts"` OpenPrice float64 `json:"o"` HighestPrice float64 `json:"p"` LowestPrice float64 `json:"l"` ClosePrice float64 `json:"c"` TradingVolume float64 `json:"vol"` TradingVolumeWithCurrencyUnit float64 `json:"volCcy"` }
WSCandlestickData represents candlestick data coming through the web socket channels
type WSCandlestickResponse ¶
type WSCandlestickResponse struct { Argument SubscriptionInfo `json:"arg"` Data []WSCandlestickData `json:"data"` }
WSCandlestickResponse represents candlestick response of with list of candlestick and
type WSInstrumentResponse ¶
type WSInstrumentResponse struct { Argument SubscriptionInfo `json:"arg"` Data []Instrument `json:"data"` }
WSInstrumentResponse represents websocket instruments push message.
type WSInstrumentsResponse ¶
type WSInstrumentsResponse struct { Arguments []SubscriptionInfo `json:"args"` Data []Instrument `json:"data"` }
WSInstrumentsResponse represents instrument subscription response.
type WSLoginResponse ¶
type WSLoginResponse struct { Event string `json:"event"` Code string `json:"code"` Msg string `json:"msg"` }
WSLoginResponse represents a websocket login response.
type WSMarketDataResponse ¶
type WSMarketDataResponse struct { Arguments []SubscriptionInfo `json:"args"` Data []TickerResponse `json:"data"` }
WSMarketDataResponse represents market data response and it's arguments.
type WSOpenInterestResponse ¶
type WSOpenInterestResponse struct { Argument SubscriptionInfo `json:"arg"` Data []OpenInterest `json:"data"` }
WSOpenInterestResponse represents an open interest instance.
type WSOrderResponse ¶
type WSOrderResponse struct { ID string `json:"id"` Operation string `json:"op"` Data []OrderData `json:"data"` Code string `json:"code,omitempty"` Msg string `json:"msg,omitempty"` }
WSOrderResponse place order response thought the websocket connection.
type WSPlaceOrder ¶
type WSPlaceOrder struct { ID string `json:"id"` Operation string `json:"op"` Arguments []WSPlaceOrderData `json:"args"` }
WSPlaceOrder holds the websocket place order input data.
type WSPlaceOrderData ¶
type WSPlaceOrderData struct { ClientOrderID string `json:"clOrdId,omitempty"` Currency string `json:"ccy,omitempty"` Tag string `json:"tag,omitempty"` PositionSide string `json:"posSide,omitempty"` ExpiryTime int64 `json:"expTime,string,omitempty"` BanAmend bool `json:"banAmend,omitempty"` Side string `json:"side"` InstrumentID string `json:"instId"` TradeMode string `json:"tdMode"` OrderType string `json:"ordType"` Size float64 `json:"sz"` Price types.Number `json:"px,omitempty"` ReduceOnly bool `json:"reduceOnly,string,omitempty"` TargetCurrency string `json:"tgtCurrency,omitempty"` }
WSPlaceOrderData holds websocket order information.
type WSPlaceOrderInput ¶
type WSPlaceOrderInput struct { Side order.Side `json:"side"` InstrumentID string `json:"instId"` TradeMode string `json:"tdMode"` OrderType string `json:"ordType"` Size types.Number `json:"sz"` Currency string `json:"ccy"` ClientOrderID string `json:"clOrdId,omitempty"` Tag string `json:"tag,omitempty"` PositionSide string `json:"posSide,omitempty"` Price types.Number `json:"px,omitempty"` ReduceOnly bool `json:"reduceOnly,omitempty"` TargetCurrency string `json:"tgtCcy"` }
WSPlaceOrderInput place order input variables as a json.
type WSSubscriptionInformation ¶
type WSSubscriptionInformation struct { Operation string `json:"op"` Arguments SubscriptionInfo `json:"arg"` }
WSSubscriptionInformation websocket subscription and unsubscription operation inputs.
type WSSubscriptionInformationList ¶
type WSSubscriptionInformationList struct { Operation string `json:"op"` Arguments []SubscriptionInfo `json:"args"` }
WSSubscriptionInformationList websocket subscription and unsubscription operation inputs.
type WSSubscriptionResponse ¶
type WSSubscriptionResponse struct { Event string `json:"event"` Argument SubscriptionInfo `json:"arg,,omitempty"` Code int `json:"code,string,omitempty"` Msg string `json:"msg,omitempty"` }
WSSubscriptionResponse represents websocket subscription information.
type WSTickerResponse ¶
type WSTickerResponse struct { Argument SubscriptionInfo `json:"arg"` Data []TickerResponse `json:"data"` }
WSTickerResponse represents websocket ticker response.
type WSTradeData ¶
type WSTradeData struct { InstrumentID string `json:"instId"` TradeID string `json:"tradeId"` Price types.Number `json:"px"` Size types.Number `json:"sz"` Side order.Side `json:"side"` Timestamp okxUnixMilliTime `json:"ts"` }
WSTradeData websocket trade data response.
type WebsocketDataResponse ¶
type WebsocketDataResponse struct { Argument SubscriptionInfo `json:"arg"` Action string `json:"action"` Data []interface{} `json:"data"` }
WebsocketDataResponse represents all pushed websocket data coming thought the websocket connection
type WebsocketEventRequest ¶
type WebsocketEventRequest struct { Operation string `json:"op"` // 1--subscribe 2--unsubscribe 3--login Arguments []WebsocketLoginData `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 WebsocketLoginData ¶
type WebsocketLoginData struct { APIKey string `json:"apiKey"` Passphrase string `json:"passphrase"` Timestamp time.Time `json:"timestamp"` Sign string `json:"sign"` }
WebsocketLoginData represents the websocket login data input json data.
func (*WebsocketLoginData) MarshalJSON ¶
func (a *WebsocketLoginData) MarshalJSON() ([]byte, error)
MarshalJSON serializes the WebsocketLoginData object
func (*WebsocketLoginData) UnmarshalJSON ¶
func (a *WebsocketLoginData) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON, and timestamp information.
type WithdrawalHistoryResponse ¶
type WithdrawalHistoryResponse struct { ChainName string `json:"chain"` WithdrawalFee types.Number `json:"fee"` Currency string `json:"ccy"` ClientID string `json:"clientId"` Amount types.Number `json:"amt"` TransactionID string `json:"txId"` // Hash record of the withdrawal. This parameter will not be returned for internal transfers. FromRemittingAddress string `json:"from"` ToReceivingAddress string `json:"to"` StateOfWithdrawal string `json:"state"` Timestamp okxUnixMilliTime `json:"ts"` WithdrawalID string `json:"wdId"` PaymentID string `json:"pmtId,omitempty"` Memo string `json:"memo"` }
WithdrawalHistoryResponse represents the withdrawal response history.
type WithdrawalInput ¶
type WithdrawalInput struct { Amount float64 `json:"amt,string"` TransactionFee float64 `json:"fee,string"` WithdrawalDestination string `json:"dest"` Currency string `json:"ccy"` ChainName string `json:"chain"` ToAddress string `json:"toAddr"` ClientID string `json:"clientId"` }
WithdrawalInput represents request parameters for cryptocurrency withdrawal
type WithdrawalResponse ¶
type WithdrawalResponse struct { Amount types.Number `json:"amt"` WithdrawalID string `json:"wdId"` Currency string `json:"ccy"` ClientID string `json:"clientId"` Chain string `json:"chain"` }
WithdrawalResponse cryptocurrency withdrawal response
type WsAccountChannelPushData ¶
type WsAccountChannelPushData struct { Argument SubscriptionInfo `json:"arg"` Data []Account `json:"data,omitempty"` }
WsAccountChannelPushData holds the websocket push data following the subscription.
type WsAdvancedAlgoOrder ¶
type WsAdvancedAlgoOrder struct { Argument SubscriptionInfo `json:"arg"` Data []WsAdvancedAlgoOrderDetail `json:"data"` }
WsAdvancedAlgoOrder advanced algo order response.
type WsAdvancedAlgoOrderDetail ¶
type WsAdvancedAlgoOrderDetail struct { ActualPrice string `json:"actualPx"` ActualSide string `json:"actualSide"` ActualSize string `json:"actualSz"` AlgoID string `json:"algoId"` Currency string `json:"ccy"` Count string `json:"count"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Leverage string `json:"lever"` NotionalUsd string `json:"notionalUsd"` OrderPrice string `json:"ordPx"` OrdType string `json:"ordType"` PositionSide string `json:"posSide"` PriceLimit string `json:"pxLimit"` PriceSpread string `json:"pxSpread"` PriceVariation string `json:"pxVar"` Side order.Side `json:"side"` StopLossOrderPrice string `json:"slOrdPx"` StopLossTriggerPrice string `json:"slTriggerPx"` State string `json:"state"` Size string `json:"sz"` SizeLimit string `json:"szLimit"` TradeMode string `json:"tdMode"` TimeInterval string `json:"timeInterval"` TakeProfitOrderPrice string `json:"tpOrdPx"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` Tag string `json:"tag"` TriggerPrice string `json:"triggerPx"` CallbackRatio string `json:"callbackRatio"` CallbackSpread string `json:"callbackSpread"` ActivePrice string `json:"activePx"` MoveTriggerPrice string `json:"moveTriggerPx"` CreationTime okxUnixMilliTime `json:"cTime"` PushTime okxUnixMilliTime `json:"pTime"` TriggerTime okxUnixMilliTime `json:"triggerTime"` }
WsAdvancedAlgoOrderDetail advanced algo order response pushed through the websocket conn
type WsAlgoOrder ¶
type WsAlgoOrder struct { Argument SubscriptionInfo `json:"arg"` Data []WsAlgoOrderDetail `json:"data"` }
WsAlgoOrder algo order detailed data.
type WsAlgoOrderDetail ¶
type WsAlgoOrderDetail struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` OrderID string `json:"ordId"` Currency string `json:"ccy"` AlgoID string `json:"algoId"` Price string `json:"px"` Size string `json:"sz"` TradeMode string `json:"tdMode"` TargetCurrency string `json:"tgtCcy"` NotionalUsd string `json:"notionalUsd"` OrderType string `json:"ordType"` Side order.Side `json:"side"` PositionSide string `json:"posSide"` State string `json:"state"` Leverage string `json:"lever"` TakeProfitTriggerPrice string `json:"tpTriggerPx"` TakeProfitTriggerPriceType string `json:"tpTriggerPxType"` TakeProfitOrdPrice string `json:"tpOrdPx"` StopLossTriggerPrice string `json:"slTriggerPx"` StopLossTriggerPriceType string `json:"slTriggerPxType"` TriggerPrice string `json:"triggerPx"` TriggerPriceType string `json:"triggerPxType"` OrderPrice types.Number `json:"ordPx"` ActualSize string `json:"actualSz"` ActualPrice string `json:"actualPx"` Tag string `json:"tag"` ActualSide string `json:"actualSide"` TriggerTime okxUnixMilliTime `json:"triggerTime"` CreationTime okxUnixMilliTime `json:"cTime"` }
WsAlgoOrderDetail algo order response pushed through the websocket conn
type WsAmendOrderInput ¶
type WsAmendOrderInput struct { ID string `json:"id"` Operation string `json:"op"` Arguments []AmendOrderRequestParams `json:"args"` }
WsAmendOrderInput websocket handler amend Order response
type WsBalanceAndPosition ¶
type WsBalanceAndPosition struct { Argument SubscriptionInfo `json:"arg"` Data []BalanceAndPositionData `json:"data"` }
WsBalanceAndPosition websocket push data for lis of BalanceAndPosition information.
type WsBlockTicker ¶
type WsBlockTicker struct { Argument SubscriptionInfo `json:"arg"` Data []BlockTicker `json:"data"` }
WsBlockTicker represents websocket push data as a result of subscription to channel "block-tickers".
type WsBlockTradeResponse ¶
type WsBlockTradeResponse struct { CreationTime okxUnixMilliTime `json:"cTime"` RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` QuoteID string `json:"quoteId"` ClientQuoteID string `json:"clQuoteId"` BlockTradeID string `json:"blockTdId"` TakerTraderCode string `json:"tTraderCode"` MakerTraderCode string `json:"mTraderCode"` Legs []OrderLeg `json:"legs"` }
WsBlockTradeResponse represents a structure block order information
type WsCancelOrderInput ¶
type WsCancelOrderInput struct { ID string `json:"id"` Operation string `json:"op"` Arguments []CancelOrderRequestParam `json:"args"` }
WsCancelOrderInput websocket cancel order request
type WsContractGridAlgoOrder ¶
type WsContractGridAlgoOrder struct { Argument SubscriptionInfo `json:"arg"` Data []ContractGridAlgoOrder `json:"data"` }
WsContractGridAlgoOrder represents websocket push data for "grid-orders-contract" subscription
type WsDeliveryEstimatedPrice ¶
type WsDeliveryEstimatedPrice struct { Argument SubscriptionInfo `json:"arg"` Data []DeliveryEstimatedPrice `json:"data"` }
WsDeliveryEstimatedPrice represents an estimated delivery/exercise price push data as a result of subscription to "estimated-price" channel
type WsFundingRate ¶
type WsFundingRate struct { Argument SubscriptionInfo `json:"arg"` Data []FundingRateResponse `json:"data"` }
WsFundingRate represents websocket push data funding rate response.
type WsGreekData ¶
type WsGreekData struct { ThetaBS string `json:"thetaBS"` ThetaPA string `json:"thetaPA"` DeltaBS string `json:"deltaBS"` DeltaPA string `json:"deltaPA"` GammaBS string `json:"gammaBS"` GammaPA string `json:"gammaPA"` VegaBS string `json:"vegaBS"` VegaPA string `json:"vegaPA"` Currency string `json:"ccy"` Timestamp okxUnixMilliTime `json:"ts"` }
WsGreekData greeks push data through websocket channel
type WsGreeks ¶
type WsGreeks struct { Argument SubscriptionInfo `json:"arg"` Data []WsGreekData `json:"data"` }
WsGreeks greeks push data with the subscription info through websocket channel
type WsGridPosition ¶
type WsGridPosition struct { Argument SubscriptionInfo `json:"arg"` Data []GridPositionData `json:"data"` }
WsGridPosition represents websocket push data for "grid-positions" subscription
type WsGridSubOrderData ¶
type WsGridSubOrderData struct { Argument SubscriptionInfo `json:"arg"` Data []GridSubOrderData `json:"data"` }
WsGridSubOrderData to retrieve grid sub orders. Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing order.
type WsIndexTicker ¶
type WsIndexTicker struct { Argument SubscriptionInfo `json:"arg"` Data []IndexTicker `json:"data"` }
WsIndexTicker represents websocket push data index ticker response
type WsMarkPrice ¶
type WsMarkPrice struct { Argument SubscriptionInfo `json:"arg"` Data []MarkPrice `json:"data"` }
WsMarkPrice represents an estimated mark price push data as a result of subscription to "mark-price" channel
type WsOptionSummary ¶
type WsOptionSummary struct { Argument SubscriptionInfo `json:"arg"` Data []OptionMarketDataResponse `json:"data"` }
WsOptionSummary represents option summary
type WsOrder ¶
type WsOrder struct { PendingOrderItem AmendResult string `json:"amendResult"` Code string `json:"code"` ExecType string `json:"execType"` FillFee types.Number `json:"fillFee"` FillFeeCurrency string `json:"fillFeeCcy"` FillNotionalUsd types.Number `json:"fillNotionalUsd"` Msg string `json:"msg"` NotionalUSD types.Number `json:"notionalUsd"` ReduceOnly bool `json:"reduceOnly,string"` RequestID string `json:"reqId"` }
WsOrder represents a websocket order.
type WsOrderActionResponse ¶
type WsOrderActionResponse struct { ID string `json:"id"` Operation string `json:"op"` Data []OrderData `json:"data"` Code string `json:"code"` Msg string `json:"msg"` }
WsOrderActionResponse holds websocket response Amendment request
type WsOrderBook ¶
type WsOrderBook struct { Argument SubscriptionInfo `json:"arg"` Action string `json:"action"` Data []WsOrderBookData `json:"data"` }
WsOrderBook order book represents order book push data which is returned as a result of subscription to "books*" channel
type WsOrderBookData ¶
type WsOrderBookData struct { Asks [][4]string `json:"asks"` Bids [][4]string `json:"bids"` Timestamp okxUnixMilliTime `json:"ts"` Checksum int32 `json:"checksum,omitempty"` }
WsOrderBookData represents a book order push data.
type WsOrderResponse ¶
type WsOrderResponse struct { Argument SubscriptionInfo `json:"arg"` Data []WsOrder `json:"data"` }
WsOrderResponse holds order list push data through the websocket connection
type WsOrderbook5 ¶
type WsOrderbook5 struct { Argument struct { Channel string `json:"channel"` InstrumentID string `json:"instId"` } `json:"arg"` Data []Book5Data `json:"data"` }
WsOrderbook5 stores the orderbook data for orderbook 5 websocket
type WsPlaceOrderInput ¶
type WsPlaceOrderInput struct { ID string `json:"id"` Operation string `json:"op"` Arguments []PlaceOrderRequestParam `json:"args"` }
WsPlaceOrderInput for all websocket request inputs.
type WsPositionResponse ¶
type WsPositionResponse struct { Argument SubscriptionInfo `json:"arg"` Arguments []AccountPosition `json:"data"` }
WsPositionResponse represents pushed position data through the websocket channel.
type WsPublicTradesResponse ¶
type WsPublicTradesResponse struct { Argument SubscriptionInfo `json:"arg"` Data []PublicBlockTradesResponse `json:"data"` }
WsPublicTradesResponse represents websocket push data of structured block trades as a result of subscription to "public-struc-block-trades"
type WsQuote ¶
type WsQuote struct { Arguments SubscriptionInfo `json:"arg"` Data []WsQuoteData `json:"data"` }
WsQuote represents websocket push data for "quotes" subscription
type WsQuoteData ¶
type WsQuoteData struct { ValidUntil okxUnixMilliTime `json:"validUntil"` UpdatedTime okxUnixMilliTime `json:"uTime"` CreationTime okxUnixMilliTime `json:"cTime"` Legs []OrderLeg `json:"legs"` QuoteID string `json:"quoteId"` RfqID string `json:"rfqId"` TraderCode string `json:"traderCode"` QuoteSide string `json:"quoteSide"` State string `json:"state"` ClientQuoteID string `json:"clQuoteId"` }
WsQuoteData represents a single quote order information
type WsRfq ¶
type WsRfq struct { Argument SubscriptionInfo `json:"arg"` Data []WsRfqData `json:"data"` }
WsRfq represents websocket push data for "rfqs" subscription
type WsRfqData ¶
type WsRfqData struct { CreationTime time.Time `json:"cTime"` UpdateTime time.Time `json:"uTime"` TraderCode string `json:"traderCode"` RfqID string `json:"rfqId"` ClientRfqID string `json:"clRfqId"` State string `json:"state"` ValidUntil string `json:"validUntil"` Counterparties []string `json:"counterparties"` Legs []RfqOrderLeg `json:"legs"` }
WsRfqData represents rfq order response data streamed through the websocket channel
type WsSpotGridAlgoOrder ¶
type WsSpotGridAlgoOrder struct { Argument SubscriptionInfo `json:"arg"` Data []SpotGridAlgoData `json:"data"` }
WsSpotGridAlgoOrder represents websocket push data for "struc-block-trades" subscription
type WsStructureBlocTrade ¶
type WsStructureBlocTrade struct { Argument SubscriptionInfo `json:"arg"` Data []WsBlockTradeResponse `json:"data"` }
WsStructureBlocTrade represents websocket push data for "struc-block-trades" subscription
type WsSystemStatusResponse ¶
type WsSystemStatusResponse struct { Argument SubscriptionInfo `json:"arg"` Data []SystemStatusResponse `json:"data"` }
WsSystemStatusResponse represents websocket push data system status push data
type WsTradeOrder ¶
type WsTradeOrder struct { Argument SubscriptionInfo `json:"arg"` Data []TradeResponse `json:"data"` }
WsTradeOrder represents a trade push data response as a result subscription to "trades" channel