rest

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account

https://www.okx.com/docs-v5/en/#rest-api-account

func NewAccount

func NewAccount(c *ClientRest) *Account

NewAccount returns a pointer to a fresh Account

func (*Account) GetAccountAndPositionRisk

func (c *Account) GetAccountAndPositionRisk(req requests.GetAccountAndPositionRisk) (response responses.GetAccountAndPositionRisk, err error)

GetAccountAndPositionRisk Get account and position risk

https://www.okx.com/docs-v5/en/#rest-api-account-get-account-and-position-risk

func (*Account) GetBalance

func (c *Account) GetBalance(req requests.GetBalance) (response responses.GetBalance, err error)

GetBalance Retrieve a list of assets (with non-zero balance), remaining balance, and available amount in the account.

https://www.okx.com/docs-v5/en/#rest-api-account-get-balance

func (*Account) GetBills

func (c *Account) GetBills(req requests.GetBills, arc bool) (response responses.GetBills, err error)

GetBills Retrieve the bills of the account. 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.

https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days

Retrieve 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.

https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months

func (*Account) GetConfig

func (c *Account) GetConfig() (response responses.GetConfig, err error)

GetConfig Retrieve current account configuration.

https://www.okx.com/docs-v5/en/#rest-api-account-get-account-configuration

func (*Account) GetInterestRates

func (c *Account) GetInterestRates(req requests.GetBalance) (response responses.GetInterestRates, err error)

GetInterestRates Get the user's current leveraged currency borrowing interest rate

https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-rate

func (*Account) GetPositions

func (c *Account) GetPositions(req requests.GetPositions) (response responses.GetPositions, err error)

GetPositions Retrieve 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.

https://www.okx.com/docs-v5/en/#rest-api-account-get-positions

func (*Account) IncreaseDecreaseMargin

func (c *Account) IncreaseDecreaseMargin(req requests.IncreaseDecreaseMargin) (response responses.IncreaseDecreaseMargin, err error)

IncreaseDecreaseMargin Increase or decrease the margin of the isolated position.

https://www.okx.com/docs-v5/en/#rest-api-account-increase-decrease-margin

func (*Account) SetAccountLevel added in v1.0.13

func (c *Account) SetAccountLevel(req requests.SetAccountLevel) (response responses.SetAccountLevel, err error)

SetAccountLevel

https://www.okx.com/docs-v5/zh/#trading-account-rest-api-set-account-mode

func (*Account) SetAutoLoan added in v1.0.7

func (c *Account) SetAutoLoan(req requests.SetAutoLoan) (response responses.SetAutoLoan, err error)

SetAutoLoan

https://www.okx.com/docs-v5/zh/#trading-account-rest-api-set-auto-loan

func (*Account) SetGreeks

func (c *Account) SetGreeks(req requests.SetGreeks) (response responses.SetGreeks, err error)

SetGreeks Set the display type of Greeks.

https://www.okx.com/docs-v5/en/#rest-api-account-set-greeks-m-bs

func (*Account) SetLeverage

func (c *Account) SetLeverage(req requests.SetLeverage) (response responses.Leverage, err error)

SetLeverage The following are the setting leverage cases for an instrument:

Set leverage for isolated MARGIN at pairs level.

Set leverage for cross MARGIN in Single-currency margin at pairs level.

Set leverage for cross MARGIN in Multi-currency margin at currency level.

Set leverage for cross/isolated FUTURES/SWAP at underlying/contract level. https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage

func (*Account) SetPositionMode

func (c *Account) SetPositionMode(req requests.SetPositionMode) (response responses.SetPositionMode, err error)

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.

https://www.okx.com/docs-v5/en/#rest-api-account-set-position-mode

type ClientRest

type ClientRest struct {
	Account    *Account
	SubAccount *SubAccount
	Trade      *Trade
	Funding    *Funding
	Market     *Market
	PublicData *PublicData
	TradeData  *TradeData

	Client *http.Client
	// contains filtered or unexported fields
}

ClientRest is the rest api client

func NewClient

func NewClient(apiKey, secretKey, passphrase string, baseURL okx.BaseURL, destination okx.Destination) *ClientRest

NewClient returns a pointer to a fresh ClientRest

func NewClientWithIP added in v1.0.24

func NewClientWithIP(apiKey, secretKey, passphrase string, baseURL okx.BaseURL, destination okx.Destination, ip string) *ClientRest

NewClient returns a pointer to a fresh ClientRest

func (*ClientRest) Do

func (c *ClientRest) Do(method, path string, private bool, params ...map[string]string) (*http.Response, error)

Do the http request to the server

func (*ClientRest) DoBatch

func (c *ClientRest) DoBatch(path string, params interface{}) (*http.Response, error)

DoBatch the private post request to the server with parameters of type slice

func (*ClientRest) Status

func (c *ClientRest) Status(req requests.Status) (response responses.Status, err error)

Status Get event status of system upgrade

https://www.okx.com/docs-v5/en/#rest-api-status

type Funding

type Funding struct {
	// contains filtered or unexported fields
}

Funding

https://www.okx.com/docs-v5/en/#rest-api-funding

func NewFunding

func NewFunding(c *ClientRest) *Funding

NewFunding returns a pointer to a fresh Funding

func (*Funding) AssetBillsDetails

func (c *Funding) AssetBillsDetails(req requests.AssetBillsDetails) (response responses.AssetBillsDetails, err error)

AssetBillsDetails Query the billing record, you can get the latest 1 month historical data.

https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details

func (*Funding) FundsTransfer

func (c *Funding) FundsTransfer(req requests.FundsTransfer) (response responses.FundsTransfer, err error)

FundsTransfer This endpoint supports the transfer of funds between your funding account and trading account, and from the master account to sub-accounts. Direct transfers between sub-accounts are not allowed.

https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer

func (*Funding) GetBalance

func (c *Funding) GetBalance(req requests.GetBalance) (response responses.GetBalance, err error)

GetBalance Retrieve the balances of all the assets, and the amount that is available or on hold.

https://www.okx.com/docs-v5/en/#rest-api-funding-get-balance

func (*Funding) GetCurrencies

func (c *Funding) GetCurrencies() (response responses.GetCurrencies, err error)

GetCurrencies Retrieve a list of all currencies. Not all currencies can be traded. Currencies that have not been defined in ISO 4217 may use a custom symbol.

https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies

func (*Funding) GetDepositAddress

func (c *Funding) GetDepositAddress(req requests.GetDepositAddress) (response responses.GetDepositAddress, err error)

GetDepositAddress Retrieve the deposit addresses of currencies, including previously-used addresses.

https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-address

func (*Funding) GetDepositHistory

func (c *Funding) GetDepositHistory(req requests.GetDepositHistory) (response responses.GetDepositHistory, err error)

GetDepositHistory Retrieve the deposit history of all currencies, up to 100 recent records in a year.

https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history

func (*Funding) GetWithdrawalHistory

func (c *Funding) GetWithdrawalHistory(req requests.GetWithdrawalHistory) (response responses.GetWithdrawalHistory, err error)

GetWithdrawalHistory Retrieve 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.

https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history

func (*Funding) Withdrawal

func (c *Funding) Withdrawal(req requests.Withdrawal) (response responses.Withdrawal, err error)

Withdrawal Withdrawal of tokens.

https://www.okx.com/docs-v5/en/#rest-api-funding-withdrawal

type Market

type Market struct {
	// contains filtered or unexported fields
}

Market

https://www.okx.com/docs-v5/en/#rest-api-market-data

func NewMarket

func NewMarket(c *ClientRest) *Market

NewMarket returns a pointer to a fresh Market

func (*Market) Candlesticks

func (c *Market) Candlesticks(req requests.Candlesticks) (response responses.Candlesticks, err error)

Candlesticks Retrieve the candlestick charts. This endpoint can retrieve the latest 1,440 data entries. Charts are returned in groups based on the requested bar.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks

func (*Market) CandlesticksHistory

func (c *Market) CandlesticksHistory(req requests.Candlesticks) (response responses.Candlesticks, err error)

CandlesticksHistory Retrieve history candlestick charts from recent years.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks

func (*Market) Get24HTotalVolume

func (c *Market) Get24HTotalVolume() (response responses.TotalVolume24H, err error)

Get24HTotalVolume The 24-hour trading volume is calculated on a rolling basis, using USD as the pricing unit.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-24h-total-volume

func (*Market) GetIndexCandlesticks

func (c *Market) GetIndexCandlesticks(req requests.GetCandlesticks) (response responses.IndexCandle, err 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.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks

func (*Market) GetIndexComponents

func (c *Market) GetIndexComponents(req requests.GetIndexComponents) (response responses.IndexComponent, err error)

GetIndexComponents Get the index component information data on the market

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-components

func (*Market) GetIndexTickers

func (c *Market) GetIndexTickers(req requests.GetIndexTickers) (response responses.Ticker, err error)

GetIndexTickers Retrieve index tickers.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-tickers

func (*Market) GetMarkPriceCandlesticks

func (c *Market) GetMarkPriceCandlesticks(req requests.GetCandlesticks) (response responses.CandleMarket, err 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.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks

func (*Market) GetOrderBook

func (c *Market) GetOrderBook(req requests.GetOrderBook) (response responses.OrderBook, err error)

GetOrderBook Retrieve a instrument is order book.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-order-book

func (*Market) GetTicker

func (c *Market) GetTicker(req requests.GetTicker) (response responses.Ticker, err error)

GetTicker Retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-ticker

func (*Market) GetTickers

func (c *Market) GetTickers(req requests.GetTickers) (response responses.Ticker, err error)

GetTickers Retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-tickers

func (*Market) GetTrades

func (c *Market) GetTrades(req requests.GetTrades) (response responses.Trade, err error)

GetTrades Retrieve the recent transactions of an instrument.

https://www.okx.com/docs-v5/en/#rest-api-market-data-get-trades

type PublicData

type PublicData struct {
	// contains filtered or unexported fields
}

PublicData

https://www.okx.com/docs-v5/en/#rest-api-public-data

func NewPublicData

func NewPublicData(c *ClientRest) *PublicData

NewPublicData returns a pointer to a fresh PublicData

func (*PublicData) GetDeliveryExerciseHistory

func (c *PublicData) GetDeliveryExerciseHistory(req requests.GetDeliveryExerciseHistory) (response responses.GetDeliveryExerciseHistory, err error)

GetDeliveryExerciseHistory Retrieve the estimated delivery price, which will only have a return value one hour before the delivery/exercise.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments

func (*PublicData) GetDiscountRateAndInterestFreeQuota

func (c *PublicData) GetDiscountRateAndInterestFreeQuota(req requests.GetDiscountRateAndInterestFreeQuota) (response responses.GetDiscountRateAndInterestFreeQuota, err error)

GetDiscountRateAndInterestFreeQuota Retrieve discount rate level and interest-free quota.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-discount-rate-and-interest-free-quota

func (*PublicData) GetEstimatedDeliveryExercisePrice

func (c *PublicData) GetEstimatedDeliveryExercisePrice(req requests.GetEstimatedDeliveryExercisePrice) (response responses.GetEstimatedDeliveryExercisePrice, err error)

GetEstimatedDeliveryExercisePrice Retrieve the estimated delivery price which will only have a return value one hour before the delivery/exercise.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-estimated-delivery-Exercise-price

func (*PublicData) GetFundingRate added in v1.0.11

func (c *PublicData) GetFundingRate(req requests.GetFundingRate) (response responses.GetFundingRate, err error)

GetFundingRate

https://www.okx.com/docs-v5/zh/#public-data-rest-api-get-funding-rate

func (*PublicData) GetInstruments

func (c *PublicData) GetInstruments(req requests.GetInstruments) (response responses.GetInstruments, err error)

GetInstruments Retrieve a list of instruments with open contracts.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments

func (*PublicData) GetInterestRateAndLoanQuota

func (c *PublicData) GetInterestRateAndLoanQuota() (response responses.GetInterestRateAndLoanQuota, err error)

GetInterestRateAndLoanQuota Get margin interest rate

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers

func (*PublicData) GetLimitPrice

func (c *PublicData) GetLimitPrice(req requests.GetLimitPrice) (response responses.GetLimitPrice, err error)

GetLimitPrice Retrieve the highest buy limit and lowest sell limit of the instrument.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-limit-price

func (*PublicData) GetLiquidationOrders

func (c *PublicData) GetLiquidationOrders(req requests.GetLiquidationOrders) (response responses.GetLiquidationOrders, err error)

GetLiquidationOrders Retrieve information on liquidation orders in the last 7 days.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-liquidation-orders

func (*PublicData) GetMarkPrice

func (c *PublicData) GetMarkPrice(req requests.GetMarkPrice) (response responses.GetMarkPrice, err error)

GetMarkPrice Retrieve mark price.

We set the mark price based on the SPOT index and at a reasonable basis to prevent individual users from manipulating the market and causing the contract price to fluctuate.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-mark-price

func (*PublicData) GetOpenInterest

func (c *PublicData) GetOpenInterest(req requests.GetOpenInterest) (response responses.GetOpenInterest, err error)

GetOpenInterest Retrieve the total open interest for contracts on okx.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest

func (*PublicData) GetOptionMarketData

func (c *PublicData) GetOptionMarketData(req requests.GetOptionMarketData) (response responses.GetOptionMarketData, err error)

GetOptionMarketData Retrieve option market data.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-market-data

func (*PublicData) GetPositionTiers

func (c *PublicData) GetPositionTiers(req requests.GetPositionTiers) (response responses.GetPositionTiers, err error)

GetPositionTiers Position information,Maximum leverage depends on your borrowings and margin ratio.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers

func (*PublicData) GetSystemTime

func (c *PublicData) GetSystemTime() (response responses.GetSystemTime, err error)

GetSystemTime Retrieve API server time.

https://www.okx.com/docs-v5/en/#rest-api-public-data-get-system-time

type SubAccount

type SubAccount struct {
	// contains filtered or unexported fields
}

SubAccount

https://www.okx.com/docs-v5/en/#rest-api-subaccount

func NewSubAccount

func NewSubAccount(c *ClientRest) *SubAccount

NewSubAccount returns a pointer to a fresh SubAccount

func (*SubAccount) CreateAPIKey

func (c *SubAccount) CreateAPIKey(req requests.CreateAPIKey) (response responses.APIKey, err error)

CreateAPIKey applies to master accounts only

https://www.okx.com/docs-v5/en/#rest-api-subaccount-create-an-apikey-for-a-sub-account

func (*SubAccount) CreateAPIKeySubAccount

func (c *SubAccount) CreateAPIKeySubAccount(req requests.CreatAPIKeySubAccount) (
	response responses.CreatAPIKeySubAccount, err error)

CreateAPIKeySubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-create-an-api-key-for-a-sub-account

func (*SubAccount) CreateDepositAddressSubAccount

func (c *SubAccount) CreateDepositAddressSubAccount(req requests.CreateDepositAddress) (
	response responses.CreateDepositAddress, err error)

CreateDepositAddressSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-create-deposit-address-for-sub-account

func (*SubAccount) CreateSubAccount

func (c *SubAccount) CreateSubAccount(req requests.CreateSubAccount) (response responses.CreateSubAccount, err error)

CreateSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-create-sub-account

func (*SubAccount) DeleteAPIKEySubAccount

func (c *SubAccount) DeleteAPIKEySubAccount(req requests.DeleteAPIKeySubAccount) (
	response responses.DeleteAPIKeySubAccount, err error)

DeleteAPIKEySubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-delete-the-api-key-of-sub-accounts

func (*SubAccount) DeleteAPIKey

func (c *SubAccount) DeleteAPIKey(req requests.DeleteAPIKey) (response responses.APIKey, err error)

DeleteAPIKey applies to master accounts only

https://www.okx.com/docs-v5/en/#rest-api-subaccount-delete-the-apikey-of-sub-accounts

func (*SubAccount) DeleteSubAccount

func (c *SubAccount) DeleteSubAccount(req requests.DeleteSubAccount) (response responses.DeleteSubAccount, err error)

DeleteSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-delete-sub-account

func (*SubAccount) GetBalance

func (c *SubAccount) GetBalance(req requests.GetBalance) (response responses.GetBalance, err error)

GetBalance Query detailed balance info of Trading Account of a sub-account via the master account (applies to master accounts only)

https://www.okx.com/docs-v5/en/#rest-api-subaccount-get-sub-account-balance

func (*SubAccount) GetBalancesFunding

func (c *SubAccount) GetBalancesFunding(req requests.GetBalancesFunding) (response responses.GetBalancesFunding, err error)

GetBalancesFunding Query detailed balance info of Funding Account of a sub-account via the master account (applies to master accounts only)

https://www.okx.com/docs-v5/en/#sub-account-rest-api-get-sub-account-funding-balance

func (*SubAccount) GetDepositAddressSubAccount

func (c *SubAccount) GetDepositAddressSubAccount(req requests.GetDepositAddress) (response responses.GetDepositAddress,
	err error)

GetDepositAddressSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-get-sub-account-deposit-address

func (*SubAccount) GetDepositHistorySubAccount

func (c *SubAccount) GetDepositHistorySubAccount(req requests.GetDepositHistory) (response responses.GetDepositHistory,
	err error)

GetDepositHistorySubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-get-sub-account-deposit-history

func (*SubAccount) GetWithdrawHistorySubAccount

func (c *SubAccount) GetWithdrawHistorySubAccount(req requests.GetWithdrawHistory) (response responses.GetWithdrawHistory,
	err error)

GetWithdrawHistorySubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-get-sub-account-withdrawal-history

func (*SubAccount) HistoryTransfer

func (c *SubAccount) HistoryTransfer(req requests.HistoryTransfer) (response responses.HistoryTransfer, err error)

HistoryTransfer applies to master accounts only

https://www.okx.com/docs-v5/en/#rest-api-subaccount-history-of-sub-account-transfer

func (*SubAccount) ListSubAccount

func (c *SubAccount) ListSubAccount(req requests.ListSubAccount) (response responses.ListSubAccount, err error)

ListSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-get-sub-account-list

func (*SubAccount) ManageTransfers

func (c *SubAccount) ManageTransfers(req requests.ManageTransfers) (response responses.ManageTransfer, err error)

ManageTransfers applies to master accounts only

Only API keys with Trade privilege can call this endpoint https://www.okx.com/docs-v5/en/#sub-account-rest-api-master-accounts-manage-the-transfers-between-sub-accounts

func (*SubAccount) QueryAPIKey

func (c *SubAccount) QueryAPIKey(req requests.QueryAPIKey) (response responses.QueryAPIKey, err error)

QueryAPIKey applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-query-the-api-key-of-a-sub-account

func (*SubAccount) ResetAPIKey

func (c *SubAccount) ResetAPIKey(req requests.ResetAPIKey) (response responses.ResetAPIKey, err error)

ResetAPIKey applies to master accounts only https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-reset-the-api-key-of-a-sub-account

func (*SubAccount) SetFeeRateSubAccount

func (c *SubAccount) SetFeeRateSubAccount(req requests.SetFeeRateSubAccount) (response responses.SetFeeRateSubAccount,
	err error)

SetFeeRateSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-set-trading-fee-rate-for-the-sub-account

func (*SubAccount) SetLevelSubAccount

func (c *SubAccount) SetLevelSubAccount(req requests.SetLevelSubAccount) (response responses.SetLevelSubAccount,
	err error)

SetLevelSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-set-the-account-level-of-the-sub-account

func (*SubAccount) UpdateAPIKeySubAccount

func (c *SubAccount) UpdateAPIKeySubAccount(req requests.UpdateAPIKEySubAccount) (
	response responses.UpdateAPIKEySubAccount, err error)

UpdateAPIKeySubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-reset-the-api-key-of-a-sub-account

func (*SubAccount) UpdateDepositAddressSubAccount

func (c *SubAccount) UpdateDepositAddressSubAccount(req requests.UpdateDepositAddress) (
	response responses.UpdateDepositAddress, err error)

UpdateDepositAddressSubAccount applies to master accounts only

https://www.okx.com/docs-v5/broker_en/#non-disclosed-broker-api-modify-sub-account-deposit-address

func (*SubAccount) ViewList

func (c *SubAccount) ViewList(req requests.ViewList) (response responses.ViewList, err error)

ViewList applies to master accounts only

https://www.okx.com/docs-v5/en/#sub-account-rest-api-get-sub-account-list

type Trade

type Trade struct {
	// contains filtered or unexported fields
}

Trade

https://www.okx.com/docs-v5/en/#rest-api-trade

func NewTrade

func NewTrade(c *ClientRest) *Trade

NewTrade returns a pointer to a fresh Trade

func (*Trade) AmendOrder

func (c *Trade) AmendOrder(req []requests.AmendOrder) (response responses.AmendOrder, err error)

AmendOrder Amend an incomplete order.

https://www.okx.com/docs-v5/en/#rest-api-trade-amend-order

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.

https://www.okx.com/docs-v5/en/#rest-api-trade-amend-multiple-orders

func (*Trade) CancelAdvanceAlgoOrder

func (c *Trade) CancelAdvanceAlgoOrder(req []requests.CancelAlgoOrder) (response responses.CancelAlgoOrder, err error)

CancelAdvanceAlgoOrder Cancel unfilled algo orders(iceberg order and twap order). A maximum of 10 orders can be canceled at a time. Request parameters should be passed in the form of an array.

Only released on demo trading

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order

func (*Trade) CancelAlgoOrder

func (c *Trade) CancelAlgoOrder(req []requests.CancelAlgoOrder) (response responses.CancelAlgoOrder, err error)

CancelAlgoOrder Cancel unfilled algo orders(trigger order, oco order, conditional order). A maximum of 10 orders can be canceled at a time. Request parameters should be passed in the form of an array.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-algo-order

func (*Trade) CancelOrder

func (c *Trade) CancelOrder(req []requests.CancelOrder) (response responses.CancelOrder, err error)

CancelOrder Cancel an incomplete order.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-order

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.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-multiple-orders

func (*Trade) ClosePosition

func (c *Trade) ClosePosition(req requests.ClosePosition) (response responses.ClosePosition, err error)

ClosePosition Close all positions of an instrument via a market order.

https://www.okx.com/docs-v5/en/#rest-api-trade-close-positions

func (*Trade) GetAlgoOrderList

func (c *Trade) GetAlgoOrderList(req requests.AlgoOrderList, arch bool) (response responses.AlgoOrderList, err error)

GetAlgoOrderList Retrieve a list of untriggered Algo orders under the current account.

`iceberg` order and `twap` order just supported on demo trading

https://www.okx.com/docs-v5/en/#rest-api-trade-get-algo-order-list

Retrieve a list of all algo orders under the current account in the last 3 months.

`iceberg` order and `twap` order just supported on demo trading

https://www.okx.com/docs-v5/en/#rest-api-trade-get-algo-order-history

func (*Trade) GetOrderDetail

func (c *Trade) GetOrderDetail(req requests.OrderDetails) (response responses.OrderList, err error)

GetOrderDetail Retrieve order details.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-details

func (*Trade) GetOrderHistory

func (c *Trade) GetOrderHistory(req requests.OrderList, arch bool) (response responses.OrderList, err error)

GetOrderHistory Retrieve the completed order data for the last 7 days, and the incomplete orders that have been cancelled are only reserved for 2 hours.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-7-days

Retrieve the completed order data of the last 3 months, and the incomplete orders that have been canceled are only reserved for 2 hours. https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-3-months

func (*Trade) GetOrderList

func (c *Trade) GetOrderList(req requests.OrderList) (response responses.OrderList, err error)

GetOrderList Retrieve all incomplete orders under the current account.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-list

func (*Trade) GetTransactionDetails

func (c *Trade) GetTransactionDetails(req requests.TransactionDetails, arch bool) (response responses.TransactionDetail, err error)

GetTransactionDetails Retrieve recently-filled transaction details in the last 3 day.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-7-days

Retrieve recently-filled transaction details in the last 3 months.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-months

func (*Trade) PlaceAlgoOrder

func (c *Trade) PlaceAlgoOrder(req requests.PlaceAlgoOrder) (response responses.PlaceAlgoOrder, err error)

PlaceAlgoOrder The algo order includes trigger order, oco order, conditional order,iceberg order and twap order.

`iceberg` order and `twap` order just supported on demo trading

https://www.okx.com/docs-v5/en/#rest-api-trade-place-algo-order

func (*Trade) PlaceMultipleOrders

func (c *Trade) PlaceMultipleOrders(req []requests.PlaceOrder) (response responses.PlaceOrder, err error)

PlaceMultipleOrders Cancel an incomplete order.

https://www.okx.com/docs-v5/en/#rest-api-trade-place-multiple-orders

func (*Trade) PlaceOrder

func (c *Trade) PlaceOrder(req requests.PlaceOrder) (response responses.PlaceOrder, err error)

PlaceOrder You can place an order only if you have sufficient funds.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-positions

type TradeData

type TradeData struct {
	// contains filtered or unexported fields
}

TradeData

https://www.okx.com/docs-v5/en/#rest-api-tradeing-data

func NewTradeData

func NewTradeData(c *ClientRest) *TradeData

NewTradeData returns a pointer to a fresh TradeData

func (*TradeData) GetContractsOpenInterestAndVolume

func (c *TradeData) GetContractsOpenInterestAndVolume(req requests.GetRatio) (response responses.GetOpenInterestAndVolume, err error)

GetContractsOpenInterestAndVolume Open interest is the sum of all long and short futures and perpetual swap positions.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume

func (*TradeData) GetLongShortRatio

func (c *TradeData) GetLongShortRatio(req requests.GetRatio) (response responses.GetRatio, err error)

GetLongShortRatio This is the ratio of users with net long vs short positions. It includes data from futures and perpetual swaps.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-long-short-ratio

func (*TradeData) GetMarginLendingRatio

func (c *TradeData) GetMarginLendingRatio(req requests.GetRatio) (response responses.GetRatio, err error)

GetMarginLendingRatio This indicator shows the ratio of cumulative data value between currency pair leverage quote currency and underlying asset over a given period of time.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-margin-lending-ratio

func (*TradeData) GetOpenInterestAndVolumeExpiry

func (c *TradeData) GetOpenInterestAndVolumeExpiry(req requests.GetRatio) (response responses.GetOpenInterestAndVolumeExpiry, err error)

GetOpenInterestAndVolumeExpiry This shows the volume and open interest for each upcoming expiration. You can use this to see which expirations are currently the most popular to trade.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-open-interest-and-volume-expiry

func (*TradeData) GetOpenInterestAndVolumeStrike

func (c *TradeData) GetOpenInterestAndVolumeStrike(req requests.GetOpenInterestAndVolumeStrike) (response responses.GetOpenInterestAndVolumeStrike, err error)

GetOpenInterestAndVolumeStrike This shows what option strikes are the most popular for each expiration.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-open-interest-and-volume-strike

func (*TradeData) GetOptionsOpenInterestAndVolume

func (c *TradeData) GetOptionsOpenInterestAndVolume(req requests.GetRatio) (response responses.GetOpenInterestAndVolume, err error)

GetOptionsOpenInterestAndVolume This shows the sum of all open positions and how much total trading volume has taken place.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume

func (*TradeData) GetPutCallRatio

func (c *TradeData) GetPutCallRatio(req requests.GetRatio) (response responses.GetPutCallRatio, err error)

GetPutCallRatio This shows the relative buy/sell volume for calls and puts. It shows whether traders are bullish or bearish on price and volatility.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-put-call-ratio

func (*TradeData) GetSupportCoin

func (c *TradeData) GetSupportCoin() (response responses.GetSupportCoin, err error)

GetSupportCoin Get the currency supported by the transaction big data interface

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-support-coin

func (*TradeData) GetTakerFlow

func (c *TradeData) GetTakerFlow(req requests.GetRatio) (response responses.GetTakerFlow, err error)

GetTakerFlow This shows the relative buy/sell volume for calls and puts. It shows whether traders are bullish or bearish on price and volatility.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-taker-flow

func (*TradeData) GetTakerVolume

func (c *TradeData) GetTakerVolume(req requests.GetTakerVolume) (response responses.GetTakerVolume, err error)

GetTakerVolume This is the taker volume for both buyers and sellers. This shows the influx and exit of funds in and out of {coin}.

https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-support-coin

Jump to

Keyboard shortcuts

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