okx

package
v0.0.0-...-38bb14b Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 46 Imported by: 0

README

GoCryptoTrader package Okx

Build Status Software License GoDoc Coverage Status Go Report Card

This okx package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on our GoCryptoTrader Kanban board.

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

Okx Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable

Enable via configuration

  • Individual package example below:
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var ok exchange.IBotExchange

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

// Public calls - wrapper functions

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

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

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

// Fetches current account information
accountInfo, err := ok.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

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

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

// Fetches historic trade data within the timeframe provided
tradeDatas, err := ok.GetHistoricTrades(...)
if err != nil {
	// Handle error
}


// Returns an estimate of fee based on the type of transaction
fee, err := ok.GetFeeByType(...)
if err != nil {
	// Handle error
}

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

// Submits an order and the exchange and returns its tradeID
orderID, err := ok.SubmitOrder(...)
if err != nil {
	// Handle error
}

// ModifyOrder will allow of changing orderbook placement and limit to market conversion
updatedOrder, err := ok.ModifyOrder(...)
if err != nil {
	// Handle error
}

How to do Websocket public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	StateUncompleted candlestickState = iota
	StateCompleted
)

candlestickState represents index candlestick states.

Variables

View Source
var (
	ErrorCodes = map[string]error{}/* 515 elements not displayed */

)

ErrorCodes and their corresponding error messages

Functions

func GetInstrumentTypeFromAssetItem

func GetInstrumentTypeFromAssetItem(a asset.Item) string

GetInstrumentTypeFromAssetItem returns a string representation of asset.Item; which is an equivalent term for InstrumentType in Okx exchange

func GetRateLimit

func GetRateLimit() request.RateLimitDefinitions

GetRateLimit returns a RateLimit instance, which implements the request.Limiter interface.

func IntervalFromString

func IntervalFromString(interval kline.Interval, appendUTC bool) string

IntervalFromString returns a kline.Interval instance from string

Types

type ADLWarning

type ADLWarning struct {
	Arg  SubscriptionInfo `json:"arg"`
	Data []struct {
		DecRate          string       `json:"decRate"`
		MaxBal           string       `json:"maxBal"`
		AdlRecRate       types.Number `json:"adlRecRate"`
		AdlRecBal        types.Number `json:"adlRecBal"`
		Balance          types.Number `json:"bal"`
		InstrumentType   string       `json:"instType"`
		AdlRate          types.Number `json:"adlRate"`
		InstrumentFamily string       `json:"instFamily"`
		MaxBalTimestamp  types.Time   `json:"maxBalTs"`
		AdlType          string       `json:"adlType"`
		State            string       `json:"state"`
		AdlBalance       types.Number `json:"adlBal"`
		Timestamp        types.Time   `json:"ts"`
	} `json:"data"`
}

ADLWarning represents auto-deleveraging warning

type APYItem

type APYItem struct {
	Rate      types.Number `json:"rate"`
	Timestamp types.Time   `json:"ts"`
}

APYItem holds annual percentage yield record

type Account

type Account struct {
	AdjustedEquity               types.Number    `json:"adjEq"`
	Details                      []AccountDetail `json:"details"`
	InitialMarginRequirement     types.Number    `json:"imr"` // Frozen equity for open positions and pending orders in USD level Applicable to Multi-currency margin and Portfolio margin
	IsolatedMarginEquity         types.Number    `json:"isoEq"`
	MgnRatio                     types.Number    `json:"mgnRatio"`
	MaintenanceMarginRequirement types.Number    `json:"mmr"` // Maintenance margin requirement in USD level Applicable to Multi-currency margin and Portfolio margin
	BorrowFrozen                 string          `json:"borrowFroz"`
	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                   types.Time      `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          types.Time           `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    types.Time   `json:"ts"`
}

AccountAssetValuation represents view account asset valuation data

type AccountBalanceData

type AccountBalanceData struct {
	Currency       string       `json:"ccy"`
	DiscountEquity types.Number `json:"disEq"` // discount equity of the currency in USD level.
	Equity         types.Number `json:"eq"`    // Equity of the currency
}

AccountBalanceData represents currency account balance

type AccountConfigurationResponse

type AccountConfigurationResponse struct {
	UID                            string       `json:"uid"`
	MainUID                        string       `json:"mainUid"`
	AccountSelfTradePreventionMode string       `json:"acctStpMode"`
	AccountLevel                   string       `json:"acctLv"`     // 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                          types.Number `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"`
	SpotOffsetType                 string       `json:"spotOffsetType"`
	RoleType                       string       `json:"roleType"`
	TraderInsts                    string       `json:"traderInsts"`
	SpotRoleType                   string       `json:"spotRoleType"`
	SpotTraderInsts                string       `json:"spotTraderInsts"`
	OptionalTradingAuth            string       `json:"opAuth"` // Whether the optional trading was activated 0: not activate 1: activated
	KYCLevel                       string       `json:"kycLv"`
	Label                          string       `json:"label"`
	IP                             string       `json:"ip"`
	Permission                     string       `json:"perm"`
	DiscountType                   string       `json:"discountType"`
	LiquidationGear                string       `json:"liquidationGear"`
	EnableSpotBorrow               bool         `json:"enableSpotBorrow"`
	SpotBorrowAutoRepay            bool         `json:"spotBorrowAutoRepay"`
}

AccountConfigurationResponse represents account configuration response

type AccountDetail

type AccountDetail struct {
	Currency                  currency.Code `json:"ccy"`
	EquityOfCurrency          types.Number  `json:"eq"`
	CashBalance               types.Number  `json:"cashBal"` // Cash Balance
	UpdateTime                types.Time    `json:"uTime"`
	IsoEquity                 types.Number  `json:"isoEq"`
	AvailableEquity           types.Number  `json:"availEq"`
	DiscountEquity            types.Number  `json:"disEq"`
	FixedBalance              types.Number  `json:"fixedBal"`
	AvailableBalance          types.Number  `json:"availBal"`
	MarginFrozenForOpenOrders types.Number  `json:"ordFrozen"`

	CrossLiab             types.Number `json:"crossLiab"`
	EquityUsd             types.Number `json:"eqUsd"`
	FrozenBalance         types.Number `json:"frozenBal"`
	Interest              types.Number `json:"interest"`
	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
	Twap                  types.Number `json:"twap"`
	UPL                   types.Number `json:"upl"` // unrealized profit & loss of all margin and derivatives positions of currency.
	UPLLiabilities        types.Number `json:"uplLiab"`
	StrategyEquity        types.Number `json:"stgyEq"`  // strategy equity
	TotalEquity           types.Number `json:"totalEq"` // Total equity in USD level. Appears unused
	RewardBalance         types.Number `json:"rewardBal"`
	InitialMarginRate     types.Number `json:"imr"`
	MMR                   types.Number `json:"mmr"` // ross maintenance margin requirement at the currency level. Applicable to Spot and futures mode and when there is cross position
	SpotInUseAmount       types.Number `json:"spotInUseAmt"`
	ClientSpotInUseAmount types.Number `json:"clSpotInUseAmt"`
	MaxSpotInUseAmount    types.Number `json:"maxSpotInUse"`
	SpotIsolatedBalance   types.Number `json:"spotIsoBal"`
	SmarkSyncEquity       types.Number `json:"smtSyncEq"`
	SpotCopyTradingEquity types.Number `json:"spotCopyTradingEq"`
	SpotBalance           types.Number `json:"spotBal"`
	OpenAvgPrice          types.Number `json:"openAvgPx"`
	AccAvgPrice           types.Number `json:"accAvgPx"`
	SpotUPL               types.Number `json:"spotUpl"`
	SpotUplRatio          types.Number `json:"spotUplRatio"`
	TotalPNL              types.Number `json:"totalPnl"`
	TotalPNLRatio         types.Number `json:"totalPnlRatio"`
}

AccountDetail account detail information

type AccountInstrument

type AccountInstrument struct {
	BaseCurrency        string       `json:"baseCcy"`
	ContractMultiplier  string       `json:"ctMult"`
	ContractType        string       `json:"ctType"`
	ContractValue       string       `json:"ctVal"`
	ContractValCurrency string       `json:"ctValCcy"`
	ExpiryTime          types.Time   `json:"expTime"`
	InstrumentType      string       `json:"instType"`
	InstrumentID        string       `json:"instId"`
	InstFamily          string       `json:"instFamily"`
	MaxLeverage         string       `json:"lever"`
	ListTime            types.Time   `json:"listTime"`
	LotSz               types.Number `json:"lotSz"` // If it is a derivatives contract, the value is the number of contracts. If it is SPOT/MARGIN, the value is the quantity in base currency.
	MaxIcebergSz        types.Number `json:"maxIcebergSz"`
	MaxLimitAmount      types.Number `json:"maxLmtAmt"`
	MaxLimitSize        types.Number `json:"maxLmtSz"`
	MaxMktAmount        types.Number `json:"maxMktAmt"`
	MaxMktSize          types.Number `json:"maxMktSz"`
	MaxStopSize         types.Number `json:"maxStopSz"`
	MaxTriggerSz        types.Number `json:"maxTriggerSz"`
	MaxTwapSize         types.Number `json:"maxTwapSz"`
	MinSize             types.Number `json:"minSz"`
	OptionType          string       `json:"optType"`
	QuoteCurrency       string       `json:"quoteCcy"`
	SettleCurrency      string       `json:"settleCcy"`
	State               string       `json:"state"`
	StrikePrice         string       `json:"stk"`
	TickSize            types.Number `json:"tickSz"`
	Underlying          string       `json:"uly"`
	RuleType            string       `json:"ruleType"`
}

AccountInstrument represents an account instrument

type AccountMode

type AccountMode struct {
	IsoMode string `json:"isoMode"`
}

AccountMode holds account mode

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                 types.Time    `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                  types.Number  `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                  types.Time    `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 types.Time `json:"pTime"` // The time when the account position data is pushed.
}

AccountPosition account position

type AccountPositionHistory

type AccountPositionHistory struct {
	InstrumentType    string       `json:"instType"`
	InstrumentID      string       `json:"instId"`
	ManagementMode    string       `json:"mgnMode"`
	Type              string       `json:"type"`
	CreationTime      types.Time   `json:"cTime"`
	UpdateTime        types.Time   `json:"uTime"`
	OpenAveragePrice  string       `json:"openAvgPx"`
	CloseAveragePrice types.Number `json:"closeAvgPx"`

	Positions                types.Number `json:"pos"`
	BaseBalance              types.Number `json:"baseBal"`
	QuoteBalance             types.Number `json:"quoteBal"`
	BaseBorrowed             types.Number `json:"baseBorrowed"`
	BaseInterest             types.Number `json:"baseInterest"`
	QuoteBorrowed            types.Number `json:"quoteBorrowed"`
	QuoteInterest            types.Number `json:"quoteInterest"`
	PositionCurrency         string       `json:"posCcy"`
	AvailablePositions       string       `json:"availPos"`
	AveragePrice             types.Number `json:"avgPx"`
	MarkPrice                types.Number `json:"markPx"`
	UPL                      types.Number `json:"upl"`
	UPLRatio                 types.Number `json:"uplRatio"`
	UPLLastPrice             types.Number `json:"uplLastPx"`
	UPLRatioLastPrice        types.Number `json:"uplRatioLastPx"`
	Leverage                 string       `json:"lever"`
	LiquidiationPrice        types.Number `json:"liqPx"`
	InitialMarginRequirement types.Number `json:"imr"`
	Margin                   string       `json:"margin"`
	MarginRatio              types.Number `json:"mgnRatio"`
	MMR                      types.Number `json:"mmr"`
	Liabilities              types.Number `json:"liab"`
	LiabilitiesCurrency      string       `json:"liabCcy"`
	Interest                 types.Number `json:"interest"`
	TradeID                  string       `json:"tradeId"`
	OptionValue              string       `json:"optVal"`
	PendingCloseOrdLiabVal   types.Number `json:"pendingCloseOrdLiabVal"`
	NotionalUSD              string       `json:"notionalUsd"`
	ADL                      string       `json:"adl"`
	LastTradedPrice          types.Number `json:"last"`
	IndexPrice               types.Number `json:"idxPx"`
	USDPrice                 string       `json:"usdPx"`
	BreakevenPrice           string       `json:"bePx"`
	DeltaBS                  string       `json:"deltaBS"`
	DeltaPA                  string       `json:"deltaPA"`
	GammaBS                  string       `json:"gammaBS"`
	ThetaBS                  string       `json:"thetaBS"`
	ThetaPA                  string       `json:"thetaPA"`
	VegaBS                   string       `json:"vegaBS"`
	VegaPA                   string       `json:"vegaPA"`
	SpotInUseAmount          types.Number `json:"spotInUseAmt"`
	SpotInUseCurrency        string       `json:"spotInUseCcy"`
	ClientSpotInUseAmount    types.Number `json:"clSpotInUseAmt"`
	BizRefID                 string       `json:"bizRefId"`
	BizRefType               string       `json:"bizRefType"`
	ProfitAndLoss            types.Number `json:"pnl"`
	Fee                      types.Number `json:"fee"`
	LiqPenalty               types.Number `json:"liqPenalty"`
	CloseOrderAlgo           types.Number `json:"closeOrderAlgo"`

	Currency           string       `json:"ccy"`
	CloseTotalPosition types.Number `json:"closeTotalPos"`
	OpenMaxPosition    types.Number `json:"openMaxPos"`
	ProfitAndLossRatio types.Number `json:"pnlRatio"`
	PositionID         string       `json:"posId"`
	PositionSide       string       `json:"posSide"`
	TriggerPrice       types.Number `json:"triggerPx"`
	Underlying         string       `json:"uly"`
}

AccountPositionHistory hold account position history

type AccountRateLimit

type AccountRateLimit struct {
	AccRateLimit     types.Number `json:"accRateLimit"`
	FillRatio        types.Number `json:"fillRatio"`
	MainFillRatio    types.Number `json:"mainFillRatio"`
	NextAccRateLimit types.Number `json:"nextAccRateLimit"`
	Timestamp        types.Time   `json:"ts"`
}

AccountRateLimit represents an account rate limit details

type AccountRiskState

type AccountRiskState struct {
	IsTheAccountAtRisk string        `json:"atRisk"`
	AtRiskIdx          []interface{} `json:"atRiskIdx"` // derivatives risk unit list
	AtRiskMgn          []interface{} `json:"atRiskMgn"` // margin risk unit list
	Timestamp          types.Time    `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 {
		Currency    string       `json:"ccy"`
		EarningType string       `json:"earningType"`
		Earnings    types.Number `json:"earnings"`
	} `json:"earningData"`
	PurchasedTime      types.Time `json:"purchasedTime"`
	FastRedemptionData []struct {
		Currency        string       `json:"ccy"`
		RedeemingAmount types.Number `json:"redeemingAmt"`
	} `json:"fastRedemptionData"`
	EstimatedRedemptionSettlementTime types.Time `json:"estSettlementTime"`
	CancelRedemptionDeadline          types.Time `json:"cancelRedemptionDeadline"`
	Tag                               string     `json:"tag"`
}

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 AffilateInviteesDetail

type AffilateInviteesDetail struct {
	InviteeLevel             types.Number `json:"inviteeLv"`
	JoinTime                 types.Time   `json:"joinTime"`
	InviteeRebateRate        types.Number `json:"inviteeRebateRate"`
	TotalCommission          types.Number `json:"totalCommission"`
	FirstTradeTime           types.Time   `json:"firstTradeTime"`
	Level                    string       `json:"level"`
	DepositAmount            types.Number `json:"depAmt"`
	AccumulatedTradingVolume types.Number `json:"volMonth"`
	AccumulatedFee           types.Number `json:"accFee"`
	KYCTime                  types.Time   `json:"kycTime"`
	Region                   string       `json:"region"`
	AffiliateCode            string       `json:"affiliateCode"`
}

AffilateInviteesDetail represents affiliate invitee's detail

type AffilateRebateInfo

type AffilateRebateInfo struct {
	Result bool   `json:"result"`
	Type   string `json:"type"`
}

AffilateRebateInfo represents rebate information

type AlgoOrdInfo

type AlgoOrdInfo struct {
	AttachAlgoID                   string  `json:"attachAlgoId,omitempty"`
	AttachAlgoClientOrderID        string  `json:"attachAlgoClOrdId,omitempty"`
	NewTakeProfitTriggerPrice      float64 `json:"newTpTriggerPx,omitempty"`
	NewTakeProfitOrderPrice        float64 `json:"newTpOrdPx,omitempty"`
	NewTakeProfitOrderKind         string  `json:"newTpOrdKind,omitempty"` // possible values are 'condition' and 'limit'
	NewStopLossTriggerPrice        float64 `json:"newSlTriggerPx,omitempty"`
	NewStopLossOrderPrice          float64 `json:"newSlOrdPx,omitempty"`
	NewTakkeProfitTriggerPriceType string  `json:"newTpTriggerPxType,omitempty"`
	NewStopLossTriggerPriceType    string  `json:"newSlTriggerPxType,omitempty"` // possible values are 'last', 'index', and 'mark'
	NewSize                        float64 `json:"sz,omitempty"`
	AmendPriceOnTriggerType        string  `json:"amendPxOnTriggerType,omitempty"` // Whether to enable Cost-price SL. Only applicable to SL order of split TPs. '0': disable, the default value '1': Enable
}

AlgoOrdInfo represents TP/SL info attached when placing an order

type AlgoOrder

type AlgoOrder struct {
	AlgoID            string `json:"algoId"`
	StatusCode        string `json:"sCode"`
	StatusMessage     string `json:"sMsg"`
	ClientOrderID     string `json:"clOrdId"`
	AlgoClientOrderID string `json:"algoClOrdId"`
	Tag               string `json:"tag"`
}

AlgoOrder algo order requests response

type AlgoOrderCancelParams

type AlgoOrderCancelParams struct {
	AlgoOrderID  string `json:"algoId"`
	InstrumentID string `json:"instId"`
}

AlgoOrderCancelParams algo order request parameter

type AlgoOrderDetail

type AlgoOrderDetail struct {
	InstrumentType          string       `json:"instType"`
	InstrumentID            string       `json:"instId"`
	OrderID                 string       `json:"ordId"`
	OrderIDList             []string     `json:"ordIdList"`
	Currency                string       `json:"ccy"`
	ClientOrderID           string       `json:"clOrdId"`
	AlgoID                  string       `json:"algoId"`
	AttachAlgoOrds          []string     `json:"attachAlgoOrds"`
	Size                    types.Number `json:"sz"`
	CloseFraction           string       `json:"closeFraction"`
	OrderType               string       `json:"ordType"`
	Side                    string       `json:"side"`
	PositionSide            string       `json:"posSide"`
	TradeMode               string       `json:"tdMode"`
	TargetCurrency          string       `json:"tgtCcy"`
	State                   string       `json:"state"`
	Leverage                types.Number `json:"lever"`
	TpTriggerPrice          types.Number `json:"tpTriggerPx"`
	TpTriggerPriceType      string       `json:"tpTriggerPxType"`
	TpOrdPrice              types.Number `json:"tpOrdPx"`
	SlTriggerPrice          types.Number `json:"slTriggerPx"`
	SlTriggerPriceType      string       `json:"slTriggerPxType"`
	TriggerPrice            types.Number `json:"triggerPx"`
	TriggerPriceType        string       `json:"triggerPxType"`
	OrderPrice              types.Number `json:"ordPx"`
	ActualSize              types.Number `json:"actualSz"`
	ActualPrice             types.Number `json:"actualPx"`
	ActualSide              string       `json:"actualSide"`
	PriceVar                string       `json:"pxVar"`
	PriceSpread             types.Number `json:"pxSpread"`
	PriceLimit              types.Number `json:"pxLimit"`
	SizeLimit               types.Number `json:"szLimit"`
	Tag                     string       `json:"tag"`
	TimeInterval            string       `json:"timeInterval"`
	CallbackRatio           types.Number `json:"callbackRatio"`
	CallbackSpread          string       `json:"callbackSpread"`
	ActivePrice             types.Number `json:"activePx"`
	MoveTriggerPrice        types.Number `json:"moveTriggerPx"`
	ReduceOnly              string       `json:"reduceOnly"`
	TriggerTime             types.Time   `json:"triggerTime"`
	Last                    types.Number `json:"last"` // Last filled price while placing
	FailCode                string       `json:"failCode"`
	AlgoClOrdID             string       `json:"algoClOrdId"`
	AmendPriceOnTriggerType string       `json:"amendPxOnTriggerType"`
	CreationTime            types.Time   `json:"cTime"`
}

AlgoOrderDetail represents an algo order detail

type AlgoOrderInfo

type AlgoOrderInfo struct {
	AttachAlgoClientOrderID  string       `json:"attachAlgoClOrdId,omitempty"`
	TPTriggerPrice           types.Number `json:"tpTriggerPx,omitempty"`
	TPOrderPrice             types.Number `json:"tpOrdPx,omitempty"`
	TPOrderKind              string       `json:"tpOrdKind,omitempty"`
	StopLossTriggerPrice     types.Number `json:"slTriggerPx,omitempty"`
	StopLossOrderPrice       types.Number `json:"slOrdPx,omitempty"`
	TPTriggerPriceType       string       `json:"tpTriggerPxType,omitempty"`
	StopLossTriggerPriceType string       `json:"slTriggerPxType,omitempty"`
	Size                     types.Number `json:"sz,omitempty"`
}

AlgoOrderInfo represents an algo order info

type AlgoOrderParams

type AlgoOrderParams struct {
	InstrumentID      string  `json:"instId"` // Required
	TradeMode         string  `json:"tdMode"` // Required
	Currency          string  `json:"ccy,omitempty"`
	Side              string  `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"`
	AlgoClientOrderID string  `json:"algoClOrdId,omitempty"`

	// Place Stop Order params
	TakeProfitOrderPrice       float64 `json:"tpOrdPx,string,omitempty"`
	TakeProfitTriggerPrice     float64 `json:"tpTriggerPx,string,omitempty"`
	TakeProfitTriggerPriceType string  `json:"tpTriggerPxType,omitempty"`
	StopLossTriggerPrice       float64 `json:"slTriggerPx,string,omitempty"`
	StopLossOrderPrice         float64 `json:"slOrdPx,string,omitempty"`
	StopLossTriggerPriceType   string  `json:"slTriggerPxType,omitempty"`
	CancelOnClosePosition      bool    `json:"cxlOnClosePos,omitempty"`

	// For trigger and trailing stop order
	CallbackRatio          float64 `json:"callbackRatio,omitempty,string"`
	ActivePrice            float64 `json:"activePx,omitempty,string"`
	CallbackSpreadVariance float64 `json:"callbackSpread,omitempty,string"`

	// 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 float64 `json:"pxVar,omitempty,string"`    // Optional
	PriceSpread   float64 `json:"pxSpread,omitempty,string"` // Optional
	SizeLimit     float64 `json:"szLimit,string,omitempty"`  // Required
	LimitPrice    float64 `json:"pxLimit,string,omitempty"`  // Required

	// TWAPOrder
	TimeInterval kline.Interval `json:"interval,omitempty"` // Required

	// Chase order
	ChaseType     string  `json:"chaseType,omitempty"` // Possible values: "distance" and "ratio"
	ChaseValue    float64 `json:"chaseVal,omitempty,string"`
	MaxChaseType  string  `json:"maxChaseType,omitempty"`
	MaxChaseValue float64 `json:"maxChaseVal,omitempty,string"`
}

AlgoOrderParams holds algo order information

type AlgoOrderPosition

type AlgoOrderPosition struct {
	AutoDecreasingLine           string       `json:"adl"`
	AlgoID                       string       `json:"algoId"`
	AveragePrice                 types.Number `json:"avgPx"`
	Currency                     string       `json:"ccy"`
	InitialMarginRequirement     string       `json:"imr"`
	InstrumentID                 string       `json:"instId"`
	InstrumentType               string       `json:"instType"`
	LastTradedPrice              types.Number `json:"last"`
	Leverage                     types.Number `json:"lever"`
	LiquidationPrice             types.Number `json:"liqPx"`
	MarkPrice                    types.Number `json:"markPx"`
	MarginMode                   string       `json:"mgnMode"`
	MarginRatio                  types.Number `json:"mgnRatio"`
	MaintenanceMarginRequirement string       `json:"mmr"`
	NotionalUSD                  types.Number `json:"notionalUsd"`
	QuantityPosition             types.Number `json:"pos"`
	PositionSide                 string       `json:"posSide"`
	UnrealizedProfitAndLoss      types.Number `json:"upl"`
	UnrealizedProfitAndLossRatio types.Number `json:"uplRatio"`
	UpdateTime                   types.Time   `json:"uTime"`
	CreationTime                 types.Time   `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                   types.Number `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                      types.Number `json:"lever"`
	TakeProfitTriggerPrice     types.Number `json:"tpTriggerPx"`
	TakeProfitTriggerPriceType string       `json:"tpTriggerPxType"`
	TakeProfitOrdPrice         types.Number `json:"tpOrdPx"`
	StopLossTriggerPriceType   string       `json:"slTriggerPxType"`
	StopLossTriggerPrice       types.Number `json:"slTriggerPx"`
	TriggerPrice               types.Number `json:"triggerPx"`
	TriggerPriceType           string       `json:"triggerPxType"`
	OrderPrice                 types.Number `json:"ordPx"`
	ActualSize                 types.Number `json:"actualSz"`
	ActualPrice                types.Number `json:"actualPx"`
	ActualSide                 string       `json:"actualSide"`
	PriceVar                   types.Number `json:"pxVar"`
	PriceSpread                types.Number `json:"pxSpread"`
	PriceLimit                 types.Number `json:"pxLimit"`
	SizeLimit                  types.Number `json:"szLimit"`
	TimeInterval               string       `json:"timeInterval"`
	TriggerTime                types.Time   `json:"triggerTime"`
	CallbackRatio              types.Number `json:"callbackRatio"`
	CallbackSpread             string       `json:"callbackSpread"`
	ActivePrice                types.Number `json:"activePx"`
	MoveTriggerPrice           types.Number `json:"moveTriggerPx"`
	CreationTime               types.Time   `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 AmendAlgoOrderParam

type AmendAlgoOrderParam struct {
	InstrumentID              string  `json:"instId"`
	AlgoID                    string  `json:"algoId,omitempty"`
	ClientSuppliedAlgoOrderID string  `json:"algoClOrdId,omitempty"`
	CancelOrderWhenFail       bool    `json:"cxlOnFail,omitempty"` // Whether the order needs to be automatically canceled when the order amendment fails Valid options: false or true, the default is false.
	RequestID                 string  `json:"reqId,omitempty"`
	NewSize                   float64 `json:"newSz,omitempty,string"`

	// Take Profit Stop Loss Orders
	NewTakeProfitTriggerPrice     float64 `json:"newTpTriggerPx,omitempty,string"`
	NewTakeProfitOrderPrice       float64 `json:"newTpOrdPx,omitempty,string"`
	NewStopLossTriggerPrice       float64 `json:"newSlTriggerPx,omitempty,string"`
	NewStopLossOrderPrice         float64 `json:"newSlOrdPx,omitempty,string"`  // Stop-loss order price If the price is -1, stop-loss will be executed at the market price.
	NewTakeProfitTriggerPriceType string  `json:"newTpTriggerPxType,omitempty"` // Take-profit trigger price type'last': last price 'index': index price 'mark': mark price
	NewStopLossTriggerPriceType   string  `json:"newSlTriggerPxType,omitempty"` // Stop-loss trigger price type 'last': last price  'index': index price  'mark': mark price

	// Trigger Order parameters
	NewTriggerPrice     float64 `json:"newTriggerPx,omitempty"`
	NewOrderPrice       float64 `json:"newOrdPx,omitempty"`
	NewTriggerPriceType string  `json:"newTriggerPxType,omitempty"`

	AttachAlgoOrders []SubTPSLParams `json:"attachAlgoOrds,omitempty"`
}

AmendAlgoOrderParam request parameter to amend an algo order

type AmendAlgoResponse

type AmendAlgoResponse struct {
	AlgoClientOrderID string `json:"algoClOrdId"`
	AlgoID            string `json:"algoId"`
	ReqID             string `json:"reqId"`
	StatusCode        string `json:"sCode"`
	StatusMessage     string `json:"sMsg"`
}

AmendAlgoResponse holds response information of amending an algo order

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,omitempty,string"`
	NewPrice        float64 `json:"newPx,omitempty,string"`

	// Modify options orders using USD prices
	// Only applicable to options.
	// When modifying options orders, users can only fill in one of the following: newPx, newPxUsd, or newPxVol.
	NewPriceInUSD float64 `json:"newPxUsd,omitempty,string"`

	NewPriceVolatility float64       `json:"newPxVol,omitempty"` // Modify options orders based on implied volatility, where 1 represents 100%. Only applicable to options.
	AttachAlgoOrders   []AlgoOrdInfo `json:"attachAlgoOrds,omitempty"`
}

AmendOrderRequestParams represents amend order requesting parameters

type AmendRecurringOrderParam

type AmendRecurringOrderParam struct {
	AlgoID       string `json:"algoId"`
	StrategyName string `json:"stgyName"`
}

AmendRecurringOrderParam holds recurring order params

type AmendSpreadOrderParam

type AmendSpreadOrderParam struct {
	OrderID       string  `json:"ordId"`
	ClientOrderID string  `json:"clOrdId"`
	RequestID     string  `json:"reqId"`
	NewSize       float64 `json:"newSz,omitempty,string"`
	NewPrice      float64 `json:"newPx,omitempty,string"`
}

AmendSpreadOrderParam holds amend parameters for spread order

type AnnouncementDetail

type AnnouncementDetail struct {
	Details []struct {
		AnnouncementType string     `json:"annType"`
		PushTime         types.Time `json:"pTime"`
		Title            string     `json:"title"`
		URL              string     `json:"url"`
	} `json:"details"`
	TotalPage types.Number `json:"totalPage"`
}

AnnouncementDetail represents an exchange's announcement detail

type AnnouncementTypeInfo

type AnnouncementTypeInfo struct {
	AnnouncementType     string `json:"annType"`
	AnnouncementTypeDesc string `json:"annTypeDesc"`
}

AnnouncementTypeInfo represents an announcement type sample and it's description

type ArchiveReference

type ArchiveReference struct {
	FileHref  string     `json:"fileHref"`
	State     string     `json:"state"`
	Timestamp types.Time `json:"ts"`
}

ArchiveReference holds recently-filled transaction details archive link and timestamp information

type AssetBalance

type AssetBalance struct {
	Currency      string       `json:"ccy"`
	AvailBal      types.Number `json:"availBal"`
	Balance       types.Number `json:"bal"`
	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  types.Number `json:"balChg"`
	AccountBalance types.Number `json:"bal"`
	Type           types.Number `json:"type"`
	Timestamp      types.Time   `json:"ts"`
}

AssetBillDetail represents the billing record

type AutoLoan

type AutoLoan struct {
	AutoLoan bool `json:"autoLoan"`
}

AutoLoan holds auto loan information

type AutoRepay

type AutoRepay struct {
	AutoRepay bool `json:"autoRepay"`
}

AutoRepay represents an auto-repay request and response

type BETHAssetsBalance

type BETHAssetsBalance struct {
	Currency              string       `json:"ccy"`
	Amount                types.Number `json:"amt"`
	LatestInterestAccrual types.Number `json:"latestInterestAccrual"`
	TotalInterestAccrual  types.Number `json:"totalInterestAccrual"`
	Timestamp             types.Time   `json:"ts"`
}

BETHAssetsBalance balance is a snapshot summarized all BETH assets

type BalanceAndPositionData

type BalanceAndPositionData struct {
	PushTime     types.Time           `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 types.Number `json:"cashBal"`
	UpdateTime  types.Time   `json:"uTime"`
}

BalanceData represents currency and it's Cash balance with the update time

type BillsArchiveInfo

type BillsArchiveInfo struct {
	FileHref  string     `json:"fileHref"`
	State     string     `json:"state"`
	Timestamp types.Time `json:"ts"`
}

BillsArchiveInfo represents a bill archive information

type BillsDetailQueryParameter

type BillsDetailQueryParameter struct {
	InstrumentType string // Instrument type "SPOT" "MARGIN" "SWAP" "FUTURES" "OPTION"
	InstrumentID   string
	Currency       currency.Code
	MarginMode     string // Margin mode "isolated" "cross"
	ContractType   string // Contract type "linear" & "inverse" Only applicable to FUTURES/SWAP
	BillType       uint64 // 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    int64  // 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 BillsDetailResp

type BillsDetailResp struct {
	Result    string     `json:"result"`
	Timestamp types.Time `json:"ts"`
}

BillsDetailResp represents response for applying for bill-details

type BillsDetailResponse

type BillsDetailResponse struct {
	Balance                    types.Number `json:"bal"`
	BalanceChange              types.Number `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"`
	Price                      types.Number `json:"px"`
	Interest                   types.Number `json:"interest"`
	Tag                        string       `json:"tag"`
	FillTime                   types.Time   `json:"fillTime"`
	TradeID                    string       `json:"tradeId"`
	ClientOrdID                string       `json:"clOrdId"`
	FillIdxPrice               types.Number `json:"fillIdxPx"`
	FillMarkPrice              types.Number `json:"fillMarkPx"`
	FillPxVolume               types.Number `json:"fillPxVol"`
	FillPxUSD                  types.Number `json:"fillPxUsd"`
	FillMarkVolume             types.Number `json:"fillMarkVol"`
	FillFwdPrice               types.Number `json:"fillFwdPx"`
	Size                       types.Number `json:"sz"`
	To                         string       `json:"to"`
	Timestamp                  types.Time   `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                types.Time   `json:"ts"`
}

BlockTicker holds block trading 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 Book5Data

type Book5Data struct {
	Asks         [][4]types.Number `json:"asks"`
	Bids         [][4]types.Number `json:"bids"`
	InstrumentID string            `json:"instId"`
	Timestamp    types.Time        `json:"ts"`
	SequenceID   int64             `json:"seqId"`
}

Book5Data stores the orderbook data for orderbook 5 websocket

type BorrowAndRepay

type BorrowAndRepay struct {
	Amount       float64       `json:"amt,string"`
	InstrumentID string        `json:"instId"`
	LoanCcy      currency.Code `json:"ccy"`
	Side         string        `json:"side"` // possible values: 'borrow' and 'repay'
}

BorrowAndRepay manual holds manual borrow and repay in quick margin mode

type BorrowInterestAndLimitResponse

type BorrowInterestAndLimitResponse struct {
	Debt             string       `json:"debt"`
	Interest         string       `json:"interest"`
	NextDiscountTime types.Time   `json:"nextDiscountTime"`
	NextInterestTime types.Time   `json:"nextInterestTime"`
	LoanAllocation   types.Number `json:"loanAlloc"`
	Records          []struct {
		AvailLoan           types.Number       `json:"availLoan"`
		Currency            string             `json:"ccy"`
		Interest            types.Number       `json:"interest"`
		LoanQuota           types.Number       `json:"loanQuota"`
		PosLoan             types.Number       `json:"posLoan"` // Frozen amount for current account Only applicable to VIP loans
		Rate                types.Number       `json:"rate"`
		SurplusLimit        types.Number       `json:"surplusLmt"`
		SurplusLimitDetails SurplusLimitDetail `json:"surplusLmtDetails"`
		UsedLmt             types.Number       `json:"usedLmt"`
		UsedLoan            types.Number       `json:"usedLoan"`
	} `json:"records"`
}

BorrowInterestAndLimitResponse represents borrow interest and limit rate for different loan type

type BorrowOrRepay

type BorrowOrRepay struct {
	Currency string       `json:"ccy"`
	Side     string       `json:"side"`
	Amount   types.Number `json:"amt"`
}

BorrowOrRepay represents a borrow and repay operation response

type BorrowRepayHistory

type BorrowRepayHistory struct {
	Currency   string     `json:"ccy"`
	TradedLoan string     `json:"tradedLoan"`
	Timestamp  types.Time `json:"ts"`
	Type       string     `json:"type"`
	UsedLoan   string     `json:"usedLoan"`
}

BorrowRepayHistory represents borrow and repay history item data

type BorrowRepayHistoryItem

type BorrowRepayHistoryItem struct {
	InstrumentID    string       `json:"instId"`
	Currency        string       `json:"ccy"`
	Side            string       `json:"side"`
	AccBorrowAmount types.Number `json:"accBorrowed"`
	Amount          types.Number `json:"amt"`
	RefID           string       `json:"refId"`
	Timestamp       types.Time   `json:"ts"`
}

BorrowRepayHistoryItem holds borrow or repay history item information

type BorrowRepayItem

type BorrowRepayItem struct {
	AccBorrowed string       `json:"accBorrowed"`
	Amount      types.Number `json:"amt"`
	Currency    string       `json:"ccy"`
	Timestamp   types.Time   `json:"ts"`
	EventType   string       `json:"type"`
}

BorrowRepayItem represents a borrow/repay history

type CancelClosePositionOrder

type CancelClosePositionOrder struct {
	AlgoID  string `json:"algoId"`
	OrderID string `json:"ordId"` // Close position order ID
}

CancelClosePositionOrder holds close position order parameter cancellation parameter

type CancelFundingParam

type CancelFundingParam struct {
	OrderID      string `json:"ordId"`
	ProtocolType string `json:"protocolType"`
}

CancelFundingParam cancel purchase or redemption request

type CancelMMPResponse

type CancelMMPResponse struct {
	Result bool `json:"result"`
}

CancelMMPResponse holds the result of a cancel MMP response.

type CancelMassReqParam

type CancelMassReqParam struct {
	InstrumentType   string `json:"instType"`
	InstrumentFamily string `json:"instFamily"`
}

CancelMassReqParam holds MMP batch cancel request parameters

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 CancelPurchaseOrRedemptionResponse

type CancelPurchaseOrRedemptionResponse struct {
	OrderIDResponse
	Tag string `json:"tag"`
}

CancelPurchaseOrRedemptionResponse represents a response for canceling a purchase or redemption

type CancelQuoteRequestParams

type CancelQuoteRequestParams struct {
	QuoteID       string `json:"quoteId,omitempty"`
	ClientQuoteID string `json:"clQuoteId,omitempty"`
}

CancelQuoteRequestParams represents cancel quote request params

type CancelQuoteResponse

type CancelQuoteResponse struct {
	QuoteID       string `json:"quoteId"`
	ClientQuoteID string `json:"clQuoteId"`
	StatusCode    string `json:"sCode"`
	StatusMessage 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,omitempty"`
	ClientRFQID string `json:"clRfqId,omitempty"`
}

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"`
	StatusMessage string `json:"sMsg"`
}

CancelRFQResponse represents cancel RFQ orders response

type CancelResponse

type CancelResponse struct {
	TriggerTime types.Time `json:"triggerTime"` // The time the cancellation is triggered. triggerTime=0 means Cancel All After is disabled.
	Tag         string     `json:"tag"`
	Timestamp   types.Time `json:"ts"` // The time the request is sent.
}

CancelResponse represents a pending order cancellation response

type CandleStick

type CandleStick struct {
	OpenTime         types.Time
	OpenPrice        types.Number
	HighestPrice     types.Number
	LowestPrice      types.Number
	ClosePrice       types.Number
	Volume           types.Number
	QuoteAssetVolume types.Number
}

CandleStick stores candlestick price data.

func (*CandleStick) UnmarshalJSON

func (c *CandleStick) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes slice of data into Candlestick structure

type CandlestickHistoryItem

type CandlestickHistoryItem struct {
	Timestamp    types.Time
	OpenPrice    types.Number
	HighestPrice types.Number
	LowestPrice  types.Number
	ClosePrice   types.Number
	Confirm      candlestickState
}

CandlestickHistoryItem retrieves historical candlestick charts for the index or mark price from recent years.

func (*CandlestickHistoryItem) UnmarshalJSON

func (c *CandlestickHistoryItem) UnmarshalJSON(data []byte) error

UnmarshalJSON converts the data slice into a CandlestickHistoryItem instance.

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 CloseLeadingPositionParam

type CloseLeadingPositionParam struct {
	InstrumentType string `json:"instType"`
	SubPositionID  string `json:"subPosId"`
	Tag            string `json:"tag"`
}

CloseLeadingPositionParam request parameter for closing leading position

type ClosePositionContractGridResponse

type ClosePositionContractGridResponse struct {
	AlgoClientOrderID string `json:"algoClOrdId"`
	AlgoID            string `json:"algoId"`
	OrderID           string `json:"ordId"`
	Tag               string `json:"tag"`
}

ClosePositionContractGridResponse holds contract grid close position response data

type ClosePositionParams

type ClosePositionParams struct {
	AlgoID                  string  `json:"algoId"`
	MarketCloseAllPositions bool    `json:"mktClose"` // true: Market close all position, false:Close part of position
	Size                    float64 `json:"sz,omitempty,string"`
	Price                   float64 `json:"px,omitempty,string"`
}

ClosePositionParams holds close position parameters

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 ComputeInvestmentDataParam

type ComputeInvestmentDataParam struct {
	InstrumentID    string           `json:"instId"`
	AlgoOrderType   string           `json:"algoOrdType"` // Algo order type 'grid': Spot grid 'contract_grid': Contract grid
	GridNumber      float64          `json:"gridNum,string"`
	Direction       string           `json:"direction,omitempty"` // Contract grid type 'long','short', 'neutral' Only applicable to contract grid
	MaxPrice        float64          `json:"maxPx,string"`
	MinPrice        float64          `json:"minPx,string"`
	RunType         string           `json:"runType"` // Grid type 1: Arithmetic, 2: Geometric
	Leverage        float64          `json:"lever,omitempty,string"`
	BasePosition    bool             `json:"basePos,omitempty"`
	InvestmentType  string           `json:"investmentType,omitempty"`
	TriggerStrategy string           `json:"triggerStrategy,omitempty"` // TriggerStrategy possible values are 'instant', 'price', 'rsi'
	InvestmentData  []InvestmentData `json:"investmentData,omitempty"`
}

ComputeInvestmentDataParam holds parameter values for computing investment data

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         types.Number `json:"annualizedRate"`
	ArbitrageNumber        types.Number `json:"arbitrageNum"`
	BasePosition           bool         `json:"basePos"`
	CancelType             string       `json:"cancelType"`
	Direction              string       `json:"direction"`
	Equity                 types.Number `json:"eq"`
	FloatProfit            types.Number `json:"floatProfit"`
	GridQuantity           types.Number `json:"gridNum"`
	GridProfit             types.Number `json:"gridProfit"`
	InstrumentID           string       `json:"instId"`
	InstrumentType         string       `json:"instType"`
	Investment             string       `json:"investment"`
	Leverage               string       `json:"lever"`
	LiqPrice               types.Number `json:"liqPx"`
	MaxPrice               types.Number `json:"maxPx"`
	MinPrice               types.Number `json:"minPx"`
	CreationTime           types.Time   `json:"cTime"`
	PushTime               types.Time   `json:"pTime"`
	PerMaxProfitRate       types.Number `json:"perMaxProfitRate"`
	PerMinProfitRate       types.Number `json:"perMinProfitRate"`
	ProfitAndLossRatio     types.Number `json:"pnlRatio"`
	RunPrice               types.Number `json:"runPx"`
	RunType                string       `json:"runType"`
	SingleAmount           types.Number `json:"singleAmt"`
	SlTriggerPrice         types.Number `json:"slTriggerPx"`
	State                  string       `json:"state"`
	StopType               string       `json:"stopType"`
	Size                   types.Number `json:"sz"`
	Tag                    string       `json:"tag"`
	TotalAnnualizedRate    string       `json:"totalAnnualizedRate"`
	TotalProfitAndLoss     types.Number `json:"totalPnl"`
	TakeProfitTriggerPrice types.Number `json:"tpTriggerPx"`
	TradeNumber            string       `json:"tradeNum"`
	TriggerTime            types.Time   `json:"triggerTime"`
	UpdateTime             types.Time   `json:"uTime"`
	Underlying             string       `json:"uly"`
}

ContractGridAlgoOrder represents contract grid algo order

type ContractOpenInterestHistoryItem

type ContractOpenInterestHistoryItem struct {
	Timestamp              types.Time
	OpenInterestInContract types.Number
	OpenInterestInCurrency types.Number
	OpenInterestInUSD      types.Number
}

ContractOpenInterestHistoryItem represents an open interest information for contract

func (*ContractOpenInterestHistoryItem) UnmarshalJSON

func (c *ContractOpenInterestHistoryItem) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes slice data into ContractOpenInterestHistoryItem instance

type ContractTakerVolume

type ContractTakerVolume struct {
	Timestamp       types.Time
	TakerSellVolume types.Number
	TakerBuyVolume  types.Number
}

ContractTakerVolume represents a contract taker sell and buy volume

func (*ContractTakerVolume) UnmarshalJSON

func (c *ContractTakerVolume) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a slice data into ContractTakerVolume

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"`
	BaseCurrencyMin  types.Number `json:"baseCcyMin"`
	QuoteCurrency    string       `json:"quoteCcy,omitempty"`
	QuoteCurrencyMax types.Number `json:"quoteCcyMax"`
	QuoteCurrencyMin types.Number `json:"quoteCcyMin"`
}

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"`
	ClientRequestID string       `json:"clTReqId"`
	Timestamp       types.Time   `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  currency.Code `json:"szCcy"`
	QuoteID       string        `json:"quoteId"`
	ClientOrderID string        `json:"clTReqId,omitempty"`
	Tag           string        `json:"tag,omitempty"`
}

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     types.Number `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"`
	Size          types.Number `json:"sz"`
	SizeCurrency  string       `json:"szCcy"`
	Timestamp     types.Time   `json:"ts"`
}

ConvertTradeResponse represents convert trade response

type CopySetting

type CopySetting struct {
	Currency             string       `json:"ccy"`
	CopyState            string       `json:"copyState"`
	CopyMarginMode       string       `json:"copyMgnMode"`
	SubPositionCloseType string       `json:"subPosCloseType"`
	StopLossTotalAmount  types.Number `json:"slTotalAmt"`
	CopyAmount           types.Number `json:"copyAmt"`
	CopyInstrumentIDType string       `json:"copyInstIdType"`
	CopyMode             string       `json:"copyMode"`
	CopyRatio            types.Number `json:"copyRatio"`
	CopyTotalAmount      types.Number `json:"copyTotalAmt"`
	InstrumentIDs        []struct {
		Enabled      string `json:"enabled"`
		InstrumentID string `json:"instId"`
	} `json:"instIds"`
	StopLossRatio   types.Number `json:"slRatio"`
	TakeProfitRatio types.Number `json:"tpRatio"`
}

CopySetting represents a copy setting response

type CopyTradingLeadTrader

type CopyTradingLeadTrader struct {
	BeginCopyTime           types.Time   `json:"beginCopyTime"`
	Currency                string       `json:"ccy"`
	CopyTotalAmount         types.Number `json:"copyTotalAmt"`
	CopyTotalProfitAndLoss  types.Number `json:"copyTotalPnl"`
	LeadMode                string       `json:"leadMode"`
	Margin                  types.Number `json:"margin"`
	NickName                string       `json:"nickName"`
	PortLink                string       `json:"portLink"`
	ProfitSharingRatio      types.Number `json:"profitSharingRatio"`
	TodayProfitAndLoss      types.Number `json:"todayPnl"`
	UniqueCode              string       `json:"uniqueCode"`
	UnrealizedProfitAndLoss types.Number `json:"upl"`
	CopyMode                string       `json:"copyMode"`
	CopyNum                 string       `json:"copyNum"`
	CopyRatio               types.Number `json:"copyRatio"`
	CopyRelID               string       `json:"copyRelId"`
	CopyState               string       `json:"copyState"`
}

CopyTradingLeadTrader represents a lead trader information

type CopyTradingNotification

type CopyTradingNotification struct {
	Argument SubscriptionInfo `json:"arg"`
	Data     []struct {
		AveragePrice        types.Number `json:"avgPx"`
		Currency            string       `json:"ccy"`
		CopyTotalAmount     types.Number `json:"copyTotalAmt"`
		InfoType            string       `json:"infoType"`
		InstrumentID        string       `json:"instId"`
		InstrumentType      string       `json:"instType"`
		Leverage            types.Number `json:"lever"`
		MaxLeadTraderNumber string       `json:"maxLeadTraderNum"`
		MinNotional         types.Number `json:"minNotional"`
		PositionSide        string       `json:"posSide"`
		RmThreshold         string       `json:"rmThold"` // Lead trader can remove copy trader if balance of copy trader less than this value.
		Side                string       `json:"side"`
		StopLossTotalAmount types.Number `json:"slTotalAmt"`
		SlippageRatio       types.Number `json:"slippageRatio"`
		SubPosID            string       `json:"subPosId"`
		UniqueCode          string       `json:"uniqueCode"`
	} `json:"data"`
}

CopyTradingNotification holds copy-trading notifications

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     string     `json:"quoteSide"`
	Legs          []QuoteLeg `json:"legs"`
}

CreateQuoteParams holds information related to create quote

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 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"`
	VerifiedName             string            `json:"verifiedName"`
}

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"`
	FillDebtSize  types.Number `json:"fillDebtSz"`
	FillToSize    types.Number `json:"fillToSz"`
	RepayCurrency string       `json:"repayCcy"`
	Status        string       `json:"status"`
	UpdateTime    types.Time   `json:"uTime"`
}

CurrencyOneClickRepay represents the currency used for one-click repayment.

type CurrencyResponse

type CurrencyResponse struct {
	Name                string       `json:"name"`        // Chinese name of currency
	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       types.Number `json:"minWd"`       // Minimum amount of currency withdrawal in a single transaction
	UsedWithdrawalQuota types.Number `json:"usedWdQuota"` // Amount of currency withdrawal used in the past 24 hours, unit in BTC
	WithdrawalQuota     types.Number `json:"wdQuota"`     // Minimum amount of currency withdrawal in a single transaction
	WithdrawalTickSize  types.Number `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       types.Time
	CallBuyVolume   types.Number
	CallSellVolume  types.Number
	PutBuyVolume    types.Number
	PutSellVolume   types.Number
	CallBlockVolume types.Number
	PutBlockVolume  types.Number
}

CurrencyTakerFlow holds the taker volume information for a single currency

func (*CurrencyTakerFlow) UnmarshalJSON

func (c *CurrencyTakerFlow) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a slice of byte data into CurrencyTakerFlow

type DeliveryEstimatedPrice

type DeliveryEstimatedPrice struct {
	InstrumentType         string       `json:"instType"`
	InstrumentID           string       `json:"instId"`
	EstimatedDeliveryPrice types.Number `json:"settlePx"`
	Timestamp              types.Time   `json:"ts"`
}

DeliveryEstimatedPrice holds an estimated delivery or exercise price response

type DeliveryHistory

type DeliveryHistory struct {
	Timestamp types.Time              `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           types.Time   `json:"ts"`
	State               types.Number `json:"state"`
	DepositID           string       `json:"depId"`
	AreaCodeFrom        string       `json:"areaCodeFrom"`
	FromWithdrawalID    string       `json:"fromWdId"`
	ActualDepBlkConfirm string       `json:"actualDepBlkConfirm"`
}

DepositHistoryResponseItem deposit history response item

type DepositWithdrawStatus

type DepositWithdrawStatus struct {
	WithdrawID      string     `json:"wdId"`
	TransactionID   string     `json:"txId"`
	State           string     `json:"state"`
	EstCompleteTime types.Time `json:"estCompleteTime"`
}

DepositWithdrawStatus holds deposit withdraw status info

type DiscountRate

type DiscountRate struct {
	Amount            types.Number           `json:"amt"`
	Currency          string                 `json:"ccy"`
	DiscountRateLevel string                 `json:"discountLv"`
	MinDiscountRate   types.Number           `json:"minDiscountRate"`
	DiscountInfo      []DiscountRateInfoItem `json:"discountInfo"`
}

DiscountRate represents the discount rate amount, currency, and other discount related information

type DiscountRateInfoItem

type DiscountRateInfoItem struct {
	DiscountRate           types.Number `json:"discountRate"`
	MaxAmount              types.Number `json:"maxAmt"`
	MinAmount              types.Number `json:"minAmt"`
	Tiers                  string       `json:"tier"`
	LiqPenaltyRate         types.Number `json:"liqPenaltyRate"`
	DiscountCurrencyEquity types.Number `json:"disCcyEq"`
}

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   types.Time   `json:"uTime"`
	Account      string       `json:"acct"`
}

EasyConvertItem represents easy convert place order response

type EconomicCalendar

type EconomicCalendar struct {
	Actual      string     `json:"actual"`
	CalendarID  string     `json:"calendarId"`
	Date        types.Time `json:"date"`
	Region      string     `json:"region"`
	Category    string     `json:"category"`
	Event       string     `json:"event"`
	RefDate     types.Time `json:"refDate"`
	Previous    string     `json:"previous"`
	Forecast    string     `json:"forecast"`
	Importance  string     `json:"importance"`
	PrevInitial string     `json:"prevInitial"`
	Currency    string     `json:"ccy"`
	Unit        string     `json:"unit"`
	Timestamp   types.Time `json:"ts"`
	DateSpan    string     `json:"dateSpan"`
	UpdateTime  types.Time `json:"uTime"`
}

EconomicCalendar represents macro-economic calendar data

type EconomicCalendarResponse

type EconomicCalendarResponse struct {
	Arg  SubscriptionInfo   `json:"arg"`
	Data []EconomicCalendar `json:"data"`
}

EconomicCalendarResponse represents response for economic calendar

type EstimateQuoteRequestInput

type EstimateQuoteRequestInput struct {
	BaseCurrency         currency.Code `json:"baseCcy,omitempty"`
	QuoteCurrency        currency.Code `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        types.Number `json:"baseSz"`
	ClientRequestID string       `json:"clQReqId"`
	ConvertPrice    types.Number `json:"cnvtPx"`
	OrigRFQSize     types.Number `json:"origRfqSz"`
	QuoteCurrency   string       `json:"quoteCcy"`
	QuoteID         string       `json:"quoteId"`
	QuoteSize       types.Number `json:"quoteSz"`
	QuoteTime       types.Time   `json:"quoteTime"`
	RFQSize         types.Number `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 ExchangeInfo

type ExchangeInfo struct {
	ExchID       string `json:"exchId"`
	ExchangeName string `json:"exchName"`
}

ExchangeInfo represents exchange information

type ExecuteQuoteParams

type ExecuteQuoteParams struct {
	RFQID   string `json:"rfqId,omitempty"`
	QuoteID string `json:"quoteId,omitempty"`
}

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    types.Time `json:"cTime"`
	Legs            []OrderLeg `json:"legs"`
}

ExecuteQuoteResponse represents execute quote response

type ExpiryOpenInterestAndVolume

type ExpiryOpenInterestAndVolume struct {
	Timestamp        types.Time
	ExpiryTime       time.Time
	CallOpenInterest types.Number
	PutOpenInterest  types.Number
	CallVolume       types.Number
	PutVolume        types.Number
}

ExpiryOpenInterestAndVolume represents open interest and trading volume of calls and puts for each upcoming expiration

func (*ExpiryOpenInterestAndVolume) UnmarshalJSON

func (e *ExpiryOpenInterestAndVolume) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes slice of data into ExpiryOpenInterestAndVolume structure

type FiatDepositPaymentMethods

type FiatDepositPaymentMethods struct {
	Currency      string       `json:"ccy"`
	PaymentMethod string       `json:"paymentMethod"`
	FeeRate       types.Number `json:"feeRate"`
	MinFee        types.Number `json:"minFee"`
	Limits        struct {
		DailyLimit            types.Number `json:"dailyLimit"`
		DailyLimitRemaining   types.Number `json:"dailyLimitRemaining"`
		WeeklyLimit           types.Number `json:"weeklyLimit"`
		WeeklyLimitRemaining  types.Number `json:"weeklyLimitRemaining"`
		MonthlyLimit          types.Number `json:"monthlyLimit"`
		MonthlyLimitRemaining types.Number `json:"monthlyLimitRemaining"`
		MaxAmount             types.Number `json:"maxAmt"`
		MinAmount             types.Number `json:"minAmt"`
		LifetimeLimit         types.Number `json:"lifetimeLimit"`
	} `json:"limits"`
	Accounts []struct {
		PaymentAcctID string `json:"paymentAcctId"`
		AccountNumber string `json:"acctNum"`
		RecipientName string `json:"recipientName"`
		BankName      string `json:"bankName"`
		BankCode      string `json:"bankCode"`
		State         string `json:"state"`
	} `json:"accounts"`
}

FiatDepositPaymentMethods represents a fiat deposit payment methods

type FiatItemInfo

type FiatItemInfo struct {
	Currency string       `json:"ccy"`
	Taker    types.Number `json:"taker"`
	Maker    types.Number `json:"maker"`
}

FiatItemInfo represents fiat currency with taker and maker fee details

type FiatOrderDetail

type FiatOrderDetail struct {
	CreatTime       types.Time   `json:"cTime"`
	UpdateTime      types.Time   `json:"uTime"`
	OrdID           string       `json:"ordId"`
	PaymentMethod   string       `json:"paymentMethod"`
	PaymentAcctID   string       `json:"paymentAcctId"`
	Amount          types.Number `json:"amt"`
	Fee             types.Number `json:"fee"`
	Currency        string       `json:"ccy"`
	State           string       `json:"state"`
	ClientID        string       `json:"clientId"`
	PaymentMethodID string       `json:"paymentMethodId,omitempty"`
}

FiatOrderDetail represents a fiat deposit/withdrawal order detail

type FiatWithdrawalPaymentMethods

type FiatWithdrawalPaymentMethods struct {
	Currency      string       `json:"ccy"`
	PaymentMethod string       `json:"paymentMethod"`
	FeeRate       types.Number `json:"feeRate"`
	MinFee        types.Number `json:"minFee"`
	Limits        struct {
		DailyLimit            types.Number `json:"dailyLimit"`
		DailyLimitRemaining   types.Number `json:"dailyLimitRemaining"`
		WeeklyLimit           types.Number `json:"weeklyLimit"`
		WeeklyLimitRemaining  types.Number `json:"weeklyLimitRemaining"`
		MonthlyLimit          types.Number `json:"monthlyLimit"`
		MonthlyLimitRemaining types.Number `json:"monthlyLimitRemaining"`
		MaxAmount             types.Number `json:"maxAmt"`
		MinAmount             types.Number `json:"minAmt"`
		LifetimeLimit         types.Number `json:"lifetimeLimit"`
	} `json:"limits"`
	Accounts []struct {
		PaymentAcctID string `json:"paymentAcctId"`
		AccountNumber string `json:"acctNum"`
		RecipientName string `json:"recipientName"`
		BankName      string `json:"bankName"`
		BankCode      string `json:"bankCode"`
		State         string `json:"state"`
	} `json:"accounts"`
}

FiatWithdrawalPaymentMethods represents a detailed information about fiat asset withdrawal payment methods and accounts

type FillArchiveParam

type FillArchiveParam struct {
	Year    int64  `json:"year,string"`
	Quarter string `json:"quarter"`
}

FillArchiveParam transaction detail param for 2 year

type FirstCopySettings

type FirstCopySettings struct {
	InstrumentType       string  `json:"instType,omitempty"`
	InstrumentID         string  `json:"instId"` // Instrument ID. If there are multiple instruments, separate them with commas. Maximum of 200 instruments can be selected
	UniqueCode           string  `json:"uniqueCode"`
	CopyMarginMode       string  `json:"copyMgnMode,omitempty"` // Copy margin mode 'cross': cross 'isolated': isolated 'copy'
	CopyInstrumentIDType string  `json:"copyInstIdType"`        // Copy contract type set 'custom': custom by instId which is required;'copy': Keep your contracts consistent with this trader
	CopyMode             string  `json:"copyMode,omitempty"`    // Possible values: 'fixed_amount', 'ratio_copy', 'copyRatio', and 'fixed_amount'
	CopyRatio            float64 `json:"copyRatio,string"`
	CopyAmount           float64 `json:"copyAmt,string,omitempty"`
	CopyTotalAmount      float64 `json:"copyTotalAmt,string"`
	SubPosCloseType      string  `json:"subPosCloseType"`
	TakeProfitRatio      float64 `json:"tpRatio,string,omitempty"`
	StopLossRatio        float64 `json:"slRatio,string,omitempty"`
	StopLossTotalAmount  float64 `json:"slTotalAmt,string,omitempty"`
}

FirstCopySettings holds parameters first copy settings for the certain lead trader

type FixedLoanBorrowLimitInformation

type FixedLoanBorrowLimitInformation struct {
	TotalBorrowLimit     types.Number `json:"totalBorrowLmt"`
	TotalAvailableBorrow types.Number `json:"totalAvailBorrow"`
	Borrowed             types.Number `json:"borrowed"`
	UsedAmount           types.Number `json:"used"`
	AvailRepay           string       `json:"availRepay"`
	Details              []struct {
		Borrowed    types.Number `json:"borrowed"`
		AvailBorrow types.Number `json:"availBorrow"`
		Currency    string       `json:"ccy"`
		MinBorrow   types.Number `json:"minBorrow"`
		Used        types.Number `json:"used"`
		Term        string       `json:"term"`
	} `json:"details"`
	Timestamp types.Time `json:"ts"`
}

FixedLoanBorrowLimitInformation represents a fixed loan borrow information

type FixedLoanBorrowOrderDetail

type FixedLoanBorrowOrderDetail struct {
	OrderID                   string       `json:"ordId"`
	AccruedInterest           string       `json:"accruedInterest"`
	ActualBorrowAmount        types.Number `json:"actualBorrowAmt"`
	CreateTime                types.Time   `json:"cTime"`
	Currency                  string       `json:"ccy"`
	CurRate                   types.Number `json:"curRate"`
	DeadlinePenaltyInterest   types.Number `json:"deadlinePenaltyInterest"`
	EarlyRepayPenaltyInterest types.Number `json:"earlyRepayPenaltyInterest"`
	ExpiryTime                types.Time   `json:"expiryTime"`
	FailedReason              string       `json:"failedReason"`
	ForceRepayTime            types.Time   `json:"forceRepayTime"`
	OverduePenaltyInterest    types.Number `json:"overduePenaltyInterest"`
	PotentialPenaltyInterest  types.Number `json:"potentialPenaltyInterest"`
	Reborrow                  bool         `json:"reborrow"`
	ReborrowRate              types.Number `json:"reborrowRate"`
	ReqBorrowAmount           types.Number `json:"reqBorrowAmt"`
	SettleReason              string       `json:"settleReason"`
	State                     string       `json:"state"`
	Term                      string       `json:"term"`
	UpdateTime                types.Time   `json:"uTime"`
}

FixedLoanBorrowOrderDetail represents a borrow order detail

type FixedLoanBorrowQuote

type FixedLoanBorrowQuote struct {
	Currency        string       `json:"ccy"`
	Term            string       `json:"term"`
	EstAvailBorrow  types.Number `json:"estAvailBorrow"`
	EstRate         types.Number `json:"estRate"`
	EstInterest     types.Number `json:"estInterest"`
	PenaltyInterest types.Number `json:"penaltyInterest"`
	Timestamp       types.Time   `json:"ts"`
}

FixedLoanBorrowQuote represents a fixed loan quote details

type FundingBalance

type FundingBalance struct {
	AvailableBalance types.Number `json:"availBal"`
	Balance          types.Number `json:"bal"`
	Currency         string       `json:"ccy"`
	FrozenBalance    types.Number `json:"frozenBal"`
}

FundingBalance holds function balance

type FundingRateResponse

type FundingRateResponse struct {
	InstrumentType               string       `json:"instType"`
	InstrumentID                 string       `json:"instId"`
	FundingRateMethod            string       `json:"method"`
	FundingRate                  types.Number `json:"fundingRate"`
	NextFundingRate              types.Number `json:"nextFundingRate"`
	FundingTime                  types.Time   `json:"fundingTime"`
	NextFundingTime              types.Time   `json:"nextFundingTime"`
	MinFundingRate               types.Number `json:"minFundingRate"`
	MaxFundingRate               types.Number `json:"maxFundingRate"`
	SettlementStateOfFundingRate string       `json:"settState"`
	SettlementFundingRate        types.Number `json:"settFundingRate"`
	Premium                      string       `json:"premium"`
	Timestamp                    types.Time   `json:"ts"`
}

FundingRateResponse response data for the Funding Rate for an instruction type

type FundingTransferRequestInput

type FundingTransferRequestInput struct {
	Currency               currency.Code `json:"ccy"`
	TransferType           int64         `json:"type,string"`
	Amount                 float64       `json:"amt,string"`
	RemittingAccountType   string        `json:"from"` // "6": Funding account, "18": Trading account
	BeneficiaryAccountType string        `json:"to"`
	SubAccount             string        `json:"subAcct"`
	LoanTransfer           bool          `json:"loanTrans,string"`
	OmitPositionRisk       bool          `json:"omitPosRisk,omitempty,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       types.Number `json:"from"`
	Amount     types.Number `json:"amt"`
	To         types.Number `json:"to"`
}

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 types.Time `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     float64 `json:"maxPx,string"`
	MinPrice     float64 `json:"minPx,string"`
	GridQuantity float64 `json:"gridNum,string"`
	GridType     string  `json:"runType"` // "1": Arithmetic, "2": Geometric Default is Arithmetic

	// Spot Grid Order
	QuoteSize float64 `json:"quoteSz,string"` // Invest amount for quote currency Either "instId" or "ccy" is required
	BaseSize  float64 `json:"baseSz,string"`  // 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         float64 `json:"sz,string"`
	Direction    string  `json:"direction"`
	Leverage     string  `json:"lever"`
}

GridAlgoOrder represents grid algo order

type GridAlgoOrderAmend

type GridAlgoOrderAmend struct {
	AlgoID                 string       `json:"algoId"`
	InstrumentID           string       `json:"instId"`
	StopLossTriggerPrice   types.Number `json:"slTriggerPx"`
	TakeProfitTriggerPrice types.Number `json:"tpTriggerPx"`
}

GridAlgoOrderAmend represents amend algo order response

type GridAlgoOrderIDResponse

type GridAlgoOrderIDResponse struct {
	AlgoOrderID   string `json:"algoId"`
	StatusCode    string `json:"sCode"`
	StatusMessage 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                  types.Number `json:"baseSz"`
	CancelType                string       `json:"cancelType"`
	Direction                 string       `json:"direction"`
	FloatProfit               types.Number `json:"floatProfit"`
	GridQuantity              types.Number `json:"gridNum"`
	GridProfit                string       `json:"gridProfit"`
	InstrumentID              string       `json:"instId"`
	InstrumentType            string       `json:"instType"`
	Investment                string       `json:"investment"`
	Leverage                  string       `json:"lever"`
	EstimatedLiquidationPrice types.Number `json:"liqPx"`
	MaximumPrice              types.Number `json:"maxPx"`
	MinimumPrice              types.Number `json:"minPx"`
	ProfitAndLossRatio        types.Number `json:"pnlRatio"`
	QuoteSize                 types.Number `json:"quoteSz"`
	RunType                   string       `json:"runType"`
	StopLossTriggerPrice      types.Number `json:"slTriggerPx"`
	State                     string       `json:"state"`
	StopResult                string       `json:"stopResult,omitempty"`
	StopType                  string       `json:"stopType"`
	Size                      types.Number `json:"sz"`
	Tag                       string       `json:"tag"`
	TotalProfitAndLoss        types.Number `json:"totalPnl"`
	TakeProfitTriggerPrice    types.Number `json:"tpTriggerPx"`
	CreationTime              types.Time   `json:"cTime"`
	UpdateTime                types.Time   `json:"uTime"`
	Underlying                string       `json:"uly"`

	EquityOfStrength    string       `json:"eq,omitempty"`
	PerMaxProfitRate    types.Number `json:"perMaxProfitRate,omitempty"`
	PerMinProfitRate    types.Number `json:"perMinProfitRate,omitempty"`
	Profit              types.Number `json:"profit,omitempty"`
	Runpx               string       `json:"runpx,omitempty"`
	SingleAmt           types.Number `json:"singleAmt,omitempty"`
	TotalAnnualizedRate types.Number `json:"totalAnnualizedRate,omitempty"`
	TradeNumber         string       `json:"tradeNum,omitempty"`

	AnnualizedRate types.Number `json:"annualizedRate,omitempty"`
	CurBaseSize    types.Number `json:"curBaseSz,omitempty"`
	CurQuoteSize   types.Number `json:"curQuoteSz,omitempty"`
}

GridAlgoOrderResponse is a complete information of grid algo order item response

type GridSubOrderData

type GridSubOrderData struct {
	AccumulatedFillSize types.Number `json:"accFillSz"`
	AlgoID              string       `json:"algoId"`
	AlgoOrderType       string       `json:"algoOrdType"`
	AveragePrice        types.Number `json:"avgPx"`
	CreationTime        types.Time   `json:"cTime"`
	ContractValue       string       `json:"ctVal"`
	Fee                 types.Number `json:"fee"`
	FeeCurrency         string       `json:"feeCcy"`
	GroupID             string       `json:"groupId"`
	InstrumentID        string       `json:"instId"`
	InstrumentType      string       `json:"instType"`
	Leverage            types.Number `json:"lever"`
	OrderID             string       `json:"ordId"`
	OrderType           string       `json:"ordType"`
	PushTime            types.Time   `json:"pTime"`
	ProfitAndLoss       types.Number `json:"pnl"`
	PositionSide        string       `json:"posSide"`
	Price               types.Number `json:"px"`
	Side                order.Side   `json:"side"`
	State               string       `json:"state"`
	Size                types.Number `json:"sz"`
	Tag                 string       `json:"tag"`
	TradeMode           string       `json:"tdMode"`
	UpdateTime          types.Time   `json:"uTime"`
}

GridSubOrderData represents a single sub order detailed info

type IncreaseDecreaseMargin

type IncreaseDecreaseMargin struct {
	Amount       types.Number `json:"amt"`
	Currency     string       `json:"ccy"`
	InstrumentID string       `json:"instId"`
	Leverage     types.Number `json:"leverage"`
	PositionSide 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"`
	MarginBalanceType string  `json:"type"`
	Amount            float64 `json:"amt,string"`
	Currency          string  `json:"ccy"`
}

IncreaseDecreaseMarginInput represents increase or decrease the margin of the isolated position

type IndexComponent

type IndexComponent struct {
	Index      string               `json:"index"`
	Components []IndexComponentItem `json:"components"`
	Last       types.Number         `json:"last"`
	Timestamp  types.Time           `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 types.Time   `json:"ts"`
}

IndexTicker represents data from the index ticker.

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                     types.Number `json:"stk"`
	ListTime                        types.Time   `json:"listTime"`
	ExpTime                         types.Time   `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 InstrumentFamilyTrade

type InstrumentFamilyTrade struct {
	Vol24H    types.Number `json:"vol24h"`
	TradeInfo []struct {
		InstrumentID string       `json:"instId"`
		TradeID      string       `json:"tradeId"`
		Side         string       `json:"side"`
		Size         types.Number `json:"sz"`
		Price        types.Number `json:"px"`
		Timestamp    types.Time   `json:"ts"`
	} `json:"tradeInfo"`
	OptionType string `json:"optType"`
}

InstrumentFamilyTrade represents transaction information of instrument. instrument family, e.g. BTC-USD Applicable to OPTION

type InstrumentsFetchParams

type InstrumentsFetchParams struct {
	InstrumentType   string // Mandatory
	Underlying       string // Optional
	InstrumentFamily string
	InstrumentID     string // Optional
}

InstrumentsFetchParams request params for requesting list of instruments

type InsuranceFundInformation

type InsuranceFundInformation struct {
	Details          []InsuranceFundInformationDetail `json:"details"`
	InstrumentFamily string                           `json:"instFamily"`
	InstrumentType   string                           `json:"instType"`
	Total            types.Number                     `json:"total"`
}

InsuranceFundInformation holds insurance fund information data

type InsuranceFundInformationDetail

type InsuranceFundInformationDetail struct {
	Timestamp                    types.Time   `json:"ts"`
	Amount                       types.Number `json:"amt"`
	Balance                      types.Number `json:"balance"`
	Currency                     string       `json:"ccy"`
	InsuranceType                string       `json:"type"`
	MaxBalance                   types.Number `json:"maxBal"`
	MaxBalTimestamp              types.Time   `json:"maxBalTs"`
	RealTimeInsuranceDeclineRate types.Number `json:"decRate"`
	ADLType                      string       `json:"adlType"`
}

InsuranceFundInformationDetail represents an Insurance fund information item for a single currency and type

type InsuranceFundInformationRequestParams

type InsuranceFundInformationRequestParams struct {
	InstrumentType   string        `json:"instType"`
	InsuranceType    string        `json:"type"` //  Type values allowed are `liquidation_balance_deposit, bankruptcy_loss, and platform_revenue`
	Underlying       string        `json:"uly"`
	InstrumentFamily string        `json:"instFamily"`
	Currency         currency.Code `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     types.Number `json:"interest"`
	InterestRate types.Number `json:"interestRate"` // Interest rate in an hour.
	Liability    types.Number `json:"liab"`
	MarginMode   string       `json:"mgnMode"` //  	Margin mode "cross" "isolated"
	Timestamp    types.Time   `json:"ts"`
	LoanType     string       `json:"type"`
}

InterestAccruedData represents interest rate accrued response

type InterestAndLoanDetail

type InterestAndLoanDetail struct {
	InterestRateDiscount types.Number `json:"irDiscount"`
	LoanQuotaCoefficient types.Number `json:"loanQuotaCoef"`
	UserLevel            string       `json:"level"`
}

InterestAndLoanDetail represents an interest rate and loan quota information

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 {
	Basic   []InterestRateLoanQuotaBasic `json:"basic"`
	VIP     []InterestAndLoanDetail      `json:"vip"`
	Regular []InterestAndLoanDetail      `json:"regular"`
}

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 InvestmentData

type InvestmentData struct {
	Amount   float64       `json:"amt,string"`
	Currency currency.Code `json:"ccy"`
}

InvestmentData holds investment data parameter

type InvestmentResult

type InvestmentResult struct {
	MinInvestmentData []InvestmentData `json:"minInvestmentData"`
	SingleAmount      types.Number     `json:"singleAmt"`
}

InvestmentResult holds investment 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 LeadPosition

type LeadPosition struct {
	Currency           string       `json:"ccy"`
	CloseAveragePrice  types.Number `json:"closeAvgPx"`
	CloseTime          types.Time   `json:"closeTime"`
	InstrumentID       string       `json:"instId"`
	InstrumentType     string       `json:"instType"`
	Leverage           types.Number `json:"lever"`
	Margin             types.Number `json:"margin"`
	MarginMode         string       `json:"mgnMode"`
	OpenAveragePrice   types.Number `json:"openAvgPx"`
	OpenTime           types.Time   `json:"openTime"`
	ProfitAndLoss      string       `json:"pnl"`
	ProfitAndLossRatio types.Number `json:"pnlRatio"`
	PositionSide       string       `json:"posSide"`
	SubPosition        string       `json:"subPos"`
	SubPositionID      string       `json:"subPosId"`
	UniqueCode         string       `json:"uniqueCode"`
}

LeadPosition holds lead trader completed leading position

type LeadTraderCurrencyPreference

type LeadTraderCurrencyPreference struct {
	Currency string       `json:"ccy"`
	Ratio    types.Number `json:"ratio"`
}

LeadTraderCurrencyPreference holds public preference currency

type LeadTraderCurrentLeadPosition

type LeadTraderCurrentLeadPosition struct {
	Currency       string       `json:"ccy"`
	InstrumentID   string       `json:"instId"`
	InstrumentType string       `json:"instType"`
	Lever          types.Number `json:"lever"`
	Margin         types.Number `json:"margin"`
	MarkPrice      types.Number `json:"markPx"`
	MarginMode     string       `json:"mgnMode"`
	OpenAvgPrice   types.Number `json:"openAvgPx"`
	OpenTime       types.Time   `json:"openTime"`
	PositionSide   string       `json:"posSide"`
	SubPos         string       `json:"subPos"`
	SubPosID       string       `json:"subPosId"`
	UniqueCode     string       `json:"uniqueCode"`
	UPL            types.Number `json:"upl"`
	UPLRatio       types.Number `json:"uplRatio"`
}

LeadTraderCurrentLeadPosition holds leading positions of lead trader

type LeadTraderStat

type LeadTraderStat struct {
	AvgSubPosNotional types.Number `json:"avgSubPosNotional"`
	Currency          string       `json:"ccy"`
	CurCopyTraderPnl  types.Number `json:"curCopyTraderPnl"`
	InvestAmount      types.Number `json:"investAmt"`
	LossDays          string       `json:"lossDays"`
	ProfitDays        string       `json:"profitDays"`
	WinRatio          types.Number `json:"winRatio"`
}

LeadTraderStat represents lead trader performance info

type LeadTradersRank

type LeadTradersRank struct {
	DataVer string `json:"dataVer"`
	Ranks   []struct {
		AccCopyTraderNum string       `json:"accCopyTraderNum"`
		Aum              string       `json:"aum"`
		Currency         string       `json:"ccy"`
		CopyState        string       `json:"copyState"`
		CopyTraderNum    string       `json:"copyTraderNum"`
		LeadDays         string       `json:"leadDays"`
		MaxCopyTraderNum string       `json:"maxCopyTraderNum"`
		NickName         string       `json:"nickName"`
		Pnl              types.Number `json:"pnl"`
		PnlRatio         types.Number `json:"pnlRatio"`
		PnlRatios        []struct {
			BeginTimestamp types.Time   `json:"beginTs"`
			PnlRatio       types.Number `json:"pnlRatio"`
		} `json:"pnlRatios"`
		PortLink    string       `json:"portLink"`
		TraderInsts []string     `json:"traderInsts"`
		UniqueCode  string       `json:"uniqueCode"`
		WinRatio    types.Number `json:"winRatio"`
	} `json:"ranks"`
	TotalPage string `json:"totalPage"`
}

LeadTradersRank represents lead traders rank info

type LeadingInstrumentItem

type LeadingInstrumentItem struct {
	Enabled      bool   `json:"enabled"`
	InstrumentID string `json:"instId"`
}

LeadingInstrumentItem represents leading instrument info and it's status

type LendingAPIHistoryItem

type LendingAPIHistoryItem struct {
	Currency  string       `json:"ccy"`
	Rate      types.Number `json:"rate"`
	Timestamp types.Time   `json:"ts"`
}

LendingAPIHistoryItem represents a lending API history item

type LendingHistory

type LendingHistory struct {
	Currency  string       `json:"ccy"`
	Amount    types.Number `json:"amt"`
	Earnings  types.Number `json:"earnings"`
	Rate      types.Number `json:"rate"`
	Timestamp types.Time   `json:"ts"`
}

LendingHistory holds lending history responses

type LendingOrderDetail

type LendingOrderDetail struct {
	OrderID       string       `json:"ordId"`
	Amount        types.Number `json:"amt"`
	AutoRenewal   bool         `json:"autoRenewal"`
	Currency      string       `json:"ccy"`
	EarningAmount types.Number `json:"earningAmt"`
	PendingAmount types.Number `json:"pendingAmt"`
	Rate          types.Number `json:"rate"`
	State         string       `json:"state"`
	Term          string       `json:"term"`
	TotalInterest string       `json:"totalInterest"`
	CreationTime  types.Time   `json:"cTime"`
	UpdateTime    types.Time   `json:"uTime"`
	SettledTime   types.Time   `json:"settledTime"`
	StartTime     types.Time   `json:"startTime"`
}

LendingOrderDetail represents a lending order detail

type LendingOrderParam

type LendingOrderParam struct {
	Currency    currency.Code `json:"ccy"`
	Amount      float64       `json:"amt,omitempty,string"`
	Rate        float64       `json:"rate,omitempty,string"`
	Term        string        `json:"term"`
	AutoRenewal bool          `json:"autoRenewal,omitempty"`
}

LendingOrderParam represents a lending order request parameters

type LendingOrderResponse

type LendingOrderResponse []struct {
	OrderID string `json:"ordId"`
}

LendingOrderResponse represents an order ID response after placing a lending order

type LendingRate

type LendingRate struct {
	Currency currency.Code `json:"ccy"`
	Rate     types.Number  `json:"rate"`
}

LendingRate represents the response containing the lending rate.

type LendingSubOrder

type LendingSubOrder struct {
	AccruedInterest        string       `json:"accruedInterest"`
	Amount                 types.Number `json:"amt"`
	Currency               string       `json:"ccy"`
	EarlyTerminatedPenalty string       `json:"earlyTerminatedPenalty"`
	ExpiryTime             types.Time   `json:"expiryTime"`
	FinalSettlementTime    types.Time   `json:"finalSettlementTime"`
	OrderID                string       `json:"ordId"`
	OverdueInterest        string       `json:"overdueInterest"`
	Rate                   string       `json:"rate"`
	SettledTime            types.Time   `json:"settledTime"`
	State                  string       `json:"state"`
	SubOrdID               string       `json:"subOrdId"`
	Term                   string       `json:"term"`
	TotalInterest          string       `json:"totalInterest"`
	CreationTime           types.Time   `json:"cTime"`
	UpdateTime             types.Time   `json:"uTime"`
}

LendingSubOrder represents a lending sub-order detail

type LendingVolume

type LendingVolume struct {
	Currency      string       `json:"ccy"`
	PendingVol    types.Number `json:"pendingVol"`
	RateRangeFrom string       `json:"rateRangeFrom"`
	RateRangeTo   string       `json:"rateRangeTo"`
	Term          string       `json:"term"`
}

LendingVolume represents a lending volume detail for a specific currency

type LeverageEstimatedInfo

type LeverageEstimatedInfo struct {
	EstimatedAvailQuoteTrans string       `json:"estAvailQuoteTrans"`
	EstimatedAvailTrans      string       `json:"estAvailTrans"`
	EstimatedLiqPrice        types.Number `json:"estLiqPx"`
	EstimatedMaxAmount       types.Number `json:"estMaxAmt"`
	EstimatedMargin          types.Number `json:"estMgn"`
	EstimatedQuoteMaxAmount  types.Number `json:"estQuoteMaxAmt"`
	EstimatedQuoteMargin     types.Number `json:"estQuoteMgn"`
	ExistOrd                 bool         `json:"existOrd"` // Whether there is pending orders
	MaxLeverage              types.Number `json:"maxLever"`
	MinLeverage              types.Number `json:"minLever"`
}

LeverageEstimatedInfo leverage estimated info response

type LeverageInfo

type LeverageInfo struct {
	Leverage     types.Number `json:"lever"`
	PositionSide string       `json:"posSide"`
}

LeverageInfo holds leverage information

type LeverageResponse

type LeverageResponse struct {
	InstrumentID string       `json:"instId"`
	MarginMode   string       `json:"mgnMode"`
	PositionSide string       `json:"posSide"`
	Leverage     types.Number `json:"lever"`
	Currency     string       `json:"ccy"`
}

LeverageResponse instrument ID leverage response

type Leverages

type Leverages struct {
	LeadTraderLevers []LeverageInfo `json:"leadTraderLevers"`
	MyLevers         []LeverageInfo `json:"myLevers"`
	InstrumentID     string         `json:"instId"`
	MarginMode       string         `json:"mgnMode"`
}

Leverages holds batch leverage info

type LightningDepositItem

type LightningDepositItem struct {
	CreationTime types.Time `json:"cTime"`
	Invoice      string     `json:"invoice"`
}

LightningDepositItem for creating an invoice

type LightningWithdrawalRequestInput

type LightningWithdrawalRequestInput struct {
	Currency currency.Code `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 types.Time `json:"cTime"`
}

LightningWithdrawalResponse response item for holding lightning withdrawal requests

type LimitPriceResponse

type LimitPriceResponse struct {
	InstrumentType string       `json:"instType"`
	InstrumentID   string       `json:"instId"`
	BuyLimit       types.Number `json:"buyLmt"`
	SellLimit      types.Number `json:"sellLmt"`
	Timestamp      types.Time   `json:"ts"`
}

LimitPriceResponse hold an information for

type LiquidationOrder

type LiquidationOrder struct {
	Details          []LiquidationOrderDetailItem `json:"details"`
	InstrumentID     string                       `json:"instId"`
	InstrumentType   string                       `json:"instType"`
	TotalLoss        types.Number                 `json:"totalLoss"`
	Underlying       string                       `json:"uly"`
	InstrumentFamily string                       `json:"instFamily"`
}

LiquidationOrder represents liquidation order item detailed information

type LiquidationOrderDetailItem

type LiquidationOrderDetailItem struct {
	BankruptcyLoss        string       `json:"bkLoss"`
	BankruptcyPrice       types.Number `json:"bkPx"`
	Currency              string       `json:"ccy"`
	PositionSide          string       `json:"posSide"`
	Side                  string       `json:"side"` // May be empty
	QuantityOfLiquidation types.Number `json:"sz"`
	Timestamp             types.Time   `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        types.Number `json:"amt"`
	AvailableLoan types.Number `json:"availLoan"`
	Currency      string       `json:"ccy"`
	LoanQuota     types.Number `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 currency.Code `json:"ccy"`
	Side     string        `json:"side,omitempty"`
	Amount   float64       `json:"amt,string,omitempty"`
}

LoanBorrowAndReplayInput represents currency VIP borrow or repay request params

type LongShortRatio

type LongShortRatio struct {
	Timestamp       types.Time
	MarginLendRatio types.Number
}

LongShortRatio represents the ratio of users with net long vs net short positions for futures and perpetual swaps

func (*LongShortRatio) UnmarshalJSON

func (l *LongShortRatio) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a slice of data into LongShortRatio

type MMPConfig

type MMPConfig struct {
	InstrumentFamily string  `json:"instFamily"`
	TimeInterval     int64   `json:"timeInterval,string"`
	FrozenInterval   int64   `json:"frozenInterval,string"` // Frozen period (ms). "0" means the trade will remain frozen until you request "Reset MMP Status" to unfrozen
	QuantityLimit    float64 `json:"qtyLimit,string"`
}

MMPConfig holds request/response structure to set Market Maker Protection (MMP)

type MMPConfigDetail

type MMPConfigDetail struct {
	FrozenInterval   types.Number `json:"frozenInterval"`
	InstrumentFamily string       `json:"instFamily"`
	MMPFrozen        bool         `json:"mmpFrozen"`
	MMPFrozenUntil   string       `json:"mmpFrozenUntil"`
	QuantityLimit    types.Number `json:"qtyLimit"`
	TimeInterval     int64        `json:"timeInterval"`
}

MMPConfigDetail holds MMP config details

type MMPStatusResponse

type MMPStatusResponse struct {
	Result bool `json:"result"`
}

MMPStatusResponse holds MMP reset status response

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"`
	AdjustMarginBalanceType 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       types.Time
	MarginLendRatio types.Number
}

MarginLendRatioItem represents margin lend ration information and creation timestamp

func (*MarginLendRatioItem) UnmarshalJSON

func (m *MarginLendRatioItem) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a slice of data into MarginLendRatio

type MarkPrice

type MarkPrice struct {
	InstrumentType string       `json:"instType"`
	InstrumentID   string       `json:"instId"`
	MarkPrice      types.Number `json:"markPx"`
	Timestamp      types.Time   `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   types.Number `json:"maxBuy"`
	MaximumSell  types.Number `json:"maxSell"`
}

MaximumBuyAndSell get maximum buy , sell amount or open amount

type MaximumLoanInstrument

type MaximumLoanInstrument struct {
	InstrumentID   string       `json:"instId"`
	MarginMode     string       `json:"mgnMode"`
	MarginCurrency string       `json:"mgnCcy"`
	MaxLoan        types.Number `json:"maxLoan"`
	Currency       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       types.Number `json:"maxWd"`   // Max withdrawal (not allowing borrowed crypto transfer out under Multi-currency margin)
	MaximumWithdrawalEx     types.Number `json:"maxWdEx"` // Max withdrawal (allowing borrowed crypto transfer out under Multi-currency margin)
	SpotOffsetMaxWithdrawal types.Number `json:"spotOffsetMaxWd"`
	SpotOffsetMaxWdEx       types.Number `json:"spotOffsetMaxWdEx"`
}

MaximumWithdrawal represents maximum withdrawal amount query response

type MonthlyStatement

type MonthlyStatement struct {
	FileHref  string     `json:"fileHref"`
	State     string     `json:"state"`
	Timestamp types.Time `json:"ts"`
}

MonthlyStatement represents the information and download link for a monthly statement document.

type NonTradableAsset

type NonTradableAsset struct {
	Balance          types.Number  `json:"bal"`
	CanWithdraw      bool          `json:"canWd"`
	Currency         string        `json:"ccy"`
	Chain            string        `json:"chain"`
	CtAddr           string        `json:"ctAddr"`
	LogoLink         string        `json:"logoLink"`
	Name             string        `json:"name"`
	NeedTag          bool          `json:"needTag"`
	WithdrawAll      bool          `json:"wdAll"`
	FeeCurrency      currency.Code `json:"feeCcy"`
	Fee              types.Number  `json:"fee"`
	MinWithdrawal    types.Number  `json:"minWd"`
	WithdrawTickSize types.Number  `json:"wdTickSz"`
	BurningFeeRate   types.Number  `json:"burningFeeRate"`
}

NonTradableAsset holds non-tradable asset detail

type Offer

type Offer struct {
	Currency        string            `json:"ccy"`
	ProductID       string            `json:"productId"`
	Protocol        string            `json:"protocol"`
	ProtocolType    string            `json:"protocolType"`
	EarningCurrency []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"`
	State                    string       `json:"state"`
	FastRedemptionDailyLimit types.Number `json:"fastRedemptionDailyLimit"`
}

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
	// contains filtered or unexported fields
}

Okx is the overarching type across this package

func (*Okx) AccountBalance

func (ok *Okx) AccountBalance(ctx context.Context, ccy currency.Code) ([]Account, error)

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

func (ok *Okx) AccountGreeksSubscription(ctx context.Context, operation string, pair currency.Pair) error

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) ActivateOption

func (ok *Okx) ActivateOption(ctx context.Context) (types.Time, error)

ActivateOption activates option

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(ctx context.Context, 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(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

AlgoOrdersSubscription for subscribing to algo - order channels

func (*Okx) AmendAlgoOrder

func (ok *Okx) AmendAlgoOrder(ctx context.Context, arg *AmendAlgoOrderParam) (*AmendAlgoResponse, error)

AmendAlgoOrder amend unfilled algo orders (Support stop order only, not including Move_order_stop order, Trigger order, Iceberg order, TWAP order, Trailing Stop order). Only applicable to Futures and Perpetual swap

func (*Okx) AmendCopySettings

func (ok *Okx) AmendCopySettings(ctx context.Context, arg *FirstCopySettings) (*ResponseSuccess, error)

AmendCopySettings amends need to use this endpoint for amending copy settings

func (*Okx) AmendFixedLoanBorrowingOrder

func (ok *Okx) AmendFixedLoanBorrowingOrder(ctx context.Context, orderID string, reborrow bool, renewMaxRate float64) (*OrderIDResponse, error)

AmendFixedLoanBorrowingOrder amends a fixed loan borrowing order

func (*Okx) AmendGridAlgoOrder

func (ok *Okx) AmendGridAlgoOrder(ctx context.Context, arg *GridAlgoOrderAmend) (*GridAlgoOrderIDResponse, error)

AmendGridAlgoOrder supported contract grid algo order amendment

func (*Okx) AmendLeadingInstruments

func (ok *Okx) AmendLeadingInstruments(ctx context.Context, instrumentID, instrumentType string) ([]LeadingInstrumentItem, error)

AmendLeadingInstruments amend current leading instruments, need to set initial leading instruments while applying to become a leading trader. All non-leading contracts can't have position or pending orders for the current request when setting non-leading contracts as leading contracts

func (*Okx) AmendLendingOrder

func (ok *Okx) AmendLendingOrder(ctx context.Context, orderID string, changeAmount, rate float64, autoRenewal bool) (string, error)

AmendLendingOrder amends a lending order

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

func (ok *Okx) AmendOrder(ctx context.Context, arg *AmendOrderRequestParams) (*OrderData, error)

AmendOrder an incomplete order

func (*Okx) AmendRecurringBuyOrder

func (ok *Okx) AmendRecurringBuyOrder(ctx context.Context, arg *AmendRecurringOrderParam) (*RecurringOrderResponse, error)

AmendRecurringBuyOrder amends recurring order

func (*Okx) AmendSpreadOrder

func (ok *Okx) AmendSpreadOrder(ctx context.Context, arg *AmendSpreadOrderParam) (*SpreadOrderResponse, error)

AmendSpreadOrder amends incomplete spread order

func (*Okx) AppendWsOrderbookItems

func (ok *Okx) AppendWsOrderbookItems(entries [][4]types.Number) (orderbook.Tranches, error)

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

func (*Okx) ApplyBillDetails

func (ok *Okx) ApplyBillDetails(ctx context.Context, year, quarter string) ([]BillsDetailResp, error)

ApplyBillDetails apply for bill data since 1 February, 2021 except for the current quarter. Quarter, valid value is Q1, Q2, Q3, Q4

func (*Okx) ApplyForMonthlyStatement

func (ok *Okx) ApplyForMonthlyStatement(ctx context.Context, month string) (types.Time, error)

ApplyForMonthlyStatement requests a monthly statement for any month within the past year

func (*Okx) BalanceAndPositionSubscription

func (ok *Okx) BalanceAndPositionSubscription(ctx context.Context, operation, uid string) error

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(ctx context.Context, 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) BusinessSubscribe

func (ok *Okx) BusinessSubscribe(channelsToSubscribe subscription.List) error

BusinessSubscribe sends a websocket subscription request to several channels to receive data.

func (*Okx) BusinessUnsubscribe

func (ok *Okx) BusinessUnsubscribe(channelsToUnsubscribe subscription.List) error

BusinessUnsubscribe sends a websocket unsubscription request to several channels to receive data.

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) CancelAllDelayed

func (ok *Okx) CancelAllDelayed(ctx context.Context, timeout int64, orderTag string) (*CancelResponse, error)

CancelAllDelayed cancel all pending orders after the countdown timeout. Applicable to all trading symbols through order book (except Spread trading)

func (*Okx) CancelAllMMPOrders

func (ok *Okx) CancelAllMMPOrders(ctx context.Context, instrumentType, instrumentFamily string, lockInterval int64) (*CancelMMPResponse, error)

CancelAllMMPOrders cancel all the MMP pending orders of an instrument family. Only applicable to Option in Portfolio Margin mode, and MMP privilege is required

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) CancelAllRFQQuotes

func (ok *Okx) CancelAllRFQQuotes(ctx context.Context) (types.Time, error)

CancelAllRFQQuotes cancels all active quote orders

func (*Okx) CancelAllRFQs

func (ok *Okx) CancelAllRFQs(ctx context.Context) (types.Time, error)

CancelAllRFQs cancels all active RFQs

func (*Okx) CancelAllSpreadOrders

func (ok *Okx) CancelAllSpreadOrders(ctx context.Context, spreadID string) (bool, error)

CancelAllSpreadOrders cancels all spread orders and return success message spreadID is optional the function returns success status and error message

func (*Okx) CancelAllSpreadOrdersAfterCountdown

func (ok *Okx) CancelAllSpreadOrdersAfterCountdown(ctx context.Context, timeoutDuration int64) (*SpreadOrderCancellationResponse, error)

CancelAllSpreadOrdersAfterCountdown cancel all pending orders after the countdown timeout. Only applicable to spread trading

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) CancelClosePositionOrderForContractGrid

func (ok *Okx) CancelClosePositionOrderForContractGrid(ctx context.Context, arg *CancelClosePositionOrder) (*ClosePositionContractGridResponse, error)

CancelClosePositionOrderForContractGrid cancels close position order for contract grid

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 cancels multiple active quotes in a single batch, with a maximum of 100 quote orders cancellable at once

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

func (ok *Okx) CancelOrder(ctx context.Context, ord *order.Cancel) error

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, quoteID, clientQuoteID string) (*CancelQuoteResponse, error)

CancelQuote cancels an existing active quote you have created in response to an RFQ

func (*Okx) CancelRFQ

func (ok *Okx) CancelRFQ(ctx context.Context, rfqID, clientRFQID string) (*CancelRFQResponse, error)

CancelRFQ cancels a request for quotation

func (*Okx) CancelSingleOrder

func (ok *Okx) CancelSingleOrder(ctx context.Context, arg *CancelOrderRequestParam) (*OrderData, error)

CancelSingleOrder cancel an incomplete order

func (*Okx) CancelSpreadOrder

func (ok *Okx) CancelSpreadOrder(ctx context.Context, orderID, clientOrderID string) (*SpreadOrderResponse, error)

CancelSpreadOrder cancels an incomplete spread order

func (*Okx) CancelWithdrawal

func (ok *Okx) CancelWithdrawal(ctx context.Context, withdrawalID string) (string, error)

CancelWithdrawal cancels a normal withdrawal request but cannot be used to cancel Lightning withdrawals

func (*Okx) CancelWithdrawalOrder

func (ok *Okx) CancelWithdrawalOrder(ctx context.Context, orderID string) (*OrderIDAndState, error)

CancelWithdrawalOrder cancel a pending fiat withdrawal order, currently only applicable to TRY

func (*Okx) CandlesticksSubscription

func (ok *Okx) CandlesticksSubscription(ctx context.Context, 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) CloseLeadingPosition

func (ok *Okx) CloseLeadingPosition(ctx context.Context, arg *CloseLeadingPositionParam) (*PositionIDInfo, error)

CloseLeadingPosition close a leading position once a time

func (*Okx) ClosePositionForContractID

func (ok *Okx) ClosePositionForContractID(ctx context.Context, arg *ClosePositionParams) (*ClosePositionContractGridResponse, error)

ClosePositionForContractID close position when the contract grid stop type is 'keep position'

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) ComputeMinInvestment

func (ok *Okx) ComputeMinInvestment(ctx context.Context, arg *ComputeInvestmentDataParam) (*InvestmentResult, error)

ComputeMinInvestment computes minimum investment

func (*Okx) ContractGridAlgoOrders

func (ok *Okx) ContractGridAlgoOrders(ctx context.Context, 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) ConvertFixedLoanToMarketLoan

func (ok *Okx) ConvertFixedLoanToMarketLoan(ctx context.Context, orderID string) (*OrderIDResponse, error)

ConvertFixedLoanToMarketLoan converts fixed loan to market loan

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) CreateWithdrawalOrder

func (ok *Okx) CreateWithdrawalOrder(ctx context.Context, ccy currency.Code, paymentAccountID, paymentMethod, clientID string, amount float64) (*FiatOrderDetail, error)

CreateWithdrawalOrder initiate a fiat withdrawal request (Authenticated endpoint, Only for API keys with "Withdrawal" access)

func (*Okx) CurrencyUnitConvert

func (ok *Okx) CurrencyUnitConvert(ctx context.Context, instrumentID string, quantity, orderPrice float64, convertType uint, unitOfCcy currency.Code, operationTypeOpen bool) (*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(ctx context.Context, 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, rfqID, quoteID string) (*ExecuteQuoteResponse, error)

ExecuteQuote executes a Quote. It is only used by the creator of the RFQ

func (*Okx) FetchTradablePairs

func (ok *Okx) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Okx) FundingRateSubscription

func (ok *Okx) FundingRateSubscription(ctx context.Context, 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) GenerateDefaultBusinessSubscriptions

func (ok *Okx) GenerateDefaultBusinessSubscriptions() ([]subscription.Subscription, error)

GenerateDefaultBusinessSubscriptions returns a list of default subscriptions to business stream.

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) GetAPYHistory

func (ok *Okx) GetAPYHistory(ctx context.Context, days int64) ([]APYItem, error)

GetAPYHistory retrieves Annual percentage yield(APY) history

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, ccy currency.Code) ([]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

func (ok *Okx) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Okx) GetAccountInstruments

func (ok *Okx) GetAccountInstruments(ctx context.Context, instrumentType asset.Item, underlying, instrumentFamily, instrumentID string) ([]AccountInstrument, error)

GetAccountInstruments retrieve available instruments info of current account

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) GetActiveSpreadOrders

func (ok *Okx) GetActiveSpreadOrders(ctx context.Context, spreadID, orderType, state, beginID, endID string, limit int64) ([]SpreadOrder, error)

GetActiveSpreadOrders retrieves list of incomplete spread orders

func (*Okx) GetAlgoOrderDetail

func (ok *Okx) GetAlgoOrderDetail(ctx context.Context, algoID, clientSuppliedAlgoID string) (*AlgoOrderDetail, error)

GetAlgoOrderDetail retrieves algo order details

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) GetAnnouncementTypes

func (ok *Okx) GetAnnouncementTypes(ctx context.Context) ([]AnnouncementTypeInfo, error)

GetAnnouncementTypes represents a list of announcement types

func (*Okx) GetAnnouncements

func (ok *Okx) GetAnnouncements(ctx context.Context, announcementType string, page int64) (*AnnouncementDetail, error)

GetAnnouncements get announcements, the response is sorted by pTime with the most recent first. The sort will not be affected if the announcement is updated. Every page has 20 records

There are differences between public endpoint and private endpoint. For public endpoint, the response is restricted based on your request IP. For private endpoint, the response is restricted based on your country of residence

func (*Okx) GetAssetBillsDetails

func (ok *Okx) GetAssetBillsDetails(ctx context.Context, ccy currency.Code, 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 Bills type possible values are listed here: https://www.okx.com/docs-v5/en/#funding-account-rest-api-asset-bills-details

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) GetBETHAssetsBalance

func (ok *Okx) GetBETHAssetsBalance(ctx context.Context) (*BETHAssetsBalance, error)

GetBETHAssetsBalance balance is a snapshot summarized all BETH assets in trading and funding accounts. Also, the snapshot updates hourly

func (*Okx) GetBalance

func (ok *Okx) GetBalance(ctx context.Context, ccy currency.Code) ([]AssetBalance, error)

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, epl request.EndpointLimit) ([]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) GetBillsHistoryArchive

func (ok *Okx) GetBillsHistoryArchive(ctx context.Context, year, quarter string) ([]BillsArchiveInfo, error)

GetBillsHistoryArchive retrieves bill data archive

func (*Okx) GetBlockTicker

func (ok *Okx) GetBlockTicker(ctx context.Context, instrumentID string) (*BlockTicker, error)

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) GetBorrowAndRepayHistoryForVIPLoans

func (ok *Okx) GetBorrowAndRepayHistoryForVIPLoans(ctx context.Context, ccy currency.Code, after, before time.Time, limit int64) ([]BorrowRepayHistory, error)

GetBorrowAndRepayHistoryForVIPLoans retrieves borrow and repay history for VIP loans

func (*Okx) GetBorrowAndRepayHistoryInQuickMarginMode

func (ok *Okx) GetBorrowAndRepayHistoryInQuickMarginMode(ctx context.Context, instrumentID currency.Pair, ccy currency.Code, side, afterPaginationID, beforePaginationID string, beginTime, endTime time.Time, limit int64) ([]BorrowRepayHistoryItem, error)

GetBorrowAndRepayHistoryInQuickMarginMode retrieves borrow and repay history in quick margin mode

func (*Okx) GetBorrowInterestAndLimit

func (ok *Okx) GetBorrowInterestAndLimit(ctx context.Context, loanType int64, ccy currency.Code) ([]BorrowInterestAndLimitResponse, error)

GetBorrowInterestAndLimit borrow interest and limit

func (*Okx) GetBorrowRepayHistory

func (ok *Okx) GetBorrowRepayHistory(ctx context.Context, ccy currency.Code, eventType string, after, before time.Time, limit int64) ([]BorrowRepayItem, error)

GetBorrowRepayHistory retrieve the borrow/repay history under Spot mode

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

func (ok *Okx) GetCollateralMode(ctx context.Context, item asset.Item) (collateral.Mode, error)

GetCollateralMode returns the collateral type for your account

func (*Okx) GetCompletedSpreadOrdersLast7Days

func (ok *Okx) GetCompletedSpreadOrdersLast7Days(ctx context.Context, spreadID, orderType, state, beginID, endID string, begin, end time.Time, limit int64) ([]SpreadOrder, error)

GetCompletedSpreadOrdersLast7Days retrieve the completed order data for the last 7 days, and the incomplete orders (filledSz =0 & state = canceled) that have been canceled are only reserved for 2 hours. Results are returned in counter chronological order

func (*Okx) GetContractsOpenInterestAndVolume

func (ok *Okx) GetContractsOpenInterestAndVolume(ctx context.Context, ccy currency.Code, 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, fromCcy, toCcy currency.Code) (*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) GetCopySettings

func (ok *Okx) GetCopySettings(ctx context.Context, instrumentType, uniqueCode string) (*CopySetting, error)

GetCopySettings retrieve the copy settings about certain lead trader

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, ccy currency.Code) ([]CurrencyDepositResponseItem, error)

GetCurrencyDepositAddress retrieve the deposit addresses of currencies, including previously-used addresses

func (*Okx) GetCurrencyDepositHistory

func (ok *Okx) GetCurrencyDepositHistory(ctx context.Context, ccy currency.Code, depositID, transactionID, fromWithdrawalID, depositType 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. Possible deposit 'type' are Deposit Type '3': internal transfer '4': deposit from chain

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) GetDailyLeadTraderPNL

func (ok *Okx) GetDailyLeadTraderPNL(ctx context.Context, instrumentType, uniqueCode, lastDays string) ([]TraderWeeklyProfitAndLoss, error)

GetDailyLeadTraderPNL retrieve lead trader daily pnl. Results are returned in counter chronological order. Last days "1": last 7 days "2": last 30 days "3": last 90 days "4": last 365 days

func (*Okx) GetDeliveryHistory

func (ok *Okx) GetDeliveryHistory(ctx context.Context, instrumentType, underlying, instrumentFamily 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) GetDepositOrderDetail

func (ok *Okx) GetDepositOrderDetail(ctx context.Context, orderID string) (*FiatOrderDetail, error)

GetDepositOrderDetail retrieves fiat deposit order detail

func (*Okx) GetDepositWithdrawalStatus

func (ok *Okx) GetDepositWithdrawalStatus(ctx context.Context, ccy currency.Code, withdrawalID, transactionID, addressTo, chain string) ([]DepositWithdrawStatus, error)

GetDepositWithdrawalStatus retrieves the detailed status and estimated completion time for deposits and withdrawals

func (*Okx) GetDiscountRateAndInterestFreeQuota

func (ok *Okx) GetDiscountRateAndInterestFreeQuota(ctx context.Context, ccy currency.Code, 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, state string, ccy currency.Code) ([]ActiveFundingOrder, error)

GetEarnActiveOrders retrieves active orders

func (*Okx) GetEasyConvertCurrencyList

func (ok *Okx) GetEasyConvertCurrencyList(ctx context.Context, source string) (*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) GetEconomicCalendarData

func (ok *Okx) GetEconomicCalendarData(ctx context.Context, region, importance string, before, after time.Time, limit int64) ([]EconomicCalendar, error)

GetEconomicCalendarData retrieves the macro-economic calendar data within 3 months. Historical data from 3 months ago is only available to users with trading fee tier VIP1 and above

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) GetExistingLeadingPositions

func (ok *Okx) GetExistingLeadingPositions(ctx context.Context, instrumentType, instrumentID string, before, after time.Time, limit int64) ([]PositionInfo, error)

GetExistingLeadingPositions retrieves leading positions that are not closed

func (*Okx) GetFee

func (ok *Okx) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns Cryptocurrency trade fee, and offline trade fee

func (*Okx) GetFeeByType

func (ok *Okx) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on the type of transaction

func (*Okx) GetFiatDepositOrderHistory

func (ok *Okx) GetFiatDepositOrderHistory(ctx context.Context, ccy currency.Code, paymentMethod, state string, after, before time.Time, limit int64) ([]FiatOrderDetail, error)

GetFiatDepositOrderHistory retrieves fiat deposit order history

func (*Okx) GetFiatDepositPaymentMethods

func (ok *Okx) GetFiatDepositPaymentMethods(ctx context.Context, ccy currency.Code) (*FiatDepositPaymentMethods, error)

GetFiatDepositPaymentMethods to display all the available fiat deposit payment methods

func (*Okx) GetFiatWithdrawalOrderHistory

func (ok *Okx) GetFiatWithdrawalOrderHistory(ctx context.Context, ccy currency.Code, paymentMethod, state string, after, before time.Time, limit int64) ([]FiatOrderDetail, error)

GetFiatWithdrawalOrderHistory retrieves fiat withdrawal order history

func (*Okx) GetFiatWithdrawalPaymentMethods

func (ok *Okx) GetFiatWithdrawalPaymentMethods(ctx context.Context, ccy currency.Code) (*FiatWithdrawalPaymentMethods, error)

GetFiatWithdrawalPaymentMethods to display all the available fiat withdrawal payment methods

func (*Okx) GetFixedLoanBorrowLimit

func (ok *Okx) GetFixedLoanBorrowLimit(ctx context.Context) (*FixedLoanBorrowLimitInformation, error)

GetFixedLoanBorrowLimit retrieves a fixed loadn borrow limit information

func (*Okx) GetFixedLoanBorrowOrderList

func (ok *Okx) GetFixedLoanBorrowOrderList(ctx context.Context, ccy currency.Code, orderID, state, term string, after, before time.Time, limit int64) ([]FixedLoanBorrowOrderDetail, error)

GetFixedLoanBorrowOrderList retrieves fixed loan borrow order list State '1': Borrowing '2': Borrowed '3': Settled (Repaid) '4': Borrow failed '5': Overdue '6': Settling '7': Reborrowing '8': Pending repay

func (*Okx) GetFixedLoanBorrowQuote

func (ok *Okx) GetFixedLoanBorrowQuote(ctx context.Context, borrowingCurrency currency.Code, borrowType, term, orderID string, amount, maxRate float64) (*FixedLoanBorrowQuote, error)

GetFixedLoanBorrowQuote retrieves a fixed loan borrow quote information

func (*Okx) GetFundingCurrencies

func (ok *Okx) GetFundingCurrencies(ctx context.Context, ccy currency.Code) ([]CurrencyResponse, error)

GetFundingCurrencies retrieve a list of all currencies

func (*Okx) GetFundingOrderHistory

func (ok *Okx) GetFundingOrderHistory(ctx context.Context, productID, protocolType string, ccy currency.Code, 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) GetFuturesContractLongShortAccountRatio

func (ok *Okx) GetFuturesContractLongShortAccountRatio(ctx context.Context, instrumentID string, period kline.Interval, startAt, endAt time.Time, limit int64) ([]TopTraderContractsLongShortRatio, error)

GetFuturesContractLongShortAccountRatio retrieve the account long/short ratio of a contract. This endpoint returns a maximum of 1440 records

func (*Okx) GetFuturesContractTakerVolume

func (ok *Okx) GetFuturesContractTakerVolume(ctx context.Context, instrumentID string, period kline.Interval, unit, limit int64, startAt, endAt time.Time) ([]ContractTakerVolume, error)

GetFuturesContractTakerVolume retrieve the contract taker volume for both buyers and sellers. This endpoint returns a maximum of 1440 records. The unit of buy/sell volume, the default is 1. '0': Crypto '1': Contracts '2': U

func (*Okx) GetFuturesContractsOpenInterestHistory

func (ok *Okx) GetFuturesContractsOpenInterestHistory(ctx context.Context, instrumentID string, period kline.Interval, startAt, endAt time.Time, limit int64) ([]ContractOpenInterestHistoryItem, error)

GetFuturesContractsOpenInterestHistory retrieve the contract open interest statistics of futures and perp. This endpoint returns a maximum of 1440 records

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) GetGreeks

func (ok *Okx) GetGreeks(ctx context.Context, ccy currency.Code) ([]GreeksItem, error)

GetGreeks retrieves a greeks list of all assets in the account

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) GetHistoricIndexCandlesticksHistory

func (ok *Okx) GetHistoricIndexCandlesticksHistory(ctx context.Context, instrumentID string, after, before time.Time, bar kline.Interval, limit int64) ([]CandlestickHistoryItem, error)

GetHistoricIndexCandlesticksHistory retrieve the candlestick charts of the index from recent years

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) GetHistoryLeadTraders

func (ok *Okx) GetHistoryLeadTraders(ctx context.Context, instrumentType, after, before string, limit int64) ([]CopyTradingLeadTrader, error)

GetHistoryLeadTraders retrieve my history lead traders

func (*Okx) GetHistoryOfManagedSubAccountTransfer

func (ok *Okx) GetHistoryOfManagedSubAccountTransfer(ctx context.Context, ccy currency.Code, transferType, subAccountName, subAccountUID string, after, before time.Time, limit int64) ([]SubAccountTransfer, error)

GetHistoryOfManagedSubAccountTransfer retrieves managed sub-account transfers. nly applicable to the trading team's master account to getting transfer records of managed sub accounts entrusted to oneself

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

func (ok *Okx) GetIndexComponents(ctx context.Context, index string) (*IndexComponent, error)

GetIndexComponents returns the index component information data on the market

func (*Okx) GetIndexTickers

func (ok *Okx) GetIndexTickers(ctx context.Context, quoteCurrency currency.Code, instID string) ([]IndexTicker, error)

GetIndexTickers Retrieves index tickers

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, ccy currency.Code, instrumentID, marginMode string, after, before time.Time) ([]InterestAccruedData, error)

GetInterestAccruedData retrieves data on accrued interest

func (*Okx) GetInterestRate

func (ok *Okx) GetInterestRate(ctx context.Context, ccy currency.Code) ([]InterestRateResponse, error)

GetInterestRate get the user's current leveraged currency borrowing interest rate

func (*Okx) GetInterestRateAndLoanQuota

func (ok *Okx) GetInterestRateAndLoanQuota(ctx context.Context) ([]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) GetInviteesDetail

func (ok *Okx) GetInviteesDetail(ctx context.Context, uid string) (*AffilateInviteesDetail, error)

GetInviteesDetail retrieves affiliate invitees details

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) GetLeadTraderCurrencyPreferences

func (ok *Okx) GetLeadTraderCurrencyPreferences(ctx context.Context, instrumentType, uniqueCode, lastDays string) ([]LeadTraderCurrencyPreference, error)

GetLeadTraderCurrencyPreferences retrieves the most frequently traded crypto of this lead trader. Results are sorted by ratio from large to small

func (*Okx) GetLeadTraderCurrentLeadPositions

func (ok *Okx) GetLeadTraderCurrentLeadPositions(ctx context.Context, instrumentType, uniqueCode, afterSubPositionID,
	beforeSubPositionID string, limit int64) ([]LeadTraderCurrentLeadPosition, error)

GetLeadTraderCurrentLeadPositions get current leading positions of lead trader Instrument type "SPOT" "SWAP"

func (*Okx) GetLeadTraderLeadPositionHistory

func (ok *Okx) GetLeadTraderLeadPositionHistory(ctx context.Context, instrumentType, uniqueCode, afterSubPositionID, beforeSubPositionID string, limit int64) ([]LeadPosition, error)

GetLeadTraderLeadPositionHistory retrieve the lead trader completed leading position of the last 3 months. Returns reverse chronological order with subPosId

func (*Okx) GetLeadTraderStats

func (ok *Okx) GetLeadTraderStats(ctx context.Context, instrumentType, uniqueCode, lastDays string) ([]LeadTraderStat, error)

GetLeadTraderStats retrieves key data related to lead trader performance

func (*Okx) GetLeadTradersRanks

func (ok *Okx) GetLeadTradersRanks(ctx context.Context, instrumentType, sortType, state,
	minLeadDays, minAssets, maxAssets, minAssetUnderManagement, maxAssetUnderManagement,
	dataVersion, page string, limit int64) ([]LeadTradersRank, error)

GetLeadTradersRanks retrieve lead trader ranks. Instrument type: SWAP, the default value Sort type"overview": overview, the default value "pnl": profit and loss "aum": assets under management "win_ratio": win ratio "pnl_ratio": pnl ratio "current_copy_trader_pnl": current copy trader pnl Lead trader state: "0": All lead traders, the default, including vacancy and non-vacancy "1": lead traders who have vacancy Minimum lead days '1': 7 days '2': 30 days '3': 90 days '4': 180 days

func (*Okx) GetLeadingInstrument

func (ok *Okx) GetLeadingInstrument(ctx context.Context, instrumentType string) ([]LeadingInstrumentItem, error)

GetLeadingInstrument retrieves leading instruments

func (*Okx) GetLeadingPositionsHistory

func (ok *Okx) GetLeadingPositionsHistory(ctx context.Context, instrumentType, instrumentID string, before, after time.Time, limit int64) ([]PositionInfo, error)

GetLeadingPositionsHistory leading trader retrieves the completed leading position of the last 3 months. Returns reverse chronological order with subPosId

func (*Okx) GetLendingHistory

func (ok *Okx) GetLendingHistory(ctx context.Context, ccy currency.Code, before, after time.Time, limit int64) ([]LendingHistory, error)

GetLendingHistory lending history

func (*Okx) GetLendingOrders

func (ok *Okx) GetLendingOrders(ctx context.Context, orderID, state string, ccy currency.Code, startAt, endAt time.Time, limit int64) ([]LendingOrderDetail, error)

GetLendingOrders retrieves list of lending orders. State: possible values are 'pending', 'earning', 'expired', 'settled'

func (*Okx) GetLendingSubOrderList

func (ok *Okx) GetLendingSubOrderList(ctx context.Context, orderID, state string, startAt, endAt time.Time, limit int64) ([]LendingSubOrder, error)

GetLendingSubOrderList retrieves a lending sub-orders list

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) GetLeverageEstimatedInfo

func (ok *Okx) GetLeverageEstimatedInfo(ctx context.Context, instrumentType, marginMode, leverage, positionSide, instrumentID string, ccy currency.Code) ([]LeverageEstimatedInfo, error)

GetLeverageEstimatedInfo retrieves leverage estimated information. Instrument type: possible values are MARGIN, SWAP, FUTURES

func (*Okx) GetLeverageRate

func (ok *Okx) GetLeverageRate(ctx context.Context, instrumentID, marginMode string, ccy currency.Code) ([]LeverageResponse, error)

GetLeverageRate retrieves leverage data for different instrument id or margin mode

func (*Okx) GetLightningDeposits

func (ok *Okx) GetLightningDeposits(ctx context.Context, ccy currency.Code, 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

func (ok *Okx) GetLimitPrice(ctx context.Context, instrumentID string) (*LimitPriceResponse, error)

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, ccy currency.Code, 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) GetMMPConfig

func (ok *Okx) GetMMPConfig(ctx context.Context, instrumentFamily string) ([]MMPConfigDetail, error)

GetMMPConfig retrieves MMP configure information Only applicable to Option in Portfolio Margin mode, and MMP privilege is required

func (*Okx) GetMarginLendingRatio

func (ok *Okx) GetMarginLendingRatio(ctx context.Context, ccy currency.Code, 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, instrumentFamily, instrumentID string) ([]MarkPrice, error)

GetMarkPrice retrieve mark price

func (*Okx) GetMarkPriceCandlestickHistory

func (ok *Okx) GetMarkPriceCandlestickHistory(ctx context.Context, instrumentID string, after, before time.Time, bar kline.Interval, limit int64) ([]CandlestickHistoryItem, error)

GetMarkPriceCandlestickHistory retrieve the candlestick charts of the mark price from recent years

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, ccy currency.Code, instrumentID, tradeMode, quickMarginType string, reduceOnly, upSpotOffset 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, ccy currency.Code, instrumentID, tradeMode, leverage string, price float64, unSpotOffset bool) ([]MaximumBuyAndSell, error)

GetMaximumBuySellAmountOROpenAmount retrieves the maximum buy or sell amount for a sell id

func (*Okx) GetMaximumLoanOfInstrument

func (ok *Okx) GetMaximumLoanOfInstrument(ctx context.Context, instrumentID, marginMode string, mgnCurrency currency.Code) ([]MaximumLoanInstrument, error)

GetMaximumLoanOfInstrument returns list of maximum loan of instruments

func (*Okx) GetMaximumWithdrawals

func (ok *Okx) GetMaximumWithdrawals(ctx context.Context, ccy currency.Code) ([]MaximumWithdrawal, error)

GetMaximumWithdrawals retrieves the maximum transferable amount from a trading account to a funding account for quick margin borrowing and repayment

func (*Okx) GetMonthlyStatement

func (ok *Okx) GetMonthlyStatement(ctx context.Context, month string) ([]MonthlyStatement, error)

GetMonthlyStatement retrieves monthly statements for the past year. Month is in the form of Jan, Feb, March etc.

func (*Okx) GetMultipleLeverages

func (ok *Okx) GetMultipleLeverages(ctx context.Context, marginMode, uniqueCode, instrumentID string) ([]Leverages, error)

GetMultipleLeverages retrieve leverages that belong to the lead trader and you

func (*Okx) GetMyLeadTraders

func (ok *Okx) GetMyLeadTraders(ctx context.Context, instrumentType string) ([]CopyTradingLeadTrader, error)

GetMyLeadTraders retrieve my lead traders

func (*Okx) GetNonTradableAssets

func (ok *Okx) GetNonTradableAssets(ctx context.Context, ccy currency.Code) ([]NonTradableAsset, error)

GetNonTradableAssets retrieves non tradable assets

func (*Okx) GetOffers

func (ok *Okx) GetOffers(ctx context.Context, productID, protocolType string, ccy currency.Code) ([]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, ccy currency.Code, 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, ccy currency.Code,
	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, instrumentFamily, 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, instrumentFamily string, expTime time.Time) ([]OptionMarketDataResponse, error)

GetOptionMarketData retrieves option market data

func (*Okx) GetOptionTrades

func (ok *Okx) GetOptionTrades(ctx context.Context, instrumentID, instrumentFamily, optionType string) ([]OptionTrade, error)

GetOptionTrades retrieves option trades Option type, 'C': Call 'P': put

func (*Okx) GetOptionTradesByInstrumentFamily

func (ok *Okx) GetOptionTradesByInstrumentFamily(ctx context.Context, instrumentFamily string) ([]InstrumentFamilyTrade, error)

GetOptionTradesByInstrumentFamily retrieve the recent transactions of an instrument under same instFamily. The maximum is 100

func (*Okx) GetOptionsOpenInterestAndVolume

func (ok *Okx) GetOptionsOpenInterestAndVolume(ctx context.Context, ccy currency.Code, period kline.Interval) ([]OpenInterestVolume, error)

GetOptionsOpenInterestAndVolume retrieves the open interest and trading volume for options

func (*Okx) GetOptionsTickBands

func (ok *Okx) GetOptionsTickBands(ctx context.Context, instrumentType, instrumentFamily string) ([]OptionTickBand, error)

GetOptionsTickBands retrieves option tick bands information. Instrument type OPTION

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) (*OrderBookResponseDetail, 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) GetPMPositionLimitation

func (ok *Okx) GetPMPositionLimitation(ctx context.Context, instrumentType, underlying, instrumentFamily string) ([]PMLimitationResponse, error)

GetPMPositionLimitation retrieve cross position limitation of SWAP/FUTURES/OPTION under Portfolio margin mode

func (*Okx) GetPairFromInstrumentID

func (ok *Okx) GetPairFromInstrumentID(instrumentID string) (currency.Pair, error)

GetPairFromInstrumentID returns a currency pair give an instrument ID and asset Item, which represents the instrument type

func (*Okx) GetPositionTiers

func (ok *Okx) GetPositionTiers(ctx context.Context, instrumentType, tradeMode, underlying, instrumentFamily, instrumentID, tiers string, ccy currency.Code) ([]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, positionID string, closePositionType, limit int64, after, before time.Time) ([]AccountPositionHistory, error)

GetPositionsHistory retrieves the updated position data for the last 3 months

func (*Okx) GetPremiumHistory

func (ok *Okx) GetPremiumHistory(ctx context.Context, instrumentID string, after, before time.Time, limit int64) ([]PremiumInfo, error)

GetPremiumHistory returns premium data in the past 6 months

func (*Okx) GetProductInfo

func (ok *Okx) GetProductInfo(ctx context.Context) (*ProductInfo, error)

GetProductInfo retrieves ETH staking products

func (*Okx) GetProfitSharingDetails

func (ok *Okx) GetProfitSharingDetails(ctx context.Context, instrumentType string, before, after time.Time, limit int64) ([]ProfitSharingItem, error)

GetProfitSharingDetails gets profits shared details for the last 3 months

func (*Okx) GetPublicBlockTrades

func (ok *Okx) GetPublicBlockTrades(ctx context.Context, instrumentID string) ([]BlockTrade, error)

GetPublicBlockTrades retrieves the recent block trading transactions of an instrument. Descending order by tradeId

func (*Okx) GetPublicBorrowHistory

func (ok *Okx) GetPublicBorrowHistory(ctx context.Context, ccy currency.Code, 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, ccy currency.Code) ([]PublicBorrowInfo, error)

GetPublicBorrowInfo returns the public borrow info

func (*Okx) GetPublicExchangeList

func (ok *Okx) GetPublicExchangeList(ctx context.Context) ([]ExchangeInfo, error)

GetPublicExchangeList retrieves exchanges

func (*Okx) GetPublicRFQTrades

func (ok *Okx) GetPublicRFQTrades(ctx context.Context, beginID, endID string, limit int64) ([]PublicTradesResponse, error)

GetPublicRFQTrades retrieves recent executed block trades

func (*Okx) GetPublicSpreadOrderBooks

func (ok *Okx) GetPublicSpreadOrderBooks(ctx context.Context, spreadID string, orderbookSize int64) ([]SpreadOrderbook, error)

GetPublicSpreadOrderBooks retrieve the order book of the spread

func (*Okx) GetPublicSpreadTickers

func (ok *Okx) GetPublicSpreadTickers(ctx context.Context, spreadID string) ([]SpreadTicker, error)

GetPublicSpreadTickers retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours

func (*Okx) GetPublicSpreadTrades

func (ok *Okx) GetPublicSpreadTrades(ctx context.Context, spreadID string) ([]SpreadPublicTradeItem, error)

GetPublicSpreadTrades retrieve the recent transactions of an instrument (at most 500 records per request). Results are returned in counter chronological order

func (*Okx) GetPublicSpreads

func (ok *Okx) GetPublicSpreads(ctx context.Context, baseCurrency, instrumentID, spreadID, state string) ([]SpreadInstrument, error)

GetPublicSpreads retrieve all available spreads based on the request parameters

func (*Okx) GetPublicUnderlyings

func (ok *Okx) GetPublicUnderlyings(ctx context.Context, instrumentType string) ([]string, error)

GetPublicUnderlyings returns list of underlyings for various instrument types

func (*Okx) GetPurchaseAndRedeemHistory

func (ok *Okx) GetPurchaseAndRedeemHistory(ctx context.Context, kind, status string, after, before time.Time, limit int64) ([]PurchaseRedeemHistory, error)

GetPurchaseAndRedeemHistory retrieves purchase and redeem history kind possible values are 'purchase' and 'redeem' Status 'pending' 'success' 'failed'

func (*Okx) GetPutCallRatio

func (ok *Okx) GetPutCallRatio(ctx context.Context, ccy currency.Code, period kline.Interval) ([]OpenInterestVolumeRatio, error)

GetPutCallRatio retrieves the open interest ration and trading volume ratio of calls vs puts

func (*Okx) GetQuoteProducts

func (ok *Okx) GetQuoteProducts(ctx context.Context) ([]QuoteProduct, error)

GetQuoteProducts retrieve the products which makers want to quote and receive RFQs for, and the corresponding price and size limit

func (*Okx) GetQuotes

func (ok *Okx) GetQuotes(ctx context.Context, arg *QuoteRequestParams) ([]QuoteResponse, error)

GetQuotes retrieves all Quotes where the user is a counterparty, either as the creator or the receiver

func (*Okx) GetRFQTrades

func (ok *Okx) GetRFQTrades(ctx context.Context, arg *RFQTradesRequestParams) ([]RFQTradeResponse, error)

GetRFQTrades retrieves executed trades where the user is a counterparty, 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 where the user is a counterparty, either as the creator or the recipient

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) GetRecurringBuyOrderHistory

func (ok *Okx) GetRecurringBuyOrderHistory(ctx context.Context, algoID string, after, before time.Time, limit int64) ([]RecurringOrderItem, error)

GetRecurringBuyOrderHistory retrieves recurring buy order history

func (*Okx) GetRecurringBuyOrderList

func (ok *Okx) GetRecurringBuyOrderList(ctx context.Context, algoID, algoOrderState string, after, before time.Time, limit int64) ([]RecurringOrderItem, error)

GetRecurringBuyOrderList retrieves recurring buy order list

func (*Okx) GetRecurringOrderDetails

func (ok *Okx) GetRecurringOrderDetails(ctx context.Context, algoID, algoOrderState string) (*RecurringOrderDeail, error)

GetRecurringOrderDetails retrieves a single recurring order detail

func (*Okx) GetRecurringSubOrders

func (ok *Okx) GetRecurringSubOrders(ctx context.Context, algoID, orderID string, after, before time.Time, limit int64) ([]RecurringBuySubOrder, error)

GetRecurringSubOrders retrieves recurring buy sub orders

func (*Okx) GetSavingBalance

func (ok *Okx) GetSavingBalance(ctx context.Context, ccy currency.Code) ([]SavingBalanceResponse, error)

GetSavingBalance returns saving balance, and only assets in the funding account can be used for saving

func (*Okx) GetServerTime

func (ok *Okx) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*Okx) GetSignalBotEventHistory

func (ok *Okx) GetSignalBotEventHistory(ctx context.Context, algoID string, after, before time.Time, limit int64) ([]SignalBotEventHistory, error)

GetSignalBotEventHistory retrieves signal bot event history

func (*Okx) GetSignalBotOrderDetail

func (ok *Okx) GetSignalBotOrderDetail(ctx context.Context, algoOrderType, algoID string) (*SignalBotOrderDetail, error)

GetSignalBotOrderDetail create and customize your own signals while gaining access to a diverse selection of signals from top providers. Empower your trading strategies and stay ahead of the game with our comprehensive signal trading platform

func (*Okx) GetSignalBotSubOrders

func (ok *Okx) GetSignalBotSubOrders(ctx context.Context, algoID, algoOrderType, subOrderType, clientOrderID, afterPaginationID, beforePaginationID string, begin, end time.Time, limit int64) ([]SubOrder, error)

GetSignalBotSubOrders retrieves historical filled sub orders and designated sub orders

func (*Okx) GetSignalOrderPositions

func (ok *Okx) GetSignalOrderPositions(ctx context.Context, algoOrderType, algoID string) (*SignalBotPosition, error)

GetSignalOrderPositions retrieves signal bot order positions

func (*Okx) GetSingleFundingRate

func (ok *Okx) GetSingleFundingRate(ctx context.Context, instrumentID string) (*FundingRateResponse, error)

GetSingleFundingRate returns the latest funding rate

func (*Okx) GetSpreadOrderDetails

func (ok *Okx) GetSpreadOrderDetails(ctx context.Context, orderID, clientOrderID string) (*SpreadOrder, error)

GetSpreadOrderDetails retrieves spread order details

func (*Okx) GetSpreadTradesOfLast7Days

func (ok *Okx) GetSpreadTradesOfLast7Days(ctx context.Context, spreadID, tradeID, orderID, beginID, endID string, begin, end time.Time, limit int64) ([]SpreadTrade, error)

GetSpreadTradesOfLast7Days retrieve historical transaction details for the last 7 days. Results are returned in counter chronological order

func (*Okx) GetSubAccountBorrowInterestAndLimit

func (ok *Okx) GetSubAccountBorrowInterestAndLimit(ctx context.Context, subAccount string, ccy currency.Code) ([]SubAccounBorrowInterestAndLimit, error)

GetSubAccountBorrowInterestAndLimit retrieves sub-account borrow interest and limit Only applicable to master account API keys. Only return VIP loan information

func (*Okx) GetSubAccountMaximumWithdrawal

func (ok *Okx) GetSubAccountMaximumWithdrawal(ctx context.Context, subAccountName string, ccy currency.Code) ([]SubAccountMaximumWithdrawal, error)

GetSubAccountMaximumWithdrawal retrieve the maximum withdrawal information of a sub-account via the master account (applies to master accounts only). If no currency is specified, the transferable amount of all owned currencies will be returned

func (*Okx) GetSubaccountFundingBalance

func (ok *Okx) GetSubaccountFundingBalance(ctx context.Context, subaccountName string, ccy currency.Code) ([]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

func (ok *Okx) GetSystemTime(ctx context.Context) (types.Time, error)

GetSystemTime retrieve API server time

func (*Okx) GetTakerFlow

func (ok *Okx) GetTakerFlow(ctx context.Context, ccy currency.Code, 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, ccy currency.Code, instrumentType, instrumentFamily string, begin, end time.Time, period kline.Interval) ([]TakerVolume, error)

GetTakerVolume retrieves the taker volume for both buyers and sellers

func (*Okx) GetTicker

func (ok *Okx) GetTicker(ctx context.Context, instrumentID string) (*TickerResponse, error)

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, instFamily string) ([]TickerResponse, error)

GetTickers retrieves the latest price snapshots best bid/ ask price, and trading volume in the last 24 hours

func (*Okx) GetTopTradersFuturesContractLongShortAccountRatio

func (ok *Okx) GetTopTradersFuturesContractLongShortAccountRatio(ctx context.Context, instrumentID string, period kline.Interval, startAt, endAt time.Time, limit int64) ([]TopTraderContractsLongShortRatio, error)

GetTopTradersFuturesContractLongShortAccountRatio retrieve the account net long/short ratio of a contract for top traders. Top traders refer to the top 5% of traders with the largest open position value. This endpoint returns a maximum of 1440 records

func (*Okx) GetTopTradersFuturesContractLongShortPositionRatio

func (ok *Okx) GetTopTradersFuturesContractLongShortPositionRatio(ctx context.Context, instrumentID string, period kline.Interval, startAt, endAt time.Time, limit int64) ([]TopTraderContractsLongShortRatio, error)

GetTopTradersFuturesContractLongShortPositionRatio retrieve the position long/short ratio of a contract for top traders. Top traders refer to the top 5% of traders with the largest open position value. This endpoint returns a maximum of 1440 records

func (*Okx) GetTotalProfitSharing

func (ok *Okx) GetTotalProfitSharing(ctx context.Context, instrumentType string) ([]TotalProfitSharing, error)

GetTotalProfitSharing gets the total amount of profit shared since joining the platform. Instrument type 'SPOT' 'SWAP' It returns all types by default

func (*Okx) GetTradeAccountRateLimit

func (ok *Okx) GetTradeAccountRateLimit(ctx context.Context) (*AccountRateLimit, error)

GetTradeAccountRateLimit get account rate limit related information. Only new order requests and amendment order requests will be counted towards this limit. For batch order requests consisting of multiple orders, each order will be counted individually

func (*Okx) GetTradeFee

func (ok *Okx) GetTradeFee(ctx context.Context, instrumentType, instrumentID, underlying, instrumentFamily, ruleType string) ([]TradeFeeRate, error)

GetTradeFee queries the trade fee rates for various instrument types and their respective 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

func (ok *Okx) GetUnderlying(pair currency.Pair, a asset.Item) (string, error)

GetUnderlying returns the instrument ID for the corresponding asset pairs and asset type( Instrument Type )

func (*Okx) GetUnrealizedProfitSharingDetails

func (ok *Okx) GetUnrealizedProfitSharingDetails(ctx context.Context, instrumentType string) ([]ProfitSharingItem, error)

GetUnrealizedProfitSharingDetails gets leading trader gets the profit sharing details that are expected to be shared in the next settlement cycle. The unrealized profit sharing details will update once there copy position is closed

func (*Okx) GetUserAffiliateRebateInformation

func (ok *Okx) GetUserAffiliateRebateInformation(ctx context.Context, apiKey string) (*AffilateRebateInfo, error)

GetUserAffiliateRebateInformation this endpoint is used to get the user's affiliate rebate information for affiliate

func (*Okx) GetVIPInterestAccruedData

func (ok *Okx) GetVIPInterestAccruedData(ctx context.Context, ccy currency.Code, orderID string, after, before time.Time, limit int64) ([]VIPInterestData, error)

GetVIPInterestAccruedData retrieves VIP interest accrued data

func (*Okx) GetVIPInterestDeductedData

func (ok *Okx) GetVIPInterestDeductedData(ctx context.Context, ccy currency.Code, orderID string, after, before time.Time, limit int64) ([]VIPInterestData, error)

GetVIPInterestDeductedData retrieves a VIP interest deducted data

func (*Okx) GetVIPLoanOrderDetail

func (ok *Okx) GetVIPLoanOrderDetail(ctx context.Context, orderID string, ccy currency.Code, after, before time.Time, limit int64) (*VIPLoanOrderDetail, error)

GetVIPLoanOrderDetail retrieves list of loan order details

func (*Okx) GetVIPLoanOrderList

func (ok *Okx) GetVIPLoanOrderList(ctx context.Context, orderID, state string, ccy currency.Code, after, before time.Time, limit int64) ([]VIPLoanOrder, error)

GetVIPLoanOrderList retrieves VIP loan order list state: possible values are 1:Borrowing 2:Borrowed 3:Repaying 4:Repaid 5:Borrow failed

func (*Okx) GetWeeklyTraderProfitAndLoss

func (ok *Okx) GetWeeklyTraderProfitAndLoss(ctx context.Context, instrumentType, uniqueCode string) ([]TraderWeeklyProfitAndLoss, error)

GetWeeklyTraderProfitAndLoss retrieve lead trader weekly pnl. Results are returned in counter chronological order

func (*Okx) GetWithdrawalHistory

func (ok *Okx) GetWithdrawalHistory(ctx context.Context, ccy currency.Code, 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) GetWithdrawalOrderDetail

func (ok *Okx) GetWithdrawalOrderDetail(ctx context.Context, orderID string) (*FiatOrderDetail, error)

GetWithdrawalOrderDetail retrieves fiat withdrawal order detail

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

func (ok *Okx) GridPositionsSubscription(ctx context.Context, operation, algoID string) error

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

func (ok *Okx) GridSubOrders(ctx context.Context, operation, algoID string) error

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, ccy currency.Code, 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(ctx context.Context, 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

func (ok *Okx) IndexTickerChannel(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

IndexTickerChannel a method to subscribe and unsubscribe to "index-tickers" channel

func (*Okx) InstantTriggerGridAlgoOrder

func (ok *Okx) InstantTriggerGridAlgoOrder(ctx context.Context, algoID string) (*TriggeredGridAlgoOrderInfo, error)

InstantTriggerGridAlgoOrder triggers grid algo order

func (*Okx) InstrumentsSubscription

func (ok *Okx) InstrumentsSubscription(ctx context.Context, 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

func (ok *Okx) IsPerpetualFutureCurrency(a asset.Item, _ currency.Pair) (bool, error)

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 configures the currency margin and sets the isolated margin trading mode for futures or perpetual contracts

func (*Okx) LightningWithdrawal

LightningWithdrawal to withdraw a currency from an invoice

func (*Okx) ManualBorrowAndRepayInQuickMarginMode

func (ok *Okx) ManualBorrowAndRepayInQuickMarginMode(ctx context.Context, arg *BorrowAndRepay) (*BorrowAndRepay, error)

ManualBorrowAndRepayInQuickMarginMode initiates a new manual borrow and repayment process in Quick Margin mode

func (*Okx) ManualBorrowOrRepay

func (ok *Okx) ManualBorrowOrRepay(ctx context.Context, ccy currency.Code, side string, amount float64) (*BorrowOrRepay, error)

ManualBorrowOrRepay borrow or repay assets. only applicable to Spot mode (enabled borrowing)

func (*Okx) ManualRenewFixedLoanBorrowingOrder

func (ok *Okx) ManualRenewFixedLoanBorrowingOrder(ctx context.Context, orderID string, maxRate float64) (*OrderIDResponse, error)

ManualRenewFixedLoanBorrowingOrder manual renew fixed loan borrowing order

func (*Okx) MarkPriceCandlesticksSubscription

func (ok *Okx) MarkPriceCandlesticksSubscription(ctx context.Context, 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(ctx context.Context, 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) NewPositionBuilder

func (ok *Okx) NewPositionBuilder(ctx context.Context, arg *PositionBuilderParam) (*PositionBuilderDetail, error)

NewPositionBuilder calculates portfolio margin information for virtual position/assets or current position of the user. You can add up to 200 virtual positions and 200 virtual assets in one request

func (*Okx) OpenInterestSubscription

func (ok *Okx) OpenInterestSubscription(ctx context.Context, 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 be pushed every 3 seconds.

func (*Okx) OptionSummarySubscription

func (ok *Okx) OptionSummarySubscription(ctx context.Context, operation string, pair currency.Pair) error

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(ctx context.Context, operation, channel string, assetType asset.Item, pair currency.Pair) error

OrderBooksSubscription subscribe or unsubscribe to "books*" channel to retrieve order book data.

func (*Okx) PlaceAlgoOrder

func (ok *Okx) PlaceAlgoOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceAlgoOrder order includes trigger, oco, chase, conditional, iceberg, twap and trailing orders. chase order only applicable to futures and swap orders

func (*Okx) PlaceChaseAlgoOrder

func (ok *Okx) PlaceChaseAlgoOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceChaseAlgoOrder places an order that adjusts the price of an open limit order to match the current market price

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) PlaceFixedLoanBorrowingOrder

func (ok *Okx) PlaceFixedLoanBorrowingOrder(ctx context.Context, ccy currency.Code, amount, maxRate, reborrowRate float64, term string, reborrow bool) (*OrderIDResponse, error)

PlaceFixedLoanBorrowingOrder for new borrowing orders, they belong to the IOC (immediately close and cancel the remaining) type. For renewal orders, they belong to the FOK (Fill-or-kill) type

func (*Okx) PlaceGridAlgoOrder

func (ok *Okx) PlaceGridAlgoOrder(ctx context.Context, arg *GridAlgoOrder) (*GridAlgoOrderIDResponse, error)

PlaceGridAlgoOrder place spot grid algo order

func (*Okx) PlaceIcebergOrder

func (ok *Okx) PlaceIcebergOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceIcebergOrder to place iceberg algo order

func (*Okx) PlaceLeadingStopOrder

func (ok *Okx) PlaceLeadingStopOrder(ctx context.Context, arg *TPSLOrderParam) (*PositionIDInfo, error)

PlaceLeadingStopOrder holds leading trader sets TP/SL for the current leading position that are not closed

func (*Okx) PlaceLendingOrder

func (ok *Okx) PlaceLendingOrder(ctx context.Context, arg *LendingOrderParam) (*LendingOrderResponse, error)

PlaceLendingOrder places a lending 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) (*OrderData, error)

PlaceOrder places an order

func (*Okx) PlaceRecurringBuyOrder

func (ok *Okx) PlaceRecurringBuyOrder(ctx context.Context, arg *PlaceRecurringBuyOrderParam) (*RecurringOrderResponse, error)

PlaceRecurringBuyOrder recurring buy is a strategy for investing a fixed amount in crypto at fixed intervals. An appropriate recurring approach in volatile markets allows you to buy crypto at lower costs. Learn more The API endpoints of Recurring buy require authentication

func (*Okx) PlaceSpreadOrder

func (ok *Okx) PlaceSpreadOrder(ctx context.Context, arg *SpreadOrderParam) (*SpreadOrderResponse, error)

PlaceSpreadOrder places new spread order

func (*Okx) PlaceStopOrder

func (ok *Okx) PlaceStopOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceStopOrder places a stop order. The order type should be "conditional" because stop orders are used for conditional take-profit or stop-loss scenarios.

func (*Okx) PlaceTWAPOrder

func (ok *Okx) PlaceTWAPOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceTWAPOrder to place TWAP algo orders

func (*Okx) PlaceTakeProfitStopLossOrder

func (ok *Okx) PlaceTakeProfitStopLossOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceTakeProfitStopLossOrder places conditional and oco orders When placing net TP/SL order (ordType=conditional) and both take-profit and stop-loss parameters are sent, only stop-loss logic will be performed and take-profit logic will be ignored

func (*Okx) PlaceTrailingStopOrder

func (ok *Okx) PlaceTrailingStopOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceTrailingStopOrder to place trailing stop order

func (*Okx) PlaceTriggerAlgoOrder

func (ok *Okx) PlaceTriggerAlgoOrder(ctx context.Context, arg *AlgoOrderParams) (*AlgoOrder, error)

PlaceTriggerAlgoOrder fetches algo trigger orders for SWAP market types

func (*Okx) PositionRiskWarningSubscription

func (ok *Okx) PositionRiskWarningSubscription(ctx context.Context, 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) PreCheckOrder

func (ok *Okx) PreCheckOrder(ctx context.Context, arg *OrderPreCheckParams) (*OrderPreCheckResponse, error)

PreCheckOrder returns the account information before and after placing a potential order Only applicable to Multi-currency margin mode, and Portfolio margin mode

func (*Okx) PriceLimitSubscription

func (ok *Okx) PriceLimitSubscription(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

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) PublicBlockTradesSubscription

func (ok *Okx) PublicBlockTradesSubscription(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

PublicBlockTradesSubscription a method to subscribe and unsubscribe to a "public-block-trades" channel to retrieve the recent block trades data by individual legs. Each leg in a block trade is pushed in a separate update. Data will be pushed whenever there is a block trade.

func (*Okx) PublicStructureBlockTradesSubscription

func (ok *Okx) PublicStructureBlockTradesSubscription(ctx context.Context, 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) PurchaseETHStaking

func (ok *Okx) PurchaseETHStaking(ctx context.Context, amount float64) error

PurchaseETHStaking staking ETH for BETH Only the assets in the funding account can be used

func (*Okx) QuotesSubscription

func (ok *Okx) QuotesSubscription(ctx context.Context, operation string) error

QuotesSubscription subscription to retrieve Quote subscription

func (*Okx) RFQSubscription

func (ok *Okx) RFQSubscription(ctx context.Context, operation, uid string) error

RFQSubscription subscription to retrieve RFQ updates on RFQ orders.

func (*Okx) RSIBackTesting

func (ok *Okx) RSIBackTesting(ctx context.Context, instrumentID, triggerCondition, duration string, threshold, timePeriod int64, timeFrame kline.Interval) (*RSIBacktestingResponse, error)

RSIBackTesting relative strength index(RSI) backtesting Parameters:

TriggerCondition: possible values are "cross_up" "cross_down" "above" "below" "cross" Default is cross_down

Threshold: The value should be an integer between 1 to 100

func (*Okx) Redeem

func (ok *Okx) Redeem(ctx context.Context, arg *RedeemRequestParam) (*OrderIDResponse, error)

Redeem redemption of investment

func (*Okx) RedeemETHStaking

func (ok *Okx) RedeemETHStaking(ctx context.Context, amount float64) error

RedeemETHStaking only the assets in the funding account can be used. If your BETH is in your trading account, you can make funding transfer first

func (*Okx) ReduceLiabilitiesForFixedLoan

func (ok *Okx) ReduceLiabilitiesForFixedLoan(ctx context.Context, orderID string, pendingRepay bool) (*ReduceLiabilities, error)

ReduceLiabilitiesForFixedLoan provide the function of "setting pending repay state / canceling pending repay state" for fixed loan order

func (*Okx) RepayFixedLoanBorrowingOrder

func (ok *Okx) RepayFixedLoanBorrowingOrder(ctx context.Context, orderID string) (*OrderIDResponse, error)

RepayFixedLoanBorrowingOrder repays fixed loan borrowing order

func (*Okx) ResetMMPStatus

func (ok *Okx) ResetMMPStatus(ctx context.Context, instrumentType, instrumentFamily string) (*MMPStatusResponse, error)

ResetMMPStatus reset the MMP status to be inactive. you can unfreeze by this endpoint once MMP is triggered. Only applicable to Option in Portfolio Margin mode, and MMP privilege is required

func (*Okx) ResetRFQMMPStatus

func (ok *Okx) ResetRFQMMPStatus(ctx context.Context) (time.Time, error)

ResetRFQMMPStatus 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) 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 any, authenticated request.AuthType, useAsItIs ...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) SetAccountMode

func (ok *Okx) SetAccountMode(ctx context.Context, accountLevel string) (*AccountMode, error)

SetAccountMode to set on the Web/App for the first set of every account mode. Account mode 1: Simple mode 2: Single-currency margin mode 3: Multi-currency margin code 4: Portfolio margin mode

func (*Okx) SetAutoLoan

func (ok *Okx) SetAutoLoan(ctx context.Context, autoLoan bool) (*AutoLoan, error)

SetAutoLoan only applicable to Multi-currency margin and Portfolio margin

func (*Okx) SetAutoRepay

func (ok *Okx) SetAutoRepay(ctx context.Context, autoRepay bool) (*AutoRepay, error)

SetAutoRepay represents an auto-repay. Only applicable to Spot mode (enabled borrowing)

func (*Okx) SetCollateralMode

func (ok *Okx) SetCollateralMode(_ context.Context, _ asset.Item, _ collateral.Mode) error

SetCollateralMode sets the collateral type for your account

func (*Okx) SetDefaults

func (ok *Okx) SetDefaults()

SetDefaults sets the basic defaults for Okx

func (*Okx) SetFirstCopySettings

func (ok *Okx) SetFirstCopySettings(ctx context.Context, arg *FirstCopySettings) (*ResponseSuccess, error)

SetFirstCopySettings set first copy settings for the certain lead trader. You need to first copy settings after stopping copying

func (*Okx) SetGreeks

func (ok *Okx) SetGreeks(ctx context.Context, greeksType string) (*GreeksType, error)

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) SetMMP

func (ok *Okx) SetMMP(ctx context.Context, arg *MMPConfig) (*MMPConfig, error)

SetMMP set MMP configure Only applicable to Option in Portfolio Margin mode, and MMP privilege is required

func (*Okx) SetMarginType

func (ok *Okx) SetMarginType(_ context.Context, _ asset.Item, _ currency.Pair, _ margin.Type) error

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) SetMultipleLeverages

func (ok *Okx) SetMultipleLeverages(ctx context.Context, arg *SetLeveragesParam) (*SetMultipleLeverageResponse, error)

SetMultipleLeverages set Multiple leverages

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

func (ok *Okx) SetPositionMode(ctx context.Context, positionMode string) (*PositionMode, 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. Position mode 'long_short_mode': long/short, only applicable to FUTURES/SWAP'net_mode': net

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) SetRiskOffsetAmount

func (ok *Okx) SetRiskOffsetAmount(ctx context.Context, ccy currency.Code, clientSpotInUseAmount float64) (*RiskOffsetAmount, error)

SetRiskOffsetAmount set risk offset amount. This does not represent the actual spot risk offset amount. Only applicable to Portfolio Margin Mode

func (*Okx) SetRiskOffsetType

func (ok *Okx) SetRiskOffsetType(ctx context.Context, riskOffsetType string) (*RiskOffsetType, error)

SetRiskOffsetType configure the risk offset type in portfolio margin mode. riskOffsetType possible values are: 1: Spot-derivatives (USDT) risk offset 2: Spot-derivatives (Crypto) risk offset 3:Derivatives only mode

func (*Okx) SetSubAccountVIPLoanAllocation

func (ok *Okx) SetSubAccountVIPLoanAllocation(ctx context.Context, arg *SubAccountLoanAllocationParam) (bool, error)

SetSubAccountVIPLoanAllocation set the VIP loan allocation of sub-accounts. Only Applicable to master account API keys with Trade access

func (*Okx) Setup

func (ok *Okx) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Okx) Shutdown

func (ok *Okx) Shutdown() error

Shutdown calls Base.Shutdown and then shuts down the response multiplexer

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(ctx context.Context, 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

func (ok *Okx) StatusSubscription(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

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) StopCopying

func (ok *Okx) StopCopying(ctx context.Context, arg *StopCopyingParameter) (*ResponseSuccess, error)

StopCopying need to use this endpoint for amending copy settings

func (*Okx) StopGridAlgoOrder

func (ok *Okx) StopGridAlgoOrder(ctx context.Context, arg []StopGridAlgoOrderRequest) ([]GridAlgoOrderIDResponse, error)

StopGridAlgoOrder stop a batch of grid algo orders. A maximum of 10 orders can be canceled per request

func (*Okx) StopRecurringBuyOrder

func (ok *Okx) StopRecurringBuyOrder(ctx context.Context, arg []StopRecurringBuyOrder) ([]RecurringOrderResponse, error)

StopRecurringBuyOrder stops recurring buy order. A maximum of 10 orders can be stopped per request

func (*Okx) StructureBlockTradesSubscription

func (ok *Okx) StructureBlockTradesSubscription(ctx context.Context, operation string) error

StructureBlockTradesSubscription to retrieve Structural block subscription

func (*Okx) SubmitOrder

func (ok *Okx) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

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(ctx context.Context, 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

func (ok *Okx) TradesSubscription(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

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) 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

func (ok *Okx) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error

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

func (ok *Okx) UpdateTickers(ctx context.Context, assetType asset.Item) error

UpdateTickers updates all currency pairs of a given asset type

func (*Okx) UpdateTradablePairs

func (ok *Okx) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

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

func (ok *Okx) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

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, arg *WithdrawalInput) (*WithdrawalResponse, error)

Withdrawal to perform a withdrawal action. Sub-account does not support withdrawal

func (*Okx) WsAccountSubscription

func (ok *Okx) WsAccountSubscription(ctx context.Context, 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) WsAmandSpreadOrder

func (ok *Okx) WsAmandSpreadOrder(ctx context.Context, arg *AmendSpreadOrderParam) (*SpreadOrderResponse, error)

WsAmandSpreadOrder amends incomplete spread order through the websocket channel.

func (*Okx) WsAmendMultipleOrders

func (ok *Okx) WsAmendMultipleOrders(ctx context.Context, args []AmendOrderRequestParams) ([]OrderData, error)

WsAmendMultipleOrders a request through the websocket connection to amend multiple trade orders.

func (*Okx) WsAmendOrder

func (ok *Okx) WsAmendOrder(ctx context.Context, arg *AmendOrderRequestParams) (*OrderData, error)

WsAmendOrder method to amend trade order using a request thought the websocket channel.

func (*Okx) WsAuth

func (ok *Okx) WsAuth(ctx context.Context) error

WsAuth will connect to Okx's Private websocket connection and Authenticate with a login payload.

func (*Okx) WsCancelAllSpreadOrders

func (ok *Okx) WsCancelAllSpreadOrders(ctx context.Context, spreadID string) (bool, error)

WsCancelAllSpreadOrders cancels all spread orders and return success message through the websocket channel.

func (*Okx) WsCancelMultipleOrder

func (ok *Okx) WsCancelMultipleOrder(ctx context.Context, args []CancelOrderRequestParam) ([]OrderData, error)

WsCancelMultipleOrder cancel multiple order through the websocket channel.

func (*Okx) WsCancelOrder

func (ok *Okx) WsCancelOrder(ctx context.Context, arg *CancelOrderRequestParam) (*OrderData, error)

WsCancelOrder websocket function to cancel a trade order

func (*Okx) WsCancelSpreadOrder

func (ok *Okx) WsCancelSpreadOrder(ctx context.Context, orderID, clientOrderID string) (*SpreadOrderResponse, error)

WsCancelSpreadOrder cancels an incomplete spread order through the websocket connection.

func (*Okx) WsConnect

func (ok *Okx) WsConnect() error

WsConnect initiates a websocket connection

func (*Okx) WsConnectBusiness

func (ok *Okx) WsConnectBusiness() error

WsConnectBusiness connects to a business websocket channel.

func (*Okx) WsHandleData

func (ok *Okx) WsHandleData(respRaw []byte) error

WsHandleData will read websocket raw data and pass to appropriate handler

func (*Okx) WsMassCancelOrders

func (ok *Okx) WsMassCancelOrders(ctx context.Context, args []CancelMassReqParam) (bool, error)

WsMassCancelOrders cancel all the MMP pending orders of an instrument family. Only applicable to Option in Portfolio Margin mode, and MMP privilege is required.

func (*Okx) WsOrderChannel

func (ok *Okx) WsOrderChannel(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair, _ string) error

WsOrderChannel for subscribing for orders.

func (*Okx) WsPlaceMultipleOrders

func (ok *Okx) WsPlaceMultipleOrders(ctx context.Context, args []PlaceOrderRequestParam) ([]OrderData, error)

WsPlaceMultipleOrders creates an order through the websocket stream.

func (*Okx) WsPlaceOrder

func (ok *Okx) WsPlaceOrder(ctx context.Context, arg *PlaceOrderRequestParam) (*OrderData, error)

WsPlaceOrder places an order thought the websocket connection stream, and returns a SubmitResponse and error message.

func (*Okx) WsPlaceSpreadOrder

func (ok *Okx) WsPlaceSpreadOrder(ctx context.Context, arg *SpreadOrderParam) (*SpreadOrderResponse, error)

WsPlaceSpreadOrder places a spread order thought the websocket connection stream, and returns a SubmitResponse and error message.

func (*Okx) WsPositionChannel

func (ok *Okx) WsPositionChannel(ctx context.Context, operation string, assetType asset.Item, pair currency.Pair) error

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

func (*Okx) WsSpreadAuth

func (ok *Okx) WsSpreadAuth(ctx context.Context) error

WsSpreadAuth will connect to Okx's Private websocket connection and Authenticate with a login payload.

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            types.Time   `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    types.Time
	OpenInterest types.Number
	Volume       types.Number
}

OpenInterestVolume represents open interest and trading volume item for currencies of futures and perpetual swaps

func (*OpenInterestVolume) UnmarshalJSON

func (p *OpenInterestVolume) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes json data into OpenInterestVolume struct

type OpenInterestVolumeRatio

type OpenInterestVolumeRatio struct {
	Timestamp         types.Time
	OpenInterestRatio types.Number
	VolumeRatio       types.Number
}

OpenInterestVolumeRatio represents open interest and trading volume ratio for currencies of futures and perpetual swaps

func (*OpenInterestVolumeRatio) UnmarshalJSON

func (o *OpenInterestVolumeRatio) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes json data into OpenInterestVolumeRatio

type OperationResponse

type OperationResponse struct {
	ID        string `json:"id"`
	Operation string `json:"op"`
	Code      string `json:"code"`
	Msg       string `json:"msg"`
}

OperationResponse holds common operation identification

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        types.Number `json:"realVol"`
	BidVolatility  types.Number `json:"bidVol"`
	AskVolatility  types.Number `json:"askVol"`
	MarkVolatility types.Number `json:"markVol"`
	Leverage       types.Number `json:"lever"`
	ForwardPrice   types.Number `json:"fwdPx"`
	Timestamp      types.Time   `json:"ts"`
}

OptionMarketDataResponse holds response data for option market data

type OptionTickBand

type OptionTickBand struct {
	InstrumentType   string `json:"instType"`
	InstrumentFamily string `json:"instFamily"`
	TickBand         []struct {
		MinPrice types.Number `json:"minPx"`
		MaxPrice types.Number `json:"maxPx"`
		TickSize types.Number `json:"tickSz"`
	} `json:"tickBand"`
}

OptionTickBand holds option band information

type OptionTrade

type OptionTrade struct {
	FillVolume       types.Number `json:"fillVol"`
	ForwardPrice     types.Number `json:"fwdPx"`
	IndexPrice       types.Number `json:"idxPx"`
	MarkPrice        types.Number `json:"markPx"`
	Price            types.Number `json:"px"`
	Size             types.Number `json:"sz"`
	InstrumentFamily string       `json:"instFamily"`
	InstrumentID     string       `json:"instId"`
	OptionType       string       `json:"optType"`
	Side             string       `json:"side"`
	TradeID          string       `json:"tradeId"`
	Timestamp        types.Time   `json:"ts"`
}

OptionTrade holds option trade item

type OracleSmartContractResponse

type OracleSmartContractResponse struct {
	Messages   []string          `json:"messages"`
	Prices     map[string]string `json:"prices"`
	Signatures []string          `json:"signatures"`
	Timestamp  types.Time        `json:"timestamp"`
}

OracleSmartContractResponse represents the cryptocurrency price signed using the Open Oracle smart contract.

type OrderBookResponseDetail

type OrderBookResponseDetail struct {
	Asks                []OrderbookItemDetail
	Bids                []OrderbookItemDetail
	GenerationTimestamp time.Time
}

OrderBookResponseDetail contains the ask and bid orders, structured with fields that include the timestamp of order generation.

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"`
	StatusCode    string `json:"sCode,omitempty"`
	StatusMessage 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              types.Number `json:"pnl"`
	OrderType                  string       `json:"ordType"`
	Side                       order.Side   `json:"side"`
	PositionSide               string       `json:"posSide"`
	TradeMode                  string       `json:"tdMode"`
	TradeID                    string       `json:"tradeId"`
	FillTime                   types.Time   `json:"fillTime"`
	Source                     string       `json:"source"`
	State                      string       `json:"state"`
	TakeProfitTriggerPriceType string       `json:"tpTriggerPxType"`
	StopLossTriggerPriceType   string       `json:"slTriggerPxType"`
	StopLossOrderPrice         types.Number `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                 types.Time   `json:"uTime"`
	CreationTime               types.Time   `json:"cTime"`
	AlgoClOrdID                string       `json:"algoClOrdId"`
	AlgoID                     string       `json:"algoId"`
	AttachAlgoClOrdID          string       `json:"attachAlgoClOrdId"`
	AttachAlgoOrds             []any        `json:"attachAlgoOrds"`
	CancelSource               string       `json:"cancelSource"`
	CancelSourceReason         string       `json:"cancelSourceReason"`
	IsTakeProfitLimit          string       `json:"isTpLimit"`
	LinkedAlgoOrd              struct {
		AlgoID string `json:"algoId"`
	} `json:"linkedAlgoOrd"`
	PriceType               string       `json:"pxType"`
	PriceVolume             types.Number `json:"pxVol"`
	PriceUSD                types.Number `json:"pxUsd"`
	QuickMgnType            string       `json:"quickMgnType"`
	ReduceOnly              bool         `json:"reduceOnly,string,omitempty"`
	SelfTradePreventionID   string       `json:"stpId"`
	SelfTradePreventionMode string       `json:"stpMode"`
}

OrderDetail holds detailed information about an order.

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 OrderIDAndState

type OrderIDAndState struct {
	OrderID string `json:"ordId"`
	State   string `json:"state"`
}

OrderIDAndState represents an orderID and state information

type OrderIDResponse

type OrderIDResponse struct {
	OrderID string `json:"orderId"`
	Tag     string `json:"tag"` // Optional to most ID responses
}

OrderIDResponse represents purchase order ID

type OrderLeg

type OrderLeg struct {
	Price          types.Number `json:"px"`
	Size           types.Number `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 OrderPreCheckParams

type OrderPreCheckParams struct {
	InstrumentID     string          `json:"instId"`
	TradeMode        string          `json:"tdMode"`
	ClientOrderID    string          `json:"clOrdId"`
	Side             string          `json:"side"`
	PositionSide     string          `json:"posSide"`
	OrderType        string          `json:"ordType"`
	Size             float64         `json:"sz,omitempty"`
	Price            float64         `json:"px,omitempty"`
	ReduceOnly       bool            `json:"reduceOnly,omitempty"`
	TargetCurrency   string          `json:"tgtCcy,omitempty"`
	AttachAlgoOrders []AlgoOrderInfo `json:"attachAlgoOrds,omitempty"`
}

OrderPreCheckParams represents an order pre-check parameters

type OrderPreCheckResponse

type OrderPreCheckResponse struct {
	AdjEq                      types.Number `json:"adjEq"`
	AdjEqChg                   types.Number `json:"adjEqChg"`
	AvailBal                   types.Number `json:"availBal"`
	AvailBalChg                types.Number `json:"availBalChg"`
	IMR                        types.Number `json:"imr"`
	IMRChg                     types.Number `json:"imrChg"`
	Liab                       types.Number `json:"liab"`
	LiabChg                    types.Number `json:"liabChg"`
	LiabChgCurrency            string       `json:"liabChgCcy"`
	LiquidiationPrice          types.Number `json:"liqPx"`
	LiquidiationPriceDiff      string       `json:"liqPxDiff"`
	LiquidiationPriceDiffRatio types.Number `json:"liqPxDiffRatio"`
	MgnRatio                   types.Number `json:"mgnRatio"`
	MgnRatioChg                types.Number `json:"mgnRatioChg"`
	MMR                        types.Number `json:"mmr"`
	MMRChange                  types.Number `json:"mmrChg"`
	PosBalance                 types.Number `json:"posBal"`
	PosBalChange               types.Number `json:"posBalChg"`
	Type                       string       `json:"type"`
}

OrderPreCheckResponse represents an order pre-checks response of account information for placing orders

type OrderbookItemDetail

type OrderbookItemDetail struct {
	DepthPrice        types.Number
	Amount            types.Number
	LiquidationOrders types.Number
	NumberOfOrders    types.Number
}

OrderbookItemDetail represents detailed information about currency bids.

func (*OrderbookItemDetail) UnmarshalJSON

func (o *OrderbookItemDetail) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes byte data into OrderbookItemDetail instance

type PMLimitationResponse

type PMLimitationResponse struct {
	MaximumSize      types.Number `json:"maxSz"`
	PositionType     string       `json:"postType"`
	Underlying       string       `json:"uly"`
	InstrumentFamily string       `json:"instFamily"`
}

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               types.Time    `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                   types.Time    `json:"fillTime"`
	InstrumentID               string        `json:"instId"`
	InstrumentType             string        `json:"instType"`
	Leverage                   types.Number  `json:"lever"`
	OrderID                    string        `json:"ordId"`
	OrderType                  string        `json:"ordType"`
	ProfitAndLoss              types.Number  `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                 types.Time    `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"`
	Source       string   `json:"source,omitempty"`
}

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 types.Time `json:"expTime,omitempty"`
}

PlaceOrderRequestParam requesting parameter for placing an order

type PlaceRecurringBuyOrderParam

type PlaceRecurringBuyOrderParam struct {
	Tag                       string              `json:"tag"`
	ClientSuppliedAlgoOrderID string              `json:"algoClOrdId"`
	StrategyName              string              `json:"stgyName"` // Custom name for trading bot
	Amount                    float64             `json:"amt,string"`
	RecurringList             []RecurringListItem `json:"recurringList"`
	Period                    string              `json:"period"` // Period 'monthly' 'weekly' 'daily'

	// Recurring buy date
	// When the period is monthly, the value range is an integer of [1,28]
	// When the period is weekly, the value range is an integer of [1,7]
	// When the period is daily, the value is 1
	RecurringDay       string `json:"recurringDay"`
	RecurringTime      int64  `json:"recurringTime,string"` // Recurring buy time, the value range is an integer of [0,23]
	TimeZone           string `json:"timeZone"`
	TradeMode          string `json:"tdMode"` // Trading mode Margin mode: 'cross' Non-Margin mode: 'cash'
	InvestmentCurrency string `json:"investmentCcy"`
}

PlaceRecurringBuyOrderParam holds parameters for placing recurring order

type PositionBuilderData

type PositionBuilderData struct {
	Delta              string       `json:"delta"`
	Gamma              string       `json:"gamma"`
	InstrumentID       string       `json:"instId"`
	InstrumentType     string       `json:"instType"`
	NotionalUSD        types.Number `json:"notionalUsd"` // Quantity of positions usd
	QuantityOfPosition types.Number `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 PositionBuilderDetail

type PositionBuilderDetail struct {
	Assets []struct {
		AvailEq   types.Number `json:"availEq"`
		BorrowIMR types.Number `json:"borrowImr"`
		BorrowMMR types.Number `json:"borrowMmr"`
		Currency  string       `json:"ccy"`
		SpotInUse string       `json:"spotInUse"`
	} `json:"assets"`
	BorrowMMR    string       `json:"borrowMmr"`
	DerivMMR     string       `json:"derivMmr"`
	Equity       string       `json:"eq"`
	MarginRatio  types.Number `json:"marginRatio"`
	RiskUnitData []struct {
		Delta          string `json:"delta"`
		Gamma          string `json:"gamma"`
		IMR            string `json:"imr"`
		IndexUsd       string `json:"indexUsd"`
		Mmr            string `json:"mmr"`
		Mr1            string `json:"mr1"`
		Mr1FinalResult struct {
			PNL       types.Number `json:"pnl"`
			SpotShock string       `json:"spotShock"`
			VolShock  string       `json:"volShock"`
		} `json:"mr1FinalResult"`
		Mr1Scenarios struct {
			VolSame      map[string]string `json:"volSame"`
			VolShockDown map[string]string `json:"volShockDown"`
			VolShockUp   map[string]string `json:"volShockUp"`
		} `json:"mr1Scenarios"`
		Mr2            string `json:"mr2"`
		Mr3            string `json:"mr3"`
		Mr4            string `json:"mr4"`
		Mr5            string `json:"mr5"`
		Mr6            string `json:"mr6"`
		Mr6FinalResult struct {
			PNL       types.Number `json:"pnl"`
			SpotShock string       `json:"spotShock"`
		} `json:"mr6FinalResult"`
		Mr7        string `json:"mr7"`
		Portfolios []struct {
			Amount         types.Number `json:"amt"`
			Delta          types.Number `json:"delta"`
			Gamma          types.Number `json:"gamma"`
			InstrumentID   string       `json:"instId"`
			InstrumentType string       `json:"instType"`
			IsRealPos      bool         `json:"isRealPos"`
			NotionalUsd    string       `json:"notionalUsd"`
			Theta          string       `json:"theta"`
			Vega           string       `json:"vega"`
		} `json:"portfolios"`
		RiskUnit string `json:"riskUnit"`
		Theta    string `json:"theta"`
		Vega     string `json:"vega"`
	} `json:"riskUnitData"`
	TotalImr  types.Number `json:"totalImr"`
	TotalMmr  types.Number `json:"totalMmr"`
	Timestamp types.Time   `json:"ts"`
}

PositionBuilderDetail represents details of portfolio margin information for virtual position/assets or current position of the user

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         uint64         `json:"pos,omitempty"`
}

PositionBuilderInput represents request parameter for position builder item

type PositionBuilderParam

type PositionBuilderParam struct {
	InclRealPosAndEq bool                `json:"inclRealPosAndEq"`
	SimPos           []SimulatedPosition `json:"simPos"`
	SimAsset         []SimulatedAsset    `json:"simAsset"`
	SpotOffsetType   string              `json:"spotOffsetType"`
	GreeksType       string              `json:"greeksType"`
}

PositionBuilderParam represents a position builder parameters

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                    types.Time            `json:"ts"`
}

PositionBuilderResponse represents a position builder endpoint response

type PositionData

type PositionData struct {
	BaseBalance        types.Number `json:"baseBal"`
	Currency           string       `json:"ccy"`
	InstrumentID       string       `json:"instId"`
	InstrumentType     string       `json:"instType"`
	ManagementMode     string       `json:"mgnMode"`
	NotionalCurrency   string       `json:"notionalCcy"`
	NotionalUSD        types.Number `json:"notionalUsd"`
	Position           string       `json:"pos"`
	PositionedCurrency string       `json:"posCcy"`
	PositionedID       string       `json:"posId"`
	PositionedSide     string       `json:"posSide"`
	QuoteBalance       types.Number `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     types.Number `json:"avgPx"`
	UpdateTime       types.Time   `json:"uTIme"`
}

PositionDataDetail position data information for the websocket push data

type PositionIDInfo

type PositionIDInfo struct {
	SubPosID string `json:"subPosId"`
	Tag      string `json:"tag"`
}

PositionIDInfo holds place positions information

type PositionInfo

type PositionInfo struct {
	InstrumentType    string       `json:"instType"`
	InstrumentID      string       `json:"instId"`
	AlgoID            string       `json:"algoId"`
	Lever             types.Number `json:"lever"`
	MarginMode        string       `json:"mgnMode"`
	OpenAvgPrice      types.Number `json:"openAvgPx"`
	OpenOrderID       string       `json:"openOrdId"`
	OpenTime          types.Time   `json:"openTime"`
	PositionSide      string       `json:"posSide"`
	SlTriggerPrice    types.Number `json:"slTriggerPx"`
	SubPos            string       `json:"subPos"`
	SubPosID          string       `json:"subPosId"`
	TpTriggerPrice    types.Number `json:"tpTriggerPx"`
	CloseAveragePrice types.Number `json:"closeAvgPx"`
	CloseTime         types.Time   `json:"closeTime"`
}

PositionInfo represents a positions detail

type PositionItem

type PositionItem struct {
	Position     string `json:"pos"`
	InstrumentID string `json:"instId"`
}

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 PremiumInfo

type PremiumInfo struct {
	InstrumentID string `json:"instId"`
	Premium      string `json:"premium"`
	Timestamp    string `json:"ts"`
}

PremiumInfo represents data on premiums for the past 6 months.

type ProductInfo

type ProductInfo struct {
	FastRedemptionDailyLimit types.Number `json:"fastRedemptionDailyLimit"`
}

ProductInfo represents ETH staking information

type ProfitSharingItem

type ProfitSharingItem struct {
	Currency            string       `json:"ccy"`
	NickName            string       `json:"nickName"`
	ProfitSharingAmount types.Number `json:"profitSharingAmt"`
	ProfitSharingID     string       `json:"profitSharingId"`
	InstrumentType      string       `json:"instType"`
	Timestamp           types.Time   `json:"ts"`
}

ProfitSharingItem holds profit sharing information

type PublicBlockTrades

type PublicBlockTrades struct {
	Arg  SubscriptionInfo `json:"arg"`
	Data []PublicTrade    `json:"data"`
}

PublicBlockTrades holds public block trades

type PublicBorrowHistory

type PublicBorrowHistory struct {
	Amount    types.Number `json:"amt"`
	Currency  string       `json:"ccy"`
	Rate      types.Number `json:"rate"`
	Timestamp types.Time   `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 PublicLendingOffer

type PublicLendingOffer struct {
	Currency         string       `json:"ccy"`
	LendQuota        string       `json:"lendQuota"`
	MinLendingAmount types.Number `json:"minLend"`
	Rate             types.Number `json:"rate"`
	Term             string       `json:"term"`
}

PublicLendingOffer represents a lending offer detail

type PublicTrade

type PublicTrade struct {
	FillVolume       types.Number `json:"fillVol"`
	ForwardPrice     types.Number `json:"fwdPx"`
	IndexPrice       types.Number `json:"idxPx"`
	InstrumentFamily string       `json:"instFamily"`
	InstrumentID     string       `json:"instId"`
	MarkPrice        types.Number `json:"markPx"`
	OptionType       string       `json:"optType"`
	Price            types.Number `json:"px"`
	Side             string       `json:"side"`
	Size             types.Number `json:"sz"`
	TradeID          string       `json:"tradeId"`
	Timestamp        types.Time   `json:"ts"`
}

PublicTrade represents public trade item for option, block, and others

type PublicTradesResponse

type PublicTradesResponse struct {
	BlockTradeID string        `json:"blockTdId"`
	CreationTime types.Time    `json:"cTime"`
	Legs         []RFQTradeLeg `json:"legs"`
}

PublicTradesResponse represents data will be pushed whenever there is a block trade

type PurchaseInvestDataItem

type PurchaseInvestDataItem struct {
	Currency currency.Code `json:"ccy"`
	Amount   float64       `json:"amt,string"`
}

PurchaseInvestDataItem represents purchase invest data information having the currency and amount information

type PurchaseRedeemHistory

type PurchaseRedeemHistory struct {
	Amt              types.Number `json:"amt"`
	CompletedTime    types.Time   `json:"completedTime"`
	EstCompletedTime types.Time   `json:"estCompletedTime"`
	RequestTime      types.Time   `json:"requestTime"`
	Status           string       `json:"status"`
	Type             string       `json:"type"`
}

PurchaseRedeemHistory holds purchase and redeem history

type PurchaseRequestParam

type PurchaseRequestParam struct {
	ProductID  string                   `json:"productId"`
	Term       int64                    `json:"term,string,omitempty"`
	InvestData []PurchaseInvestDataItem `json:"investData"`
}

PurchaseRequestParam represents purchase request param specific product

type QuoteLeg

type QuoteLeg struct {
	Price          float64    `json:"px,string"`
	SizeOfQuoteLeg float64    `json:"sz,string"`
	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

func (a *QuoteLeg) MarshalJSON() ([]byte, error)

MarshalJSON serialized QuoteLeg instance into bytes

type QuoteProduct

type QuoteProduct struct {
	InstrumentType string `json:"instType,omitempty"`
	IncludeALL     bool   `json:"includeALL"`
	Data           []struct {
		Underlying     string       `json:"uly"`
		MaxBlockSize   types.Number `json:"maxBlockSz"`
		MakerPriceBand types.Number `json:"makerPxBand"`
	} `json:"data"`
	InstrumentType0 string `json:"instType:,omitempty"`
}

QuoteProduct represents products which makers want to quote and receive RFQs for

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  types.Time `json:"cTime"`
	UpdateTime    types.Time `json:"uTime"`
	ValidUntil    types.Time `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 RFQOrderLeg

type RFQOrderLeg struct {
	Size         types.Number `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     types.Time `json:"cTime"`
	UpdateTime     types.Time `json:"uTime"`
	ValidUntil     types.Time `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         types.Number `json:"sz"`
		Side         string       `json:"side"`
		TgtCurrency  string       `json:"tgtCcy"`
	} `json:"legs"`
}

RFQResponse RFQ response detail

type RFQTradeLeg

type RFQTradeLeg struct {
	InstrumentID string       `json:"instId"`
	Side         string       `json:"side"`
	Size         string       `json:"sz"`
	Price        types.Number `json:"px"`
	TradeID      string       `json:"tradeId"`

	Fee         types.Number `json:"fee"`
	FeeCurrency string       `json:"feeCcy"`
}

RFQTradeLeg RFQ trade response leg

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            []RFQTradeLeg `json:"legs"`
	CreationTime    types.Time    `json:"cTime"`
	TakerTraderCode string        `json:"tTraderCode"`
	MakerTraderCode string        `json:"mTraderCode"`
}

RFQTradeResponse RFQ trade response

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 RSIBacktestingResponse

type RSIBacktestingResponse struct {
	TriggerNumber string `json:"triggerNum"`
}

RSIBacktestingResponse holds response for relative strength index(RSI) backtesting

type RecurringBuyOrder

type RecurringBuyOrder struct {
	AlgoClOrdID        string       `json:"algoClOrdId"`
	AlgoID             string       `json:"algoId"`
	AlgoOrderType      string       `json:"algoOrdType"`
	Amount             types.Number `json:"amt"`
	CreationTime       types.Time   `json:"cTime"`
	Cycles             string       `json:"cycles"`
	InstrumentType     string       `json:"instType"`
	InvestmentAmount   types.Number `json:"investmentAmt"`
	InvestmentCurrency string       `json:"investmentCcy"`
	MarketCap          string       `json:"mktCap"`
	NextInvestTime     types.Time   `json:"nextInvestTime"`
	PushTime           types.Time   `json:"pTime"`
	Period             string       `json:"period"`
	ProfitAndLossRatio types.Number `json:"pnlRatio"`
	RecurringDay       string       `json:"recurringDay"`
	RecurringHour      string       `json:"recurringHour"`
	RecurringList      []struct {
		AveragePrice types.Number `json:"avgPx"`
		Currency     string       `json:"ccy"`
		Profit       string       `json:"profit"`
		Price        types.Number `json:"px"`
		Ratio        types.Number `json:"ratio"`
		TotalAmount  types.Number `json:"totalAmt"`
	} `json:"recurringList"`
	RecurringTime string     `json:"recurringTime"`
	State         string     `json:"state"`
	StrategyName  string     `json:"stgyName"`
	Tag           string     `json:"tag"`
	TimeZone      string     `json:"timeZone"`
	TotalAnnRate  string     `json:"totalAnnRate"`
	TotalPnl      string     `json:"totalPnl"`
	UpdateTime    types.Time `json:"uTime"`
}

RecurringBuyOrder represents a recurring buy order instance

type RecurringBuySubOrder

type RecurringBuySubOrder struct {
	AccFillSize     types.Number `json:"accFillSz"`
	AlgoClientOrdID string       `json:"algoClOrdId"`
	AlgoID          string       `json:"algoId"`
	AlgoOrderType   string       `json:"algoOrdType"`
	AveragePrice    types.Number `json:"avgPx"`
	CreationTime    types.Time   `json:"cTime"`
	Fee             types.Number `json:"fee"`
	FeeCurrency     string       `json:"feeCcy"`
	InstrumentID    string       `json:"instId"`
	InstrumentType  string       `json:"instType"`
	OrderID         string       `json:"ordId"`
	OrderType       string       `json:"ordType"`
	Price           types.Number `json:"px"`
	Side            string       `json:"side"`
	State           string       `json:"state"`
	Size            types.Number `json:"sz"`
	Tag             string       `json:"tag"`
	TradeMode       string       `json:"tdMode"`
	UpdateTime      types.Time   `json:"uTime"`
}

RecurringBuySubOrder holds recurring buy sub order detail

type RecurringListItem

type RecurringListItem struct {
	Currency currency.Code `json:"ccy"`
	Ratio    float64       `json:"ratio,string"`
}

RecurringListItem holds recurring list item

type RecurringListItemDetailed

type RecurringListItemDetailed struct {
	AveragePrice types.Number `json:"avgPx"`
	Currency     string       `json:"ccy"`
	Profit       types.Number `json:"profit"`
	Price        types.Number `json:"px"`
	Ratio        types.Number `json:"ratio"`
	TotalAmount  types.Number `json:"totalAmt"`
}

RecurringListItemDetailed holds a detailed instance of recurring list item

type RecurringOrderDeail

type RecurringOrderDeail struct {
	RecurringListItem
	RecurringList []RecurringListItemDetailed `json:"recurringList"`
}

RecurringOrderDeail holds detailed information about recurring order

type RecurringOrderItem

type RecurringOrderItem struct {
	AlgoClOrdID        string              `json:"algoClOrdId"`
	AlgoID             string              `json:"algoId"`
	AlgoOrdType        string              `json:"algoOrdType"`
	Amount             types.Number        `json:"amt"`
	CreationTime       types.Time          `json:"cTime"`
	Cycles             string              `json:"cycles"`
	InstrumentType     string              `json:"instType"`
	InvestmentAmount   types.Number        `json:"investmentAmt"`
	InvestmentCurrency string              `json:"investmentCcy"`
	MarketCap          string              `json:"mktCap"`
	Period             string              `json:"period"`
	ProfitAndLossRatio types.Number        `json:"pnlRatio"`
	RecurringDay       string              `json:"recurringDay"`
	RecurringList      []RecurringListItem `json:"recurringList"`
	RecurringTime      string              `json:"recurringTime"`
	State              string              `json:"state"`
	StgyName           string              `json:"stgyName"`
	Tag                string              `json:"tag"`
	TimeZone           string              `json:"timeZone"`
	TotalAnnRate       types.Number        `json:"totalAnnRate"`
	TotalPnl           types.Number        `json:"totalPnl"`
	UpdateTime         types.Time          `json:"uTime"`
}

RecurringOrderItem holds recurring order info

type RecurringOrderResponse

type RecurringOrderResponse struct {
	AlgoID            string `json:"algoId"`
	AlgoClientOrderID string `json:"algoClOrdId"`
	StatusCode        string `json:"sCode"`
	StatusMessage     string `json:"sMsg"`
}

RecurringOrderResponse holds recurring order response

type RedeemRequestParam

type RedeemRequestParam struct {
	OrderID          string `json:"ordId"`
	ProtocolType     string `json:"protocolType"`
	AllowEarlyRedeem bool   `json:"allowEarlyRedeem"`
}

RedeemRequestParam represents redeem request input param

type ReduceLiabilities

type ReduceLiabilities struct {
	OrderID      string `json:"ordId"`
	PendingRepay bool   `json:"pendingRepay"`
}

ReduceLiabilities represents a response after reducing liabilities

type ResponseSuccess

type ResponseSuccess struct {
	Result bool `json:"result"`

	StatusCode    string `json:"sCode,omitempty"`
	StatusMessage string `json:"sMsg,omitempty"`
}

ResponseSuccess holds responses having a status result value

type RiskOffsetAmount

type RiskOffsetAmount struct {
	Currency              string       `json:"ccy"`
	ClientSpotInUseAmount types.Number `json:"clSpotInUseAmt"`
}

RiskOffsetAmount represents risk offset amount

type RiskOffsetType

type RiskOffsetType struct {
	Type string `json:"type"`
}

RiskOffsetType represents risk offset type value

type SavingBalanceResponse

type SavingBalanceResponse struct {
	Currency      string       `json:"ccy"`
	Earnings      types.Number `json:"earnings"`
	RedemptAmount types.Number `json:"redemptAmt"`
	Rate          types.Number `json:"rate"`
	Amount        types.Number `json:"amt"`
	LoanAmount    types.Number `json:"loanAmt"`
	PendingAmount types.Number `json:"pendingAmt"`
}

SavingBalanceResponse holds the response data for a savings balance.

type SavingsPurchaseRedemptionInput

type SavingsPurchaseRedemptionInput struct {
	Currency   currency.Code `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 method

type SavingsPurchaseRedemptionResponse

type SavingsPurchaseRedemptionResponse struct {
	Currency   string       `json:"ccy"`
	ActionType string       `json:"side"`
	Account    string       `json:"acct"` // '6': Funding account '18': Trading account
	Amount     types.Number `json:"amt"`
	Rate       types.Number `json:"rate"`
}

SavingsPurchaseRedemptionResponse formats the JSON response for the SavingPurchase or SavingRedemption POST methods

type ServerTime

type ServerTime struct {
	Timestamp types.Time `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     currency.Code `json:"ccy,omitempty"`    // Optional:
	PositionSide string        `json:"posSide,omitempty"`

	AssetType asset.Item `json:"-"`
}

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 SetLeveragesParam

type SetLeveragesParam struct {
	MarginMode   string `json:"mgnMode"`
	Leverage     int64  `json:"lever,string"`
	InstrumentID string `json:"instId,omitempty"` // Instrument ID. If there are multiple instruments, separate them with commas. Maximum of 200 instruments can be selected
}

SetLeveragesParam sets leverage parameter

type SetMultipleLeverageResponse

type SetMultipleLeverageResponse struct {
	FailInstrumentID string `json:"failInstId"`
	Result           string `json:"result"`
	SuccInstrumentID string `json:"succInstId"`
}

SetMultipleLeverageResponse represents multiple 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 SignalBotEventHistory

type SignalBotEventHistory struct {
	AlertMsg            time.Time  `json:"alertMsg"`
	AlgoID              string     `json:"algoId"`
	EventCreationTime   types.Time `json:"eventCtime"`
	EventProcessMessage string     `json:"eventProcessMsg"`
	EventStatus         string     `json:"eventStatus"`
	EventUtime          types.Time `json:"eventUtime"`
	EventType           string     `json:"eventType"`
	TriggeredOrdData    []struct {
		ClientOrderID string `json:"clOrdId"`
	} `json:"triggeredOrdData"`
}

SignalBotEventHistory holds history information for signal bot

type SignalBotOrderDetail

type SignalBotOrderDetail struct {
	AlgoID               string       `json:"algoId"`
	ClientSuppliedAlgoID string       `json:"algoClOrdId"`
	AlgoOrderType        string       `json:"algoOrdType"`
	InstrumentType       string       `json:"instType"`
	InstrumentIDs        []string     `json:"instIds"`
	CreationTime         types.Time   `json:"cTime"`
	UpdateTime           types.Time   `json:"uTime"`
	State                string       `json:"state"`
	CancelType           string       `json:"cancelType"`
	TotalPNL             types.Number `json:"totalPnl"`
	ProfitAndLossRatio   types.Number `json:"pnlRatio"`
	TotalEq              types.Number `json:"totalEq"`
	FloatPNL             types.Number `json:"floatPnl"`
	FrozenBalance        types.Number `json:"frozenBal"`
	AvailableBalance     types.Number `json:"availBal"`
	Lever                types.Number `json:"lever"`
	InvestAmount         types.Number `json:"investAmt"`
	SubOrdType           string       `json:"subOrdType"`
	Ratio                types.Number `json:"ratio"`
	EntrySettingParam    struct {
		AllowMultipleEntry bool         `json:"allowMultipleEntry"`
		Amount             types.Number `json:"amt"`
		EntryType          string       `json:"entryType"`
		Ratio              types.Number `json:"ratio"`
	} `json:"entrySettingParam"`
	ExitSettingParam struct {
		StopLossPercentage   types.Number `json:"slPct"`
		TakeProfitPercentage types.Number `json:"tpPct"`
		TakeProfitSlType     string       `json:"tpSlType"`
	} `json:"exitSettingParam"`
	SignalChanID     string `json:"signalChanId"`
	SignalChanName   string `json:"signalChanName"`
	SignalSourceType string `json:"signalSourceType"`

	TotalPnlRatio types.Number `json:"totalPnlRatio"`
	RealizedPnl   types.Number `json:"realizedPnl"`
}

SignalBotOrderDetail holds detail of signal bot order

type SignalBotPosition

type SignalBotPosition struct {
	AutoDecreaseLine             string       `json:"adl"`
	AlgoClientOrderID            string       `json:"algoClOrdId"`
	AlgoID                       string       `json:"algoId"`
	AveragePrice                 types.Number `json:"avgPx"`
	CreationTime                 types.Time   `json:"cTime"`
	Currency                     string       `json:"ccy"`
	InitialMarginRequirement     string       `json:"imr"`
	InstrumentID                 string       `json:"instId"`
	InstrumentType               string       `json:"instType"`
	Last                         types.Number `json:"last"`
	Lever                        types.Number `json:"lever"`
	LiquidationPrice             types.Number `json:"liqPx"`
	MarkPrice                    types.Number `json:"markPx"`
	MarginMode                   string       `json:"mgnMode"`
	MgnRatio                     types.Number `json:"mgnRatio"` // Margin mode 'cross' 'isolated'
	MaintenanceMarginRequirement string       `json:"mmr"`
	NotionalUSD                  string       `json:"notionalUsd"`
	Position                     string       `json:"pos"`
	PositionSide                 string       `json:"posSide"` // Position side 'net'
	UpdateTime                   types.Time   `json:"uTime"`
	UnrealizedProfitAndLoss      string       `json:"upl"`
	UplRatio                     types.Number `json:"uplRatio"` // Unrealized profit and loss ratio
}

SignalBotPosition holds signal bot position information

type SimulatedAsset

type SimulatedAsset struct {
	Currency string       `json:"ccy"`
	Amount   types.Number `json:"amt"`
}

SimulatedAsset represents a simulated asset detail

type SimulatedPosition

type SimulatedPosition struct {
	Position     string `json:"pos"`
	InstrumentID string `json:"instId"`
}

SimulatedPosition represents a simulated position detail of a new position builder

type SmallAssetConvertResponse

type SmallAssetConvertResponse struct {
	Details []struct {
		Amount        types.Number `json:"amt"`    // Quantity of currency assets before conversion
		Currency      string       `json:"ccy"`    //
		ConvertAmount types.Number `json:"cnvAmt"` // Quantity of OKB after conversion
		ConversionFee types.Number `json:"fee"`    // Fee for conversion, unit in OKB
	} `json:"details"`
	TotalConvertAmount types.Number `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  types.Number `json:"annualizedRate"`
	ArbitrageNumber types.Number `json:"arbitrageNum"`
	BaseSize        types.Number `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          types.Number `json:"curBaseSz"`
	CurQuoteSize         types.Number `json:"curQuoteSz"`
	FloatProfit          types.Number `json:"floatProfit"`
	GridNumber           string       `json:"gridNum"`
	GridProfit           types.Number `json:"gridProfit"`
	InstrumentID         string       `json:"instId"`
	InstrumentType       string       `json:"instType"`
	Investment           types.Number `json:"investment"`
	MaximumPrice         types.Number `json:"maxPx"`
	MinimumPrice         types.Number `json:"minPx"`
	PerMaximumProfitRate types.Number `json:"perMaxProfitRate"`
	PerMinimumProfitRate types.Number `json:"perMinProfitRate"`
	ProfitAndLossRatio   types.Number `json:"pnlRatio"`
	QuoteSize            types.Number `json:"quoteSz"`
	RunPrice             types.Number `json:"runPx"`
	RunType              string       `json:"runType"`
	SingleAmount         types.Number `json:"singleAmt"`
	StopLossTriggerPrice types.Number `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    types.Number `json:"totalAnnualizedRate"`
	TotalProfitAndLoss     types.Number `json:"totalPnl"`
	TakeProfitTriggerPrice types.Number `json:"tpTriggerPx"`
	TradeNum               types.Number `json:"tradeNum"`
	TriggerTime            types.Time   `json:"triggerTime"`
	CreationTime           types.Time   `json:"cTime"`
	PushTime               types.Time   `json:"pTime"`
	UpdateTime             types.Time   `json:"uTime"`
}

SpotGridAlgoData represents spot grid algo orders

type SpreadInstrument

type SpreadInstrument struct {
	SpreadID      string       `json:"sprdId"`
	SpreadType    string       `json:"sprdType"`
	State         string       `json:"state"`
	BaseCurrency  string       `json:"baseCcy"`
	SizeCurrency  string       `json:"szCcy"`
	QuoteCurrency string       `json:"quoteCcy"`
	TickSize      types.Number `json:"tickSz"`
	MinSize       types.Number `json:"minSz"`
	LotSize       types.Number `json:"lotSz"`
	ListTime      types.Time   `json:"listTime"`
	Legs          []struct {
		InstrumentID string `json:"instId"`
		Side         string `json:"side"`
	} `json:"legs"`
	ExpTime    types.Time `json:"expTime"`
	UpdateTime types.Time `json:"uTime"`
}

SpreadInstrument retrieve all available spreads based on the request parameters

type SpreadOrder

type SpreadOrder struct {
	TradeID           string       `json:"tradeId"`
	InstrumentID      string       `json:"instId"`
	OrderID           string       `json:"ordId"`
	SpreadID          string       `json:"sprdId"`
	ClientOrderID     string       `json:"clOrdId"`
	Tag               string       `json:"tag"`
	Price             types.Number `json:"px"`
	Size              types.Number `json:"sz"`
	OrderType         string       `json:"ordType"`
	Side              string       `json:"side"`
	FillSize          types.Number `json:"fillSz"`
	FillPrice         types.Number `json:"fillPx"`
	AccFillSize       types.Number `json:"accFillSz"`
	PendingFillSize   types.Number `json:"pendingFillSz"`
	PendingSettleSize types.Number `json:"pendingSettleSz"`
	CanceledSize      types.Number `json:"canceledSz"`
	State             string       `json:"state"`
	AveragePrice      types.Number `json:"avgPx"`
	CancelSource      string       `json:"cancelSource"`
	UpdateTime        types.Time   `json:"uTime"`
	CreationTime      types.Time   `json:"cTime"`
}

SpreadOrder holds spread order details

type SpreadOrderCancellationResponse

type SpreadOrderCancellationResponse struct {
	TriggerTime types.Time `json:"triggerTime"`
	Timestamp   types.Time `json:"ts"`
}

SpreadOrderCancellationResponse represents a spread order cancellation response

type SpreadOrderInfo

type SpreadOrderInfo struct {
	ClientOrderID string `json:"clOrdId"`
	OrderID       string `json:"ordId"`
	Tag           string `json:"tag"`
	StatusCode    string `json:"sCode"`
	StatusMessage string `json:"sMsg"`
}

SpreadOrderInfo holds spread order response information

type SpreadOrderParam

type SpreadOrderParam struct {
	InstrumentID  string  `json:"instId"`
	SpreadID      string  `json:"sprdId,omitempty"`
	ClientOrderID string  `json:"clOrdId,omitempty"`
	Side          string  `json:"side"`    // Order side, buy sell
	OrderType     string  `json:"ordType"` // Order type  'limit': Limit order  'post_only': Post-only order 'ioc': Immediate-or-cancel order
	Size          float64 `json:"sz,string"`
	Price         float64 `json:"px,string"`
	Tag           string  `json:"tag,omitempty"`
}

SpreadOrderParam holds parameters for spread orders

type SpreadOrderResponse

type SpreadOrderResponse struct {
	StatusCode    string `json:"sCode"`
	StatusMessage string `json:"sMsg"`
	ClientOrderID string `json:"clOrdId"`
	OrderID       string `json:"ordId"`
	Tag           string `json:"tag"`

	// Added when amending spread order through websocket
	RequestID string `json:"reqId"`
}

SpreadOrderResponse represents a spread create order response

type SpreadOrderbook

type SpreadOrderbook struct {
	// Asks and Bids are [3]string; price, quantity, and # number of orders at the price
	Asks      [][]types.Number `json:"asks"`
	Bids      [][]types.Number `json:"bids"`
	Timestamp types.Time       `json:"ts"`
}

SpreadOrderbook holds spread orderbook information

type SpreadPublicTradeItem

type SpreadPublicTradeItem struct {
	SprdID    string       `json:"sprdId"`
	Side      string       `json:"side"`
	Size      types.Number `json:"sz"`
	Price     types.Number `json:"px"`
	TradeID   string       `json:"tradeId"`
	Timestamp types.Time   `json:"ts"`
}

SpreadPublicTradeItem represents publicly available trade order instance

type SpreadTicker

type SpreadTicker struct {
	SpreadID  string       `json:"sprdId"`
	Last      types.Number `json:"last"`
	LastSize  types.Number `json:"lastSz"`
	AskPrice  types.Number `json:"askPx"`
	AskSize   types.Number `json:"askSz"`
	BidPrice  types.Number `json:"bidPx"`
	BidSize   types.Number `json:"bidSz"`
	Timestamp types.Time   `json:"ts"`
}

SpreadTicker represents a ticker instance

type SpreadTrade

type SpreadTrade struct {
	SpreadID      string       `json:"sprdId"`
	TradeID       string       `json:"tradeId"`
	OrderID       string       `json:"ordId"`
	ClientOrderID string       `json:"clOrdId"`
	Tag           string       `json:"tag"`
	FillPrice     types.Number `json:"fillPx"`
	FillSize      types.Number `json:"fillSz"`
	State         string       `json:"state"`
	Side          string       `json:"side"`
	ExecType      string       `json:"execType"`
	Timestamp     string       `json:"ts"`
	Legs          []struct {
		InstrumentID string       `json:"instId"`
		Price        types.Number `json:"px"`
		Size         types.Number `json:"sz"`
		Side         string       `json:"side"`
		Fee          types.Number `json:"fee"`
		FeeCurrency  string       `json:"feeCcy"`
		TradeID      string       `json:"tradeId"`
	} `json:"legs"`
	Code string `json:"code"`
	Msg  string `json:"msg"`
}

SpreadTrade holds spread trade transaction instance

type StopCopyingParameter

type StopCopyingParameter struct {
	InstrumentType       string `json:"instType,omitempty"`
	UniqueCode           string `json:"uniqueCode"`
	SubPositionCloseType string `json:"subPosCloseType"`
}

StopCopyingParameter holds stop copying request parameter

type StopGridAlgoOrderParam

type StopGridAlgoOrderParam struct {
	AlgoID        string `json:"algoId"`
	InstrumentID  string `json:"instId"`
	StopType      string `json:"stopType"`
	AlgoOrderType string `json:"algoOrdType"`
}

StopGridAlgoOrderParam holds stop grid algo order parameter

type StopGridAlgoOrderRequest

type StopGridAlgoOrderRequest struct {
	AlgoID        string `json:"algoId"`
	InstrumentID  string `json:"instId"`
	StopType      uint64 `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 StopRecurringBuyOrder

type StopRecurringBuyOrder struct {
	AlgoID string `json:"algoId"`
}

StopRecurringBuyOrder stop recurring order

type StrikeOpenInterestAndVolume

type StrikeOpenInterestAndVolume struct {
	Timestamp        types.Time
	Strike           types.Number
	CallOpenInterest types.Number
	PutOpenInterest  types.Number
	CallVolume       types.Number
	PutVolume        types.Number
}

StrikeOpenInterestAndVolume represents open interest and volume for both buyers and sellers of calls and puts

func (*StrikeOpenInterestAndVolume) UnmarshalJSON

func (s *StrikeOpenInterestAndVolume) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes slice of byte data into StrikeOpenInterestAndVolume

type SubAccounBorrowInterestAndLimit

type SubAccounBorrowInterestAndLimit struct {
	SubAcct          string       `json:"subAcct"`
	Debt             types.Number `json:"debt"`
	Interest         types.Number `json:"interest"`
	NextDiscountTime types.Time   `json:"nextDiscountTime"`
	NextInterestTime types.Time   `json:"nextInterestTime"`
	LoanAlloc        types.Number `json:"loanAlloc"`
	Records          []struct {
		AvailLoan         types.Number `json:"availLoan"`
		Currency          string       `json:"ccy"`
		Interest          types.Number `json:"interest"`
		LoanQuota         types.Number `json:"loanQuota"`
		PosLoan           string       `json:"posLoan"`
		Rate              types.Number `json:"rate"`
		SurplusLmt        string       `json:"surplusLmt"`
		SurplusLmtDetails struct {
			AllAcctRemainingQuota types.Number `json:"allAcctRemainingQuota"`
			CurAcctRemainingQuota types.Number `json:"curAcctRemainingQuota"`
			PlatRemainingQuota    types.Number `json:"platRemainingQuota"`
		} `json:"surplusLmtDetails"`
		UsedLmt  types.Number `json:"usedLmt"`
		UsedLoan types.Number `json:"usedLoan"`
	} `json:"records"`
}

SubAccounBorrowInterestAndLimit represents sub-account borrow interest and limit

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 {
	IP               string     `json:"ip"`
	SubAccountName   string     `json:"subAcct"`
	APIKey           string     `json:"apiKey"`
	Label            string     `json:"label"`
	APIKeyPermission string     `json:"perm"`
	Timestamp        types.Time `json:"ts"`
}

SubAccountAPIKeyResponse represents sub-account api key reset response

type SubAccountAssetTransferParams

type SubAccountAssetTransferParams struct {
	Currency         currency.Code `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 SubAccountLoanAllocationParam

type SubAccountLoanAllocationParam struct {
	Enable bool                              `json:"enable"`
	Alloc  []subAccountVIPLoanAllocationInfo `json:"alloc"`
}

SubAccountLoanAllocationParam holds parameter for VIP sub-account loan allocation

type SubAccountMaximumWithdrawal

type SubAccountMaximumWithdrawal struct {
	Currency          string       `json:"ccy"`
	MaxWd             types.Number `json:"maxWd"`
	MaxWdEx           types.Number `json:"maxWdEx"`
	SpotOffsetMaxWd   types.Number `json:"spotOffsetMaxWd"`
	SpotOffsetMaxWdEx types.Number `json:"spotOffsetMaxWdEx"`
}

SubAccountMaximumWithdrawal holds sub-account maximum withdrawal information

type SubAccountTransfer

type SubAccountTransfer struct {
	BillID     string       `json:"billId"`
	Type       string       `json:"type"`
	Currency   string       `json:"ccy"`
	SubAccount string       `json:"subAcct"`
	SubUID     string       `json:"subUid"`
	Amount     types.Number `json:"amt"`
	Timestamp  types.Time   `json:"ts"`
}

SubAccountTransfer holds sub-account transfer instance

type SubOrder

type SubOrder struct {
	AccountFillSize   types.Number `json:"accFillSz"`
	AlgoClientOrderID string       `json:"algoClOrdId"`
	AlgoID            string       `json:"algoId"`
	AlgoOrdType       string       `json:"algoOrdType"`
	AveragePrice      types.Number `json:"avgPx"`
	CreationTime      types.Time   `json:"cTime"`
	Currency          string       `json:"ccy"`
	ClientOrderID     string       `json:"clOrdId"`
	CtVal             string       `json:"ctVal"`
	Fee               types.Number `json:"fee"`
	FeeCurrency       string       `json:"feeCcy"`
	InstrumentID      string       `json:"instId"`
	InstrumentType    string       `json:"instType"`
	Leverage          types.Number `json:"lever"`
	OrderID           string       `json:"ordId"`
	OrderType         string       `json:"ordType"`
	ProfitAndLoss     types.Number `json:"pnl"`
	PositionSide      string       `json:"posSide"`
	Price             types.Number `json:"px"`
	Side              string       `json:"side"`
	State             string       `json:"state"`
	Size              types.Number `json:"sz"`
	Tag               string       `json:"tag"`
	TdMode            string       `json:"tdMode"`
	UpdateTime        types.Time   `json:"uTime"`
}

SubOrder holds signal bot sub orders

type SubTPSLParams

type SubTPSLParams struct {
	NewTakeProfitTriggerPrice     float64 `json:"newTpTriggerPx,omitempty,string"`
	NewTakeProfitOrderPrice       float64 `json:"newTpOrdPx,omitempty,string"`
	NewStopLossTriggerPrice       float64 `json:"newSlTriggerPx,omitempty,string"`
	NewStopLossOrderPrice         float64 `json:"newSlOrdPx,omitempty,string"`  // Stop-loss order price If the price is -1, stop-loss will be executed at the market price.
	NewTakeProfitTriggerPriceType string  `json:"newTpTriggerPxType,omitempty"` // Take-profit trigger price type'last': last price 'index': index price 'mark': mark price
	NewStopLossTriggerPriceType   string  `json:"newSlTriggerPxType,omitempty"` // Stop-loss trigger price type 'last': last price  'index': index price  'mark': mark price
}

SubTPSLParams represents take-profit and stop-loss price parameters to be used by algo orders

type SubaccountBalanceDetail

type SubaccountBalanceDetail struct {
	AvailableBalance               types.Number `json:"availBal"`
	AvailableEquity                types.Number `json:"availEq"`
	CashBalance                    types.Number `json:"cashBal"`
	Currency                       string       `json:"ccy"`
	CrossLiability                 types.Number `json:"crossLiab"`
	DiscountEquity                 types.Number `json:"disEq"`
	Equity                         types.Number `json:"eq"`
	EquityUSD                      types.Number `json:"eqUsd"`
	FrozenBalance                  types.Number `json:"frozenBal"`
	Interest                       types.Number `json:"interest"`
	IsoEquity                      string       `json:"isoEq"`
	IsolatedLiabilities            types.Number `json:"isoLiab"`
	LiabilitiesOfCurrency          string       `json:"liab"`
	MaxLoan                        types.Number `json:"maxLoan"`
	MarginRatio                    types.Number `json:"mgnRatio"`
	NotionalLeverage               string       `json:"notionalLever"`
	OrdFrozen                      string       `json:"ordFrozen"`
	Twap                           string       `json:"twap"`
	UpdateTime                     types.Time   `json:"uTime"`
	UnrealizedProfitAndLoss        types.Number `json:"upl"`
	UnrealizedProfitAndLiabilities string       `json:"uplLiab"`
	FixedBalance                   types.Number `json:"fixedBal"`
	BorrowFroz                     types.Number `json:"borrowFroz"`
	SpotISOBalance                 types.Number `json:"spotIsoBal"`
	SMTSyncEquity                  types.Number `json:"smtSyncEq"`
}

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                  types.Number              `json:"mgnRatio"`
	MaintenanceMarginRequirement types.Number              `json:"mmr"`
	NotionalUSD                  types.Number              `json:"notionalUsd"`
	OrdFroz                      types.Number              `json:"ordFroz"`
	TotalEq                      types.Number              `json:"totalEq"`
	UpdateTime                   types.Time                `json:"uTime"`
	BorrowFroz                   types.Number              `json:"borrowFroz"`
	UPL                          types.Number              `json:"upl"`
}

SubaccountBalanceResponse represents subaccount balance response

type SubaccountBillItem

type SubaccountBillItem struct {
	BillID                 string       `json:"billId"`
	Type                   string       `json:"type"`
	AccountCurrencyBalance string       `json:"ccy"`
	Amount                 types.Number `json:"amt"`
	SubAccount             string       `json:"subAcct"`
	Timestamp              types.Time   `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       types.Time `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,omitempty"`
	InstrumentID     string `json:"instId,omitempty"`
	InstrumentFamily string `json:"instFamily,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"`
	SpreadID string `json:"sprdId,omitempty"`
}

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 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 SurplusLimitDetail

type SurplusLimitDetail struct {
	AllAcctRemainingQuota string `json:"allAcctRemainingQuota"`
	CurAcctRemainingQuota string `json:"curAcctRemainingQuota"`
	PlatRemainingQuota    string `json:"platRemainingQuota"`
}

SurplusLimitDetail represents details of available amount across all sub-accounts. The value of surplusLmt is the minimum value within this array

type SystemStatusResponse

type SystemStatusResponse struct {
	Title               string     `json:"title"`
	State               string     `json:"state"`
	Begin               types.Time `json:"begin"` // Begin time of system maintenance,
	End                 types.Time `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"`
	PreOpenBegin        string     `json:"preOpenBegin"`
	MaintenanceType     string     `json:"maintType"`
	Environment         string     `json:"env"` // Environment '1': Production Trading '2': Demo Trading

	// PushTime timestamp information when the data is pushed
	PushTime types.Time `json:"ts"`
}

SystemStatusResponse represents the system status and other details

type TPSLOrderParam

type TPSLOrderParam struct {
	InstrumentType         string  `json:"instType"`
	SubPositionID          string  `json:"subPosId"`
	TakeProfitTriggerPrice float64 `json:"tpTriggerPx,omitempty,string"`
	StopLossTriggerPrice   float64 `json:"slTriggerPx,omitempty,string"`

	TakeProfitOrderPrice float64 `json:"tpOrdPx,omitempty,string"`
	StopLossOrderPrice   float64 `json:"slOrdPx,omitempty,string"`

	TakePofitTriggerPriceType string `json:"tpTriggerPriceType,omitempty,string"` // last: last price, 'index': index price 'mark': mark price Default is 'last'
	StopLossTriggerPriceType  string `jsonL:"slTriggerPxType,omitempty,string"`   // Stop-loss trigger price type 'last': last price 'index': index price 'mark': mark price Default is 'last'
	SubPositionType           string `json:"subPosType,omitempty,string"`         // 'lead': lead trading, the default value 'copy': copy trading
	Tag                       string `json:"tag,omitempty,string"`
}

TPSLOrderParam holds Take profit and stop loss order parameters

type TakerVolume

type TakerVolume struct {
	Timestamp  types.Time
	SellVolume types.Number
	BuyVolume  types.Number
}

TakerVolume represents taker volume information with creation timestamp

func (*TakerVolume) UnmarshalJSON

func (t *TakerVolume) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a slice of data into TakerVolume

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 types.Time `json:"ts"`
}

TickerResponse represents the detailed data from the market ticker endpoint.

type TopTraderContractsLongShortRatio

type TopTraderContractsLongShortRatio struct {
	Timestamp types.Time
	Ratio     types.Number
}

TopTraderContractsLongShortRatio represents the timestamp and ratio information of top traders long and short accounts/positions

func (*TopTraderContractsLongShortRatio) UnmarshalJSON

func (t *TopTraderContractsLongShortRatio) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes slice data into TopTraderContractsLongShortRatio instance

type TotalProfitSharing

type TotalProfitSharing struct {
	Currency                 string       `json:"ccy"`
	InstrumentType           string       `json:"instType"`
	TotalProfitSharingAmount types.Number `json:"totalProfitSharingAmt"`
}

TotalProfitSharing holds information about total amount of profit shared since joining the platform

type TradeFeeRate

type TradeFeeRate struct {
	Category         string         `json:"category"`
	DeliveryFeeRate  types.Number   `json:"delivery"`
	Exercise         string         `json:"exercise"`
	InstrumentType   asset.Item     `json:"instType"`
	FeeRateLevel     string         `json:"level"`
	FeeRateMaker     types.Number   `json:"maker"`
	FeeRateTaker     types.Number   `json:"taker"`
	Timestamp        types.Time     `json:"ts"`
	FeeRateMakerUSDT types.Number   `json:"makerU"`
	FeeRateTakerUSDT types.Number   `json:"takerU"`
	FeeRateMakerUSDC types.Number   `json:"makerUSDC"`
	FeeRateTakerUSDC types.Number   `json:"takerUSDC"`
	RuleType         string         `json:"ruleType"`
	Fiat             []FiatItemInfo `json:"fiat"`
}

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    types.Time   `json:"ts"`
	Count        string       `json:"count"`
}

TradeResponse represents the recent transaction instance

type TraderWeeklyProfitAndLoss

type TraderWeeklyProfitAndLoss struct {
	BeginTimestamp     types.Time   `json:"beginTs"`
	ProfitAndLoss      types.Number `json:"pnl"`
	ProfitAndLossRatio types.Number `json:"pnlRatio"`
}

TraderWeeklyProfitAndLoss represents lead trader weekly pnl

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          types.Time   `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"`
	TransactionType          string       `json:"subType"`
	BillID                   string       `json:"billId"`
	Tag                      string       `json:"tag"`
	FillPrice                types.Number `json:"fillPx"`
	FillSize                 types.Number `json:"fillSz"`
	FillIndexPrice           types.Number `json:"fillIdxPx"`
	FillProfitAndLoss        types.Number `json:"fillPnl"`
	FillPriceVolatility      types.Number `json:"fillPxVol"`
	FillPriceUSD             types.Number `json:"fillPxUsd"`
	MarkVolatilityWhenFilled types.Number `json:"fillMarkVol"`
	ForwardPriceWhenFilled   types.Number `json:"fillFwdPx"`
	MarkPriceWhenFilled      types.Number `json:"fillMarkPx"`
	Side                     order.Side   `json:"side"`
	PositionSide             string       `json:"posSide"`
	ExecType                 string       `json:"execType"`
	FeeCurrency              string       `json:"feeCcy"`
	Fee                      types.Number `json:"fee"`
	FillTime                 types.Time   `json:"fillTime"`
	Timestamp                types.Time   `json:"ts"`
}

TransactionDetail holds recently-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"`
	SubType        string    `json:"subType,omitempty"`
	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           types.Number `json:"type"`
}

TransferFundRateResponse represents funding transfer rate response

type TransferIDInfo

type TransferIDInfo struct {
	TransferID string `json:"transId"`
}

TransferIDInfo represents master account transfer between subaccount

type TriggeredGridAlgoOrderInfo

type TriggeredGridAlgoOrderInfo struct {
	AlgoClientOrderID string `json:"algoClOrdId"`
	AlgoID            string `json:"algoId"`
}

TriggeredGridAlgoOrderInfo holds grid algo order info

type UnitConvertResponse

type UnitConvertResponse struct {
	InstrumentID string       `json:"instId"`
	Price        types.Number `json:"px"`
	Size         types.Number `json:"sz"`
	ConvertType  types.Number `json:"type"`
	Unit         string       `json:"unit"`
}

UnitConvertResponse unit convert response

type UsdCnyExchangeRate

type UsdCnyExchangeRate struct {
	UsdCny types.Number `json:"usdCny"`
}

UsdCnyExchangeRate the exchange rate for converting from USD to CNV

type VIPInterestData

type VIPInterestData struct {
	OrderID      string       `json:"ordId"`
	Currency     string       `json:"ccy"`
	Interest     types.Number `json:"interest"`
	InterestRate types.Number `json:"interestRate"`
	Liability    types.Number `json:"liab"`
	Timestamp    types.Time   `json:"ts"`
}

VIPInterestData holds interest accrued/deducted data

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 VIPLoanOrder

type VIPLoanOrder struct {
	OrderID         string       `json:"ordId"`
	Currency        string       `json:"ccy"`
	State           string       `json:"state"`
	BorrowAmount    types.Number `json:"borrowAmt"`
	CurrentRate     types.Number `json:"curRate"`
	DueAmount       types.Number `json:"dueAmt"`
	NextRefreshTime types.Time   `json:"nextRefreshTime"`
	OriginalRate    types.Number `json:"origRate"`
	RepayAmount     types.Number `json:"repayAmt"`
	Timestamp       types.Time   `json:"ts"`
}

VIPLoanOrder holds VIP loan items

type VIPLoanOrderDetail

type VIPLoanOrderDetail struct {
	Amount     types.Number `json:"amt"`
	Currency   string       `json:"ccy"`
	FailReason string       `json:"failReason"`
	Rate       types.Number `json:"rate"`
	Timestamp  types.Time   `json:"ts"`
	Type       string       `json:"type"` // Operation Type: 1:Borrow 2:Repayment 3:System Repayment 4:Interest Rate Refresh
}

VIPLoanOrderDetail holds vip loan order detail

type WSInstrumentResponse

type WSInstrumentResponse struct {
	Argument SubscriptionInfo `json:"arg"`
	Data     []Instrument     `json:"data"`
}

WSInstrumentResponse represents websocket instruments push message

type WSOpenInterestResponse

type WSOpenInterestResponse struct {
	Argument SubscriptionInfo `json:"arg"`
	Data     []OpenInterest   `json:"data"`
}

WSOpenInterestResponse represents an open interest instance

type WSSubscriptionInformationList

type WSSubscriptionInformationList struct {
	Operation string             `json:"op"`
	Arguments []SubscriptionInfo `json:"args"`
}

WSSubscriptionInformationList websocket subscription and unsubscription operation inputs

type WSTickerResponse

type WSTickerResponse struct {
	Argument SubscriptionInfo `json:"arg"`
	Data     []TickerResponse `json:"data"`
}

WSTickerResponse represents websocket ticker response

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  int64  `json:"timestamp,string"`
	Sign       string `json:"sign"`
}

WebsocketLoginData represents the websocket login data input json data

type WithdrawalHistoryResponse

type WithdrawalHistoryResponse struct {
	Currency             string       `json:"ccy"`
	ChainName            string       `json:"chain"`
	NonTradableAsset     bool         `json:"nonTradableAsset"`
	Amount               types.Number `json:"amt"`
	Timestamp            types.Time   `json:"ts"`
	FromRemittingAddress string       `json:"from"`
	ToReceivingAddress   string       `json:"to"`
	AreaCodeFrom         string       `json:"areaCodeFrom"`
	AreaCodeTo           string       `json:"areaCodeTo"`
	Tag                  string       `json:"tag"`
	WithdrawalFee        types.Number `json:"fee"`
	FeeCurrency          string       `json:"feeCcy"`
	Memo                 string       `json:"memo"`
	AddrEx               string       `json:"addrEx"`
	ClientID             string       `json:"clientId"`
	TransactionID        string       `json:"txId"` // Hash record of the withdrawal. This parameter will not be returned for internal transfers.
	StateOfWithdrawal    string       `json:"state"`
	WithdrawalID         string       `json:"wdId"`
	PaymentID            string       `json:"pmtId"`
}

WithdrawalHistoryResponse represents the withdrawal response history

type WithdrawalInput

type WithdrawalInput struct {
	Currency              currency.Code                   `json:"ccy"`
	Amount                float64                         `json:"amt,string"`
	TransactionFee        float64                         `json:"fee,string"`
	WithdrawalDestination string                          `json:"dest"`
	ChainName             string                          `json:"chain"`
	ToAddress             string                          `json:"toAddr"`
	ClientID              string                          `json:"clientId"`
	AreaCode              string                          `json:"areaCode,omitempty"`
	RecipientInformation  *WithdrawalRecipientInformation `json:"rcvrInfo,omitempty"`
}

WithdrawalInput represents request parameters for cryptocurrency withdrawal

type WithdrawalRecipientInformation

type WithdrawalRecipientInformation struct {
	WalletType                 string `json:"walletType,omitempty"`
	ExchangeID                 string `json:"exchId,omitempty"`
	ReceiverFirstName          string `json:"rcvrFirstName,omitempty"`
	ReceiverLastName           string `json:"rcvrLastName,omitempty"`
	ReceiverCountry            string `json:"rcvrCountry,omitempty"`
	ReceiverCountrySubDivision string `json:"rcvrCountrySubDivision,omitempty"`
	ReceiverTownName           string `json:"rcvrTownName,omitempty"`
	ReceiverStreetName         string `json:"rcvrStreetName,omitempty"`
}

WithdrawalRecipientInformation represents a recipient information for 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            types.Number `json:"actualPx"`
	ActualSide             string       `json:"actualSide"`
	ActualSize             types.Number `json:"actualSz"`
	AlgoID                 string       `json:"algoId"`
	Currency               string       `json:"ccy"`
	Count                  string       `json:"count"`
	InstrumentID           string       `json:"instId"`
	InstrumentType         string       `json:"instType"`
	Leverage               types.Number `json:"lever"`
	NotionalUSD            types.Number `json:"notionalUsd"`
	OrderPrice             types.Number `json:"ordPx"`
	OrdType                string       `json:"ordType"`
	PositionSide           string       `json:"posSide"`
	PriceLimit             types.Number `json:"pxLimit"`
	PriceSpread            types.Number `json:"pxSpread"`
	PriceVariation         string       `json:"pxVar"`
	Side                   order.Side   `json:"side"`
	StopLossOrderPrice     types.Number `json:"slOrdPx"`
	StopLossTriggerPrice   types.Number `json:"slTriggerPx"`
	State                  string       `json:"state"`
	Size                   types.Number `json:"sz"`
	SizeLimit              types.Number `json:"szLimit"`
	TradeMode              string       `json:"tdMode"`
	TimeInterval           string       `json:"timeInterval"`
	TakeProfitOrderPrice   types.Number `json:"tpOrdPx"`
	TakeProfitTriggerPrice types.Number `json:"tpTriggerPx"`
	Tag                    string       `json:"tag"`
	TriggerPrice           types.Number `json:"triggerPx"`
	CallbackRatio          types.Number `json:"callbackRatio"`
	CallbackSpread         string       `json:"callbackSpread"`
	ActivePrice            types.Number `json:"activePx"`
	MoveTriggerPrice       types.Number `json:"moveTriggerPx"`
	CreationTime           types.Time   `json:"cTime"`
	PushTime               types.Time   `json:"pTime"`
	TriggerTime            types.Time   `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                      types.Number `json:"px"`
	Size                       types.Number `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     types.Number `json:"tpTriggerPx"`
	TakeProfitTriggerPriceType string       `json:"tpTriggerPxType"`
	TakeProfitOrdPrice         types.Number `json:"tpOrdPx"`
	StopLossTriggerPrice       types.Number `json:"slTriggerPx"`
	StopLossTriggerPriceType   string       `json:"slTriggerPxType"`
	TriggerPrice               types.Number `json:"triggerPx"`
	TriggerPriceType           string       `json:"triggerPxType"`
	OrderPrice                 types.Number `json:"ordPx"`
	ActualSize                 types.Number `json:"actualSz"`
	ActualPrice                types.Number `json:"actualPx"`
	Tag                        string       `json:"tag"`
	ActualSide                 string       `json:"actualSide"`
	TriggerTime                types.Time   `json:"triggerTime"`
	CreationTime               types.Time   `json:"cTime"`
}

WsAlgoOrderDetail algo order response pushed through the websocket conn

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    types.Time `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 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 WsDepositInfo

type WsDepositInfo struct {
	ActualDepBulkConfirm string       `json:"actualDepBlkConfirm"`
	Amount               types.Number `json:"amt"`
	AreaCodeFrom         string       `json:"areaCodeFrom"`
	Currency             string       `json:"ccy"`
	Chain                string       `json:"chain"`
	DepositID            string       `json:"depId"`
	From                 string       `json:"from"`
	FromWdID             string       `json:"fromWdId"` // Internal transfer initiator's withdrawal ID
	PushTime             types.Time   `json:"pTime"`
	State                string       `json:"state"`
	SubAccount           string       `json:"subAcct"`
	To                   string       `json:"to"`
	Timestamp            types.Time   `json:"ts"`
	TransactionID        string       `json:"txId"`
	UID                  string       `json:"uid"`
}

WsDepositInfo represents a deposit information

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 types.Time `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 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 WsOperationInput

type WsOperationInput struct {
	ID        string `json:"id"`
	Operation string `json:"op"`
	Arguments any    `json:"args"`
}

WsOperationInput for all websocket request inputs

type WsOptionSummary

type WsOptionSummary struct {
	Argument SubscriptionInfo           `json:"arg"`
	Data     []OptionMarketDataResponse `json:"data"`
}

WsOptionSummary represents option summary

type WsOptionTrades

type WsOptionTrades struct {
	Arg  SubscriptionInfo `json:"arg"`
	Data []PublicTrade    `json:"data"`
}

WsOptionTrades represents option trade data

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]types.Number `json:"asks"`
	Bids      [][4]types.Number `json:"bids"`
	Timestamp types.Time        `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 WsPlaceOrderResponse

type WsPlaceOrderResponse struct {
	OperationResponse
	Data []OrderData `json:"data"`
}

WsPlaceOrderResponse place order response thought the websocket connection

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     []PublicTradesResponse `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    types.Time `json:"validUntil"`
	UpdatedTime   types.Time `json:"uTime"`
	CreationTime  types.Time `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 WsSpreadOrder

type WsSpreadOrder struct {
	SpreadID          string       `json:"sprdId"`
	OrderID           string       `json:"ordId"`
	ClientOrderID     string       `json:"clOrdId"`
	Tag               string       `json:"tag"`
	Price             types.Number `json:"px"`
	Size              types.Number `json:"sz"`
	OrderType         string       `json:"ordType"`
	Side              string       `json:"side"`
	FillSize          types.Number `json:"fillSz"`
	FillPrice         types.Number `json:"fillPx"`
	TradeID           string       `json:"tradeId"`
	AccFillSize       types.Number `json:"accFillSz"`
	PendingFillSize   types.Number `json:"pendingFillSz"`
	PendingSettleSize types.Number `json:"pendingSettleSz"`
	CanceledSize      types.Number `json:"canceledSz"`
	State             string       `json:"state"`
	AveragePrice      types.Number `json:"avgPx"`
	CancelSource      string       `json:"cancelSource"`
	UpdateTime        types.Time   `json:"uTime"`
	CreationTime      types.Time   `json:"cTime"`
	Code              string       `json:"code"`
	Msg               string       `json:"msg"`
}

WsSpreadOrder represents spread order detail

type WsSpreadOrderTrade

type WsSpreadOrderTrade struct {
	Argument struct {
		Channel  string `json:"channel"`
		SpreadID string `json:"sprdId"`
		UID      string `json:"uid"`
	} `json:"arg"`
	Data []struct {
		SpreadID      string       `json:"sprdId"`
		TradeID       string       `json:"tradeId"`
		OrderID       string       `json:"ordId"`
		ClientOrderID string       `json:"clOrdId"`
		Tag           string       `json:"tag"`
		FillPrice     types.Number `json:"fillPx"`
		FillSize      types.Number `json:"fillSz"`
		State         string       `json:"state"`
		Side          string       `json:"side"`
		ExecType      string       `json:"execType"`
		Timestamp     types.Time   `json:"ts"`
		Legs          []struct {
			InstrumentID string       `json:"instId"`
			Price        types.Number `json:"px"`
			Size         types.Number `json:"sz"`
			Side         string       `json:"side"`
			Fee          types.Number `json:"fee"`
			FeeCurrency  string       `json:"feeCcy"`
			TradeID      string       `json:"tradeId"`
		} `json:"legs"`
		Code string `json:"code"`
		Msg  string `json:"msg"`
	} `json:"data"`
}

WsSpreadOrderTrade trade of an order

type WsSpreadOrderbook

type WsSpreadOrderbook struct {
	Arg struct {
		Channel  string `json:"channel"`
		SpreadID string `json:"sprdId"`
	} `json:"arg"`
	Data []struct {
		Asks      [][3]types.Number `json:"asks"`
		Bids      [][3]types.Number `json:"bids"`
		Timestamp types.Time        `json:"ts"`
	} `json:"data"`
}

WsSpreadOrderbook holds spread orderbook data

func (*WsSpreadOrderbook) ExtractSpreadOrder

func (a *WsSpreadOrderbook) ExtractSpreadOrder() (*WsSpreadOrderbookData, error)

ExtractSpreadOrder extracts WsSpreadOrderbookData from a WsSpreadOrderbook instance

type WsSpreadOrderbookData

type WsSpreadOrderbookData struct {
	Argument SubscriptionInfo `json:"arg"`
	Data     []WsSpreadOrderbookItem
}

WsSpreadOrderbookData represents orderbook response for spread instruments

type WsSpreadOrderbookItem

type WsSpreadOrderbookItem struct {
	Asks      []orderbook.Tranche
	Bids      []orderbook.Tranche
	Timestamp time.Time
}

WsSpreadOrderbookItem represents an orderbook asks and bids details

type WsSpreadPublicTicker

type WsSpreadPublicTicker struct {
	SpreadID  string       `json:"sprdId"`
	Last      types.Number `json:"last"`
	LastSize  types.Number `json:"lastSz"`
	AskPrice  types.Number `json:"askPx"`
	AskSize   types.Number `json:"askSz"`
	BidPrice  types.Number `json:"bidPx"`
	BidSize   types.Number `json:"bidSz"`
	Timestamp types.Time   `json:"ts"`
}

WsSpreadPublicTicker holds spread public ticker data

type WsSpreadPublicTrade

type WsSpreadPublicTrade struct {
	SpreadID  string       `json:"sprdId"`
	Side      string       `json:"side"`
	Size      types.Number `json:"sz"`
	Price     types.Number `json:"px"`
	TradeID   string       `json:"tradeId"`
	Timestamp types.Time   `json:"ts"`
}

WsSpreadPublicTrade holds trades data from sprd-public-trades

type WsSpreadPushData

type WsSpreadPushData struct {
	Argument SubscriptionInfo `json:"arg"`
	Data     any              `json:"data"`
}

WsSpreadPushData holds push data

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

type WsWithdrawlInfo

type WsWithdrawlInfo struct {
	AddrEx           any          `json:"addrEx"`
	Amount           types.Number `json:"amt"`
	AreaCodeFrom     string       `json:"areaCodeFrom"`
	AreaCodeTo       string       `json:"areaCodeTo"`
	Currency         string       `json:"ccy"`
	Chain            string       `json:"chain"`
	ClientID         string       `json:"clientId"`
	Fee              types.Number `json:"fee"`
	FeeCurrency      string       `json:"feeCcy"`
	From             string       `json:"from"`
	Memo             string       `json:"memo"`
	NonTradableAsset bool         `json:"nonTradableAsset"`
	PushTime         types.Time   `json:"pTime"`
	PmtID            string       `json:"pmtId"`
	State            string       `json:"state"`
	SubAcct          string       `json:"subAcct"`
	Tag              string       `json:"tag"`
	To               string       `json:"to"`
	Timestamp        types.Time   `json:"ts"`
	TransactionID    string       `json:"txId"`
	UID              string       `json:"uid"`
	WithdrawalID     string       `json:"wdId"`
}

WsWithdrawlInfo represents push notification is triggered when a withdrawal is initiated or the withdrawal status changes

Jump to

Keyboard shortcuts

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