Documentation ¶
Index ¶
- Constants
- func GetDueTimestamp(timestamp int64) (flag int, dueTimestamp map[string]int64)
- func GetRealContractTypeBoard() map[string][]string
- type DepositAddress
- type DepositWithDrawHistory
- type Future
- func (future *Future) CancelOrder(order *FutureOrder) ([]byte, error)
- func (future *Future) GetAccount() (*FutureAccount, []byte, error)
- func (future *Future) GetContract(pair Pair, contractType string) (*FutureContract, error)
- func (future *Future) GetDepth(pair Pair, contractType string, size int) (*FutureDepth, []byte, error)
- func (future *Future) GetExchangeName() string
- func (future *Future) GetIndex(pair Pair) (float64, []byte, error)
- func (future *Future) GetInstrumentId(pair Pair, contractAlias string) string
- func (future *Future) GetKlineRecords(contractType string, pair Pair, period, size, since int) ([]*FutureKline, []byte, error)
- func (future *Future) GetLimit(pair Pair, contractType string) (float64, float64, error)
- func (future *Future) GetMark(pair Pair, contractType string) (float64, []byte, error)
- func (future *Future) GetOrder(order *FutureOrder) ([]byte, error)
- func (future *Future) GetOrders(pair Pair, contractType string) ([]*FutureOrder, []byte, error)
- func (future *Future) GetPairFlow(pair Pair) ([]*FutureAccountItem, []byte, error)
- func (future *Future) GetTicker(pair Pair, contractType string) (*FutureTicker, []byte, error)
- func (future *Future) GetTrades(pair Pair, contractType string) ([]*Trade, []byte, error)
- func (future *Future) KeepAlive()
- func (future *Future) PlaceOrder(order *FutureOrder) ([]byte, error)
- type Margin
- func (margin *Margin) CancelOrder(order *Order) ([]byte, error)
- func (margin *Margin) GetAccount(pair Pair) (*MarginAccount, []byte, error)
- func (margin *Margin) GetDepth(pair Pair, size int) (*Depth, []byte, error)
- func (margin *Margin) GetExchangeRule(pair Pair) (*Rule, []byte, error)
- func (margin *Margin) GetKlineRecords(pair Pair, period, size, since int) ([]*Kline, []byte, error)
- func (margin *Margin) GetLoan(loan *Loan) ([]byte, error)
- func (margin *Margin) GetOrder(order *Order) ([]byte, error)
- func (margin *Margin) GetOrders(pair Pair) ([]*Order, error)
- func (margin *Margin) GetTicker(pair Pair) (*Ticker, []byte, error)
- func (margin *Margin) GetUnFinishOrders(pair Pair) ([]*Order, []byte, error)
- func (margin *Margin) KeepAlive()
- func (margin *Margin) PlaceLoan(loan *Loan) ([]byte, error)
- func (margin *Margin) PlaceOrder(order *Order) ([]byte, error)
- func (margin *Margin) ReturnLoan(loan *Loan) ([]byte, error)
- type OKEx
- func (ok *OKEx) BuildRequestBody(params interface{}) (string, *bytes.Reader, error)
- func (ok *OKEx) ContractTimestamp(timestamp int64, contractType string) (startTimestamp int64, swapTimestamp int64, dueTimestamp int64)
- func (ok *OKEx) DoRequest(httpMethod, uri, reqBody string, response interface{}) ([]byte, error)
- func (ok *OKEx) DoRequestMarket(httpMethod, uri, reqBody string, response interface{}) ([]byte, error)
- func (ok *OKEx) GetExchangeName() string
- func (ok *OKEx) IsoTime() string
- type OKexFutureWebsocket
- func (this *OKexFutureWebsocket) Close()
- func (this *OKexFutureWebsocket) Init()
- func (this *OKexFutureWebsocket) Login(config *APIConfig) error
- func (this *OKexFutureWebsocket) Start()
- func (this *OKexFutureWebsocket) Subscribe(channel string) error
- func (this *OKexFutureWebsocket) Unsubscribe(channel string) error
- type OrderResponse
- type PlaceOrderParam
- type Spot
- func (spot *Spot) CancelOrder(order *Order) ([]byte, error)
- func (spot *Spot) GetAccount() (*Account, []byte, error)
- func (spot *Spot) GetDepth(pair Pair, size int) (*Depth, []byte, error)
- func (spot *Spot) GetExchangeRule(pair Pair) (*Rule, []byte, error)
- func (spot *Spot) GetKlineRecords(pair Pair, period, size, since int) ([]*Kline, []byte, error)
- func (spot *Spot) GetOrder(order *Order) ([]byte, error)
- func (spot *Spot) GetOrders(pair Pair) ([]*Order, error)
- func (spot *Spot) GetTicker(pair Pair) (*Ticker, []byte, error)
- func (spot *Spot) GetTrades(pair Pair, since int64) ([]*Trade, error)
- func (spot *Spot) GetUnFinishOrders(pair Pair) ([]*Order, []byte, error)
- func (spot *Spot) KeepAlive()
- func (spot *Spot) PlaceOrder(order *Order) ([]byte, error)
- type Swap
- func (swap *Swap) AddMargin(pair Pair, openType FutureType, marginAmount float64) ([]byte, error)
- func (swap *Swap) CancelOrder(order *SwapOrder) ([]byte, error)
- func (swap *Swap) GetAccount() (*SwapAccount, []byte, error)
- func (swap *Swap) GetAccountFlow() ([]*SwapAccountItem, []byte, error)
- func (swap *Swap) GetContract(pair Pair) *SwapContract
- func (swap *Swap) GetDepth(pair Pair, size int) (*SwapDepth, []byte, error)
- func (swap *Swap) GetFundingFee(pair Pair) (float64, error)
- func (swap *Swap) GetFundingFees(pair Pair) ([][]interface{}, []byte, error)
- func (swap *Swap) GetKline(pair Pair, period, size, since int) ([]*SwapKline, []byte, error)
- func (swap *Swap) GetLimit(pair Pair) (float64, float64, error)
- func (swap *Swap) GetOpenAmount(pair Pair) (float64, int64, []byte, error)
- func (swap *Swap) GetOrder(order *SwapOrder) ([]byte, error)
- func (swap *Swap) GetOrders(pair Pair) ([]*SwapOrder, []byte, error)
- func (swap *Swap) GetPairFlow(pair Pair) ([]*SwapAccountItem, []byte, error)
- func (swap *Swap) GetPosition(pair Pair, openType FutureType) (*SwapPosition, []byte, error)
- func (swap *Swap) GetTicker(pair Pair) (*SwapTicker, []byte, error)
- func (swap *Swap) GetUnFinishOrders(pair Pair) ([]*SwapOrder, []byte, error)
- func (swap *Swap) KeepAlive()
- func (swap *Swap) PlaceOrder(order *SwapOrder) ([]byte, error)
- func (swap *Swap) ReduceMargin(pair Pair, openType FutureType, marginAmount float64) ([]byte, error)
- type TransferParameter
- type Wallet
- func (ok *Wallet) GetAccount() (*Account, []byte, error)
- func (ok *Wallet) GetDepositAddress(currency Currency) ([]DepositAddress, []byte, error)
- func (ok *Wallet) GetDepositHistory(currency *Currency) ([]DepositWithDrawHistory, []byte, error)
- func (ok *Wallet) GetWithDrawalFee(currency *Currency) ([]WithdrawFee, []byte, error)
- func (ok *Wallet) GetWithDrawalHistory(currency *Currency) ([]DepositWithDrawHistory, []byte, error)
- func (ok *Wallet) Transfer(param TransferParameter) error
- func (ok *Wallet) Withdrawal(param WithdrawParameter) (withdrawId string, resp []byte, err error)
- type WithdrawFee
- type WithdrawParameter
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_UNFINISHED_ORDERS = "/api/swap/v3/orders/%s?status=%d&from=%d&limit=%d" )
View Source
const ( SUB_ACCOUNT = iota //子账户 SPOT // 币币交易 FUTURE //交割合约 C2C //法币 SPOT_MARGIN //币币杠杆交易 WALLET // 资金账户 TIPS //余币宝 SWAP //永续合约 OPTION //期权 )
View Source
const ( WITHDRAWAL_OKCOIN int = 2 //提币到okcoin国际站 WITHDRAWAL_OKEx = 3 //提币到okex,站内提币 WITHDRAWAL_COIN = 4 //提币到数字货币地址,跨平台提币或者提到自己钱包 )
Variables ¶
This section is empty.
Functions ¶
func GetDueTimestamp ¶
Types ¶
type DepositAddress ¶
type DepositWithDrawHistory ¶
type DepositWithDrawHistory struct { WithdrawalId string `json:"withdrawal_id,omitempty"` Currency string `json:"currency"` Txid string `json:"txid"` Amount float64 `json:"amount,string"` From string `json:"from,omitempty"` To string `json:"to"` Memo string `json:"memo,omitempty"` Fee string `json:"fee"` Status int `json:"status,string"` Timestamp time.Time `json:"timestamp"` }
type Future ¶
type Future struct { *OKEx Contracts FutureContracts Locker sync.Locker // contains filtered or unexported fields }
func (*Future) CancelOrder ¶
func (*Future) GetAccount ¶
func (*Future) GetContract ¶
func (*Future) GetExchangeName ¶
func (*Future) GetInstrumentId ¶
获取instrument_id
func (*Future) GetKlineRecords ¶
func (future *Future) GetKlineRecords( contractType string, pair Pair, period, size, since int, ) ([]*FutureKline, []byte, error)
*
- since : 单位毫秒,开始时间
*
func (*Future) GetPairFlow ¶
func (*Future) PlaceOrder ¶
type Margin ¶
type Margin struct {
*OKEx
}
func (*Margin) CancelOrder ¶
func (*Margin) GetAccount ¶
private api
func (*Margin) GetExchangeRule ¶
func (*Margin) GetKlineRecords ¶
func (*Margin) GetUnFinishOrders ¶
func (*Margin) PlaceOrder ¶
func (*Margin) ReturnLoan ¶
type OKEx ¶
type OKEx struct { Spot *Spot Margin *Margin Swap *Swap Future *Future Wallet *Wallet // contains filtered or unexported fields }
func (*OKEx) BuildRequestBody ¶
Get a http request body is a json string and a byte array.
func (*OKEx) ContractTimestamp ¶
func (*OKEx) DoRequestMarket ¶
func (*OKEx) GetExchangeName ¶
type OKexFutureWebsocket ¶
type OKexFutureWebsocket struct {
// contains filtered or unexported fields
}
func (*OKexFutureWebsocket) Close ¶
func (this *OKexFutureWebsocket) Close()
func (*OKexFutureWebsocket) Init ¶
func (this *OKexFutureWebsocket) Init()
func (*OKexFutureWebsocket) Login ¶
func (this *OKexFutureWebsocket) Login(config *APIConfig) error
func (*OKexFutureWebsocket) Start ¶
func (this *OKexFutureWebsocket) Start()
func (*OKexFutureWebsocket) Subscribe ¶
func (this *OKexFutureWebsocket) Subscribe(channel string) error
func (*OKexFutureWebsocket) Unsubscribe ¶
func (this *OKexFutureWebsocket) Unsubscribe(channel string) error
type OrderResponse ¶
type OrderResponse struct { ClientOid string `json:"client_oid"` OrderId string `json:"order_id"` Price float64 `json:"price,string"` 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"` OrderType int `json:"order_type,string"` Timestamp string `json:"timestamp"` }
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 Spot ¶
type Spot struct {
*OKEx
}
func (*Spot) CancelOrder ¶
orderId can set client oid or orderId
func (*Spot) GetExchangeRule ¶
func (*Spot) GetKlineRecords ¶
func (*Spot) GetUnFinishOrders ¶
func (*Spot) PlaceOrder ¶
type Swap ¶
func (*Swap) CancelOrder ¶
func (*Swap) GetAccount ¶
func (*Swap) GetAccountFlow ¶
func (*Swap) GetContract ¶
func (swap *Swap) GetContract(pair Pair) *SwapContract
func (*Swap) GetFundingFee ¶
func (*Swap) GetFundingFees ¶
func (*Swap) GetOpenAmount ¶
func (*Swap) GetPairFlow ¶
func (*Swap) GetPosition ¶
func (*Swap) GetUnFinishOrders ¶
func (*Swap) PlaceOrder ¶
type TransferParameter ¶
type Wallet ¶
type Wallet struct {
*OKEx
}
func (*Wallet) GetAccount ¶
func (*Wallet) GetDepositAddress ¶
func (ok *Wallet) GetDepositAddress(currency Currency) ([]DepositAddress, []byte, error)
func (*Wallet) GetDepositHistory ¶
func (ok *Wallet) GetDepositHistory(currency *Currency) ([]DepositWithDrawHistory, []byte, error)
func (*Wallet) GetWithDrawalFee ¶
func (ok *Wallet) GetWithDrawalFee(currency *Currency) ([]WithdrawFee, []byte, error)
func (*Wallet) GetWithDrawalHistory ¶
func (ok *Wallet) GetWithDrawalHistory(currency *Currency) ([]DepositWithDrawHistory, []byte, error)
func (*Wallet) Transfer ¶
func (ok *Wallet) 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 (*Wallet) Withdrawal ¶
func (ok *Wallet) Withdrawal(param WithdrawParameter) (withdrawId string, resp []byte, err error)
认证过的数字货币地址、邮箱或手机号。某些数字货币地址格式为:地址+标签,例:"ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456"
type WithdrawFee ¶
Click to show internal directories.
Click to hide internal directories.