Documentation ¶
Index ¶
- type ActualContractDepth
- type ActualContractTradeHistory
- type ActualSpotDepth
- type ActualSpotTradeHistory
- type CandleStickData
- type ContractDepth
- type ContractPrice
- type FuturePosition
- type FutureTradeHistory
- type HoldData
- type Info
- type OKEX
- func (o *OKEX) CheckContractPosition(position string) error
- func (o *OKEX) CheckContractType(contractType string) error
- func (o *OKEX) CheckSymbol(symbol string) error
- func (o *OKEX) CheckType(typeInput string) error
- func (o *OKEX) GetContractCandlestickData(symbol, typeInput, contractType string, size, since int) ([]CandleStickData, error)
- func (o *OKEX) GetContractExchangeRate() (float64, error)
- func (o *OKEX) GetContractFutureEstimatedPrice(symbol string) (float64, error)
- func (o *OKEX) GetContractFuturesTradeHistory(symbol, date string, since int) error
- func (o *OKEX) GetContractHoldingsNumber(symbol, contractType string) (map[string]float64, error)
- func (o *OKEX) GetContractIndexPrice(symbol string) (float64, error)
- func (o *OKEX) GetContractMarketDepth(symbol, contractType string) (ActualContractDepth, error)
- func (o *OKEX) GetContractPosition(symbol, contractType string) error
- func (o *OKEX) GetContractPrice(symbol, contractType string) (ContractPrice, error)
- func (o *OKEX) GetContractTradeHistory(symbol, contractType string) ([]ActualContractTradeHistory, error)
- func (o *OKEX) GetContractUserInfo() error
- func (o *OKEX) GetContractlimit(symbol, contractType string) (map[string]float64, error)
- func (o *OKEX) GetErrorCode(code interface{}) error
- func (o *OKEX) GetExchangeAccountInfo() (exchange.AccountInfo, error)
- func (o *OKEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
- func (o *OKEX) GetOrderbookEx(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (o *OKEX) GetSpotCandleStick(symbol, typeInput string, size, since int) ([]CandleStickData, error)
- func (o *OKEX) GetSpotMarketDepth(symbol, size string) (ActualSpotDepth, error)
- func (o *OKEX) GetSpotRecentTrades(symbol, since string) ([]ActualSpotTradeHistory, error)
- func (o *OKEX) GetSpotTicker(symbol string) (SpotPrice, error)
- func (o *OKEX) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (o *OKEX) PlaceContractOrders(symbol, contractType, position string, leverageRate int, price, amount float64, ...) (float64, error)
- func (o *OKEX) Run()
- func (o *OKEX) SendAuthenticatedHTTPRequest(method string, values url.Values, result interface{}) (err error)
- func (o *OKEX) SendHTTPRequest(path string, result interface{}) error
- func (o *OKEX) SetCheckVarDefaults()
- func (o *OKEX) SetDefaults()
- func (o *OKEX) SetErrorDefaults()
- func (o *OKEX) Setup(exch config.ExchangeConfig)
- func (o *OKEX) Start()
- func (o *OKEX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (o *OKEX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- type SpotDepth
- type SpotPrice
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActualContractDepth ¶
type ActualContractDepth struct { Asks []struct { Price float64 Volume float64 } Bids []struct { Price float64 Volume float64 } }
ActualContractDepth better manipulated structure to return
type ActualContractTradeHistory ¶
type ActualContractTradeHistory struct { Amount float64 `json:"amount"` DateInMS float64 `json:"date_ms"` Date float64 `json:"date"` Price float64 `json:"price"` TID float64 `json:"tid"` Type string `json:"buy"` }
ActualContractTradeHistory holds contract trade history
type ActualSpotDepth ¶
type ActualSpotDepth struct { Asks []struct { Price float64 Volume float64 } Bids []struct { Price float64 Volume float64 } }
ActualSpotDepth better manipulated structure to return
type ActualSpotTradeHistory ¶
type ActualSpotTradeHistory struct { Amount float64 `json:"amount"` DateInMS float64 `json:"date_ms"` Date float64 `json:"date"` Price float64 `json:"price"` TID float64 `json:"tid"` Type string `json:"buy"` }
ActualSpotTradeHistory holds contract trade history
type CandleStickData ¶
type CandleStickData struct { Timestamp float64 `json:"timestamp"` Open float64 `json:"open"` High float64 `json:"high"` Low float64 `json:"low"` Close float64 `json:"close"` Volume float64 `json:"volume"` Amount float64 `json:"amount"` }
CandleStickData holds candlestick data
type ContractDepth ¶
type ContractDepth struct { Asks []interface{} `json:"asks"` Bids []interface{} `json:"bids"` Result bool `json:"result"` Error interface{} `json:"error_code"` }
ContractDepth response depth
type ContractPrice ¶
type ContractPrice struct { Date string `json:"date"` Ticker struct { Buy float64 `json:"buy"` ContractID int `json:"contract_id"` High float64 `json:"high"` Low float64 `json:"low"` Last float64 `json:"last"` Sell float64 `json:"sell"` UnitAmount float64 `json:"unit_amount"` Vol float64 `json:"vol"` } `json:"ticker"` Result bool `json:"result"` Error interface{} `json:"error_code"` }
ContractPrice holds date and ticker price price for contracts.
type FuturePosition ¶
type FuturePosition struct { ForceLiquidationPrice float64 `json:"force_liqu_price"` Holding []HoldData `json:"holding"` }
FuturePosition contains an array of holding types
type FutureTradeHistory ¶
type FutureTradeHistory struct { Amount float64 `json:"amount"` Date int `json:"date"` Price float64 `json:"price"` TID float64 `json:"tid"` Type string `json:"type"` }
FutureTradeHistory will contain futures trade data
type HoldData ¶
type HoldData struct { BuyAmount float64 `json:"buy_amount"` BuyAvailable float64 `json:"buy_available"` BuyPriceAvg float64 `json:"buy_price_avg"` BuyPriceCost float64 `json:"buy_price_cost"` BuyProfitReal float64 `json:"buy_profit_real"` ContractID int `json:"contract_id"` ContractType string `json:"contract_type"` CreateDate int `json:"create_date"` LeverRate float64 `json:"lever_rate"` SellAmount float64 `json:"sell_amount"` SellAvailable float64 `json:"sell_available"` SellPriceAvg float64 `json:"sell_price_avg"` SellPriceCost float64 `json:"sell_price_cost"` SellProfitReal float64 `json:"sell_profit_real"` Symbol string `json:"symbol"` }
HoldData is a sub type for FuturePosition
type Info ¶
type Info struct { AccountRights float64 `json:"account_rights"` KeepDeposit float64 `json:"keep_deposit"` ProfitReal float64 `json:"profit_real"` ProfitUnreal float64 `json:"profit_unreal"` RiskRate float64 `json:"risk_rate"` }
Info holds individual information
type OKEX ¶
type OKEX struct { exchange.Base // Spot and contract market error codes as per https://www.okex.com/rest_request.html ErrorCodes map[string]error // Stores for corresponding variable checks ContractTypes []string CurrencyPairs []string ContractPosition []string Types []string *request.Handler }
OKEX is the overaching type across the OKEX methods
func (*OKEX) CheckContractPosition ¶
CheckContractPosition checks to see if the string is a valid position for okex
func (*OKEX) CheckContractType ¶
CheckContractType checks to see if the string is a correct asset
func (*OKEX) CheckSymbol ¶
CheckSymbol checks to see if the string is a valid symbol for okex
func (*OKEX) GetContractCandlestickData ¶
func (o *OKEX) GetContractCandlestickData(symbol, typeInput, contractType string, size, since int) ([]CandleStickData, error)
GetContractCandlestickData returns CandleStickData
symbol e.g. btc_usd type e.g. 1min or 1 minute candlestick data contract_type e.g. this_week size: specify data size to be acquired since: timestamp(eg:1417536000000). data after the timestamp will be returned
func (*OKEX) GetContractExchangeRate ¶
GetContractExchangeRate returns the current exchange rate for the currency pair USD-CNY exchange rate used by OKEX, updated weekly
func (*OKEX) GetContractFutureEstimatedPrice ¶
GetContractFutureEstimatedPrice returns futures estimated price
symbol e.g btc_usd
func (*OKEX) GetContractFuturesTradeHistory ¶
GetContractFuturesTradeHistory returns OKEX Contract Trade History (Not for Personal)
func (*OKEX) GetContractHoldingsNumber ¶
GetContractHoldingsNumber returns current number of holdings
func (*OKEX) GetContractIndexPrice ¶
GetContractIndexPrice returns the current index price
symbol e.g. btc_usd
func (*OKEX) GetContractMarketDepth ¶
func (o *OKEX) GetContractMarketDepth(symbol, contractType string) (ActualContractDepth, error)
GetContractMarketDepth returns contract market depth
symbol e.g. "btc_usd" contractType e.g. "this_week" "next_week" "quarter"
func (*OKEX) GetContractPosition ¶
GetContractPosition returns User Contract Positions (Cross-Margin Mode)
func (*OKEX) GetContractPrice ¶
func (o *OKEX) GetContractPrice(symbol, contractType string) (ContractPrice, error)
GetContractPrice returns current contract prices
symbol e.g. "btc_usd" contractType e.g. "this_week" "next_week" "quarter"
func (*OKEX) GetContractTradeHistory ¶
func (o *OKEX) GetContractTradeHistory(symbol, contractType string) ([]ActualContractTradeHistory, error)
GetContractTradeHistory returns trade history for the contract market
func (*OKEX) GetContractUserInfo ¶
GetContractUserInfo returns OKEX Contract Account Info(Cross-Margin Mode)
func (*OKEX) GetContractlimit ¶
GetContractlimit returns upper and lower price limit
func (*OKEX) GetErrorCode ¶
GetErrorCode finds the associated error code and returns its corresponding string
func (*OKEX) GetExchangeAccountInfo ¶
GetExchangeAccountInfo retrieves balances for all enabled currencies for the OKEX exchange
func (*OKEX) GetExchangeHistory ¶
func (o *OKEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*OKEX) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*OKEX) GetSpotCandleStick ¶
func (o *OKEX) GetSpotCandleStick(symbol, typeInput string, size, since int) ([]CandleStickData, error)
GetSpotCandleStick returns candlestick data
func (*OKEX) GetSpotMarketDepth ¶
func (o *OKEX) GetSpotMarketDepth(symbol, size string) (ActualSpotDepth, error)
GetSpotMarketDepth returns Market Depth
func (*OKEX) GetSpotRecentTrades ¶
func (o *OKEX) GetSpotRecentTrades(symbol, since string) ([]ActualSpotTradeHistory, error)
GetSpotRecentTrades returns recent trades
func (*OKEX) GetSpotTicker ¶
GetSpotTicker returns Price Ticker
func (*OKEX) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*OKEX) PlaceContractOrders ¶
func (o *OKEX) PlaceContractOrders(symbol, contractType, position string, leverageRate int, price, amount float64, matchPrice bool) (float64, error)
PlaceContractOrders places orders
func (*OKEX) SendAuthenticatedHTTPRequest ¶
func (o *OKEX) SendAuthenticatedHTTPRequest(method string, values url.Values, result interface{}) (err error)
SendAuthenticatedHTTPRequest sends an authenticated http request to a desired path
func (*OKEX) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP request
func (*OKEX) SetCheckVarDefaults ¶
func (o *OKEX) SetCheckVarDefaults()
SetCheckVarDefaults sets main variables that will be used in requests because api does not return an error if there are misspellings in strings. So better to check on this, this end.
func (*OKEX) SetDefaults ¶
func (o *OKEX) SetDefaults()
SetDefaults method assignes the default values for Bittrex
func (*OKEX) SetErrorDefaults ¶
func (o *OKEX) SetErrorDefaults()
SetErrorDefaults sets the full error default list
func (*OKEX) Setup ¶
func (o *OKEX) Setup(exch config.ExchangeConfig)
Setup method sets current configuration details if enabled
func (*OKEX) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*OKEX) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
type SpotDepth ¶
type SpotDepth struct { Asks []interface{} `json:"asks"` Bids []interface{} `json:"bids"` Result bool `json:"result"` Error interface{} `json:"error_code"` }
SpotDepth response depth
type SpotPrice ¶
type SpotPrice struct { Date string `json:"date"` Ticker struct { Buy float64 `json:"buy,string"` ContractID int `json:"contract_id"` High float64 `json:"high,string"` Low float64 `json:"low,string"` Last float64 `json:"last,string"` Sell float64 `json:"sell,string"` UnitAmount float64 `json:"unit_amount,string"` Vol float64 `json:"vol,string"` } `json:"ticker"` Result bool `json:"result"` Error interface{} `json:"error_code"` }
SpotPrice holds date and ticker price price for contracts.