okex

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 14 Imported by: 0

README

#使用特定交易所的API可以获取更多的接口实现

var okex = NewOKEx(&goex.APIConfig{
                    	Endpoint: "https://www.okex.com",
                    	//HttpClient: &http.Client{
                    	//	Transport: &http.Transport{
                    	//		Proxy: func(req *http.Request) (*url.URL, error) {
                    	//			return &url.URL{
                    	//				Scheme: "socks5",
                    	//				Host:   "127.0.0.1:1080"}, nil
                    	//		},
                    	//	},
                    	//},
                    	ApiKey:        "",
                    	ApiSecretKey:  "",
                    	ApiPassphrase: "",
                    })
 var (
   okexSpot = okex.OKExSpot
   okexSwap = okex.OKExSwap   //永续合约实现
   okexFuture=okex.OKExFuture //交割合约实现
   okexWallet =okex.OKExWallet //资金账户(钱包)操作
   )
 
  //接口调用,更多接口调用请看代码
  log.Println(okexSpot.GetAccount()) //获取账户资产信息
  //okexSpot.BatchPlaceOrders([]goex.Order{...}) //批量下单,单个交易对同时最大只能下10笔
  log.Println(okexSwap.GetFutureUserinfo()) //获取账户权益信息
  log.Println(okexFuture.GetFutureUserinfo())//获取账户权益信息
  

Documentation

Index

Constants

View Source
const (
	/*
	  http headers
	*/
	OK_ACCESS_KEY        = "OK-ACCESS-KEY"
	OK_ACCESS_SIGN       = "OK-ACCESS-SIGN"
	OK_ACCESS_TIMESTAMP  = "OK-ACCESS-TIMESTAMP"
	OK_ACCESS_PASSPHRASE = "OK-ACCESS-PASSPHRASE"

	/**
	  paging params
	*/
	OK_FROM  = "OK-FROM"
	OK_TO    = "OK-TO"
	OK_LIMIT = "OK-LIMIT"

	CONTENT_TYPE = "Content-Type"
	ACCEPT       = "Accept"
	COOKIE       = "Cookie"
	LOCALE       = "locale="

	APPLICATION_JSON      = "application/json"
	APPLICATION_JSON_UTF8 = "application/json; charset=UTF-8"

	/*
	  i18n: internationalization
	*/
	ENGLISH            = "en_US"
	SIMPLIFIED_CHINESE = "zh_CN"
	//zh_TW || zh_HK
	TRADITIONAL_CHINESE = "zh_HK"

	/*
	  http methods
	*/
	GET    = "GET"
	POST   = "POST"
	DELETE = "DELETE"

	/*
	 others
	*/
	ResultDataJsonString = "resultDataJsonString"
	ResultPageJsonString = "resultPageJsonString"

	BTC_USD_SWAP = "BTC-USD-SWAP"
	LTC_USD_SWAP = "LTC-USD-SWAP"
	ETH_USD_SWAP = "ETH-USD-SWAP"
	ETC_USD_SWAP = "ETC-USD-SWAP"
	BCH_USD_SWAP = "BCH-USD-SWAP"
	BSV_USD_SWAP = "BSV-USD-SWAP"
	EOS_USD_SWAP = "EOS-USD-SWAP"
	XRP_USD_SWAP = "XRP-USD-SWAP"

	/*Rest Endpoint*/
	Endpoint              = "https://www.okex.com"
	GET_ACCOUNTS          = "/api/swap/v3/accounts"
	PLACE_ORDER           = "/api/swap/v3/order"
	CANCEL_ORDER          = "/api/swap/v3/cancel_order/%s/%s"
	GET_ORDER             = "/api/swap/v3/orders/%s/%s"
	GET_POSITION          = "/api/swap/v3/%s/position"
	GET_DEPTH             = "/api/swap/v3/instruments/%s/depth?size=%d"
	GET_TICKER            = "/api/swap/v3/instruments/%s/ticker"
	GET_ALL_TICKER        = "/api/swap/v3/instruments/ticker"
	GET_UNFINISHED_ORDERS = "/api/swap/v3/orders/%s?status=%d&limit=%d"
	PLACE_ALGO_ORDER      = "/api/swap/v3/order_algo"
	CANCEL_ALGO_ORDER     = "/api/swap/v3/cancel_algos"
	GET_ALGO_ORDER        = "/api/swap/v3/order_algo/%s?order_type=%d&"
)
View Source
const (
	WITHDRAWAL_OKCOIN int = 2 //提币到okcoin国际站
	WITHDRAWAL_OKEx       = 3 //提币到okex,站内提币
	WITHDRAWAL_COIN       = 4 //提币到数字货币地址,跨平台提币或者提到自己钱包
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AcctBalance added in v1.3.2

type AcctBalance struct {
	AvailBal  string `json:"availBal"`  //可用余额
	CashBal   string `json:"cashBal"`   // 币种余额
	Ccy       string `json:"ccy"`       //币种,如 BTC
	FrozenBal string `json:"frozenBal"` //币种占用金额
	OrdFrozen string `json:"ordFrozen"` //挂单冻结数量
}

type AllFutureContractInfo

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

type BaesDepthInfo

type BaesDepthInfo []interface{}

type Balance added in v1.3.2

type Balance struct {
	AvailBal  string `json:"availBal"`  //可用余额
	Bal       string `json:"bal"`       // 余额
	Ccy       string `json:"ccy"`       //币种,如 BTC
	FrozenBal string `json:"frozenBal"` //冻结(不可用)
}

type BaseCandleInfo

type BaseCandleInfo []interface{}

type BaseFillInfo

type BaseFillInfo struct {
	InstrumentId string `json:"instrument_id"`
	OrderQty     string `json:"order_qty"`
	TradeId      string `json:"trade_id"`
	Fee          string `json:"fee"`
	OrderId      string `json:"order_id"`
	Timestamp    string `json:"timestamp"`
	Price        string `json:"price"`
	Side         string `json:"side"`
	ExecType     string `json:"exec_type"`
}

type BaseHistoricalFundingRate

type BaseHistoricalFundingRate struct {
	InstrumentId string `json:"instrument_id"`
	InterestRate string `json:"interest_rate"`
	FundingRate  string `json:"funding_rate"`
	FundingTime  string `json:"funding_time"`
	RealizedRate string `json:"realized_rate"`
}

type BaseInstrumentAmount

type BaseInstrumentAmount struct {
	BizWarmTips
	InstrumentId string `json:"instrument_id"`
	Timestamp    string `json:"timestamp"`
	Amount       string `json:"amount"`
}

type BaseInstrumentInfo

type BaseInstrumentInfo struct {
	InstrumentId    string `json:"instrument_id"`
	QuoteCurrency   string `json:"quote_currency"`
	TickSize        string `json:"tick_size"`
	ContractVal     string `json:"contract_val"`
	Listing         string `json:"listing"`
	UnderlyingIndex string `json:"underlying_index"`
	Delivery        string `json:"delivery"`
	Coin            string `json:"coin"`
	SizeIncrement   string `json:"size_increment"`
}

type BaseLedgerInfo

type BaseLedgerInfo struct {
	InstrumentId string `json:"instrument_id"`
	Fee          string `json:"fee"`
	Timestamp    string `json:"timestamp"`
	Amount       string `json:"amount"`
	LedgerId     string `json:"ledger_id"`
	Type         string `json:"type"`
}

type BaseLiquidationInfo

type BaseLiquidationInfo struct {
	InstrumentId string `json:"instrument_id"`
	Loss         string `json:"loss"`
	CreatedAt    string `json:"created_at"`
	Type         string `json:"type"`
	Price        string `json:"price"`
	Size         string `json:"size"`
}

type BaseOrderInfo

type BaseOrderInfo struct {
	InstrumentId string  `json:"instrument_id"`
	Status       int     `json:"status,string"`
	OrderId      string  `json:"order_id"`
	ClientOid    string  `json:"client_oid"`
	Timestamp    string  `json:"timestamp"`
	Price        float64 `json:"price,string"`
	PriceAvg     float64 `json:"price_avg,string"`
	Size         float64 `json:"size,string"`
	Fee          float64 `json:"fee,string"`
	FilledQty    float64 `json:"filled_qty,string"`
	ContractVal  string  `json:"contract_val"`
	Type         int     `json:"type,string"`
}

type BasePlaceOrderInfo

type BasePlaceOrderInfo struct {
	ClientOid  string `json:"client_oid"`
	Price      string `json:"price"`
	MatchPrice string `json:"match_price"`
	Type       string `json:"type"`
	Size       string `json:"size"`
	OrderType  string `json:"order_type"`
}

type BaseResponse

type BaseResponse struct {
	ErrorCode    string `json:"error_code"`
	ErrorMessage string `json:"error_message"`
	Result       bool   `json:"result,string"`
}

type BaseSwapOrderResult

type BaseSwapOrderResult struct {
	OrderId      string `json:"order_id"`
	ClientOid    string `json:"client_oid"`
	ErrorMessage string `json:"error_message"`
	ErrorCode    string `json:"error_code"`
	Result       string `json:"result"`
}

type BaseTickerInfo

type BaseTickerInfo struct {
	InstrumentId string  `json:"instrument_id"`
	Last         float64 `json:"last,string"`
	Timestamp    string  `json:"timestamp"`
	High24h      float64 `json:"high_24h,string"`
	Volume24h    float64 `json:"volume_24h,string"`
	Low24h       float64 `json:"low_24h,string"`
	BestBid      float64 `json:"best_bid,string"`
	BestAsk      float64 `json:"best_ask,string"`
}

type BaseTradeInfo

type BaseTradeInfo struct {
	Timestamp string `json:"timestamp"`
	TradeId   string `json:"trade_id"`
	Side      string `json:"side"`
	Price     string `json:"price"`
	Size      string `json:"size"`
}

type BizWarmTips

type BizWarmTips struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type CrossedAccountInfo

type CrossedAccountInfo struct {
	MarginMode       string  `json:"margin_mode"`
	Equity           float64 `json:"equity,string"`
	RealizedPnl      float64 `json:"realized_pnl,string"`
	UnrealizedPnl    float64 `json:"unrealized_pnl,string"`
	MarginFrozen     float64 `json:"margin_frozen,string"`
	MarginRatio      float64 `json:"margin_ratio,string"`
	MaintMarginRatio float64 `json:"maint_margin_ratio,string"`
}

type CurrencyOKRes added in v1.3.2

type CurrencyOKRes struct {
	Ccy         string `json:"ccy"`         //币种名称,如 BTC
	Name        string `json:"name"`        //币种中文名称,不显示则无对应名称
	Chain       string `json:"chain"`       //币种链信息 有的币种下有多个链,必须要做区分,如USDT下有USDT-ERC20,USDT-TRC20,USDT-Omni多个链
	CanDep      bool   `json:"canDep"`      //是否可充值,false表示不可链上充值,true表示可以链上充值
	CanWd       bool   `json:"canWd"`       //是否可提币,false表示不可链上提币,true表示可以链上提币
	CanInternal bool   `json:"canInternal"` //是否可内部转账,false表示不可内部转账,true表示可以内部转账
	MinWd       string `json:"minWd"`       //币种最小提币量
	MinFee      string `json:"minFee"`      //最小提币手续费数量
	MaxFee      string `json:"maxFee"`      //最大提币手续费数量 获取资金账户余额 获取资金账户所有资产列
}

type DepositAddress

type DepositAddress struct {
	Address     string `json:"address"`
	Tag         string `json:"tag"`
	PaymentId   string `json:"payment_id"`
	Currency    string `json:"currency"`
	CanDeposit  int    `json:"can_deposit"`
	CanWithdraw int    `json:"can_withdraw"`
	Memo        string `json:"memo"` //eos need
}

type DepositAddressOKRes added in v1.3.2

type DepositAddressOKRes struct {
	Chain    string `json:"chain"`    //币种链信息 有的币种下有多个链,必须要做区分,如USDT下有USDT-ERC20,USDT-TRC20,USDT-Omni多个链
	CtAddr   string `json:"ctAddr"`   //合约地址后6位
	Ccy      string `json:"ccy"`      //币种,如BTC
	To       string `json:"to"`       //转入账户 1:币币 3:交割合约 6:资金账户 9:永续合约 12:期权 18:统一账户
	Selected bool   `json:"selected"` //该地址是否为页面选中的地址
	Addr     string `json:"addr"`     //充值地址
}

type FutureContractInfo

type FutureContractInfo struct {
	InstrumentID    string  `json:"instrument_id"` //合约ID:如BTC-USD-180213
	UnderlyingIndex string  `json:"underlying_index"`
	QuoteCurrency   string  `json:"quote_currency"`
	TickSize        float64 `json:"tick_size,string"` //下单价格精度
	TradeIncrement  string  `json:"trade_increment"`  //数量精度
	ContractVal     string  `json:"contract_val"`     //合约面值(美元)
	Listing         string  `json:"listing"`
	Delivery        string  `json:"delivery"` //交割日期
	Alias           string  `json:"alias"`    //	本周 this_week 次周 next_week 季度 quarter
}

合约信息

type Instrument added in v1.3.2

type Instrument struct {
	InstrumentID        string    `json:"instrument_id"`
	UnderlyingIndex     string    `json:"underlying_index"`
	QuoteCurrency       string    `json:"quote_currency"`
	Coin                string    `json:"coin"`
	ContractVal         float64   `json:"contract_val,string"`
	Listing             time.Time `json:"listing"`
	Delivery            time.Time `json:"delivery"`
	SizeIncrement       int       `json:"size_increment,string"`
	TickSize            float64   `json:"tick_size,string"`
	BaseCurrency        string    `json:"base_currency"`
	Underlying          string    `json:"underlying"`
	SettlementCurrency  string    `json:"settlement_currency"`
	IsInverse           bool      `json:"is_inverse,string"`
	ContractValCurrency string    `json:"contract_val_currency"`
}

type MarginLeverage added in v1.3.2

type MarginLeverage struct {
	LongLeverage  float64 `json:"long_leverage,string"`
	MarginMode    string  `json:"margin_mode"`
	ShortLeverage float64 `json:"short_leverage,string"`
	InstrumentId  string  `json:"instrument_id"`
}

type OKEx

type OKEx struct {
	OKExSpot        *OKExSpotV5
	OKExFuture      *OKExFuture
	OKExSwap        *OKExSwap
	OKExWallet      *OKExWallet
	OKExMargin      *OKExMargin
	OKExV3FuturesWs *OKExV3FuturesWs
	OKExV3SpotWs    *OKExV3SpotWs
	OKExV3SwapWs    *OKExV3SwapWs
	OKExAssetV5     *OKExAssetV5
	OKExWalletV5    *OKExWalletV5
	Simulated       bool
	// contains filtered or unexported fields
}

func NewOKEx

func NewOKEx(config *APIConfig) *OKEx

func (*OKEx) BuildRequestBody

func (ok *OKEx) BuildRequestBody(params interface{}) (string, *bytes.Reader, error)

Get a http request body is a json string and a byte array.

func (*OKEx) CancelOrder

func (ok *OKEx) CancelOrder(orderId string, currency CurrencyPair) (bool, error)

func (*OKEx) DoRequest

func (ok *OKEx) DoRequest(httpMethod, uri, reqBody string, response interface{}) error

func (*OKEx) GetAccount

func (ok *OKEx) GetAccount() (*Account, error)

func (*OKEx) GetDepth

func (ok *OKEx) GetDepth(size int, currency CurrencyPair) (*Depth, error)

func (*OKEx) GetExchangeName

func (ok *OKEx) GetExchangeName() string

func (*OKEx) GetKlineRecords

func (ok *OKEx) GetKlineRecords(currency CurrencyPair, period KlinePeriod, size int, optional ...OptionalParameter) ([]Kline, error)

func (*OKEx) GetOneOrder

func (ok *OKEx) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error)

func (*OKEx) GetOrderHistorys

func (ok *OKEx) GetOrderHistorys(currency CurrencyPair, opt ...OptionalParameter) ([]Order, error)

func (*OKEx) GetTicker

func (ok *OKEx) GetTicker(currency CurrencyPair) (*Ticker, error)

func (*OKEx) GetTrades

func (ok *OKEx) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*OKEx) GetUnfinishOrders

func (ok *OKEx) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)

func (*OKEx) IsoTime

func (ok *OKEx) IsoTime() string

Get a iso time

eg: 2018-03-16T18:02:48.284Z

func (*OKEx) LimitBuy

func (ok *OKEx) LimitBuy(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*OKEx) LimitSell

func (ok *OKEx) LimitSell(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*OKEx) MarketBuy

func (ok *OKEx) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)

func (*OKEx) MarketSell

func (ok *OKEx) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)

func (*OKEx) UUID

func (ok *OKEx) UUID() string

type OKExAssetV5 added in v1.3.2

type OKExAssetV5 struct {
	*OKEx
}

func (*OKExAssetV5) GetBalances added in v1.3.2

func (self *OKExAssetV5) GetBalances(ccy ...string) ([]*Balance, error)

查询余额

func (*OKExAssetV5) GetCurrencies added in v1.3.2

func (self *OKExAssetV5) GetCurrencies() ([]*CurrencyOKRes, error)

获取平台所有币种列表。并非所有币种都可被用于交易。

func (*OKExAssetV5) GetDepositAddress added in v1.3.2

func (self *OKExAssetV5) GetDepositAddress(ccy string) ([]*DepositAddressOKRes, error)

获取各个币种的充值地址,包括曾使用过的老地址。 限速: 6次/s

func (*OKExAssetV5) Transfer added in v1.3.2

func (self *OKExAssetV5) Transfer(Ccy string, Amt string, Ty string, From string, To string) (*TransferResponseV5, error)

资产划转 支持母账户的资金账户划转到交易账户,母账户到子账户的资金账户和交易账户划转。 不支持子账户和子账户之间直接划转。

func (*OKExAssetV5) Withdrawal added in v1.3.2

func (self *OKExAssetV5) Withdrawal(chain string, Ccy string, Amt string, Dest string, ToAddr string, Pwd string, Fee string) (*WithdrawalRes, error)

用户提币。 限速: 6次/s

type OKExFuture

type OKExFuture struct {
	*OKEx
	sync.Locker
	// contains filtered or unexported fields
}

func (*OKExFuture) FutureCancelOrder

func (ok *OKExFuture) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)

func (*OKExFuture) GetAccounts added in v1.3.2

func (ok *OKExFuture) GetAccounts(currencyPair CurrencyPair) (*FutureAccount, error)

func (*OKExFuture) GetAllFutureContractInfo added in v1.3.2

func (ok *OKExFuture) GetAllFutureContractInfo() ([]FutureContractInfo, error)

func (*OKExFuture) GetContractInfo added in v1.3.2

func (ok *OKExFuture) GetContractInfo(contractId string) (*FutureContractInfo, error)

func (*OKExFuture) GetContractValue

func (ok *OKExFuture) GetContractValue(currencyPair CurrencyPair) (float64, error)

func (*OKExFuture) GetDeliveryTime

func (ok *OKExFuture) GetDeliveryTime() (int, int, int, int)

func (*OKExFuture) GetExchangeName

func (ok *OKExFuture) GetExchangeName() string

func (*OKExFuture) GetFee

func (ok *OKExFuture) GetFee() (float64, error)

func (*OKExFuture) GetFutureAllTicker added in v1.3.2

func (ok *OKExFuture) GetFutureAllTicker() (*[]FutureTicker, error)

func (*OKExFuture) GetFutureContractId added in v1.3.2

func (ok *OKExFuture) GetFutureContractId(pair CurrencyPair, contractAlias string) string

func (*OKExFuture) GetFutureDepth

func (ok *OKExFuture) GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)

func (*OKExFuture) GetFutureEstimatedPrice

func (ok *OKExFuture) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)

func (*OKExFuture) GetFutureIndex

func (ok *OKExFuture) GetFutureIndex(currencyPair CurrencyPair) (float64, error)

func (*OKExFuture) GetFutureOrder

func (ok *OKExFuture) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)

func (*OKExFuture) GetFutureOrderHistory added in v1.3.2

func (ok *OKExFuture) GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)

func (*OKExFuture) GetFutureOrders

func (ok *OKExFuture) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*OKExFuture) GetFuturePosition

func (ok *OKExFuture) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)

func (*OKExFuture) GetFutureTicker

func (ok *OKExFuture) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)

func (*OKExFuture) GetFutureUserinfo

func (ok *OKExFuture) GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)

基本上已经报废,OK限制10s一次,但是基本上都会返回error:{"code":30014,"message":"Too Many Requests"} 加入currency pair救活了这个接口

func (*OKExFuture) GetKlineRecords

func (ok *OKExFuture) GetKlineRecords(contractType string, currency CurrencyPair, period KlinePeriod, size int, opt ...OptionalParameter) ([]FutureKline, error)

func (*OKExFuture) GetKlineRecordsByRange added in v1.3.2

func (ok *OKExFuture) GetKlineRecordsByRange(contractType string, currency CurrencyPair, period, since, to int) ([]FutureKline, error)

*

since : 单位秒,开始时间
to : 单位秒,结束时间

func (*OKExFuture) GetRate

func (ok *OKExFuture) GetRate() (float64, error)

获取法币汇率

func (*OKExFuture) GetTrades

func (ok *OKExFuture) GetTrades(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*OKExFuture) GetUnfinishFutureOrders

func (ok *OKExFuture) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*OKExFuture) LimitFuturesOrder added in v1.3.2

func (ok *OKExFuture) LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)

func (*OKExFuture) MarketCloseAllPosition

func (ok *OKExFuture) MarketCloseAllPosition(currency CurrencyPair, contract string, oType int) (bool, error)

特殊接口

市价全平仓
contract:合约ID
oType:平仓方向:CLOSE_SELL平空,CLOSE_BUY平多

func (*OKExFuture) MarketFuturesOrder added in v1.3.2

func (ok *OKExFuture) MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)

func (*OKExFuture) PlaceFutureOrder

func (ok *OKExFuture) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)

func (*OKExFuture) PlaceFutureOrder2

func (ok *OKExFuture) PlaceFutureOrder2(matchPrice int, ord *FutureOrder) (*FutureOrder, error)

matchPrice:是否以对手价下单(0:不是 1:是),默认为0;当取值为1时,price字段无效,当以对手价下单,order_type只能选择0:普通委托

type OKExMargin

type OKExMargin struct {
	*OKEx
}

func (*OKExMargin) Borrow

func (ok *OKExMargin) Borrow(parameter BorrowParameter) (borrowId string, err error)

*

杠杆交易区借币,
pair : 操作的交易对
currency: 需要借的币种
amount : 借的金额

func (*OKExMargin) CancelOrder

func (ok *OKExMargin) CancelOrder(orderId string, currency CurrencyPair) (bool, error)

func (*OKExMargin) GetMarginAccount

func (ok *OKExMargin) GetMarginAccount(pair CurrencyPair) (*MarginAccount, error)

func (*OKExMargin) GetOneOrder

func (ok *OKExMargin) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error)

orderId can set client oid or orderId

func (*OKExMargin) GetUnfinishOrders

func (ok *OKExMargin) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)

func (*OKExMargin) PlaceOrder

func (ok *OKExMargin) PlaceOrder(ord *Order) (*Order, error)

func (*OKExMargin) Repayment

func (ok *OKExMargin) Repayment(parameter RepaymentParameter) (repaymentId string, err error)

type OKExSpot

type OKExSpot struct {
	*OKEx
}

func (*OKExSpot) BatchPlaceOrders

func (ok *OKExSpot) BatchPlaceOrders(orders []Order) ([]PlaceOrderResponse, error)

* Must Set Client Oid

func (*OKExSpot) CancelOrder

func (ok *OKExSpot) CancelOrder(orderId string, currency CurrencyPair) (bool, error)

orderId can set client oid or orderId

func (*OKExSpot) GetAccount

func (ok *OKExSpot) GetAccount() (*Account, error)

func (*OKExSpot) GetCurrenciesPrecision added in v1.3.2

func (ok *OKExSpot) GetCurrenciesPrecision() ([]OKExSpotSymbol, error)

func (*OKExSpot) GetDepth

func (ok *OKExSpot) GetDepth(size int, currency CurrencyPair) (*Depth, error)

func (*OKExSpot) GetExchangeName

func (ok *OKExSpot) GetExchangeName() string

func (*OKExSpot) GetKlineRecords

func (ok *OKExSpot) GetKlineRecords(currency CurrencyPair, period KlinePeriod, size int, optional ...OptionalParameter) ([]Kline, error)

func (*OKExSpot) GetOneOrder

func (ok *OKExSpot) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error)

orderId can set client oid or orderId

func (*OKExSpot) GetOrderHistorys

func (ok *OKExSpot) GetOrderHistorys(currency CurrencyPair, optional ...OptionalParameter) ([]Order, error)

func (*OKExSpot) GetTicker

func (ok *OKExSpot) GetTicker(currency CurrencyPair) (*Ticker, error)

func (*OKExSpot) GetTrades

func (ok *OKExSpot) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)

非个人,整个交易所的交易记录

func (*OKExSpot) GetUnfinishOrders

func (ok *OKExSpot) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)

func (*OKExSpot) LimitBuy

func (ok *OKExSpot) LimitBuy(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*OKExSpot) LimitSell

func (ok *OKExSpot) LimitSell(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*OKExSpot) MarketBuy

func (ok *OKExSpot) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)

func (*OKExSpot) MarketSell

func (ok *OKExSpot) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)

func (*OKExSpot) PlaceOrder

func (ok *OKExSpot) PlaceOrder(ty string, ord *Order) (*Order, error)

type OKExSpotSymbol added in v1.3.2

type OKExSpotSymbol struct {
	BaseCurrency    string
	QuoteCurrency   string
	PricePrecision  float64
	AmountPrecision float64
	MinAmount       float64
	MinValue        float64
	SymbolPartition string
	Symbol          string
}

type OKExSpotV5 added in v1.3.2

type OKExSpotV5 struct {
	*OKEx
}

func (*OKExSpotV5) GetDepth added in v1.3.2

func (ok *OKExSpotV5) GetDepth(size int, currency CurrencyPair) (*Depth, error)

func (*OKExSpotV5) GetTicker added in v1.3.2

func (ok *OKExSpotV5) GetTicker(currency CurrencyPair) (*Ticker, error)

func (*OKExSpotV5) LimitBuy added in v1.3.2

func (ok *OKExSpotV5) LimitBuy(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*OKExSpotV5) LimitSell added in v1.3.2

func (ok *OKExSpotV5) LimitSell(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*OKExSpotV5) MarketBuy added in v1.3.2

func (ok *OKExSpotV5) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)

func (*OKExSpotV5) MarketSell added in v1.3.2

func (ok *OKExSpotV5) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)

func (*OKExSpotV5) PlaceOrder added in v1.3.2

func (ok *OKExSpotV5) PlaceOrder(ty string, ord *Order) (*Order, error)

type OKExSwap

type OKExSwap struct {
	*OKEx
	// contains filtered or unexported fields
}

func NewOKExSwap

func NewOKExSwap(config *APIConfig) *OKExSwap

func (*OKExSwap) AdaptTradeStatus

func (ok *OKExSwap) AdaptTradeStatus(status int) TradeStatus

func (*OKExSwap) FutureCancelAlgoOrder added in v1.3.2

func (ok *OKExSwap) FutureCancelAlgoOrder(currencyPair CurrencyPair, orderId []string) (bool, error)

委托策略撤单

func (*OKExSwap) FutureCancelOrder

func (ok *OKExSwap) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)

func (*OKExSwap) GetContractValue

func (ok *OKExSwap) GetContractValue(currencyPair CurrencyPair) (float64, error)

*

  • BTC: 100美元一张合约
  • LTC/ETH/ETC/BCH: 10美元一张合约

func (*OKExSwap) GetDeliveryTime

func (ok *OKExSwap) GetDeliveryTime() (int, int, int, int)

func (*OKExSwap) GetExchangeName

func (ok *OKExSwap) GetExchangeName() string

func (*OKExSwap) GetExchangeRate

func (ok *OKExSwap) GetExchangeRate() (float64, error)

func (*OKExSwap) GetFee

func (ok *OKExSwap) GetFee() (float64, error)

func (*OKExSwap) GetFutureAccountInfo added in v1.3.2

func (ok *OKExSwap) GetFutureAccountInfo(currency CurrencyPair) (*SwapAccountInfo, error)

func (*OKExSwap) GetFutureAlgoOrders added in v1.3.2

func (ok *OKExSwap) GetFutureAlgoOrders(algo_id string, status string, currencyPair CurrencyPair) ([]FutureOrder, error)

获取委托单列表, status和algo_id必填且只能填其一

func (*OKExSwap) GetFutureAllTicker added in v1.3.2

func (ok *OKExSwap) GetFutureAllTicker() (*[]FutureTicker, error)

func (*OKExSwap) GetFutureDepth

func (ok *OKExSwap) GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)

func (*OKExSwap) GetFutureEstimatedPrice

func (ok *OKExSwap) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)

func (*OKExSwap) GetFutureIndex

func (ok *OKExSwap) GetFutureIndex(currencyPair CurrencyPair) (float64, error)

func (*OKExSwap) GetFutureOrder

func (ok *OKExSwap) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)

*

*获取单个订单信息

func (*OKExSwap) GetFutureOrderHistory added in v1.3.2

func (ok *OKExSwap) GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)

func (*OKExSwap) GetFutureOrders

func (ok *OKExSwap) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

*

*获取订单信息

func (*OKExSwap) GetFuturePosition

func (ok *OKExSwap) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)

func (*OKExSwap) GetFutureTicker

func (ok *OKExSwap) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)

func (*OKExSwap) GetFutureUserinfo

func (ok *OKExSwap) GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)

func (*OKExSwap) GetHistoricalFunding added in v1.0.5

func (ok *OKExSwap) GetHistoricalFunding(contractType string, currencyPair CurrencyPair, page int) ([]HistoricalFunding, error)

func (*OKExSwap) GetInstruments added in v1.3.2

func (ok *OKExSwap) GetInstruments() ([]Instrument, error)

func (*OKExSwap) GetKlineRecords

func (ok *OKExSwap) GetKlineRecords(contractType string, currency CurrencyPair, period KlinePeriod, size int, opt ...OptionalParameter) ([]FutureKline, error)

func (*OKExSwap) GetKlineRecords2 added in v1.3.2

func (ok *OKExSwap) GetKlineRecords2(contractType string, currency CurrencyPair, start, end, period string) ([]FutureKline, error)

*

since : 单位秒,开始时间

func (*OKExSwap) GetKlineRecordsByRange added in v1.3.2

func (ok *OKExSwap) GetKlineRecordsByRange(currency CurrencyPair, period, since, to int) ([]FutureKline, error)

*

since : 单位秒,开始时间
to : 单位秒,结束时间

func (*OKExSwap) GetMarginLevel added in v1.3.2

func (ok *OKExSwap) GetMarginLevel(currencyPair CurrencyPair) (*MarginLeverage, error)

func (*OKExSwap) GetTrades

func (ok *OKExSwap) GetTrades(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*OKExSwap) GetUnfinishFutureOrders

func (ok *OKExSwap) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*OKExSwap) LimitFuturesOrder added in v1.3.2

func (ok *OKExSwap) LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)

func (*OKExSwap) MarketFuturesOrder added in v1.3.2

func (ok *OKExSwap) MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)

func (*OKExSwap) PlaceFutureAlgoOrder added in v1.3.2

func (ok *OKExSwap) PlaceFutureAlgoOrder(ord *FutureOrder) (*FutureOrder, error)

委托策略下单 algo_type 1:限价 2:市场价;触发价格类型,默认是限价;为市场价时,委托价格不必填;

func (*OKExSwap) PlaceFutureOrder

func (ok *OKExSwap) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)

func (*OKExSwap) PlaceFutureOrder2 added in v1.3.2

func (ok *OKExSwap) PlaceFutureOrder2(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)

func (*OKExSwap) SetMarginLevel added in v1.3.2

func (ok *OKExSwap) SetMarginLevel(currencyPair CurrencyPair, level, marginMode int) (*MarginLeverage, error)

marginmode 1:逐仓-多仓 2:逐仓-空仓 3:全仓

type OKExV3FuturesWs added in v1.3.2

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

func NewOKExV3FuturesWs added in v1.3.2

func NewOKExV3FuturesWs(base *OKEx) *OKExV3FuturesWs

func (*OKExV3FuturesWs) DepthCallback added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) DepthCallback(depthCallback func(*Depth))

func (*OKExV3FuturesWs) KlineCallback added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) KlineCallback(klineCallback func(*FutureKline, int))

func (*OKExV3FuturesWs) SetCallbacks added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) SetCallbacks(tickerCallback func(*FutureTicker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade, string),
	klineCallback func(*FutureKline, int))

func (*OKExV3FuturesWs) SubscribeDepth added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) SubscribeDepth(currencyPair CurrencyPair, contractType string) error

func (*OKExV3FuturesWs) SubscribeKline added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) SubscribeKline(currencyPair CurrencyPair, contractType string, period int) error

func (*OKExV3FuturesWs) SubscribeTicker added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) SubscribeTicker(currencyPair CurrencyPair, contractType string) error

func (*OKExV3FuturesWs) SubscribeTrade added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) SubscribeTrade(currencyPair CurrencyPair, contractType string) error

func (*OKExV3FuturesWs) TickerCallback added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) TickerCallback(tickerCallback func(*FutureTicker))

func (*OKExV3FuturesWs) TradeCallback added in v1.3.2

func (okV3Ws *OKExV3FuturesWs) TradeCallback(tradeCallback func(*Trade, string))

type OKExV3SpotWs added in v1.3.2

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

func NewOKExSpotV3Ws added in v1.3.2

func NewOKExSpotV3Ws(base *OKEx) *OKExV3SpotWs

func (*OKExV3SpotWs) DepthCallback added in v1.3.2

func (okV3Ws *OKExV3SpotWs) DepthCallback(depthCallback func(*Depth))

func (*OKExV3SpotWs) KLineCallback added in v1.3.2

func (okV3Ws *OKExV3SpotWs) KLineCallback(klineCallback func(kline *Kline, period KlinePeriod))

func (*OKExV3SpotWs) SetCallbacks added in v1.3.2

func (okV3Ws *OKExV3SpotWs) SetCallbacks(tickerCallback func(*Ticker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade),
	klineCallback func(*Kline, KlinePeriod))

func (*OKExV3SpotWs) SubscribeDepth added in v1.3.2

func (okV3Ws *OKExV3SpotWs) SubscribeDepth(currencyPair CurrencyPair) error

func (*OKExV3SpotWs) SubscribeKline added in v1.3.2

func (okV3Ws *OKExV3SpotWs) SubscribeKline(currencyPair CurrencyPair, period int) error

func (*OKExV3SpotWs) SubscribeTicker added in v1.3.2

func (okV3Ws *OKExV3SpotWs) SubscribeTicker(currencyPair CurrencyPair) error

func (*OKExV3SpotWs) SubscribeTrade added in v1.3.2

func (okV3Ws *OKExV3SpotWs) SubscribeTrade(currencyPair CurrencyPair) error

func (*OKExV3SpotWs) TickerCallback added in v1.3.2

func (okV3Ws *OKExV3SpotWs) TickerCallback(tickerCallback func(*Ticker))

func (*OKExV3SpotWs) TradeCallback added in v1.3.2

func (okV3Ws *OKExV3SpotWs) TradeCallback(tradeCallback func(*Trade))

type OKExV3SwapWs added in v1.3.2

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

func NewOKExV3SwapWs added in v1.3.2

func NewOKExV3SwapWs(base *OKEx) *OKExV3SwapWs

func (*OKExV3SwapWs) DepthCallback added in v1.3.2

func (okV3Ws *OKExV3SwapWs) DepthCallback(depthCallback func(*Depth))

func (*OKExV3SwapWs) KlineCallback added in v1.3.2

func (okV3Ws *OKExV3SwapWs) KlineCallback(klineCallback func(*FutureKline, int))

func (*OKExV3SwapWs) SetCallbacks added in v1.3.2

func (okV3Ws *OKExV3SwapWs) SetCallbacks(tickerCallback func(*FutureTicker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade, string),
	klineCallback func(*FutureKline, int))

func (*OKExV3SwapWs) SubscribeDepth added in v1.3.2

func (okV3Ws *OKExV3SwapWs) SubscribeDepth(currencyPair CurrencyPair, contractType string) error

func (*OKExV3SwapWs) SubscribeKline added in v1.3.2

func (okV3Ws *OKExV3SwapWs) SubscribeKline(currencyPair CurrencyPair, contractType string, period int) error

func (*OKExV3SwapWs) SubscribeTicker added in v1.3.2

func (okV3Ws *OKExV3SwapWs) SubscribeTicker(currencyPair CurrencyPair, contractType string) error

func (*OKExV3SwapWs) SubscribeTrade added in v1.3.2

func (okV3Ws *OKExV3SwapWs) SubscribeTrade(currencyPair CurrencyPair, contractType string) error

func (*OKExV3SwapWs) TickerCallback added in v1.3.2

func (okV3Ws *OKExV3SwapWs) TickerCallback(tickerCallback func(*FutureTicker))

func (*OKExV3SwapWs) TradeCallback added in v1.3.2

func (okV3Ws *OKExV3SwapWs) TradeCallback(tradeCallback func(*Trade, string))

type OKExV3Ws added in v1.3.2

type OKExV3Ws struct {
	*WsBuilder

	WsConn *WsConn
	// contains filtered or unexported fields
}

func NewOKExV3Ws added in v1.3.2

func NewOKExV3Ws(base *OKEx, handle func(channel string, data json.RawMessage) error) *OKExV3Ws

func (*OKExV3Ws) ConnectWs added in v1.3.2

func (okV3Ws *OKExV3Ws) ConnectWs()

func (*OKExV3Ws) Subscribe added in v1.3.2

func (okV3Ws *OKExV3Ws) Subscribe(sub map[string]interface{}) error

type OKExWallet

type OKExWallet struct {
	*OKEx
}

func (*OKExWallet) GetAccount

func (ok *OKExWallet) GetAccount() (*Account, error)

func (*OKExWallet) GetDepositAddress

func (ok *OKExWallet) GetDepositAddress(currency Currency) ([]DepositAddress, error)

func (*OKExWallet) GetDepositHistory

func (ok *OKExWallet) GetDepositHistory(currency *Currency) ([]DepositWithdrawHistory, error)

func (*OKExWallet) GetWithDrawHistory added in v1.3.2

func (ok *OKExWallet) GetWithDrawHistory(currency *Currency) ([]DepositWithdrawHistory, error)

func (*OKExWallet) GetWithDrawalFee

func (ok *OKExWallet) GetWithDrawalFee(currency *Currency) ([]WithdrawFee, error)

func (*OKExWallet) Transfer

func (ok *OKExWallet) Transfer(param TransferParameter) error
解释说明

from或to指定为0时,sub_account为必填项。

当from为0时,to只能填6,即子账户的资金账户只能转到母账户的资金账户。

当from指定为6,to指定为1-9,且sub_account填写子账户名时,可从母账户直接划转至子账户对应的币币、合约等账户。

from或to指定为5时,instrument_id为必填项。

func (*OKExWallet) Withdrawal

func (ok *OKExWallet) Withdrawal(param WithdrawParameter) (withdrawId string, err error)

认证过的数字货币地址、邮箱或手机号。某些数字货币地址格式为:地址+标签,例:"ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456"

type OKExWalletV5 added in v1.3.2

type OKExWalletV5 struct {
	*OKEx
}

func (*OKExWalletV5) GetAccountBalance added in v1.3.2

func (ok *OKExWalletV5) GetAccountBalance(ccy ...string) ([]*AcctBalance, error)

type OKRes added in v1.3.2

type OKRes struct {
	Code string      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type OrderParamV5 added in v1.3.2

type OrderParamV5 struct {
	InstId     string `json:"instId"` //产品ID
	TdMode     string `json:"tdMode"`
	Ccy        string `json:"ccy"`
	ClOrdId    string `json:"clOrdId"`
	Tag        string `json:"tag"`
	Side       string `json:"side"` //订单方向 buy:买 sell:卖
	PosSide    string `json:"posSide"`
	OrdType    string `json:"ordType"` //
	Sz         string `json:"sz"`      //委托数量
	Px         string `json:"px"`      //委托价格,
	ReduceOnly bool   `json:"reduceOnly"`
	TgtCcy     string `json:"tgtCcy"` //委托数量的类型 base_ccy:交易货币 ;quote_ccy:计价货币 仅适用于币币订单
}

OrdType 订单类型 market:市价单 limit:限价单 post_only:只做maker单 fok:全部成交或立即取消 ioc:立即成交并取消剩余 optimal_limit_ioc:市价委托立即成交并取消剩余(仅适用交割、永续)

type OrderResponse

type OrderResponse struct {
	InstrumentId   string  `json:"instrument_id"`
	ClientOid      string  `json:"client_oid"`
	OrderId        string  `json:"order_id"`
	Price          string  `json:"price,omitempty"`
	Size           float64 `json:"size,string"`
	Notional       string  `json:"notional"`
	Side           string  `json:"side"`
	Type           string  `json:"type"`
	FilledSize     string  `json:"filled_size"`
	FilledNotional string  `json:"filled_notional"`
	PriceAvg       string  `json:"price_avg"`
	State          int     `json:"state,string"`
	Fee            string  `json:"fee"`
	OrderType      int     `json:"order_type,string"`
	Timestamp      string  `json:"timestamp"`
}

type OrderResponseV5 added in v1.3.2

type OrderResponseV5 struct {
	InstType    string `json:"instType"`
	InstId      string `json:"instId"`
	TgtCcy      string `json:"tgtCcy"`
	Ccy         string `json:"ccy"`
	OrdId       string `json:"ordId"`
	ClOrdId     string `json:"clOrdId"`
	Tag         string `json:"tag"`
	Px          string `json:"px"`
	Sz          string `json:"sz"`
	Pnl         string `json:"pnl"`
	OrdType     string `json:"ordType"`
	Side        int    `json:"side"`
	PosSide     string `json:"posSide"`
	TdMode      int    `json:"tdMode"`
	AccFillSz   string `json:"accFillSz"`
	FillPx      string `json:"fillPx"`
	TradeId     string `json:"tradeId"`
	FillSz      string `json:"fillSz"`
	FillTime    string `json:"fillTime"`
	AvgPx       string `json:"avgPx"`
	State       string `json:"state"`
	Lever       string `json:"lever"`
	TpTriggerPx string `json:"tpTriggerPx"`
	TpOrdPx     string `json:"tpOrdPx"`
	SlTriggerPx string `json:"slTriggerPx"`
	SlOrdPx     string `json:"slOrdPx"`
	FeeCcy      string `json:"feeCcy"`
	Fee         string `json:"fee"`
	RebateCcy   string `json:"rebateCcy"`
	Rebate      string `json:"rebate"`
	Category    string `json:"category"`
	UTime       string `json:"uTime"`
	CTime       string `json:"cTime"`
}

type PlaceOrderInfo

type PlaceOrderInfo struct {
	BasePlaceOrderInfo
	InstrumentId string `json:"instrument_id"`
}

type PlaceOrderParam

type PlaceOrderParam struct {
	ClientOid     string  `json:"client_oid"`
	Type          string  `json:"type"`
	Side          string  `json:"side"`
	InstrumentId  string  `json:"instrument_id"`
	OrderType     int     `json:"order_type"`
	Price         float64 `json:"price"`
	Size          float64 `json:"size"`
	Notional      float64 `json:"notional"`
	MarginTrading string  `json:"margin_trading,omitempty"`
}

type PlaceOrderResponse

type PlaceOrderResponse struct {
	OrderId      string `json:"order_id"`
	ClientOid    string `json:"client_oid"`
	Result       bool   `json:"result"`
	ErrorCode    string `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type PlaceOrderResponseV5 added in v1.3.2

type PlaceOrderResponseV5 struct {
	OrdId   string `json:"ordId"`
	ClOrdId string `json:"clOrdId"`
	Tag     string `json:"tag"`
	SCode   string `json:"sCode"`
	SMsg    string `json:"sMsg"`
}

type PlaceOrdersInfo

type PlaceOrdersInfo struct {
	InstrumentId string                `json:"instrument_id"`
	OrderData    []*BasePlaceOrderInfo `json:"order_data"`
}

type SwapAccountHolds

type SwapAccountHolds BaseInstrumentAmount

type SwapAccountInfo

type SwapAccountInfo struct {
	InstrumentId      string  `json:"instrument_id"`
	Timestamp         string  `json:"timestamp"`
	MarginFrozen      float64 `json:"margin_frozen,string"`
	TotalAvailBalance float64 `json:"total_avail_balance,string"`
	MarginRatio       float64 `json:"margin_ratio,string"`
	RealizedPnl       float64 `json:"realized_pnl,string"`
	UnrealizedPnl     float64 `json:"unrealized_pnl,string"`
	FixedBalance      float64 `json:"fixed_balance,string"`
	Equity            float64 `json:"equity,string"`
	Margin            float64 `json:"margin,string"`
	MarginMode        string  `json:"margin_mode"`
}

type SwapAccounts

type SwapAccounts struct {
	BizWarmTips
	Info []SwapAccountInfo `json:"info"`
}

type SwapAccountsLedgerList

type SwapAccountsLedgerList []BaseLedgerInfo

type SwapAccountsSetting

type SwapAccountsSetting struct {
	BizWarmTips
	InstrumentId  string `json:"instrument_id"`
	LongLeverage  string `json:"long_leverage"`
	ShortLeverage string `json:"short_leverage"`
	MarginMode    string `json:"margin_mode"`
}

type SwapBatchCancelOrderResult

type SwapBatchCancelOrderResult struct {
	BizWarmTips
	InstrumentId string   `json:"instrument_id"`
	Ids          []string `json:"ids"`
	Result       string   `json:"result"`
}

type SwapCancelOrderResult

type SwapCancelOrderResult struct {
	ErrorMessage string `json:"error_message"`
	ErrorCode    string `json:"error_code"`
	OrderId      string `json:"order_id"`
	Result       bool   `json:"result,string"`
}

type SwapCandleList

type SwapCandleList []BaseCandleInfo

type SwapFillsInfo

type SwapFillsInfo struct {
	BizWarmTips
	FillInfo []*BaseFillInfo `json:"fill_info"`
}

type SwapFundingTime

type SwapFundingTime struct {
	BizWarmTips
	InstrumentId string `json:"instrument_id"`
	FundingTime  string `json:"funding_time"`
}

type SwapHistoricalFundingRateList

type SwapHistoricalFundingRateList []BaseHistoricalFundingRate

type SwapIndexInfo

type SwapIndexInfo struct {
	BizWarmTips
	InstrumentId string `json:"instrument_id"`
	Index        string `json:"index"`
	Timestamp    string `json:"timestamp"`
}

type SwapInstrumentDepth

type SwapInstrumentDepth struct {
	BizWarmTips
	Timestamp string          `json:"time"`
	Bids      []BaesDepthInfo `json:"bids"`
	Asks      []BaesDepthInfo `json:"asks"`
}

type SwapInstrumentList

type SwapInstrumentList []BaseInstrumentInfo

type SwapLiquidationList

type SwapLiquidationList []BaseLiquidationInfo

type SwapMarkPrice

type SwapMarkPrice struct {
	BizWarmTips
	InstrumentId string `json:"instrument_id"`
	MarkPrice    string `json:"mark_price"`
	Timestamp    string `json:"timestamp"`
}

type SwapOpenInterest

type SwapOpenInterest BaseInstrumentAmount

type SwapOrderResult

type SwapOrderResult struct {
	BaseSwapOrderResult
	BizWarmTips
}

type SwapOrdersInfo

type SwapOrdersInfo struct {
	BizWarmTips
	OrderInfo []BaseOrderInfo `json:"order_info"`
}

type SwapOrdersResult

type SwapOrdersResult struct {
	BizWarmTips
	OrderInfo []BaseSwapOrderResult `json:"order_info"`
}

type SwapPosition

type SwapPosition struct {
	BizWarmTips
	MarginMode string                `json:"margin_mode"`
	Holding    []SwapPositionHolding `json:"holding"`
}

type SwapPositionHolding

type SwapPositionHolding struct {
	LiquidationPrice float64 `json:"liquidation_price , string"`
	Position         float64 `json:"position,string"`
	AvailPosition    float64 `json:"avail_position,string"`
	AvgCost          float64 `json:"avg_cost,string"`
	SettlementPrice  float64 `json:"settlement_price,string"`
	InstrumentId     string  `json:"instrument_id"`
	Leverage         string  `json:"leverage"`
	RealizedPnl      float64 `json:"realized_pnl,string"`
	Side             string  `json:"side"`
	Timestamp        string  `json:"timestamp"`
	Margin           string  `json:"margin";default:""`
}

type SwapPriceLimit

type SwapPriceLimit struct {
	BizWarmTips
	InstrumentId string `json:"instrument_id"`
	Lowest       string `json:"lowest"`
	Highest      string `json:"highest"`
	Timestamp    string `json:"timestamp"`
}

type SwapRate

type SwapRate struct {
	InstrumentId string `json:"instrument_id"`
	Timestamp    string `json:"timestamp"`
	Rate         string `json:"rate"`
}

type SwapTickerList

type SwapTickerList []BaseTickerInfo

type SwapTradeList

type SwapTradeList []BaseTradeInfo

type TransferParamV5 added in v1.3.2

type TransferParamV5 struct {
	Ccy  string `json:"ccy"`  //币种,如 USDT
	Amt  string `json:"amt"`  //划转数量
	Ty   string `json:"type"` //0:账户内划转 1:母账户转子账户 2:子账户转母账户 默认为0。
	From string `json:"from"` //转出账户 1:币币账户 3:交割合约 5:币币杠杆账户 6:资金账户 9:永续合约账户 12:期权合约 18:统一账户
	To   string `json:"to"`   //转入账户 1:币币账户 3:交割合约 5:币币杠杆账户 6:资金账户 9:永续合约账户 12:期权合约 18:统一账户
}

type TransferResponseV5 added in v1.3.2

type TransferResponseV5 struct {
	TransId string `json:"transId"` //划转 ID
	Ccy     string `json:"ccy"`     //币种,如 USDT
	Amt     string `json:"amt"`     //划转数量
	From    string `json:"from"`    //转出账户 1:币币账户 3:交割合约 5:币币杠杆账户 6:资金账户 9:永续合约账户 12:期权合约 18:统一账户
	To      string `json:"to"`      //转入账户 1:币币账户 3:交割合约 5:币币杠杆账户 6:资金账户 9:永续合约账户 12:期权合约 18:统一账户
}

type WithdrawFee

type WithdrawFee struct {
	Currency string `json:"currency"`
	MaxFee   string `json:"max_fee"`
	MinFee   string `json:"min_fee"`
}

type WithdrawalParam added in v1.3.2

type WithdrawalParam struct {
	Ccy    string `json:"ccy"`    //	币种,如 USDT
	Chain  string `json:"chain"`  //	链
	Amt    string `json:"amt"`    //	数量
	Dest   string `json:"dest"`   //	提币到 3:欧易OKEx 4:数字货币地址
	ToAddr string `json:"toAddr"` //	认证过的数字货币地址、邮箱或手机号。 某些数字货币地址格式为:地址+标签,如 ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456
	Pwd    string `json:"pwd"`    //	交易密码
	Fee    string `json:"fee"`    //	网络手续费≥0,提币到数字货币地址所需网络手续费可通过获取币种列表接口查询
}

type WithdrawalRes added in v1.3.2

type WithdrawalRes struct {
	Ccy   string `json:"ccy"`   //	币种,如 USDT
	Chain string `json:"chain"` //	链
	Amt   string `json:"amt"`   //	数量
	WdId  string `json:"wdId"`  //	提币申请ID
}

Jump to

Keyboard shortcuts

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