Documentation ¶
Index ¶
- Constants
- func IsoTime() string
- type AccountV5
- type AccountV5Response
- type DepthV5
- type InstrumentsV5
- type InstrumentsV5Response
- type Okx
- func (g *Okx) BuildRequestBody(params interface{}) (string, *bytes.Reader, error)
- func (g *Okx) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)
- func (p *Okx) DoPost(uri string, body io.Reader, header map[string]string) ([]byte, error)
- func (g *Okx) GetAccount() (*Account, error)
- func (g *Okx) GetBestTicker(currencyPair CurrencyPair) (*BestTicker, error)
- func (g *Okx) GetCurrencyPairs() ([]CurrencyPair, error)
- func (g *Okx) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)
- func (g *Okx) GetExchangeName() string
- func (g *Okx) GetKlineRecords(currencyPair CurrencyPair, period KlinePeriod, size int, ...) ([]Kline, error)
- func (g *Okx) GetOneOrder(orderId string, currencyPair CurrencyPair) (*Order, error)
- func (g *Okx) GetOrderHistorys(currencyPair CurrencyPair, optional ...OptionalParameter) ([]Order, error)
- func (g *Okx) GetSubAccount(coin Currency) (*SubAccount, error)
- func (g *Okx) GetTicker(currencyPair CurrencyPair) (*Ticker, error)
- func (g *Okx) GetTradeFee(currencyPair CurrencyPair) (*TradeFee, error)
- func (g *Okx) GetTrades(currencyPair CurrencyPair, size int64) ([]Trade, error)
- func (g *Okx) GetUnfinishOrders(currencyPair CurrencyPair) ([]Order, error)
- func (g *Okx) LimitBuy(amount, price string, currencyPair CurrencyPair, ...) (*Order, error)
- func (g *Okx) LimitSell(amount, price string, currencyPair CurrencyPair, ...) (*Order, error)
- func (g *Okx) MarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)
- func (g *Okx) MarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)
- func (g *Okx) PlaceOrder(ty string, ord *Order) (*Order, error)
- type OrderV5
- type OrderV5Response
- type PlaceOrderReqParam
- type PlaceOrderV5
- type PlaceOrderV5Response
- type ServerResponse
- type SpotWs
- func (s *SpotWs) BestTickerCallback(f func(ticker *gocoinex.BestTicker, exchange string))
- func (s *SpotWs) DepthCallback(f func(depth *gocoinex.Depth, exchange string))
- func (s *SpotWs) SubscribeBestTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeDepth(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeTrade(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeUserBalance() error
- func (s *SpotWs) SubscribeUserOrder() error
- func (s *SpotWs) TickerCallback(f func(ticker *gocoinex.Ticker, exchange string))
- func (s *SpotWs) TradeCallback(f func(trade *gocoinex.Trade, exchange string))
- func (s *SpotWs) UnSubscribeBestTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeDepth(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeTrade(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeUserBalance() error
- func (s *SpotWs) UnSubscribeUserOrder() error
- func (s *SpotWs) UserBalanceCallback(f func(trade *gocoinex.SubAccount, exchange string))
- func (s *SpotWs) UserOrderCallback(f func(ticker *gocoinex.Order, exchange string))
- type SubAccountV5
- type TickerV5
- type TickerV5Response
- type TradeFeeV5
- type TradeFeeV5Response
- type TradeV5
- type TradeV5Response
- type WsDataResponse
- type WsDepthResponse
- type WsTickerResponse
- type WsTradeResponse
- type WssubscribeArgsReq
- type WssubscribeReq
- type WssubscribeResponse
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" )
View Source
const ( Subscribe = "subscribe" UnSubscribe = "unsubscribe" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountV5 ¶
type AccountV5 struct { TotalEq string `json:"totalEq"` IsoEq string `json:"isoEq"` AdjEq string `json:"adjEq"` OrdFroz string `json:"ordFroz"` Imr string `json:"imr,omitempty"` Mmr string `json:"mmr"` BorrowFroz string `json:"borrowFroz"` NotionalUsd string `json:"notionalUsd"` Upl string `json:"upl"` Details []SubAccountV5 `json:"details"` }
type AccountV5Response ¶
type InstrumentsV5 ¶
type InstrumentsV5Response ¶
type InstrumentsV5Response struct { Code int `json:"code,string"` Msg string `json:"msg"` Data []InstrumentsV5 `json:"data"` }
type Okx ¶
type Okx struct {
// contains filtered or unexported fields
}
func (*Okx) BuildRequestBody ¶
func (*Okx) CancelOrder ¶
func (*Okx) GetAccount ¶
func (*Okx) GetBestTicker ¶
func (*Okx) GetExchangeName ¶
func (*Okx) GetKlineRecords ¶
func (*Okx) GetOneOrder ¶
func (*Okx) GetOrderHistorys ¶
func (*Okx) GetSubAccount ¶
func (*Okx) GetTradeFee ¶
私有权限
func (*Okx) GetUnfinishOrders ¶
查询指定交易对所有挂单
func (*Okx) LimitBuy ¶
func (g *Okx) LimitBuy(amount, price string, currencyPair CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)
限价买单
func (*Okx) MarketSell ¶
func (*Okx) PlaceOrder ¶
type OrderV5 ¶
type OrderV5 struct { InstId string `json:"instId"` ClOrdId string `json:"clOrdId"` OrdId string `json:"ordId"` OrdType string `json:"ordType"` Price string `json:"px,omitempty"` Size float64 `json:"sz,string"` DealAmount string `json:"accFillSz"` AvgPrice string `json:"avgPx"` Side string `json:"side"` State string `json:"state"` Timestamp string `json:"cTime"` UpdateTime string `json:"uTime"` Fee string `json:"fee"` }
type OrderV5Response ¶
type PlaceOrderReqParam ¶
type PlaceOrderV5 ¶
type PlaceOrderV5Response ¶
type PlaceOrderV5Response struct { Code int `json:"code,string"` Msg string `json:"msg"` Data []PlaceOrderV5 `json:"data"` }
type ServerResponse ¶
type ServerResponse struct { Code int `json:"code,string"` Msg string `json:"msg"` Data json.RawMessage `json:"data"` }
api server response
type SpotWs ¶
type SpotWs struct {
// contains filtered or unexported fields
}
func (*SpotWs) BestTickerCallback ¶
func (s *SpotWs) BestTickerCallback(f func(ticker *gocoinex.BestTicker, exchange string))
func (*SpotWs) DepthCallback ¶
func (*SpotWs) SubscribeBestTicker ¶
func (s *SpotWs) SubscribeBestTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeDepth ¶
func (s *SpotWs) SubscribeDepth(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeTicker ¶
func (s *SpotWs) SubscribeTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeTrade ¶
func (s *SpotWs) SubscribeTrade(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeUserBalance ¶
func (*SpotWs) SubscribeUserOrder ¶
func (*SpotWs) TickerCallback ¶
func (*SpotWs) TradeCallback ¶
func (*SpotWs) UnSubscribeBestTicker ¶
func (s *SpotWs) UnSubscribeBestTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeDepth ¶
func (s *SpotWs) UnSubscribeDepth(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeTicker ¶
func (s *SpotWs) UnSubscribeTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeTrade ¶
func (s *SpotWs) UnSubscribeTrade(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeUserBalance ¶
func (*SpotWs) UnSubscribeUserOrder ¶
func (*SpotWs) UserBalanceCallback ¶
func (s *SpotWs) UserBalanceCallback(f func(trade *gocoinex.SubAccount, exchange string))
type SubAccountV5 ¶
type TickerV5 ¶
type TickerV5 struct { InstId string `json:"instId"` Last float64 `json:"last,string"` BuyPrice float64 `json:"bidPx,string"` BuySize float64 `json:"bidSz,string"` SellPrice float64 `json:"askPx,string"` SellSize float64 `json:"askSz,string"` Open float64 `json:"open24h,string"` High float64 `json:"high24h,string"` Low float64 `json:"low24h,string"` Vol float64 `json:"volCcy24h,string"` VolQuote float64 `json:"vol24h,string"` Timestamp uint64 `json:"ts,string"` // 单位:ms }
type TickerV5Response ¶
type TradeFeeV5 ¶
type TradeFeeV5Response ¶
type TradeFeeV5Response struct { Code int `json:"code,string"` Msg string `json:"msg"` Data []TradeFeeV5 `json:"data"` }
type TradeV5Response ¶
type WsDataResponse ¶
type WsDataResponse struct { Arg WssubscribeArgsReq `json:"arg"` Data json.RawMessage `json:"data"` // contains filtered or unexported fields }
websocket req struct
type WsDepthResponse ¶
type WsTickerResponse ¶
type WsTickerResponse struct { InstId string `json:"instId"` Last float64 `json:"last,string"` LastSz float64 `json:"lastSz,string"` BuyPrice float64 `json:"bidPx,string"` BuySize float64 `json:"bidSz,string"` SellPrice float64 `json:"askPx,string"` SellSize float64 `json:"askSz,string"` Open float64 `json:"open24h,string"` High float64 `json:"high24h,string"` Low float64 `json:"low24h,string"` Vol float64 `json:"volCcy24h,string"` VolQuote float64 `json:"vol24h,string"` Timestamp uint64 `json:"ts,string"` // 单位:ms }
type WsTradeResponse ¶
type WssubscribeArgsReq ¶
type WssubscribeArgsReq struct { Channel string `json:"channel"` InstType string `json:"instType,omitempty"` InstFamily string `json:"instFamily,omitempty"` //适用于交割/永续/期权 InstId string `json:"instId"` }
websocket req struct
type WssubscribeReq ¶
type WssubscribeReq struct { Op string `json:"op"` Args []WssubscribeArgsReq `json:"args"` }
websocket req struct
type WssubscribeResponse ¶
type WssubscribeResponse struct { Event string `json:"event"` Code string `json:"code"` Message string `json:"msg"` Arg WssubscribeArgsReq `json:"arg"` ConnId string `json:"connId"` }
Click to show internal directories.
Click to hide internal directories.