okcoin

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 37 Imported by: 0

README

GoCryptoTrader package Okcoin

Build Status Software License GoDoc Coverage Status Go Report Card

This okcoin 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 this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

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

Okcoin Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable
	// 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 o exchange.IBotExchange

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

// Public calls - wrapper functions

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

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

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

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

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

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

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

// GetUserInfo returns account info
accountInfo, err := o.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := o.Trade(...)
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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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    okcoinTime   `json:"ts"`
}

AccountAssetValuation represents account asset valuation

type AccountBalanceInformation

type AccountBalanceInformation struct {
	AdjustedEquity string `json:"adjEq"` // Adjusted / Effective equity in USD . Not enabled. Please disregard.
	Details        []struct {
		AvailableBalance                 types.Number `json:"availBal"`
		AvailableEquity                  types.Number `json:"availEq"`
		CashBalance                      types.Number `json:"cashBal"`
		Currency                         string       `json:"ccy"`
		CrossLiability                   string       `json:"crossLiab"`
		DiscountEquity                   string       `json:"disEq"`
		Equity                           types.Number `json:"eq"`
		EquityUsd                        types.Number `json:"eqUsd"`
		FixedBalance                     types.Number `json:"fixedBal"`
		FrozenBalance                    types.Number `json:"frozenBal"`
		Interest                         types.Number `json:"interest"`
		IsolatedEquity                   types.Number `json:"isoEq"`
		IsolatedLiability                types.Number `json:"isoLiab"`
		IsolatedUpl                      string       `json:"isoUpl"` // Isolated unrealized profit and loss of the currency. Not enabled. Please disregard.
		Liability                        types.Number `json:"liab"`
		MaxLoan                          types.Number `json:"maxLoan"`
		MarginRatio                      types.Number `json:"mgnRatio"`
		NotionalLever                    types.Number `json:"notionalLever"`
		OrderFrozen                      types.Number `json:"ordFrozen"`
		SpotInUseAmount                  types.Number `json:"spotInUseAmt"`
		StrategyEquity                   string       `json:"stgyEq"`
		Twap                             string       `json:"twap"`
		UpdateTime                       okcoinTime   `json:"uTime"`
		UnrealizedProfitAndLoss          types.Number `json:"upl"`
		UnrealizedProfitAndLossLiability string       `json:"uplLiab"`
	} `json:"details"`
	IMR            string       `json:"imr"` // Frozen equity for open positions and pending orders in USD.
	IsolatedEquity string       `json:"isoEq"`
	MarginRatio    types.Number `json:"mgnRatio"`
	Mmr            string       `json:"mmr"` // Maintenance margin requirement in USD.
	NotionalUsd    types.Number `json:"notionalUsd"`
	OrdFroz        string       `json:"ordFroz"`
	TotalEq        string       `json:"totalEq"`
	UpdateTime     okcoinTime   `json:"uTime"`
}

AccountBalanceInformation represents currency balance information.

type AccountConfiguration

type AccountConfiguration struct {
	AccountLevel         string `json:"acctLv"`
	AutoLoan             bool   `json:"autoLoan"`
	ContractIsolatedMode string `json:"ctIsoMode"`
	GreeksType           string `json:"greeksType"`
	Level                string `json:"level"`
	LevelTemporary       string `json:"levelTmp"`
	MarginIsolatedMode   string `json:"mgnIsoMode"`
	PositionMode         string `json:"posMode"`
	SpotOffsetType       string `json:"spotOffsetType"`
	UID                  string `json:"uid"`
}

AccountConfiguration represents account configuration information.

type AlgoOrderDetail

type AlgoOrderDetail struct {
	ActivePrice              types.Number `json:"activePx"`
	ActualPrice              types.Number `json:"actualPx"`
	ActualSide               string       `json:"actualSide"`
	ActualSize               types.Number `json:"actualSz"`
	AlgoID                   string       `json:"algoId"`
	CreateTime               okcoinTime   `json:"cTime"`
	CallbackRatio            types.Number `json:"callbackRatio"`
	CallbackSpread           string       `json:"callbackSpread"`
	Currency                 string       `json:"ccy"`
	ClientOrderID            string       `json:"clOrdId"`
	InstrumentID             string       `json:"instId"`
	InstrumentType           string       `json:"instType"`
	Leverage                 types.Number `json:"lever"`
	MoveTriggerPrice         types.Number `json:"moveTriggerPx"`
	OrderID                  string       `json:"ordId"`
	OrdPrice                 types.Number `json:"ordPx"`
	OrderType                string       `json:"ordType"`
	PosSide                  string       `json:"posSide"`
	PriceLimit               types.Number `json:"pxLimit"`
	PriceSpread              types.Number `json:"pxSpread"`
	PriceVar                 types.Number `json:"pxVar"`
	Side                     string       `json:"side"`
	StopLossOrdPrice         types.Number `json:"slOrdPx"`
	StopLossTriggerPrice     types.Number `json:"slTriggerPx"`
	StopLossTriggerPriceType string       `json:"slTriggerPxType"`
	State                    string       `json:"state"`
	Size                     types.Number `json:"sz"`
	SizeLimit                types.Number `json:"szLimit"`
	Tag                      string       `json:"tag"`
	TdMode                   string       `json:"tdMode"`
	TgtCcy                   string       `json:"tgtCcy"`
	TimeInterval             string       `json:"timeInterval"`
	TpOrdPrice               types.Number `json:"tpOrdPx"`
	TpTriggerPrice           types.Number `json:"tpTriggerPx"`
	TpTriggerPriceType       string       `json:"tpTriggerPxType"`
	TriggerPrice             types.Number `json:"triggerPx"`
	TriggerPriceType         string       `json:"triggerPxType"`
	TriggerTime              okcoinTime   `json:"triggerTime"`
}

AlgoOrderDetail represents an algo-order detailed information

type AlgoOrderRequestParam

type AlgoOrderRequestParam struct {
	InstrumentID             string  `json:"instId"`
	TradeMode                string  `json:"tdMode"`
	Side                     string  `json:"side"`
	OrderType                string  `json:"ordType"` // Order type'conditional': One-way stop order'oco': One-cancels-the-other order'trigger': Trigger order'move_order_stop': Trailing order'iceberg': Iceberg order'twap': TWAP order
	Size                     float64 `json:"sz,string"`
	TpTriggerPrice           float64 `json:"tpTriggerPx,string,omitempty"`
	TpOrderPrice             float64 `json:"tpOrdPx,string,omitempty"`
	TpTriggerOrderPriceType  string  `json:"tpTriggerPxType,omitempty"`
	StopLossTriggerPrice     float64 `json:"slTriggerPx,string,omitempty"`
	StopLossOrderPrice       float64 `json:"slOrdPx,string,omitempty"`
	StopLossTriggerPriceType string  `json:"slTriggerPxType,omitempty"`
	TargetCurrency           string  `json:"tgtCcy,omitempty"`
	Tag                      string  `json:"tag,omitempty"`
	ClientOrderID            string  `json:"clOrdId,omitempty"`

	// Trigger Order
	TriggerPrice     float64 `json:"triggerPx,omitempty,string"`
	OrderPrice       float64 `json:"orderPx,omitempty,string"`
	TriggerPriceType string  `json:"triggerPxType,omitempty"`

	// Trailing Stop Order
	CallbackRatio  float64 `json:"callbackRatio,string,omitempty"` // Either callbackRatio or callbackSpread is allowed to be passed.
	CallbackSpread string  `json:"callbackSpread"`
	ActivePrice    float64 `json:"activePx,string,omitempty"`

	// Iceberg Order
	PriceRatio  float64 `json:"pxVar,string,omitempty"`
	PriceSpread float64 `json:"pxSpread,string,omitempty"`
	SizeLimit   float64 `json:"szLimit,string,omitempty"` // Average amount
	PriceLimit  float64 `json:"pxLimit,string,omitempty"`

	TimeInterval string `json:"timeInterval,omitempty"`
}

AlgoOrderRequestParam represents algo order request parameters.

type AlgoOrderResponse

type AlgoOrderResponse struct {
	AlgoID        string `json:"algoId"`
	ClientOrderID string `json:"clOrdId"`
	StatusCode    string `json:"sCode"`
	StatusMsg     string `json:"sMsg"`
}

AlgoOrderResponse represents a response data for creating algo order.

type AmendTradeOrderRequestParam

type AmendTradeOrderRequestParam struct {
	OrderID                 string  `json:"ordId,omitempty"`
	InstrumentID            string  `json:"instId"`
	ClientOrderID           string  `json:"clOrdId,omitempty"`
	ClientRequestID         string  `json:"reqId,omitempty"`
	NewSize                 float64 `json:"newSz,string,omitempty"` // Conditional
	NewPrice                float64 `json:"newPx,string,omitempty"` // Conditional
	CancelOOrderIfAmendFail bool    `json:"cxlOnFail,omitempty"`    // whether the order needs to be automatically canceled when the order amendment fails
}

AmendTradeOrderRequestParam represents an order cancellation request parameter

type AmendTradeOrderResponse

type AmendTradeOrderResponse struct {
	ClientOrderID string `json:"clOrdId"`
	OrderID       string `json:"ordId"`
	RequestID     string `json:"reqId"`
	StatusCode    string `json:"sCode"`
	StatusMessage string `json:"sMsg"`
}

AmendTradeOrderResponse represents a request parameter to amend an incomplete order.

type AssetBillDetail

type AssetBillDetail struct {
	BillID    string       `json:"billId"`
	Currency  string       `json:"ccy"`
	ClientID  string       `json:"clientId"`
	BalChange types.Number `json:"balChg"`
	Balance   types.Number `json:"bal"`
	Type      string       `json:"type"`
	Timestamp okcoinTime   `json:"ts"`
}

AssetBillDetail represents the billing record.

type AvailableRFQPair

type AvailableRFQPair struct {
	Instruments []struct {
		BaseCurrency      string       `json:"baseCcy"`
		BaseCurrencyIcon  string       `json:"baseCcyIcon"`
		BaseSingleMin     types.Number `json:"baseSingleMin"`
		InstrumentID      string       `json:"instId"`
		QuoteCurrency     string       `json:"quoteCcy"`
		QuoteCurrencyIcon string       `json:"quoteCcyIcon"`
		QuoteSingleMin    types.Number `json:"quoteSingleMin"`
	} `json:"instruments"`
	Timestamp okcoinTime `json:"ts"`
}

AvailableRFQPair represents list of instruments and

type AvailableTradableAmount

type AvailableTradableAmount struct {
	AvailableBuy  types.Number `json:"availBuy"`
	AvailableSell types.Number `json:"availSell"`
	InstrumentID  string       `json:"instId"`
}

AvailableTradableAmount represents maximum available tradable amount information

type BillsDetail

type BillsDetail struct {
	Balance          types.Number `json:"bal"`
	BalanceChange    types.Number `json:"balChg"`
	BillID           string       `json:"billId"`
	Currency         string       `json:"ccy"`
	ExecType         string       `json:"execType"`
	Fee              types.Number `json:"fee"`
	From             string       `json:"from"`
	InstrumentID     string       `json:"instId"`
	InstrumentType   string       `json:"instType"`
	MarginMode       string       `json:"mgnMode"`
	Notes            string       `json:"notes"`
	OrderID          string       `json:"ordId"`
	ProfitAndLoss    types.Number `json:"pnl"`
	PosBalance       types.Number `json:"posBal"`
	PosBalanceChange types.Number `json:"posBalChg"`
	BillSubType      string       `json:"subType"`
	Size             types.Number `json:"sz"`
	To               string       `json:"to"`
	BillType         string       `json:"type"`
	Timestamp        okcoinTime   `json:"ts"`
}

BillsDetail represents a bill

type CancelAlgoOrderRequestParam

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

CancelAlgoOrderRequestParam represents a algo order cancellation request parameter

type CancelDepositAddressResp

type CancelDepositAddressResp struct {
	DepositAddressID string `json:"depId"`
}

CancelDepositAddressResp represents a deposit address id response after cancelling.

type CancelTradeOrderRequest

type CancelTradeOrderRequest struct {
	InstrumentID  string `json:"instId"`
	OrderID       string `json:"ordId,omitempty"`
	ClientOrderID string `json:"clOrdId,omitempty"`
}

CancelTradeOrderRequest represents a cancel trade order request body

type CandlestickData

type CandlestickData struct {
	Timestamp            okcoinTime
	OpenPrice            float64
	HighestPrice         float64
	LowestPrice          float64
	ClosePrice           float64
	TradingVolume        float64
	QuoteTradingVolume   float64
	TradingVolumeInQuote float64
	Confirm              string
}

CandlestickData represents the candlestick chart

func ExtractCandlesticks

func ExtractCandlesticks(candles []candlestickItemResponse) ([]CandlestickData, error)

ExtractCandlesticks retrieves a list of CandlestickData

type ChannelInfo

type ChannelInfo struct {
	ChannelID            string       `json:"chanId"`
	Currency             string       `json:"ccy"`
	DepositQuota         string       `json:"depQuota"`
	MinDeposit           types.Number `json:"minDep"`
	WithdrawalQuota      types.Number `json:"wdQuota"`
	MinWithdrawal        types.Number `json:"minWd"`
	UsedWithdrawalQuota  types.Number `json:"usedWdQuota"`
	ValidWithdrawalQuota types.Number `json:"validWdQuota"`
	BankAccountInfo      []struct {
		BankAccountName   string `json:"bankAcctName"`
		BankAccountNumber string `json:"bankAcctNum"`
		InstrumentName    string `json:"instName"`
		MaskAccountNumber string `json:"maskAcctNum"`
	} `json:"bankAcctInfo"`
}

ChannelInfo represents a channel information

type CurrencyBalance

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

CurrencyBalance represents a currency balance information.

type CurrencyInfo

type CurrencyInfo struct {
	CanDep                     bool         `json:"canDep"`
	CanInternal                bool         `json:"canInternal"`
	CanWd                      bool         `json:"canWd"`
	Currency                   string       `json:"ccy"`
	Chain                      string       `json:"chain"`
	DepQuotaFixed              string       `json:"depQuotaFixed"`
	DepQuoteDailyLayer2        string       `json:"depQuoteDailyLayer2"`
	LogoLink                   string       `json:"logoLink"`
	MainNet                    bool         `json:"mainNet"`
	MaxFee                     types.Number `json:"maxFee"`
	MaxWithdrawal              types.Number `json:"maxWd"`
	MinDeposit                 types.Number `json:"minDep"`
	MinDepArrivalConfirm       string       `json:"minDepArrivalConfirm"`
	MinFee                     types.Number `json:"minFee"`
	MinWithdrawal              types.Number `json:"minWd"`
	MinWithdrawalUnlockConfirm string       `json:"minWdUnlockConfirm"`
	Name                       string       `json:"name"`
	NeedTag                    bool         `json:"needTag"`
	UsedDepQuotaFixed          string       `json:"usedDepQuotaFixed"`
	UsedWdQuota                string       `json:"usedWdQuota"`
	WithdrawalQuota            string       `json:"wdQuota"`
	WithdrawalTickSize         types.Number `json:"wdTickSz"`
}

CurrencyInfo represents a currency instance detailed information

type DepositAddress

type DepositAddress struct {
	Chain                    string `json:"chain"`
	ContractAddr             string `json:"ctAddr"`
	Ccy                      string `json:"ccy"`
	To                       string `json:"to"`
	Address                  string `json:"addr"`
	Selected                 bool   `json:"selected"`
	Tag                      string `json:"tag"`
	Memo                     string `json:"memo"`
	DepositPaymentID         string `json:"pmtId"`
	DepositAddressAttachment string `json:"addrEx"`
}

DepositAddress represents a currency deposit address detail

type DepositHistoryItem

type DepositHistoryItem struct {
	ActualDepBlkConfirm string       `json:"actualDepBlkConfirm"` // ActualDepBlkConfirm actual amount of blockchain confirm in a single deposit
	Amount              types.Number `json:"amt"`
	Currency            string       `json:"ccy"`
	Chain               string       `json:"chain"`
	DepositID           string       `json:"depId"`
	From                string       `json:"from"`
	State               string       `json:"state"`
	To                  string       `json:"to"`
	Timestamp           okcoinTime   `json:"ts"`
	TransactionID       string       `json:"txId"`
}

DepositHistoryItem represents deposit records according to the currency, deposit status, and time range in reverse chronological order.

type DepositHistoryResponse

type DepositHistoryResponse struct {
	DepositID         string       `json:"depId"`
	ChannelID         string       `json:"chanId"`
	BillID            string       `json:"billId"`
	BankAccountName   string       `json:"bankAcctName"`
	BankAccountNumber string       `json:"bankAcctNum"`
	Amount            types.Number `json:"amt"`
	State             string       `json:"state"`
	Currency          string       `json:"ccy"`
	CreationTime      okcoinTime   `json:"cTime"`
	UpdatedTime       okcoinTime   `json:"uTime"`
}

DepositHistoryResponse represents a deposit history instance detail.

type ExchangeRate

type ExchangeRate struct {
	UsdCny string `json:"usdCny"`
}

ExchangeRate represents average exchange rate data

type FeeRate

type FeeRate struct {
	Category       string       `json:"category"`
	Delivery       string       `json:"delivery"`
	Exercise       string       `json:"exercise"`
	InstrumentType string       `json:"instType"`
	Level          string       `json:"level"`
	MakerFeeRate   types.Number `json:"maker"`
	MakerU         types.Number `json:"makerU"`
	MakerUSDC      types.Number `json:"makerUSDC"`
	TakerFeeRate   types.Number `json:"taker"`
	TakerU         types.Number `json:"takerU"`
	TakerUSDC      types.Number `json:"takerUSDC"`
	Timestamp      okcoinTime   `json:"ts"`
}

FeeRate represents instrument trading fee information.

type FiatDepositRequestArg

type FiatDepositRequestArg struct {
	ChannelID         string  `json:"chanId"` // Channel ID. 9:PrimeX; 28:PrimeX US; 21:PrimeX Europe; 3:Silvergate SEN; 27:Silvergate SEN HK; 24:ACH
	BankAccountNumber string  `json:"bankAcctNum"`
	Amount            float64 `json:"amt,string"`
	To                float64 `json:"to,omitempty,string"` // Amount to deposit. Recharge to the account: funding:Funding Account
}

FiatDepositRequestArg represents

type FiatDepositResponse

type FiatDepositResponse struct {
	DepositID    string     `json:"depId"`
	CreationTime okcoinTime `json:"cTime"`
}

FiatDepositResponse represents a fiat deposit response data

type FiatWithdrawalHistoryItem

type FiatWithdrawalHistoryItem struct {
	WithdrawalID    string       `json:"wdId"`
	ChannelID       string       `json:"chanId"`
	BillID          string       `json:"billId"`
	BankAccountName string       `json:"bankAcctName"`
	BankAcctNumber  string       `json:"bankAcctNum"`
	Amount          types.Number `json:"amt"`
	Fee             types.Number `json:"fee"`
	State           string       `json:"state"`
	Ccy             string       `json:"ccy"`
	CreationTime    okcoinTime   `json:"cTime"`
	UpdateTime      okcoinTime   `json:"uTime"`
}

FiatWithdrawalHistoryItem represents fiat withdrawal history item.

type FiatWithdrawalParam

type FiatWithdrawalParam struct {
	ChannelID      string  `json:"chanId"`
	BankAcctNumber string  `json:"bankAcctNum"`
	Amount         float64 `json:"amt,string"`
}

FiatWithdrawalParam represents a fiat withdrawal parameters

type FiatWithdrawalResponse

type FiatWithdrawalResponse struct {
	DepositID    string       `json:"depId"`
	Fee          types.Number `json:"fee"`
	CreationTime okcoinTime   `json:"cTime"`
}

FiatWithdrawalResponse represents a fiat withdrawal

type FundingTransferItem

type FundingTransferItem struct {
	TransferID     string       `json:"transId"`
	Currency       string       `json:"ccy"`
	ClientID       string       `json:"clientId"`
	From           string       `json:"from"`
	Amount         types.Number `json:"amt"`
	InstrumentID   string       `json:"instId"`
	State          string       `json:"state"`
	SubAcct        string       `json:"subAcct"`
	To             string       `json:"to"`
	ToInstrumentID string       `json:"toInstId"`
	Type           string       `json:"type"`
}

FundingTransferItem represents a response for a transfer of funds between your funding account and trading account

type FundingTransferRequest

type FundingTransferRequest struct {
	Currency currency.Code `json:"ccy"`
	// Transfer type
	// 0: transfer within account
	// 1: master account to sub-account (Only applicable to APIKey from master account)
	// 2: sub-account to master account (Only applicable to APIKey from master account)
	// 3: sub-account to master account (Only applicable to APIKey from sub-account)
	// The default is 0.
	Amount       float64 `json:"amt,string"`
	From         string  `json:"from"`
	To           string  `json:"to"`
	TransferType int32   `json:"type,string,omitempty"`
	SubAccount   string  `json:"subAcct,omitempty"`
	ClientID     string  `json:"clientId,omitempty"`
}

FundingTransferRequest represents a transfer of funds between your funding account and trading account

type GetOrderBookResponse

type GetOrderBookResponse struct {
	Timestamp okcoinTime  `json:"ts"`
	Asks      [][4]string `json:"asks"` // [[0]: "Price", [1]: "Size", [2]: "Num_orders"], ...
	Bids      [][4]string `json:"bids"` // [[0]: "Price", [1]: "Size", [2]: "Num_orders"], ...
}

GetOrderBookResponse response data

type Instrument

type Instrument struct {
	Alias          string       `json:"alias"`
	BaseCurrency   string       `json:"baseCcy"`
	Category       string       `json:"category"`
	CtMult         string       `json:"ctMult"`
	CtType         string       `json:"ctType"`
	CtVal          string       `json:"ctVal"`
	CtValCurrency  string       `json:"ctValCcy"`
	ExpTime        okcoinTime   `json:"expTime"`
	InstFamily     string       `json:"instFamily"`
	InstrumentID   string       `json:"instId"`
	InstrumentType string       `json:"instType"`
	Leverage       types.Number `json:"lever"`
	ListTime       okcoinTime   `json:"listTime"`
	LotSize        types.Number `json:"lotSz"`
	MaxIcebergSz   types.Number `json:"maxIcebergSz"`
	MaxLimitSize   types.Number `json:"maxLmtSz"`
	MaxMarketSize  types.Number `json:"maxMktSz"`
	MaxStopSize    types.Number `json:"maxStopSz"`
	MaxTwapSize    types.Number `json:"maxTwapSz"`
	MaxTriggerSize types.Number `json:"maxTriggerSz"`
	MinSize        types.Number `json:"minSz"` // Minimum order size
	QuoteCurrency  string       `json:"quoteCcy"`
	OptionType     string       `json:"optType"`
	SettleCurrency string       `json:"settleCcy"`
	State          string       `json:"state"`
	StrikePrice    types.Number `json:"stk"`
	TickSize       types.Number `json:"tickSz"`
	Underlying     string       `json:"uly"`
}

Instrument represents an instrument in an open contract.

type IntraAccountTransferParam

type IntraAccountTransferParam struct {
	Ccy            string  `json:"ccy"`
	Amount         float64 `json:"amt,string"`
	From           string  `json:"from"`
	To             string  `json:"to"`
	FromSubAccount string  `json:"fromSubAccount"`
	ToSubAccount   string  `json:"toSubAccount"`
}

IntraAccountTransferParam represents an intra account transfer request parameters.

type LightningDepositDetail

type LightningDepositDetail struct {
	CreationTime okcoinTime `json:"cTime"`
	Invoice      string     `json:"invoice"`
}

LightningDepositDetail represents a lightning deposit instance detail

type LightningWithdrawals

type LightningWithdrawals struct {
	WithdrawalID string     `json:"wdId"`
	CreationTime okcoinTime `json:"cTime"`
}

LightningWithdrawals the minimum withdrawal amount is approximately 0.000001 BTC. Sub-account does not support withdrawal.

type LightningWithdrawalsRequest

type LightningWithdrawalsRequest struct {
	Ccy     currency.Code `json:"ccy"`
	Invoice string        `json:"invoice"`
	Memo    string        `json:"memo,omitempty"`
}

LightningWithdrawalsRequest represents lightning withdrawal request params

type MaxBuySellResp

type MaxBuySellResp struct {
	Currency     string       `json:"ccy"`
	InstrumentID string       `json:"instId"`
	MaxBuy       types.Number `json:"maxBuy"`
	MaxSell      types.Number `json:"maxSell"`
}

MaxBuySellResp represent a maximum buy sell or open amount information.

type MaximumWithdrawal

type MaximumWithdrawal struct {
	Currency          string `json:"ccy"`
	MaxWithdrawal     string `json:"maxWd"`
	MaxWithdrawalEx   string `json:"maxWdEx"`
	SpotOffsetMaxWd   string `json:"spotOffsetMaxWd"`
	SpotOffsetMaxWdEx string `json:"spotOffsetMaxWdEx"`
}

MaximumWithdrawal represents maximum withdrawal information for currency.

type Okcoin

type Okcoin struct {
	exchange.Base
	// Spot and contract market error codes
	ErrorCodes map[string]error
}

Okcoin is the overarching type used for Okcoin's exchange API implementation

func (*Okcoin) AccountBalanceTransfer

func (o *Okcoin) AccountBalanceTransfer(ctx context.Context, arg *IntraAccountTransferParam) (*SubAccountTransferResponse, error)

AccountBalanceTransfer posts an account transfer between master and sub-account transfers.

func (*Okcoin) AmendMultipleOrder

func (o *Okcoin) AmendMultipleOrder(ctx context.Context, args []AmendTradeOrderRequestParam) ([]AmendTradeOrderResponse, error)

AmendMultipleOrder amends multiple trade orders.

func (*Okcoin) AmendOrder

AmendOrder amends an incomplete order.

func (*Okcoin) AppendWsOrderbookItems

func (o *Okcoin) AppendWsOrderbookItems(entries [][2]types.Number) ([]orderbook.Tranche, error)

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

func (*Okcoin) CalculateChecksum

func (o *Okcoin) CalculateChecksum(orderbookData *WebsocketOrderBook) (int32, error)

CalculateChecksum alternates over the first 25 bid and ask entries from websocket data. The checksum is made up of the price and the quantity with a semicolon (:) deliminating them. This will also work when there are less than 25 entries (for whatever reason) eg Bid:Ask:Bid:Ask:Ask:Ask

func (*Okcoin) CalculateOrderbookUpdateChecksum

func (o *Okcoin) CalculateOrderbookUpdateChecksum(orderbookData *orderbook.Base) int32

CalculateOrderbookUpdateChecksum calculated the orderbook update checksum using currency pair full snapshot.

func (*Okcoin) CancelAdvancedAlgoOrder

func (o *Okcoin) CancelAdvancedAlgoOrder(ctx context.Context, args []CancelAlgoOrderRequestParam) ([]AlgoOrderResponse, error)

CancelAdvancedAlgoOrder cancel unfilled algo orders (including Iceberg order, TWAP order, Trailing Stop order). A maximum of 10 orders can be canceled per request. Request parameters should be passed in the form of an array.

func (*Okcoin) CancelAlgoOrder

func (o *Okcoin) CancelAlgoOrder(ctx context.Context, args []CancelAlgoOrderRequestParam) ([]AlgoOrderResponse, error)

CancelAlgoOrder cancel unfilled algo orders (not including Iceberg order, TWAP order, Trailing Stop order). A maximum of 10 orders can be canceled per request. Request parameters should be passed in the form of an array.

func (*Okcoin) CancelAllOrders

func (o *Okcoin) CancelAllOrders(_ context.Context, _ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Okcoin) CancelBatchOrders

func (o *Okcoin) CancelBatchOrders(ctx context.Context, args []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Okcoin) CancelFiatDeposit

func (o *Okcoin) CancelFiatDeposit(ctx context.Context, depositID string) (*CancelDepositAddressResp, error)

CancelFiatDeposit cancels pending deposit requests.

func (*Okcoin) CancelMultipleOrders

func (o *Okcoin) CancelMultipleOrders(ctx context.Context, args []CancelTradeOrderRequest) ([]TradeOrderResponse, error)

CancelMultipleOrders cancel incomplete orders in batches. Maximum 20 orders can be canceled per request. Request parameters should be passed in the form of an array.

func (*Okcoin) CancelOrder

func (o *Okcoin) CancelOrder(ctx context.Context, cancel *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Okcoin) CancelTradeOrder

func (o *Okcoin) CancelTradeOrder(ctx context.Context, arg *CancelTradeOrderRequest) (*TradeOrderResponse, error)

CancelTradeOrder cancels a single trade order

func (*Okcoin) CancelWithdrawal

func (o *Okcoin) CancelWithdrawal(ctx context.Context, arg *WithdrawalCancellation) (*WithdrawalCancellation, error)

CancelWithdrawal cancel normal withdrawal requests, but you cannot cancel withdrawal requests on Lightning.

func (*Okcoin) Deposit

Deposit posts a fiat deposit to an account

func (*Okcoin) FetchAccountInfo

func (o *Okcoin) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Okcoin) FetchOrderbook

func (o *Okcoin) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Okcoin) FetchTicker

func (o *Okcoin) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Okcoin) FetchTradablePairs

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

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Okcoin) FiatCancelWithdrawal

func (o *Okcoin) FiatCancelWithdrawal(ctx context.Context, withdrawalID string) (string, error)

FiatCancelWithdrawal cancels fiat withdrawal request

func (*Okcoin) FiatWithdrawal

func (o *Okcoin) FiatWithdrawal(ctx context.Context, arg *FiatWithdrawalParam) (*FiatWithdrawalResponse, error)

FiatWithdrawal submit fiat withdrawal operations.

func (*Okcoin) FundsTransfer

func (o *Okcoin) FundsTransfer(ctx context.Context, arg *FundingTransferRequest) (*FundingTransferItem, error)

FundsTransfer transfer of funds between your funding account and trading account, and from the master account to sub-accounts.

func (*Okcoin) GenerateDefaultSubscriptions

func (o *Okcoin) GenerateDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*Okcoin) Get24HourTradingVolume

func (o *Okcoin) Get24HourTradingVolume(ctx context.Context) ([]TradingVolume, error)

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

func (*Okcoin) GetAPIKeyOfSubAccount

func (o *Okcoin) GetAPIKeyOfSubAccount(ctx context.Context, subAccountName, apiKey string) ([]SubAccountAPIKey, error)

GetAPIKeyOfSubAccount retrieves sub-account's API Key information.

func (*Okcoin) GetAccountAssetValuation

func (o *Okcoin) GetAccountAssetValuation(ctx context.Context, ccy currency.Code) ([]AccountAssetValuation, error)

GetAccountAssetValuation view account asset valuation

func (*Okcoin) GetAccountBalance

func (o *Okcoin) GetAccountBalance(ctx context.Context, currencies ...currency.Code) ([]AccountBalanceInformation, error)

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

func (*Okcoin) GetAccountConfigurations

func (o *Okcoin) GetAccountConfigurations(ctx context.Context) ([]AccountConfiguration, error)

GetAccountConfigurations retrieves current account configuration information.

func (*Okcoin) GetAccountFundingHistory

func (o *Okcoin) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Okcoin) GetActiveOrders

func (o *Okcoin) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Okcoin) GetAlgoOrderHistory

func (o *Okcoin) GetAlgoOrderHistory(ctx context.Context, orderType, state, algoOrderID, instrumentType, instrumentID, afterAlgoID, beforeAlgoID string, limit int64) ([]AlgoOrderDetail, error)

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

func (*Okcoin) GetAlgoOrderList

func (o *Okcoin) GetAlgoOrderList(ctx context.Context, orderType, algoOrderID, clientOrderID, instrumentType, instrumentID, afterAlgoID, beforeAlgoID string, limit int64) ([]AlgoOrderDetail, error)

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

func (*Okcoin) GetAssetBillsDetail

func (o *Okcoin) GetAssetBillsDetail(ctx context.Context, ccy currency.Code, billType, clientSuppliedID string, before, after time.Time, limit int64) ([]AssetBillDetail, error)

GetAssetBillsDetail query the billing record. You can get the latest 1 month historical data. Bill type 1: Deposit 2: Withdrawal 13: Canceled withdrawal 20: Transfer to sub account 21: Transfer from sub account 22: Transfer out from sub to master account 23: Transfer in from master to sub account 37: Transfer to spot 38: Transfer from spot

func (*Okcoin) GetAvailableRFQPairs

func (o *Okcoin) GetAvailableRFQPairs(ctx context.Context) ([]AvailableRFQPair, error)

GetAvailableRFQPairs retrieves a list of RFQ instruments.

func (*Okcoin) GetBalance

func (o *Okcoin) GetBalance(ctx context.Context, ccy currency.Code) ([]CurrencyBalance, error)

GetBalance retrieve the funding account balances of all the assets and the amount that is available or on hold.

func (*Okcoin) GetBillsDetails

func (o *Okcoin) GetBillsDetails(ctx context.Context, ccy currency.Code, instrumentType, billType, billSubType, afterBillID, beforeBillID string, begin, end time.Time, limit int64) ([]BillsDetail, error)

GetBillsDetails retrieve the bills of the account. The bill refers to all transaction records that result in changing the balance of an account. Pagination is supported, and the response is sorted with the most recent first. For the last 7 days.

func (*Okcoin) GetBillsDetailsFor3Months

func (o *Okcoin) GetBillsDetailsFor3Months(ctx context.Context, ccy currency.Code, instrumentType, billType, billSubType, afterBillID, beforeBillID string, begin, end time.Time, limit int64) ([]BillsDetail, error)

GetBillsDetailsFor3Months retrieve the bills of the account. The bill refers to all transaction records that result in changing the balance of an account. Pagination is supported, and the response is sorted with the most recent first. For the last 3 months.

func (*Okcoin) GetCandlesData

func (o *Okcoin) GetCandlesData(arg *WebsocketCandlesResponse) ([]stream.KlineData, error)

GetCandlesData represents a candlestick instances list.

func (*Okcoin) GetCandlestickHistory

func (o *Okcoin) GetCandlestickHistory(ctx context.Context, instrumentID string, start, end time.Time, bar kline.Interval, limit int64) ([]CandlestickData, error)

GetCandlestickHistory retrieve history candlestick charts from recent years.

func (*Okcoin) GetCandlesticks

func (o *Okcoin) GetCandlesticks(ctx context.Context, instrumentID string, interval kline.Interval, after, before time.Time, limit int64, utcOpeningPrice bool) ([]CandlestickData, 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 (*Okcoin) GetChannelInfo

func (o *Okcoin) GetChannelInfo(ctx context.Context, channelID string) ([]ChannelInfo, error)

GetChannelInfo retrieves channel detailed information given channel id.

func (*Okcoin) GetCurrencies

func (o *Okcoin) GetCurrencies(ctx context.Context, ccy currency.Code) ([]CurrencyInfo, error)

GetCurrencies retrieves all list of currencies

func (*Okcoin) GetCurrencyDepositAddresses

func (o *Okcoin) GetCurrencyDepositAddresses(ctx context.Context, ccy currency.Code) ([]DepositAddress, error)

GetCurrencyDepositAddresses retrieve the deposit addresses of currencies, including previously-used addresses.

func (*Okcoin) GetDepositAddress

func (o *Okcoin) GetDepositAddress(ctx context.Context, c currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Okcoin) GetDepositHistory

func (o *Okcoin) GetDepositHistory(ctx context.Context, ccy currency.Code, depositID, transactionID, depositType, state string, after, before time.Time, limit int64) ([]DepositHistoryItem, error)

GetDepositHistory retrieve the deposit records according to the currency, deposit status, and time range in reverse chronological order. The 100 most recent records are returned by default.

func (*Okcoin) GetExchangeRate

func (o *Okcoin) GetExchangeRate(ctx context.Context) ([]ExchangeRate, error)

GetExchangeRate provides the average exchange rate data for 2 weeks

func (*Okcoin) GetFee

func (o *Okcoin) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*Okcoin) GetFeeByType

func (o *Okcoin) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Okcoin) GetFeeRates

func (o *Okcoin) GetFeeRates(ctx context.Context, instrumentType, instrumentID string) ([]FeeRate, error)

GetFeeRates retrieves instrument trading fee information.

func (*Okcoin) GetFiatDepositHistory

func (o *Okcoin) GetFiatDepositHistory(ctx context.Context, ccy currency.Code, channelID, depositState, depositID string, after, before time.Time, limit int64) ([]DepositHistoryResponse, error)

GetFiatDepositHistory deposit history query requests can be filtered by the different elements, such as channels, deposit status, and currencies. Paging is also available during query and is stored in reverse order based on the transaction time, with the latest one at the top.

func (*Okcoin) GetFiatWithdrawalHistory

func (o *Okcoin) GetFiatWithdrawalHistory(ctx context.Context, ccy currency.Code, channelID, withdrawalState, withdrawalID string, after, before time.Time, limit int64) ([]FiatWithdrawalHistoryItem, error)

GetFiatWithdrawalHistory retrieves a fiat withdrawal orders list Channel ID used in the transaction. 9:PrimeX; 28:PrimeX US; 21:PrimeX Europe; 3:Silvergate SEN; 27:Silvergate SEN HK Withdrawal state. -2:User canceled the order;-1:Withdrawal attempt has failed; 0:Withdrawal request submitted; 1:Withdrawal request is pending; 2:Withdrawal has been credited

func (*Okcoin) GetFundsTransferState

func (o *Okcoin) GetFundsTransferState(ctx context.Context, transferID, clientID, transferType string) ([]FundingTransferItem, error)

GetFundsTransferState retrieve the transfer state data of the last 2 weeks.

func (*Okcoin) GetFuturesContractDetails

func (o *Okcoin) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns all contracts from the exchange by asset type

func (*Okcoin) GetHistoricCandles

func (o *Okcoin) 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 (*Okcoin) GetHistoricCandlesExtended

func (o *Okcoin) 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 (*Okcoin) GetHistoricTrades

func (o *Okcoin) GetHistoricTrades(ctx context.Context, pair currency.Pair, assetType asset.Item, start, end time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Okcoin) GetInstruments

func (o *Okcoin) GetInstruments(ctx context.Context, instrumentType, instrumentID string) ([]Instrument, error)

GetInstruments Get market data. This endpoint provides the snapshots of market data and can be used without verifications. List trading pairs and get the trading limit, price, and more information of different trading pairs.

func (*Okcoin) GetLatestFundingRates

GetLatestFundingRates returns the latest funding rates data

func (*Okcoin) GetLightningDeposits

func (o *Okcoin) GetLightningDeposits(ctx context.Context, ccy currency.Code, amount float64, to string) ([]LightningDepositDetail, error)

GetLightningDeposits retrieves lightning deposit instances

func (*Okcoin) GetMaximumAvailableTradableAmount

func (o *Okcoin) GetMaximumAvailableTradableAmount(ctx context.Context, tradeMode string, instrumentIDs ...string) ([]AvailableTradableAmount, error)

GetMaximumAvailableTradableAmount retrieves maximum available tradable amount. Single instrument or multiple instruments (no more than 5) separated with comma, e.g. BTC-USDT,ETH-USDT Trade mode 'cash'

func (*Okcoin) GetMaximumBuySellOrOpenAmount

func (o *Okcoin) GetMaximumBuySellOrOpenAmount(ctx context.Context, instrumentID, tradeMode string, price float64) ([]MaxBuySellResp, error)

GetMaximumBuySellOrOpenAmount retrieves maximum buy, sell, or open amount information. Single instrument or multiple instruments (no more than 5) separated with comma, e.g. BTC-USD Trade mode 'cash' Price When the price is not specified, it will be calculated according to the last traded price. optional parameter

func (*Okcoin) GetMaximumWithdrawals

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

GetMaximumWithdrawals retrieve the maximum transferable amount from trading account to funding account. If no currency is specified, the transferable amount of all owned currencies will be returned.

func (*Okcoin) GetOracle

func (o *Okcoin) GetOracle(ctx context.Context) (*Oracle, error)

GetOracle retrieves the crypto price of signing using Open Oracle smart contract.

func (*Okcoin) GetOrderHistory

func (o *Okcoin) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Okcoin) GetOrderHistory3Months

func (o *Okcoin) GetOrderHistory3Months(ctx context.Context, instrumentType, instrumentID, orderType, state string, before, after time.Time, limit int64) ([]TradeOrder, error)

GetOrderHistory3Months retrieve the completed order data of the last 3 months.

func (*Okcoin) GetOrderHistory7Days

func (o *Okcoin) GetOrderHistory7Days(ctx context.Context, instrumentType, instrumentID, orderType, state string, before, after time.Time, limit int64) ([]TradeOrder, error)

GetOrderHistory7Days retrieve the completed order data for the last 7 days, and the incomplete orders that have been canceled are only reserved for 2 hours.

func (*Okcoin) GetOrderInfo

func (o *Okcoin) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Okcoin) GetOrderbook

func (o *Okcoin) GetOrderbook(ctx context.Context, instrumentID string, sideDepth int64) (*GetOrderBookResponse, error)

GetOrderbook retrieve order book of the instrument.

func (*Okcoin) GetPersonalOrderDetail

func (o *Okcoin) GetPersonalOrderDetail(ctx context.Context, instrumentID, orderID, clientOrderID string) (*TradeOrder, error)

GetPersonalOrderDetail retrieves an order detail

func (*Okcoin) GetPersonalOrderList

func (o *Okcoin) GetPersonalOrderList(ctx context.Context, instrumentType, instrumentID, orderType, state string, before, after time.Time, limit int64) ([]TradeOrder, error)

GetPersonalOrderList retrieve all incomplete orders under the current account.

func (*Okcoin) GetRFQOrderDetails

func (o *Okcoin) GetRFQOrderDetails(ctx context.Context, clientDefinedID, tradeOrderID string) ([]RFQOrderDetail, error)

GetRFQOrderDetails retrieves an RFQ order details.

func (*Okcoin) GetRFQOrderHistory

func (o *Okcoin) GetRFQOrderHistory(ctx context.Context, begin, end time.Time, pageSize, pageIndex int64) ([]RFQOrderHistoryItem, error)

GetRFQOrderHistory retrieves an RFQ order history

func (*Okcoin) GetRecentTrades

func (o *Okcoin) 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 (*Okcoin) GetRecentTransactionDetail

func (o *Okcoin) GetRecentTransactionDetail(ctx context.Context, instrumentType, instrumentID, orderID, afterBillID, beforeBillID string, begin, end time.Time, limit int64) ([]TransactionFillItem, error)

GetRecentTransactionDetail retrieve recently-filled transaction details in the last 3 day.

func (*Okcoin) GetServerTime

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

GetServerTime returns the current exchange server time.

func (*Okcoin) GetSubAccountFundingBalance

func (o *Okcoin) GetSubAccountFundingBalance(ctx context.Context, subAccountName string, currencies ...string) ([]SubAccountFundingBalance, error)

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

func (*Okcoin) GetSubAccountTradingBalance

func (o *Okcoin) GetSubAccountTradingBalance(ctx context.Context, subAccountName string) ([]SubAccountTradingBalance, error)

GetSubAccountTradingBalance retrieves detailed balance info of Trading Account of a sub-account via the master account (applies to master accounts only).

func (*Okcoin) GetSubAccounts

func (o *Okcoin) GetSubAccounts(ctx context.Context, enable bool, subAccountName string, after, before time.Time, limit int64) ([]SubAccountInfo, error)

GetSubAccounts lists the sub-accounts detail. Applies to master accounts only

func (*Okcoin) GetSystemStatus

func (o *Okcoin) GetSystemStatus(ctx context.Context, state string) ([]SystemStatus, error)

GetSystemStatus system maintenance status,scheduled: waiting; ongoing: processing; pre_open: pre_open; completed: completed ;canceled: canceled. Generally, pre_open last about 10 minutes. There will be pre_open when the time of upgrade is too long. If this parameter is not filled, the data with status scheduled, ongoing and pre_open will be returned by default

func (*Okcoin) GetSystemTime

func (o *Okcoin) GetSystemTime(ctx context.Context) (time.Time, error)

GetSystemTime retrieve API server time.

func (*Okcoin) GetTicker

func (o *Okcoin) GetTicker(ctx context.Context, instrumentID string) (*TickerData, error)

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

func (*Okcoin) GetTickers

func (o *Okcoin) GetTickers(ctx context.Context, instrumentType string) ([]TickerData, error)

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

func (*Okcoin) GetTradeHistory

func (o *Okcoin) GetTradeHistory(ctx context.Context, instrumentID, paginationType string, before, after time.Time, limit int64) ([]SpotTrade, error)

GetTradeHistory retrieve the recent transactions of an instrument from the last 3 months with pagination.

func (*Okcoin) GetTrades

func (o *Okcoin) GetTrades(ctx context.Context, instrumentID string, limit int64) ([]SpotTrade, error)

GetTrades retrieve the recent transactions of an instrument.

func (*Okcoin) GetTransactionDetails3Months

func (o *Okcoin) GetTransactionDetails3Months(ctx context.Context, instrumentType, instrumentID, orderID, beforeBillID, afterBillID string, begin, end time.Time, limit int64) ([]TransactionFillItem, error)

GetTransactionDetails3Months retrieves recently filled transaction detail in the last 3-months

func (*Okcoin) GetWithdrawalHistory

func (o *Okcoin) GetWithdrawalHistory(ctx context.Context, ccy currency.Code, withdrawalID, clientID, transactionID, withdrawalType, state string, after, before time.Time, limit int64) ([]WithdrawalOrderItem, error)

GetWithdrawalHistory retrieve the withdrawal records according to the currency, withdrawal status, and time range in reverse chronological order. The 100 most recent records are returned by default.

func (*Okcoin) GetWithdrawalsHistory

func (o *Okcoin) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Okcoin) ModifyOrder

func (o *Okcoin) ModifyOrder(ctx context.Context, req *order.Modify) (*order.ModifyResponse, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Okcoin) PlaceAlgoOrder

func (o *Okcoin) PlaceAlgoOrder(ctx context.Context, arg *AlgoOrderRequestParam) (*AlgoOrderResponse, error)

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

func (*Okcoin) PlaceMultipleOrder

func (o *Okcoin) PlaceMultipleOrder(ctx context.Context, args []PlaceTradeOrderParam) ([]TradeOrderResponse, error)

PlaceMultipleOrder place orders in batches. Maximum 20 orders can be placed per request. Request parameters should be passed in the form of an array.

func (*Okcoin) PlaceOrder

func (o *Okcoin) PlaceOrder(ctx context.Context, arg *PlaceTradeOrderParam) (*TradeOrderResponse, error)

PlaceOrder to place a trade order.

func (*Okcoin) PlaceRFQOrder

func (o *Okcoin) PlaceRFQOrder(ctx context.Context, arg *PlaceRFQOrderRequest) ([]RFQOrderResponse, error)

PlaceRFQOrder submit RFQ order

func (*Okcoin) ReSubscribeSpecificOrderbook

func (o *Okcoin) ReSubscribeSpecificOrderbook(obChannel string, p currency.Pair) error

ReSubscribeSpecificOrderbook removes the subscription and the subscribes again to fetch a new snapshot in the event of a de-sync event.

func (*Okcoin) RequestQuote

func (o *Okcoin) RequestQuote(ctx context.Context, arg *QuoteRequestArg) ([]RFQQuoteResponse, error)

RequestQuote query current market quotation information

func (*Okcoin) SendHTTPRequest

func (o *Okcoin) SendHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, httpMethod, requestType, requestPath string, data, result interface{}, authenticated bool) 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 (*Okcoin) SendWebsocketRequest

func (o *Okcoin) SendWebsocketRequest(operation string, data, result interface{}, authenticated bool) error

SendWebsocketRequest send a request through the websocket connection.

func (*Okcoin) SetDefaults

func (o *Okcoin) SetDefaults()

SetDefaults method assigns the default values for Okcoin

func (*Okcoin) SetErrorDefaults

func (o *Okcoin) SetErrorDefaults()

SetErrorDefaults sets the full error default list

func (*Okcoin) Setup

func (o *Okcoin) Setup(exch *config.Exchange) error

Setup sets user exchange configuration settings

func (*Okcoin) SubAccountTransferHistory

func (o *Okcoin) SubAccountTransferHistory(ctx context.Context, subAccountName, currency, transferType string, after, before time.Time, limit int64) ([]SubAccountTransferInfo, error)

SubAccountTransferHistory retrieve the transfer data for the last 3 months. Applies to master accounts only. 0: Transfers from master account to sub-account ; 1 : Transfers from sub-account to master account.

func (*Okcoin) SubmitLightningWithdrawals

func (o *Okcoin) SubmitLightningWithdrawals(ctx context.Context, arg *LightningWithdrawalsRequest) ([]LightningWithdrawals, error)

SubmitLightningWithdrawals the maximum withdrawal amount is 0.1 BTC per request, and 1 BTC in 24 hours. The minimum withdrawal amount is approximately 0.000001 BTC. Sub-account does not support withdrawal.

func (*Okcoin) SubmitOrder

func (o *Okcoin) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Okcoin) SubmitOrders added in v1.0.7

func (o *Okcoin) SubmitOrders(ctx context.Context, ss ...*order.Submit) ([]*order.SubmitResponse, error)

func (*Okcoin) Subscribe

func (o *Okcoin) Subscribe(channelsToSubscribe []subscription.Subscription) error

Subscribe sends a websocket message to receive data from the channel

func (*Okcoin) Unsubscribe

func (o *Okcoin) Unsubscribe(channelsToUnsubscribe []subscription.Subscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*Okcoin) UpdateAccountInfo

func (o *Okcoin) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*Okcoin) UpdateOrderExecutionLimits

func (o *Okcoin) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error

UpdateOrderExecutionLimits sets exchange execution order limits for an asset type

func (*Okcoin) UpdateOrderbook

func (o *Okcoin) UpdateOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Okcoin) UpdateTicker

func (o *Okcoin) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Okcoin) UpdateTickers

func (o *Okcoin) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*Okcoin) UpdateTradablePairs

func (o *Okcoin) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

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

func (*Okcoin) ValidateAPICredentials

func (o *Okcoin) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper

func (*Okcoin) ValidateCredentials

func (o *Okcoin) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper functionality

func (*Okcoin) WithdrawCryptocurrencyFunds

func (o *Okcoin) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Okcoin) WithdrawFiatFunds

func (o *Okcoin) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Okcoin) WithdrawFiatFundsToInternationalBank

func (o *Okcoin) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Okcoin) Withdrawal

func (o *Okcoin) Withdrawal(ctx context.Context, arg *WithdrawalRequest) ([]WithdrawalResponse, error)

Withdrawal apply withdrawal of tokens. Sub-account does not support withdrawal. Withdrawal method 3: 'internal' using email, phone or login account name. 4: 'on chain' a trusted crypto currency address.

func (*Okcoin) WsAmendMultipleOrder

func (o *Okcoin) WsAmendMultipleOrder(args []AmendTradeOrderRequestParam) ([]AmendTradeOrderResponse, error)

WsAmendMultipleOrder amends multiple trade orders.

func (*Okcoin) WsAmendOrder

WsAmendOrder amends an incomplete order through the websocket connection

func (*Okcoin) WsCancelMultipleOrders

func (o *Okcoin) WsCancelMultipleOrders(args []CancelTradeOrderRequest) ([]TradeOrderResponse, error)

WsCancelMultipleOrders cancel incomplete orders in batches through the websocket stream. Maximum 20 orders can be canceled per request. Request parameters should be passed in the form of an array.

func (*Okcoin) WsCancelTradeOrder

func (o *Okcoin) WsCancelTradeOrder(arg *CancelTradeOrderRequest) (*TradeOrderResponse, error)

WsCancelTradeOrder cancels a single trade order through the websocket stream.

func (*Okcoin) WsConnect

func (o *Okcoin) WsConnect() error

WsConnect initiates a websocket connection

func (*Okcoin) WsHandleData

func (o *Okcoin) WsHandleData(respRaw []byte) error

WsHandleData will read websocket raw data and pass to appropriate handler

func (*Okcoin) WsLogin

func (o *Okcoin) WsLogin(ctx context.Context, dialer *websocket.Dialer) error

WsLogin sends a login request to websocket to enable access to authenticated endpoints

func (*Okcoin) WsPlaceMultipleOrder

func (o *Okcoin) WsPlaceMultipleOrder(args []PlaceTradeOrderParam) ([]TradeOrderResponse, error)

WsPlaceMultipleOrder place orders in batches through the websocket stream. Maximum 20 orders can be placed per request. Request parameters should be passed in the form of an array.

func (*Okcoin) WsPlaceOrder

func (o *Okcoin) WsPlaceOrder(arg *PlaceTradeOrderParam) (*TradeOrderResponse, error)

WsPlaceOrder place trade order through the websocket channel.

func (*Okcoin) WsReadData

func (o *Okcoin) WsReadData(conn stream.Connection)

WsReadData receives and passes on websocket messages for processing

type Oracle

type Oracle []struct {
	Messages   []string          `json:"messages"`
	Prices     map[string]string `json:"prices"`
	Signatures []string          `json:"signatures"`
	Timestamp  okcoinTime        `json:"timestamp"`
}

Oracle represents crypto price of signing using Open Oracle smart contract.

type PlaceRFQOrderRequest

type PlaceRFQOrderRequest struct {
	ClientDefinedTradeRequestID string        `json:"clTReqId"`
	ClientRFQSendingTime        int64         `json:"clTReqTs"`
	QuoteID                     string        `json:"quoteId"`
	BaseCurrency                currency.Code `json:"baseCcy"`
	QuoteCurrency               currency.Code `json:"quoteCcy"`
	Side                        string        `json:"side"`
	Size                        float64       `json:"Sz,string"`
	SizeCurrency                currency.Code `json:"szCcy"`
}

PlaceRFQOrderRequest represents a place RFQ request order.

type PlaceTradeOrderParam

type PlaceTradeOrderParam struct {
	InstrumentID   currency.Pair `json:"instId"`
	TradeMode      string        `json:"tdMode"` // Trade mode --> Margin mode: 'cross','isolated' Non-Margin mode: 'cash'
	ClientOrderID  string        `json:"clOrdId,omitempty"`
	Side           string        `json:"side"`                // Order side, buy sell
	OrderType      string        `json:"ordType"`             // Order type 'market': Market order 'limit': Limit order 'post_only': Post-only order 'fok': Fill-or-kill order 'ioc': Immediate-or-cancel order
	Price          float64       `json:"px,string,omitempty"` // Order price. Only applicable to limit,post_only,fok,ioc order.
	Size           float64       `json:"sz,string"`
	OrderTag       string        `json:"tag,omitempty"` // Order tag A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
	BanAmend       bool          `json:"banAmend,omitempty"`
	TargetCurrency string        `json:"tgtCcy,omitempty"` // Whether the target currency uses the quote or base currency.

	// ExpiryTime is the request effective deadline.
	ExpiryTime int64 `json:"expTime,omitempty,string"`
}

PlaceTradeOrderParam represents a trade order arguments.

type QuoteRequestArg

type QuoteRequestArg struct {
	BaseCurrency                currency.Code `json:"baseCcy"`
	QuoteCurrency               currency.Code `json:"quoteCcy"`
	Side                        string        `json:"side"`
	RfqSize                     float64       `json:"rfqSz,string"` // Amount
	RfqSzCurrency               currency.Code `json:"rfqSzCcy"`     // Token
	ClientDefinedQuoteRequestID string        `json:"clQReqId,omitempty"`
	ClientRequestTimestamp      string        `json:"clQReqTs,omitempty"`
}

QuoteRequestArg market quotation information

type RFQOrderDetail

type RFQOrderDetail struct {
	Timestamp      okcoinTime   `json:"ts"`
	TradeID        string       `json:"tradeId"`
	QuoteID        string       `json:"quoteId"`
	ClTReqID       string       `json:"clTReqId"`
	State          string       `json:"state"`
	InstrumentID   string       `json:"instId"`
	BaseCurrency   string       `json:"baseCcy"`
	QuoteCurrency  string       `json:"quoteCcy"`
	Side           string       `json:"side"`
	Price          types.Number `json:"px"`
	FilledBaseSize types.Number `json:"filledBaseSz"`
	FilledTermSize types.Number `json:"filledTermSz"`
}

RFQOrderDetail represents an rfq order detail

type RFQOrderHistoryItem

type RFQOrderHistoryItem struct {
	Timestamp        okcoinTime `json:"ts"`
	PageIdx          int64      `json:"pageIdx,string"`
	TotalPageCount   int64      `json:"totalPageCnt,string"`
	TotalRecordCount int64      `json:"totalRecordCnt,string"`
	Trades           []struct {
		Timestamp      okcoinTime   `json:"ts"`
		TradeID        string       `json:"tradeId"`
		TradeTimestamp okcoinTime   `json:"tradeTs"`
		ClTRequestID   string       `json:"clTReqId"`
		InstrumentID   string       `json:"instId"`
		Side           string       `json:"side"`
		Price          types.Number `json:"px"`
		BaseCurrency   string       `json:"baseCcy"`
		BaseSize       types.Number `json:"baseSz"`
		QuoteCurrency  string       `json:"quoteCcy"`
		QuoteSize      types.Number `json:"quoteSz"`
	} `json:"trades"`
}

RFQOrderHistoryItem represents otc rfq order instance.

type RFQOrderResponse

type RFQOrderResponse struct {
	Timestamp      okcoinTime   `json:"ts"`
	TradeID        string       `json:"tradeId"`
	QuoteID        string       `json:"quoteId"`
	ClTReqID       string       `json:"clTReqId"` // user-defined ID
	State          string       `json:"state"`
	InstrumentID   string       `json:"instId"`
	BaseCurrency   string       `json:"baseCcy"`
	QuoteCurrency  string       `json:"quoteCcy"`
	Side           string       `json:"side"`
	Price          types.Number `json:"px"`
	FilledBaseSize types.Number `json:"filledBaseSz"`
	FilledTermSize types.Number `json:"filledTermSz"`
}

RFQOrderResponse represents an RFQ

type RFQQuoteResponse

type RFQQuoteResponse struct {
	QuoteTimestamp okcoinTime   `json:"quoteTs"`
	TTLMs          string       `json:"ttlMs"`
	ClQReqID       string       `json:"clQReqId"`
	QuoteID        string       `json:"quoteId"`
	BaseCurrency   string       `json:"baseCcy"`
	QuoteCurrency  string       `json:"quoteCcy"`
	Side           string       `json:"side"`
	OrigRfqSize    float64      `json:"origRfqSz"`
	RfqSize        float64      `json:"rfqSz"`
	RfqSzCurrency  string       `json:"rfqSzCcy"`
	BidPrice       types.Number `json:"bidPx"`
	BidBaseSize    types.Number `json:"bidBaseSz"`
	BidQuoteSize   types.Number `json:"bidQuoteSz"`
	AskPx          types.Number `json:"askPx"`
	AskBaseSize    types.Number `json:"askBaseSz"`
	AskQuoteSize   types.Number `json:"askQuoteSz"`
}

RFQQuoteResponse query current market quotation information

type RateLimit

type RateLimit struct {
	PlaceTradeOrder                                *rate.Limiter
	PlaceTradeMultipleOrders                       *rate.Limiter
	CancelTradeOrder                               *rate.Limiter
	CancelMultipleOrder                            *rate.Limiter
	AmendTradeOrder                                *rate.Limiter
	AmendMultipleOrders                            *rate.Limiter
	GetOrderDetails                                *rate.Limiter
	GetOrderList                                   *rate.Limiter
	GetOrderHistory                                *rate.Limiter
	GetOrderhistory3Months                         *rate.Limiter
	GetTransactionDetails3Days                     *rate.Limiter
	GetTransactionDetails3Months                   *rate.Limiter
	PlaceAlgoOrder                                 *rate.Limiter
	CancelAlgoOrder                                *rate.Limiter
	CancelAdvancedAlgoOrder                        *rate.Limiter
	GetAlgoOrderList                               *rate.Limiter
	GetAlgoOrderHistory                            *rate.Limiter
	GetFundingCurrencies                           *rate.Limiter
	GetFundingAccountBalance                       *rate.Limiter
	GetAccountAssetValuation                       *rate.Limiter
	FundingTransfer                                *rate.Limiter
	GetFundsTransferState                          *rate.Limiter
	AssetBillsDetail                               *rate.Limiter
	LightningDeposits                              *rate.Limiter
	GetAssetDepositAddress                         *rate.Limiter
	GetDepositHistory                              *rate.Limiter
	PostWithdrawal                                 *rate.Limiter
	PostLightningWithdrawal                        *rate.Limiter
	CancelWithdrawal                               *rate.Limiter
	GetAssetWithdrawalHistory                      *rate.Limiter
	GetAccountBalance                              *rate.Limiter
	GetBillsDetailLast3Month                       *rate.Limiter
	GetBillsDetail                                 *rate.Limiter
	GetAccountConfiguration                        *rate.Limiter
	GetMaxBuySellAmountOpenAmount                  *rate.Limiter
	GetMaxAvailableTradableAmount                  *rate.Limiter
	GetFeeRates                                    *rate.Limiter
	GetMaxWithdrawals                              *rate.Limiter
	GetAvailablePairs                              *rate.Limiter
	RequestQuotes                                  *rate.Limiter
	PlaceRFQOrder                                  *rate.Limiter
	GetRFQTradeOrderDetails                        *rate.Limiter
	GetRFQTradeOrderHistory                        *rate.Limiter
	FiatDepositRate                                *rate.Limiter
	FiatCancelDepositRate                          *rate.Limiter
	FiatDepositHistoryRate                         *rate.Limiter
	FiatWithdrawalRate                             *rate.Limiter
	FiatCancelWithdrawalRate                       *rate.Limiter
	FiatGetWithdrawalsRate                         *rate.Limiter
	FiatGetChannelInfoRate                         *rate.Limiter
	SubAccountsList                                *rate.Limiter
	GetAPIKeyOfASubAccount                         *rate.Limiter
	GetSubAccountTradingBalance                    *rate.Limiter
	GetSubAccountFundingBalance                    *rate.Limiter
	SubAccountTransferHistory                      *rate.Limiter
	MasterAccountsManageTransfersBetweenSubaccount *rate.Limiter
	GetTickers                                     *rate.Limiter
	GetTicker                                      *rate.Limiter
	GetOrderbook                                   *rate.Limiter
	GetCandlesticks                                *rate.Limiter
	GetCandlestickHistory                          *rate.Limiter
	GetPublicTrades                                *rate.Limiter
	GetPublicTradeHistrory                         *rate.Limiter
	Get24HourTradingVolume                         *rate.Limiter
	GetOracle                                      *rate.Limiter
	GetExchangeRate                                *rate.Limiter
	GetInstrumentsRate                             *rate.Limiter
	GetSystemTimeRate                              *rate.Limiter
	GetSystemStatusRate                            *rate.Limiter
}

RateLimit implementa a rate Limiter

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns a new RateLimit instance which implements request.Limiter interface.

func (*RateLimit) Limit

func (r *RateLimit) Limit(ctx context.Context, ep request.EndpointLimit) error

Limit implements an endpoint limit.

type SpotTrade

type SpotTrade struct {
	InstrumentID string       `json:"instId"`
	Side         string       `json:"side"`
	TradeSize    types.Number `json:"sz"`
	TradePrice   types.Number `json:"px"`
	TradeID      string       `json:"tradeId"`
	Timestamp    okcoinTime   `json:"ts"`
}

SpotTrade represents spot trades

type SubAccountAPIKey

type SubAccountAPIKey struct {
	Label        string     `json:"label"`
	APIKey       string     `json:"apiKey"`
	Permissions  string     `json:"perm"`
	LinkedIP     string     `json:"ip"`
	CreationTime okcoinTime `json:"ts"`
}

SubAccountAPIKey retrieves sub-account API key.

type SubAccountFundingBalance

type SubAccountFundingBalance struct {
	AvailBal  types.Number `json:"availBal"`
	Bal       types.Number `json:"bal"`
	Currency  string       `json:"ccy"`
	FrozenBal types.Number `json:"frozenBal"`
}

SubAccountFundingBalance represents a sub-account funding balance for a currency.

type SubAccountInfo

type SubAccountInfo struct {
	SubAccountEnable  bool       `json:"enable"`
	SubAccountName    string     `json:"subAcct"`
	SubAccountType    string     `json:"type"`
	Label             string     `json:"label"`
	MobileNumber      string     `json:"mobile"`
	GoogleAuthEnabled bool       `json:"gAuth"`
	CanTransferOut    bool       `json:"canTransOut"`
	CreationTimestamp okcoinTime `json:"ts"`
}

SubAccountInfo represents a single sub-account info.

type SubAccountTradingBalance

type SubAccountTradingBalance struct {
	AdjEq   types.Number `json:"adjEq"` // Adjusted / Effective equity in USD. Not enabled. Please disregard.
	Details []struct {
		AvailableBal            types.Number `json:"availBal"`
		AvailableEquity         types.Number `json:"availEq"`
		CashBalance             types.Number `json:"cashBal"`
		Currency                string       `json:"ccy"`
		CrossLiab               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"`
		IsolatedEquity          types.Number `json:"isoEq"`
		IsolatedLiability       types.Number `json:"isoLiab"`
		Liability               types.Number `json:"liab"`
		MaxLoan                 types.Number `json:"maxLoan"`
		MarginRatio             types.Number `json:"mgnRatio"`
		NotionalLeverage        types.Number `json:"notionalLever"`
		OrderMarginFrozen       types.Number `json:"ordFrozen"`
		Twap                    types.Number `json:"twap"`
		UTime                   types.Number `json:"uTime"`
		UnrealizedProfitAndLoss types.Number `json:"upl"`
		UPLLiability            types.Number `json:"uplLiab"`
	} `json:"details"`
	IMR            types.Number `json:"imr"` // Frozen equity for open positions and pending orders in USD. Not enabled. Please disregard.
	IsolatedEquity types.Number `json:"isoEq"`
	MarginRatio    types.Number `json:"mgnRatio"`
	MMR            types.Number `json:"mmr"` // Maintenance margin requirement in USD. Not enabled. Please disregard
	NotionalUsd    types.Number `json:"notionalUsd"`
	OrdFrozen      types.Number `json:"ordFroz"`
	TotalEquity    types.Number `json:"totalEq"`
	UpdatedTime    okcoinTime   `json:"uTime"`
}

SubAccountTradingBalance represents a sub-account trading detail.

type SubAccountTransferInfo

type SubAccountTransferInfo struct {
	BillID            string       `json:"billId"`
	Type              string       `json:"type"`
	Ccy               string       `json:"ccy"`
	Amount            types.Number `json:"amt"`
	SubAccount        string       `json:"subAcct"`
	CreationTimestamp okcoinTime   `json:"ts"`
}

SubAccountTransferInfo represents a sub-account transfer information.

type SubAccountTransferResponse

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

SubAccountTransferResponse represents a transfer operation response.

type SystemStatus

type SystemStatus struct {
	Title       string     `json:"title"`
	State       string     `json:"state"`
	Begin       okcoinTime `json:"begin"`
	End         okcoinTime `json:"end"`
	Href        string     `json:"href"`
	ServiceType string     `json:"serviceType"`
	System      string     `json:"system"`
	ScheDesc    string     `json:"scheDesc"`
}

SystemStatus represents system status

type TickerData

type TickerData struct {
	InstType        string       `json:"instType"`
	InstrumentID    string       `json:"instId"`
	LastTradedPrice types.Number `json:"last"`
	LastTradedSize  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"`   // Open price in the past 24 hours
	High24H         types.Number `json:"high24h"`   // Highest price in the past 24 hours
	Low24H          types.Number `json:"low24h"`    // Lowest price in the past 24 hours
	VolCcy24H       types.Number `json:"volCcy24h"` // 24h trading volume, with a unit of currency. The value is the quantity in quote currency.
	Vol24H          types.Number `json:"vol24h"`    // 24h trading volume, with a unit of contract. The value is the quantity in base currency.
	Timestamp       okcoinTime   `json:"ts"`
	OpenPriceInUtc0 types.Number `json:"sodUtc0"`
	OpenPriceInUtc8 types.Number `json:"sodUtc8"`
}

TickerData stores ticker data

type TradeOrder

type TradeOrder struct {
	AccFillSize                types.Number `json:"accFillSz"`
	AveragePrice               types.Number `json:"avgPx"`
	CreationTime               okcoinTime   `json:"cTime"`
	Category                   string       `json:"category"`
	Currency                   string       `json:"ccy"`
	ClientOrdID                string       `json:"clOrdId"`
	Fee                        types.Number `json:"fee"`
	FeeCurrency                string       `json:"feeCcy"`
	FillPrice                  types.Number `json:"fillPx"`
	FillSize                   types.Number `json:"fillSz"`
	FillTime                   okcoinTime   `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"`
	PosSide                    string       `json:"posSide"`
	Price                      types.Number `json:"px"`
	Rebate                     types.Number `json:"rebate"`
	RebateCurrency             string       `json:"rebateCcy"`
	ReduceOnly                 bool         `json:"reduceOnly,string"`
	Side                       string       `json:"side"`
	StopLossOrdPrice           types.Number `json:"slOrdPx"`
	StopLossTriggerPrice       types.Number `json:"slTriggerPx"`
	StopLossTriggerPriceType   string       `json:"slTriggerPxType"`
	Source                     string       `json:"source"`
	State                      string       `json:"state"`
	Size                       types.Number `json:"sz"`
	Tag                        string       `json:"tag"`
	TradeMode                  string       `json:"tdMode"`
	TargetCurrency             string       `json:"tgtCcy"`
	TakeProfitOrderPrice       types.Number `json:"tpOrdPx"`
	TakeProfitTriggerPrice     types.Number `json:"tpTriggerPx"`
	TakeProfitTriggerPriceType string       `json:"tpTriggerPxType"`
	TradeID                    string       `json:"tradeId"`
	UpdateTime                 okcoinTime   `json:"uTime"`
}

TradeOrder represents a trade order detail

type TradeOrderResponse

type TradeOrderResponse struct {
	ClientOrderID string `json:"clOrdId"`
	OrderID       string `json:"ordId"`
	Tag           string `json:"tag"`
	SCode         string `json:"sCode"`
	SMsg          string `json:"sMsg"`
}

TradeOrderResponse represents a single trade order information

type TradingVolume

type TradingVolume struct {
	VolCny    types.Number `json:"volCny"`
	VolUsd    types.Number `json:"volUsd"`
	Timestamp okcoinTime   `json:"ts"`
}

TradingVolume represents the trading volume of the platform in 24 hours

type TransactionFillItem

type TransactionFillItem struct {
	InstrumentType string       `json:"instType"`
	InstrumentID   string       `json:"instId"`
	TradeID        string       `json:"tradeId"`
	OrderID        string       `json:"ordId"`
	ClientOrderID  string       `json:"clOrdId"`
	BillID         string       `json:"billId"`
	Tag            string       `json:"tag"`
	FillSize       types.Number `json:"fillSz"`
	FillPrice      types.Number `json:"fillPx"`
	Side           string       `json:"side"`
	PosSide        string       `json:"posSide"`
	ExecType       string       `json:"execType"`
	FeeCurrency    string       `json:"feeCcy"`
	Fee            types.Number `json:"fee"`
	Timestamp      okcoinTime   `json:"ts"`
}

TransactionFillItem represents recently filled transactions

type WebsocketAccount

type WebsocketAccount struct {
	Arg struct {
		Channel string `json:"channel"`
		UID     string `json:"uid"`
	} `json:"arg"`
	Data []struct {
		AdjustedEquity string `json:"adjEq"`
		Details        []struct {
			AvailableBalance   types.Number `json:"availBal"`
			AvailableEquity    types.Number `json:"availEq"`
			CashBalance        types.Number `json:"cashBal"`
			Currency           string       `json:"ccy"`
			CoinUsdPrice       types.Number `json:"coinUsdPrice"`
			CrossLiab          string       `json:"crossLiab"`
			DiscountEquity     string       `json:"disEq"`
			Equity             string       `json:"eq"`
			EquityUsd          string       `json:"eqUsd"`
			FixedBalance       types.Number `json:"fixedBal"`
			FrozenBalance      types.Number `json:"frozenBal"`
			Interest           types.Number `json:"interest"`
			IsoEquity          string       `json:"isoEq"`
			IsoLiability       string       `json:"isoLiab"`
			IsoUpl             string       `json:"isoUpl"`
			Liability          types.Number `json:"liab"`
			MaxLoan            types.Number `json:"maxLoan"`
			MgnRatio           types.Number `json:"mgnRatio"`
			NotionalLeverage   string       `json:"notionalLever"`
			MarginFrozenOrders string       `json:"ordFrozen"`
			SpotInUseAmount    string       `json:"spotInUseAmt"`
			StrategyEquity     string       `json:"stgyEq"`
			Twap               string       `json:"twap"`
			UPL                string       `json:"upl"` // Unrealized profit and loss
			UpdateTime         okcoinTime   `json:"uTime"`
		} `json:"details"`
		FrozenEquity                 string       `json:"imr"`
		IsoEquity                    string       `json:"isoEq"`
		MarginRatio                  string       `json:"mgnRatio"`
		MaintenanceMarginRequirement string       `json:"mmr"`
		NotionalUsd                  types.Number `json:"notionalUsd"`
		MarginOrderFrozen            string       `json:"ordFroz"`
		TotalEquity                  string       `json:"totalEq"`
		UpdateTime                   okcoinTime   `json:"uTime"`
	} `json:"data"`
}

WebsocketAccount represents an account information. Data will be pushed when triggered by events such as placing order, canceling order, transaction execution

type WebsocketAdvancedAlgoOrder

type WebsocketAdvancedAlgoOrder struct {
	Arg struct {
		Channel      string `json:"channel"`
		UID          string `json:"uid"`
		InstType     string `json:"instType"`
		InstrumentID string `json:"instId"`
	} `json:"arg"`
	Data []struct {
		ActualPx             types.Number `json:"actualPx"`
		ActualSide           string       `json:"actualSide"`
		ActualSz             types.Number `json:"actualSz"`
		AlgoID               string       `json:"algoId"`
		CreationTime         okcoinTime   `json:"cTime"`
		Ccy                  string       `json:"ccy"`
		ClOrdID              string       `json:"clOrdId"`
		Count                string       `json:"count"`
		InstrumentID         string       `json:"instId"`
		InstType             string       `json:"instType"`
		Lever                types.Number `json:"lever"`
		NotionalUsd          types.Number `json:"notionalUsd"`
		OrderPrice           types.Number `json:"ordPx"`
		OrderType            string       `json:"ordType"`
		PushTime             okcoinTime   `json:"pTime"`
		PosSide              string       `json:"posSide"`
		PriceLimit           types.Number `json:"pxLimit"`
		PriceSpread          types.Number `json:"pxSpread"`
		PriceVar             types.Number `json:"pxVar"`
		Side                 string       `json:"side"`
		StopLossOrdPrice     string       `json:"slOrdPx"`
		StopLossTriggerPrice string       `json:"slTriggerPx"`
		State                string       `json:"state"`
		Size                 types.Number `json:"sz"`
		SizeLimit            types.Number `json:"szLimit"`
		TradeMode            string       `json:"tdMode"`
		TimeInterval         string       `json:"timeInterval"`
		TakeProfitOrdPx      types.Number `json:"tpOrdPx"`
		TakeProfitTriggerPx  types.Number `json:"tpTriggerPx"`
		Tag                  string       `json:"tag"`
		TriggerPrice         types.Number `json:"triggerPx"`
		TriggerTime          string       `json:"triggerTime"`
		CallbackRatio        string       `json:"callbackRatio"`
		CallbackSpread       string       `json:"callbackSpread"`
		ActivePrice          types.Number `json:"activePx"`
		MoveTriggerPrice     types.Number `json:"moveTriggerPx"`
	} `json:"data"`
}

WebsocketAdvancedAlgoOrder represents advance algo orders (including Iceberg order, TWAP order, Trailing order).

type WebsocketAlgoOrder

type WebsocketAlgoOrder struct {
	Arg struct {
		Channel      string `json:"channel"`
		UID          string `json:"uid"`
		InstType     string `json:"instType"`
		InstrumentID string `json:"instId"`
	} `json:"arg"`
	Data []struct {
		InstrumentType             string       `json:"instType"`
		InstrumentID               string       `json:"instId"`
		OrderID                    string       `json:"ordId"`
		Currency                   string       `json:"ccy"`
		ClientOrderID              string       `json:"clOrdId"`
		AlgoID                     string       `json:"algoId"`
		Price                      types.Number `json:"px"`
		Size                       types.Number `json:"sz"`
		TradeMode                  string       `json:"tdMode"`
		TgtCurrency                string       `json:"tgtCcy"`
		NotionalUsd                types.Number `json:"notionalUsd"`
		OrderType                  string       `json:"ordType"`
		Side                       string       `json:"side"`
		PositionSide               string       `json:"posSide"`
		State                      string       `json:"state"`
		Leverage                   float64      `json:"lever"`
		TakeProfitTriggerPrice     types.Number `json:"tpTriggerPx"`
		TakeProfitTriggerPriceType string       `json:"tpTriggerPxType"`
		TakeProfitOrdPrice         types.Number `json:"tpOrdPx"`
		SlTriggerPrice             types.Number `json:"slTriggerPx"`
		SlTriggerPriceType         string       `json:"slTriggerPxType"`
		TriggerPxType              string       `json:"triggerPxType"`
		TriggerPrice               types.Number `json:"triggerPx"`
		OrderPrice                 types.Number `json:"ordPx"`
		Tag                        string       `json:"tag"`
		ActualSize                 types.Number `json:"actualSz"`
		ActualPrice                types.Number `json:"actualPx"`
		ActualSide                 string       `json:"actualSide"`
		TriggerTime                okcoinTime   `json:"triggerTime"`
		CreateTime                 okcoinTime   `json:"cTime"`
	} `json:"data"`
}

WebsocketAlgoOrder represents algo orders (includes trigger order, oco order, conditional order).

type WebsocketCandlesResponse

type WebsocketCandlesResponse struct {
	Arg struct {
		Channel      string `json:"channel"`
		InstrumentID string `json:"instId"`
	} `json:"arg"`
	Data [][]string `json:"data"`
}

WebsocketCandlesResponse represents a candlestick response data.

type WebsocketDataResponse

type WebsocketDataResponse struct {
	ID        string `json:"id"`
	Operation string `json:"op"`
	Message   string `json:"msg"`
	Arguments struct {
		Channel        string `json:"channel"`
		InstrumentID   string `json:"instId"`
		InstrumentType string `json:"instType"`
	} `json:"arg"`
	Action string        `json:"action"`
	Data   []interface{} `json:"data"`
}

WebsocketDataResponse formats all response data for a websocket event

type WebsocketDataResponseReciever

type WebsocketDataResponseReciever struct {
	Arguments struct {
		Channel        string `json:"channel"`
		InstrumentID   string `json:"instId"`
		InstrumentType string `json:"instType"`
	} `json:"arg"`
	Action string      `json:"action"`
	Data   interface{} `json:"data"`
}

WebsocketDataResponseReciever formats all response data for a websocket events and used to unmarshal push data into corresponding instance

type WebsocketErrorResponse

type WebsocketErrorResponse struct {
	Event     string `json:"event"`
	Message   string `json:"message"`
	ErrorCode int64  `json:"errorCode"`
}

WebsocketErrorResponse yo

type WebsocketEventRequest

type WebsocketEventRequest struct {
	Operation string              `json:"op"`   // 1--subscribe 2--unsubscribe 3--login
	Arguments []map[string]string `json:"args"` // args: the value is the channel name, which can be one or more channels
}

WebsocketEventRequest contains event data for a websocket channel

type WebsocketEventResponse

type WebsocketEventResponse struct {
	Event   string `json:"event"`
	Channel string `json:"channel,omitempty"`
	Message string `json:"msg"`
	Code    string `json:"code"`
}

WebsocketEventResponse contains event data for a websocket channel

type WebsocketInstrumentData

type WebsocketInstrumentData struct {
	Alias                 string       `json:"alias"`
	BaseCurrency          string       `json:"baseCcy"`
	Category              string       `json:"category"`
	ContractMultiplier    string       `json:"ctMult"`
	ContractType          string       `json:"ctType"`
	ContractValue         string       `json:"ctVal"`
	ContractValueCurrency string       `json:"ctValCcy"`
	ExpiryTime            okcoinTime   `json:"expTime"`
	InstrumentFamily      string       `json:"instFamily"`
	InstrumentID          string       `json:"instId"`
	InstrumentType        string       `json:"instType"`
	Leverage              types.Number `json:"lever"`
	ListTime              okcoinTime   `json:"listTime"`
	LotSize               types.Number `json:"lotSz"`
	MaxIcebergSize        types.Number `json:"maxIcebergSz"`
	MaxLimitSize          types.Number `json:"maxLmtSz"`
	MaxMarketSize         types.Number `json:"maxMktSz"`
	MaxStopSize           types.Number `json:"maxStopSz"`
	MaxTriggerSize        types.Number `json:"maxTriggerSz"`
	MaxTwapSize           types.Number `json:"maxTwapSz"`
	MinimumOrderSize      types.Number `json:"minSz"`
	OptionType            string       `json:"optType"`
	QuoteCurrency         string       `json:"quoteCcy"`
	SettleCurrency        string       `json:"settleCcy"`
	State                 string       `json:"state"`
	StrikePrice           types.Number `json:"stk"`
	TickSize              types.Number `json:"tickSz"`
	Underlying            string       `json:"uly"`
}

WebsocketInstrumentData contains formatted data for instruments related websocket responses

type WebsocketOrder

type WebsocketOrder struct {
	Arg struct {
		Channel        string `json:"channel"`
		InstrumentType string `json:"instType"`
		InstrumentID   string `json:"instId"`
		UID            string `json:"uid"`
	} `json:"arg"`
	Data []struct {
		AccFillSize                types.Number `json:"accFillSz"`
		AmendResult                string       `json:"amendResult"`
		AveragePrice               types.Number `json:"avgPx"`
		CreateTime                 okcoinTime   `json:"cTime"`
		Category                   string       `json:"category"`
		Currency                   string       `json:"ccy"`
		ClientOrdID                string       `json:"clOrdId"`
		Code                       string       `json:"code"`
		ExecType                   string       `json:"execType"`
		Fee                        types.Number `json:"fee"`
		FeeCurrency                string       `json:"feeCcy"`
		FillFee                    types.Number `json:"fillFee"`
		FillFeeCurrency            string       `json:"fillFeeCcy"`
		FillNotionalUsd            types.Number `json:"fillNotionalUsd"`
		FillPrice                  types.Number `json:"fillPx"`
		FillSize                   types.Number `json:"fillSz"`
		FillTime                   okcoinTime   `json:"fillTime"`
		InstrumentID               string       `json:"instId"`
		InstrumentType             string       `json:"instType"`
		Leverage                   types.Number `json:"lever"`
		ErrorMessage               string       `json:"msg"`
		NotionalUsd                types.Number `json:"notionalUsd"`
		OrderID                    string       `json:"ordId"`
		OrderType                  string       `json:"ordType"`
		ProfitAndLoss              types.Number `json:"pnl"`
		PositionSide               string       `json:"posSide"`
		Price                      types.Number `json:"px"`
		Rebate                     string       `json:"rebate"`
		RebateCurrency             string       `json:"rebateCcy"`
		ReduceOnly                 bool         `json:"reduceOnly,string"`
		ClientRequestID            string       `json:"reqId"`
		Side                       string       `json:"side"`
		StopLossOrderPrice         types.Number `json:"slOrdPx"`
		StopLossTriggerPrice       types.Number `json:"slTriggerPx"`
		StopLossTriggerPriceType   string       `json:"slTriggerPxType"`
		Source                     string       `json:"source"`
		State                      string       `json:"state"`
		Size                       types.Number `json:"sz"`
		Tag                        string       `json:"tag"`
		TradeMode                  string       `json:"tdMode"`
		TargetCurrency             string       `json:"tgtCcy"`
		TakeProfitOrdPrice         types.Number `json:"tpOrdPx"`
		TakeProfitTriggerPrice     types.Number `json:"tpTriggerPx"`
		TakeProfitTriggerPriceType string       `json:"tpTriggerPxType"`
		TradeID                    string       `json:"tradeId"`
		UpdateTime                 okcoinTime   `json:"uTime"`
	} `json:"data"`
}

WebsocketOrder represents and order information. Data will not be pushed when first subscribed.

type WebsocketOrderBook

type WebsocketOrderBook struct {
	Checksum  int64             `json:"checksum"`
	Asks      [][2]types.Number `json:"asks"` // [ Price, Quantity, depreciated, number of orders at the price ]
	Bids      [][2]types.Number `json:"bids"` // [ Price, Quantity, depreciated, number of orders at the price ]
	Timestamp okcoinTime        `json:"ts"`
}

WebsocketOrderBook holds orderbook data

type WebsocketOrderBooksData

type WebsocketOrderBooksData struct {
	Table  string               `json:"table"`
	Action string               `json:"action"`
	Data   []WebsocketOrderBook `json:"data"`
}

WebsocketOrderBooksData is the full websocket response containing orderbook data

type WebsocketOrderbookResponse

type WebsocketOrderbookResponse struct {
	Arg struct {
		Channel      string `json:"channel"`
		InstrumentID string `json:"instId"`
	} `json:"arg"`
	Action string               `json:"action"`
	Data   []WebsocketOrderBook `json:"data"`
}

WebsocketOrderbookResponse formats orderbook data for a websocket push data

type WebsocketStatus

type WebsocketStatus struct {
	Arg struct {
		Channel string `json:"channel"`
	} `json:"arg"`
	Data []struct {
		Title                 string     `json:"title"`
		State                 string     `json:"state"`
		End                   okcoinTime `json:"end"`
		Begin                 okcoinTime `json:"begin"`
		Href                  string     `json:"href"`
		ServiceType           int64      `json:"serviceType,string"`
		System                string     `json:"system"`
		RescheduleDescription string     `json:"scheDesc"`
		Time                  okcoinTime `json:"ts"`
	} `json:"data"`
}

WebsocketStatus represents a system status response.

type WebsocketTradeResponse

type WebsocketTradeResponse struct {
	Arg struct {
		Channel      string `json:"channel"`
		InstrumentID string `json:"instId"`
	} `json:"arg"`
	Data []struct {
		InstrumentID string       `json:"instId"`
		TradeID      string       `json:"tradeId"`
		Price        types.Number `json:"px"`
		Size         types.Number `json:"sz"`
		Side         string       `json:"side"`
		Timestamp    okcoinTime   `json:"ts"`
	} `json:"data"`
}

WebsocketTradeResponse contains formatted data for trade related websocket responses

type WithdrawalCancellation

type WithdrawalCancellation struct {
	WithdrawalID string `json:"wdId"`
}

WithdrawalCancellation represents a request parameter for withdrawal cancellation

type WithdrawalOrderItem

type WithdrawalOrderItem struct {
	Ccy                         string       `json:"ccy"`
	Chain                       string       `json:"chain"`
	Amount                      types.Number `json:"amt"`
	Timestamp                   okcoinTime   `json:"ts"`
	RemittingAddress            string       `json:"from"`
	ReceivingAddress            string       `json:"to"`
	Tag                         string       `json:"tag"`
	PaymentID                   string       `json:"pmtId"`
	Memo                        string       `json:"memo"`
	WithdrawalAddressAttachment string       `json:"addrEx"`
	TransactionID               string       `json:"txId"`
	Fee                         types.Number `json:"fee"`
	State                       string       `json:"state"`
	WithdrawalID                string       `json:"wdId"`
	ClientID                    string       `json:"clientId"`
}

WithdrawalOrderItem represents a withdrawal instance item

type WithdrawalRequest

type WithdrawalRequest struct {
	Amount           float64       `json:"amt,string,omitempty"`
	TransactionFee   float64       `json:"fee,string"`
	WithdrawalMethod string        `json:"dest,omitempty"` // Withdrawal method 3: internal  4: on chain
	Ccy              currency.Code `json:"ccy,omitempty"`
	Chain            string        `json:"chain,omitempty"`
	ClientID         string        `json:"clientId,omitempty"`
	ToAddress        string        `json:"toAddr,omitempty"`
}

WithdrawalRequest represents withdrawal of tokens request.

type WithdrawalResponse

type WithdrawalResponse struct {
	Amt      types.Number `json:"amt"`
	WdID     string       `json:"wdId"`
	Currency string       `json:"ccy"`
	ClientID string       `json:"clientId"`
	Chain    string       `json:"chain"`
}

WithdrawalResponse represents withdrawal of tokens response.

type WsTickerData

type WsTickerData struct {
	InstrumentType string       `json:"instType"`
	InstrumentID   string       `json:"instId"`
	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"`
	Open24H        types.Number `json:"open24h"`
	High24H        types.Number `json:"high24h"`
	Low24H         types.Number `json:"low24h"`
	SodUtc0        string       `json:"sodUtc0"`
	SodUtc8        string       `json:"sodUtc8"`
	VolCcy24H      types.Number `json:"volCcy24h"`
	Vol24H         types.Number `json:"vol24h"`
	Timestamp      okcoinTime   `json:"ts"`
}

WsTickerData contains formatted data for ticker related websocket responses

Jump to

Keyboard shortcuts

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