okex

package
v0.0.0-...-81ab215 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// OkExWebsocketURL WebsocketURL
	OkExWebsocketURL = "wss://real.okex.com:8443/ws/v3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OKEX

type OKEX struct {
	okgroup.OKGroup
}

OKEX bases all account, spot and margin methods off okgroup implementation

func (*OKEX) CancelBatchOrders

func (o *OKEX) CancelBatchOrders(_ []order.Cancel) (order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*OKEX) CancelETTOrder

func (o *OKEX) CancelETTOrder(orderID string) (resp okgroup.PlaceETTOrderResponse, _ error)

CancelETTOrder Cancel an unfilled order.

func (*OKEX) CancelFuturesOrder

func (o *OKEX) CancelFuturesOrder(request okgroup.CancelFuturesOrderRequest) (resp okgroup.CancelFuturesOrderResponse, _ error)

CancelFuturesOrder Cancelling an unfilled order.

func (*OKEX) CancelFuturesOrderBatch

func (o *OKEX) CancelFuturesOrderBatch(request okgroup.CancelMultipleSpotOrdersRequest) (resp okgroup.CancelMultipleSpotOrdersResponse, _ error)

CancelFuturesOrderBatch With best effort, cancel all open orders.

func (*OKEX) CancelMultipleSwapOrders

func (o *OKEX) CancelMultipleSwapOrders(request okgroup.CancelMultipleSwapOrdersRequest) (resp okgroup.CancelMultipleSwapOrdersResponse, _ error)

CancelMultipleSwapOrders With best effort, cancel all open orders.

func (*OKEX) CancelSwapOrder

func (o *OKEX) CancelSwapOrder(request okgroup.CancelSwapOrderRequest) (resp okgroup.CancelSwapOrderResponse, _ error)

CancelSwapOrder Cancelling an unfilled order

func (*OKEX) FetchTicker

func (o *OKEX) FetchTicker(p currency.Pair, assetType asset.Item) (tickerData *ticker.Price, err error)

FetchTicker returns the ticker for a currency pair

func (*OKEX) FetchTradablePairs

func (o *OKEX) FetchTradablePairs(i asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*OKEX) GetAllFuturesTokenInfo

func (o *OKEX) GetAllFuturesTokenInfo() (resp []okgroup.GetFuturesTokenInfoResponse, _ error)

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

func (*OKEX) GetAllMarginRates

func (o *OKEX) GetAllMarginRates() ([]okgroup.MarginCurrencyData, error)

GetAllMarginRates gets interest rates for all margin currencies on OKEX

func (*OKEX) GetAllSwapTokensInformation

func (o *OKEX) GetAllSwapTokensInformation() (resp []okgroup.GetAllSwapTokensInformationResponse, _ error)

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

func (*OKEX) GetDefaultConfig

func (o *OKEX) GetDefaultConfig() (*config.ExchangeConfig, error)

GetDefaultConfig returns a default exchange config

func (*OKEX) GetETT

func (o *OKEX) GetETT() (resp []okgroup.GetETTResponse, _ error)

GetETT List the assets in ETT account. Get information such as balance, amount on hold/ available.

func (*OKEX) GetETTAccountInformationForCurrency

func (o *OKEX) GetETTAccountInformationForCurrency(currency string) (resp okgroup.GetETTResponse, _ error)

GetETTAccountInformationForCurrency Getting the balance, amount available/on hold of a token in ETT account.

func (*OKEX) GetETTBillsDetails

func (o *OKEX) GetETTBillsDetails(currency string) (resp []okgroup.GetETTBillsDetailsResponse, _ error)

GetETTBillsDetails Bills details. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first

func (*OKEX) GetETTConstituents

func (o *OKEX) GetETTConstituents(ett string) (resp okgroup.GetETTConstituentsResponse, _ error)

GetETTConstituents Get ETT Constituents.This is a public endpoint, no identity verification is needed.

func (*OKEX) GetETTOrderDetails

func (o *OKEX) GetETTOrderDetails(orderID string) (resp okgroup.GetETTOrderListResponse, _ error)

GetETTOrderDetails Get order details by order ID.

func (*OKEX) GetETTOrderList

func (o *OKEX) GetETTOrderList(request okgroup.GetETTOrderListRequest) (resp []okgroup.GetETTOrderListResponse, _ error)

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

func (*OKEX) GetETTSettlementPriceHistory

func (o *OKEX) GetETTSettlementPriceHistory(ett string) (resp []okgroup.GetETTSettlementPriceHistoryResponse, _ error)

GetETTSettlementPriceHistory Get ETT settlement price history. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFundingRate

func (o *OKEX) GetFundingRate(marketName, limit string) ([]okgroup.PerpSwapFundingRates, error)

GetFundingRate gets funding rate of a given currency

func (*OKEX) GetFuturesAccountOfACurrency

func (o *OKEX) GetFuturesAccountOfACurrency(instrumentID string) (resp okgroup.FuturesCurrencyData, _ error)

GetFuturesAccountOfACurrency Get the futures account info of a token.

func (*OKEX) GetFuturesAccountOfAllCurrencies

func (o *OKEX) GetFuturesAccountOfAllCurrencies() (resp okgroup.FuturesAccountForAllCurrenciesResponse, _ error)

GetFuturesAccountOfAllCurrencies Get the futures account info of all token. Due to high energy consumption, you are advised to capture data with the "Futures Account of a Currency" API instead.

func (*OKEX) GetFuturesBillDetails

GetFuturesBillDetails Shows the account’s historical coin in flow and out flow. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKEX) GetFuturesContractInformation

func (o *OKEX) GetFuturesContractInformation() (resp []okgroup.GetFuturesContractInformationResponse, _ error)

GetFuturesContractInformation Get market data. This endpoint provides the snapshots of market data and can be used without verifications.

func (*OKEX) GetFuturesCurrentMarkPrice

func (o *OKEX) GetFuturesCurrentMarkPrice(instrumentID string) (resp okgroup.GetFuturesCurrentMarkPriceResponse, _ error)

GetFuturesCurrentMarkPrice The maximum buying price and the minimum selling price of the contract. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesCurrentPriceLimit

func (o *OKEX) GetFuturesCurrentPriceLimit(instrumentID string) (resp okgroup.GetFuturesCurrentPriceLimitResponse, _ error)

GetFuturesCurrentPriceLimit The maximum buying price and the minimum selling price of the contract. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesEstimatedDeliveryPrice

func (o *OKEX) GetFuturesEstimatedDeliveryPrice(instrumentID string) (resp okgroup.GetFuturesEstimatedDeliveryPriceResponse, _ error)

GetFuturesEstimatedDeliveryPrice the estimated delivery price. It is available 3 hours before delivery. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesExchangeRates

func (o *OKEX) GetFuturesExchangeRates() (resp okgroup.GetFuturesExchangeRatesResponse, _ error)

GetFuturesExchangeRates Get the fiat exchange rates. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesFilledOrder

func (o *OKEX) GetFuturesFilledOrder(request okgroup.GetFuturesFilledOrderRequest) (resp []okgroup.GetFuturesFilledOrdersResponse, _ error)

GetFuturesFilledOrder Get the recent 300 transactions of all contracts. Pagination is not supported here. The whole book will be returned for one request. Websocket is recommended here.

func (*OKEX) GetFuturesForceLiquidatedOrders

func (o *OKEX) GetFuturesForceLiquidatedOrders(request okgroup.GetFuturesForceLiquidatedOrdersRequest) (resp []okgroup.GetFuturesForceLiquidatedOrdersResponse, _ error)

GetFuturesForceLiquidatedOrders Get force liquidated orders. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesHoldAmount

func (o *OKEX) GetFuturesHoldAmount(instrumentID string) (resp okgroup.GetFuturesHoldAmountResponse, _ error)

GetFuturesHoldAmount Get the number of futures with hold.

func (*OKEX) GetFuturesIndices

func (o *OKEX) GetFuturesIndices(instrumentID string) (resp okgroup.GetFuturesIndicesResponse, _ error)

GetFuturesIndices Get Indices of tokens. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesLeverage

func (o *OKEX) GetFuturesLeverage(instrumentID string) (resp okgroup.GetFuturesLeverageResponse, _ error)

GetFuturesLeverage Get the leverage of the futures account

func (*OKEX) GetFuturesOpenInterests

func (o *OKEX) GetFuturesOpenInterests(instrumentID string) (resp okgroup.GetFuturesOpenInterestsResponse, _ error)

GetFuturesOpenInterests Get the open interest of a contract. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesOrderDetails

func (o *OKEX) GetFuturesOrderDetails(request okgroup.GetFuturesOrderDetailsRequest) (resp okgroup.GetFuturesOrderDetailsResponseData, _ error)

GetFuturesOrderDetails Get order details by order ID.

func (*OKEX) GetFuturesOrderList

func (o *OKEX) GetFuturesOrderList(request okgroup.GetFuturesOrdersListRequest) (resp okgroup.GetFuturesOrderListResponse, _ error)

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

func (*OKEX) GetFuturesPostions

func (o *OKEX) GetFuturesPostions() (resp okgroup.GetFuturesPositionsResponse, _ error)

GetFuturesPostions Get the information of all holding positions in futures trading. Due to high energy consumption, you are advised to capture data with the "Futures Account of a Currency" API instead.

func (*OKEX) GetFuturesPostionsForCurrency

func (o *OKEX) GetFuturesPostionsForCurrency(instrumentID string) (resp okgroup.GetFuturesPositionsForCurrencyResponse, _ error)

GetFuturesPostionsForCurrency Get the information of holding positions of a contract.

func (*OKEX) GetFuturesTagPrice

func (o *OKEX) GetFuturesTagPrice(instrumentID string) (resp okgroup.GetFuturesTagPriceResponse, _ error)

GetFuturesTagPrice Get the tag price. This is a public endpoint, no identity verification is needed.

func (*OKEX) GetFuturesTokenInfoForCurrency

func (o *OKEX) GetFuturesTokenInfoForCurrency(instrumentID string) (resp okgroup.GetFuturesTokenInfoResponse, _ error)

GetFuturesTokenInfoForCurrency Get the last traded price, best bid/ask price, 24 hour trading volume and more info of a contract.

func (*OKEX) GetFuturesTransactionDetails

func (o *OKEX) GetFuturesTransactionDetails(request okgroup.GetFuturesTransactionDetailsRequest) (resp []okgroup.GetFuturesTransactionDetailsResponse, _ error)

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

func (*OKEX) GetMarginRates

func (o *OKEX) GetMarginRates(instrumentID currency.Pair) (okgroup.MarginCurrencyData, error)

GetMarginRates gets interest rates for margin currencies

func (*OKEX) GetPerpSwapMarkets

func (o *OKEX) GetPerpSwapMarkets() ([]okgroup.TickerData, error)

GetPerpSwapMarkets gets perpetual swap markets' data

func (*OKEX) GetRecentTrades

func (o *OKEX) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns recent trade data

func (*OKEX) GetSpotMarkets

func (o *OKEX) GetSpotMarkets() ([]okgroup.TradingPairData, error)

GetSpotMarkets gets perpetual swap markets' data

func (*OKEX) GetSwapAccountOfAllCurrency

func (o *OKEX) GetSwapAccountOfAllCurrency() (resp okgroup.GetSwapAccountOfAllCurrencyResponse, _ error)

GetSwapAccountOfAllCurrency Get the perpetual swap account info of a token. Margin ratio set as 10,000 when users have no open position.

func (*OKEX) GetSwapAccountSettingsOfAContract

func (o *OKEX) GetSwapAccountSettingsOfAContract(instrumentID string) (resp okgroup.GetSwapAccountSettingsOfAContractResponse, _ error)

GetSwapAccountSettingsOfAContract Get leverage level and margin mode of a contract.

func (*OKEX) GetSwapBillDetails

func (o *OKEX) GetSwapBillDetails(request okgroup.GetSpotBillDetailsForCurrencyRequest) (resp []okgroup.GetSwapBillDetailsResponse, _ error)

GetSwapBillDetails Shows the account’s historical coin in flow and out flow. All paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first.

func (*OKEX) GetSwapContractInformation

func (o *OKEX) GetSwapContractInformation() (resp []okgroup.GetSwapContractInformationResponse, _ error)

GetSwapContractInformation Get market data.

func (*OKEX) GetSwapCurrentPriceLimits

func (o *OKEX) GetSwapCurrentPriceLimits(instrumentID string) (resp okgroup.GetSwapCurrentPriceLimitsResponse, _ error)

GetSwapCurrentPriceLimits Get the open interest of a contract.

func (*OKEX) GetSwapExchangeRates

func (o *OKEX) GetSwapExchangeRates() (resp okgroup.GetSwapExchangeRatesResponse, _ error)

GetSwapExchangeRates Get the fiat exchange rates.

func (*OKEX) GetSwapFilledOrdersData

func (o *OKEX) GetSwapFilledOrdersData(request *okgroup.GetSwapFilledOrdersDataRequest) (resp []okgroup.GetSwapFilledOrdersDataResponse, _ error)

GetSwapFilledOrdersData Get details of the recent filled orders

func (*OKEX) GetSwapForceLiquidatedOrders

func (o *OKEX) GetSwapForceLiquidatedOrders(request okgroup.GetSwapForceLiquidatedOrdersRequest) (resp []okgroup.GetSwapForceLiquidatedOrdersResponse, _ error)

GetSwapForceLiquidatedOrders Get force liquidated orders.

func (*OKEX) GetSwapFundingRateHistory

func (o *OKEX) GetSwapFundingRateHistory(request okgroup.GetSwapFundingRateHistoryRequest) (resp []okgroup.GetSwapFundingRateHistoryResponse, _ error)

GetSwapFundingRateHistory Get Funding Rate History.

func (*OKEX) GetSwapIndices

func (o *OKEX) GetSwapIndices(instrumentID string) (resp okgroup.GetSwapIndecesResponse, _ error)

GetSwapIndices Get Indices of tokens.

func (*OKEX) GetSwapMarkPrice

func (o *OKEX) GetSwapMarkPrice(instrumentID string) (resp okgroup.GetSwapMarkPriceResponse, _ error)

GetSwapMarkPrice Get the time of next settlement.

func (*OKEX) GetSwapMarkets

func (o *OKEX) GetSwapMarkets() ([]okgroup.SwapInstrumentsData, error)

GetSwapMarkets gets perpetual swap markets

func (*OKEX) GetSwapNextSettlementTime

func (o *OKEX) GetSwapNextSettlementTime(instrumentID string) (resp okgroup.GetSwapNextSettlementTimeResponse, _ error)

GetSwapNextSettlementTime Get the time of next settlement.

func (*OKEX) GetSwapOnHoldAmountForOpenOrders

func (o *OKEX) GetSwapOnHoldAmountForOpenOrders(instrumentID string) (resp okgroup.GetSwapOnHoldAmountForOpenOrdersResponse, _ error)

GetSwapOnHoldAmountForOpenOrders Get On Hold Amount for Open Orders.

func (*OKEX) GetSwapOpenInterest

func (o *OKEX) GetSwapOpenInterest(instrumentID string) (resp okgroup.GetSwapExchangeRatesResponse, _ error)

GetSwapOpenInterest Get the open interest of a contract.

func (*OKEX) GetSwapOrderDetails

func (o *OKEX) GetSwapOrderDetails(request okgroup.GetSwapOrderDetailsRequest) (resp okgroup.GetSwapOrderListResponseData, _ error)

GetSwapOrderDetails Get order details by order ID.

func (*OKEX) GetSwapOrderList

func (o *OKEX) GetSwapOrderList(request okgroup.GetSwapOrderListRequest) (resp okgroup.GetSwapOrderListResponse, _ error)

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

func (*OKEX) GetSwapPostions

func (o *OKEX) GetSwapPostions() (resp []okgroup.GetSwapPostionsResponse, _ error)

GetSwapPostions Get the information of all holding positions in swap trading. Due to high energy consumption, you are advised to capture data with the "Swap Account of a Currency" API instead.

func (*OKEX) GetSwapPostionsForContract

func (o *OKEX) GetSwapPostionsForContract(instrumentID string) (resp okgroup.GetSwapPostionsResponse, _ error)

GetSwapPostionsForContract Get the information of holding positions of a contract.

func (*OKEX) GetSwapTokensInformationForCurrency

func (o *OKEX) GetSwapTokensInformationForCurrency(instrumentID string) (resp okgroup.GetAllSwapTokensInformationResponse, _ error)

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

func (*OKEX) GetSwapTransactionDetails

func (o *OKEX) GetSwapTransactionDetails(request okgroup.GetSwapTransactionDetailsRequest) (resp []okgroup.GetSwapTransactionDetailsResponse, _ error)

GetSwapTransactionDetails Get details of the recent filled orders

func (*OKEX) PlaceETTOrder

func (o *OKEX) PlaceETTOrder(request *okgroup.PlaceETTOrderRequest) (resp okgroup.PlaceETTOrderResponse, _ error)

PlaceETTOrder You can place subscription or redemption orders under ETT trading. You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold in the order lifecycle. The assets and amount on hold depends on the order's specific type and parameters.

func (*OKEX) PlaceFuturesOrder

func (o *OKEX) PlaceFuturesOrder(request okgroup.PlaceFuturesOrderRequest) (resp okgroup.PlaceFuturesOrderResponse, _ error)

PlaceFuturesOrder OKEx futures trading only supports limit orders. You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold in the order lifecycle. The assets and amount on hold depends on the order's specific type and parameters.

func (*OKEX) PlaceFuturesOrderBatch

func (o *OKEX) PlaceFuturesOrderBatch(request okgroup.PlaceFuturesOrderBatchRequest) (resp okgroup.PlaceFuturesOrderBatchResponse, _ error)

PlaceFuturesOrderBatch Batch contract placing order operation.

func (*OKEX) PlaceMultipleSwapOrders

func (o *OKEX) PlaceMultipleSwapOrders(request okgroup.PlaceMultipleSwapOrdersRequest) (resp okgroup.PlaceMultipleSwapOrdersResponse, _ error)

PlaceMultipleSwapOrders Batch contract placing order operation.

func (*OKEX) PlaceSwapOrder

func (o *OKEX) PlaceSwapOrder(request okgroup.PlaceSwapOrderRequest) (resp okgroup.PlaceSwapOrderResponse, _ error)

PlaceSwapOrder OKEx perpetual swap trading only supports limit orders,USD as quote currency for orders. You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold in the order lifecycle. The assets and amount on hold depends on the order's specific type and parameters.

func (*OKEX) Run

func (o *OKEX) Run()

Run implements the OKEX wrapper

func (*OKEX) SetDefaults

func (o *OKEX) SetDefaults()

SetDefaults method assignes the default values for OKEX

func (*OKEX) SetFuturesLeverage

func (o *OKEX) SetFuturesLeverage(request okgroup.SetFuturesLeverageRequest) (resp okgroup.SetFuturesLeverageResponse, _ error)

SetFuturesLeverage Adjusting the leverage for futures account。 Cross margin request requirements: {"leverage":"10"} Fixed margin request requirements: {"instrument_id":"BTC-USD-180213","direction":"long","leverage":"10"}

func (*OKEX) SetSwapLeverageLevelOfAContract

func (o *OKEX) SetSwapLeverageLevelOfAContract(request okgroup.SetSwapLeverageLevelOfAContractRequest) (resp okgroup.SetSwapLeverageLevelOfAContractResponse, _ error)

SetSwapLeverageLevelOfAContract Setting the leverage level of a contract TODO this returns invalid parameters, but matches spec. Unsure how to fix

func (*OKEX) Start

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

Start starts the OKGroup go routine

func (*OKEX) UpdateTicker

func (o *OKEX) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*OKEX) UpdateTradablePairs

func (o *OKEX) UpdateTradablePairs(forceUpdate bool) error

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

Jump to

Keyboard shortcuts

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