Documentation ¶
Index ¶
- Variables
- func NewOkexExchange(cfg exchange.Config, cltName string) (e exchange.Exchange, err error)
- type AccountBalance
- type AccountBalanceResp
- type AccountConfig
- type AccountPosition
- type AccountPositionResp
- type AlgoOrder
- type CancelAlgoResp
- type CancelNormalResp
- type CandleResp
- type Instrument
- type InstrumentResp
- type LoginArg
- type OKEXAlgoOrder
- type OKEXOrder
- type OKEXPos
- type OPArg
- type OPParam
- type OkxConfig
- type OkxTrader
- func (b *OkxTrader) CancelAllOrders() (orders []*Order, err error)
- func (b *OkxTrader) CancelOrder(old *Order) (order *Order, err error)
- func (b *OkxTrader) GetKline(symbol, bSize string, start, end time.Time) (data []*Candle, err error)
- func (b *OkxTrader) Info() exchange.ExchangeInfo
- func (b *OkxTrader) ProcessOrder(act TradeAction) (ret *Order, err error)
- func (b *OkxTrader) SetInstType(instType string)
- func (b *OkxTrader) Start() (err error)
- func (b *OkxTrader) Stop() (err error)
- func (b *OkxTrader) Symbols() (symbols []Symbol, err error)
- func (b *OkxTrader) Watch(param exchange.WatchParam, fn exchange.WatchFn) (err error)
- type OrderNormal
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ApiAddr = "https://www.okx.com/" WSOkexPUbilc = "wss://wsaws.okx.com:8443/ws/v5/public" WSOkexPrivate = "wss://wsaws.okx.com:8443/ws/v5/private" TypeSPOT = "SPOT" //币币 TypeMARGIN = "MARGIN" // 币币杠杆 TypeSWAP = "SWAP" //永续合约 TypeFUTURES = "FUTURES" //交割合约 TypeOption = "OPTION" //期权 PosNetMode = "net_mode" PosLongShortMode = "long_short_mode" )
Functions ¶
Types ¶
type AccountBalance ¶
type AccountBalance struct { AdjEq string `json:"adjEq"` Details []struct { AvailBal string `json:"availBal"` AvailEq string `json:"availEq"` CashBal string `json:"cashBal"` Ccy string `json:"ccy"` CrossLiab string `json:"crossLiab"` DisEq string `json:"disEq"` Eq string `json:"eq"` EqUsd string `json:"eqUsd"` FrozenBal string `json:"frozenBal"` Interest string `json:"interest"` IsoEq string `json:"isoEq"` IsoLiab string `json:"isoLiab"` IsoUpl string `json:"isoUpl"` Liab string `json:"liab"` MaxLoan string `json:"maxLoan"` MgnRatio string `json:"mgnRatio"` NotionalLever string `json:"notionalLever"` OrdFrozen string `json:"ordFrozen"` Twap string `json:"twap"` UTime string `json:"uTime"` Upl string `json:"upl"` UplLiab string `json:"uplLiab"` StgyEq string `json:"stgyEq"` SpotInUseAmt string `json:"spotInUseAmt"` } `json:"details"` Imr string `json:"imr"` IsoEq string `json:"isoEq"` MgnRatio string `json:"mgnRatio"` Mmr string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` OrdFroz string `json:"ordFroz"` TotalEq string `json:"totalEq"` UTime string `json:"uTime"` }
type AccountBalanceResp ¶
type AccountBalanceResp struct { Code string `json:"code"` Data []AccountBalance `json:"data"` Msg string `json:"msg"` }
type AccountConfig ¶
type AccountConfig struct { Code string `json:"code"` Data []struct { AcctLv string `json:"acctLv"` AutoLoan bool `json:"autoLoan"` CtIsoMode string `json:"ctIsoMode"` GreeksType string `json:"greeksType"` Level string `json:"level"` LevelTmp string `json:"levelTmp"` MgnIsoMode string `json:"mgnIsoMode"` PosMode string `json:"posMode"` SpotOffsetType string `json:"spotOffsetType"` UID string `json:"uid"` Label string `json:"label"` RoleType string `json:"roleType"` TraderInsts []any `json:"traderInsts"` OpAuth string `json:"opAuth"` IP string `json:"ip"` } `json:"data"` Msg string `json:"msg"` }
type AccountPosition ¶
type AccountPosition struct { Adl string `json:"adl"` AvailPos string `json:"availPos"` AvgPx string `json:"avgPx"` CTime string `json:"cTime"` Ccy string `json:"ccy"` DeltaBS string `json:"deltaBS"` DeltaPA string `json:"deltaPA"` GammaBS string `json:"gammaBS"` GammaPA string `json:"gammaPA"` Imr string `json:"imr"` InstID string `json:"instId"` InstType string `json:"instType"` Interest string `json:"interest"` Last string `json:"last"` UsdPx string `json:"usdPx"` Lever string `json:"lever"` Liab string `json:"liab"` LiabCcy string `json:"liabCcy"` LiqPx string `json:"liqPx"` MarkPx string `json:"markPx"` Margin string `json:"margin"` MgnMode string `json:"mgnMode"` MgnRatio string `json:"mgnRatio"` Mmr string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` OptVal string `json:"optVal"` PTime string `json:"pTime"` Pos string `json:"pos"` PosCcy string `json:"posCcy"` PosID string `json:"posId"` PosSide string `json:"posSide"` SpotInUseAmt string `json:"spotInUseAmt"` SpotInUseCcy string `json:"spotInUseCcy"` ThetaBS string `json:"thetaBS"` ThetaPA string `json:"thetaPA"` TradeID string `json:"tradeId"` BizRefID string `json:"bizRefId"` BizRefType string `json:"bizRefType"` QuoteBal string `json:"quoteBal"` BaseBal string `json:"baseBal"` BaseBorrowed string `json:"baseBorrowed"` BaseInterest string `json:"baseInterest"` QuoteBorrowed string `json:"quoteBorrowed"` QuoteInterest string `json:"quoteInterest"` UTime string `json:"uTime"` Upl string `json:"upl"` UplRatio string `json:"uplRatio"` VegaBS string `json:"vegaBS"` VegaPA string `json:"vegaPA"` CloseOrderAlgo []struct { AlgoID string `json:"algoId"` SlTriggerPx string `json:"slTriggerPx"` SlTriggerPxType string `json:"slTriggerPxType"` TpTriggerPx string `json:"tpTriggerPx"` TpTriggerPxType string `json:"tpTriggerPxType"` CloseFraction string `json:"closeFraction"` } `json:"closeOrderAlgo"` }
type AccountPositionResp ¶
type AccountPositionResp struct { Code string `json:"code"` Msg string `json:"msg"` Data []AccountPosition `json:"data"` }
type AlgoOrder ¶
type AlgoOrder struct { ActualPx string `json:"actualPx"` ActualSide string `json:"actualSide"` ActualSz string `json:"actualSz"` AlgoID string `json:"algoId"` CTime string `json:"cTime"` Ccy string `json:"ccy"` InstID string `json:"instId"` InstType string `json:"instType"` Lever string `json:"lever"` NotionalUsd string `json:"notionalUsd"` OrdID string `json:"ordId"` OrdPx string `json:"ordPx"` OrdType string `json:"ordType"` PosSide string `json:"posSide"` ReduceOnly string `json:"reduceOnly"` Side string `json:"side"` SlOrdPx string `json:"slOrdPx"` SlTriggerPx string `json:"slTriggerPx"` State string `json:"state"` Sz string `json:"sz"` TdMode string `json:"tdMode"` TgtCcy string `json:"tgtCcy"` TpOrdPx string `json:"tpOrdPx"` TpTriggerPx string `json:"tpTriggerPx"` TriggerPx string `json:"triggerPx"` TriggerTime string `json:"triggerTime"` }
type CancelAlgoResp ¶
type CancelNormalResp ¶
type CancelNormalResp struct { Code string `json:"code"` Msg string `json:"msg"` Data []OrderNormal `json:"data"` }
type CandleResp ¶
type Instrument ¶
type Instrument struct { InstType string `json:"instType"` // 产品类型 InstID string `json:"instId"` // 产品id, 如 BTC-USD-SWAP Uly string `json:"uly"` // 标的指数,如 BTC-USD,仅适用于交割/永续/期权 Category string `json:"category"` // 手续费档位,每个交易产品属于哪个档位手续费 BaseCcy string `json:"baseCcy"` // 交易货币币种,如 BTC-USDT 中的 BTC ,仅适用于币币 QuoteCcy string `json:"quoteCcy"` // 计价货币币种,如 BTC-USDT 中的USDT ,仅适用于币币 SettleCcy string `json:"settleCcy"` // 盈亏结算和保证金币种,如 BTC 仅适用于交割/永续/期权 CtVal string `json:"ctVal"` // 合约面值,仅适用于交割/永续/期权 CtMult string `json:"ctMult"` // 合约乘数,仅适用于交割/永续/期权 CtValCcy string `json:"ctValCcy"` // 合约面值计价币种,仅适用于交割/永续/期权 OptType string `json:"optType"` // 期权类型,C或P 仅适用于期权 Stk string `json:"stk"` // 行权价格,仅适用于期权 ListTime string `json:"listTime"` // 上线日期 Unix时间戳的毫秒数格式,如 1597026383085 ExpTime string `json:"expTime"` // 交割/行权日期,仅适用于交割 和 期权 Unix时间戳的毫秒数格式,如 1597026383085 Lever string `json:"lever"` // 该instId支持的最大杠杆倍数,不适用于币币、期权 TickSz string `json:"tickSz"` // 下单价格精度,如 0.0001 LotSz string `json:"lotSz"` // 下单数量精度,如 BTC-USDT-SWAP:1 MinSz string `json:"minSz"` // 最小下单数量 CtType string `json:"ctType"` // linear:正向合约 inverse:反向合约 仅适用于交割/永续 Alias string `json:"alias"` // 合约日期别名 this_week:本周 next_week:次周 quarter:季度 next_quarter:次季度 仅适用于交割 State string `json:"state"` // 产品状态 live:交易中 suspend:暂停中 preopen:预上线settlement:资金费结算 }
type InstrumentResp ¶
type InstrumentResp struct { Code string `json:"code"` Msg string `json:"msg"` Data []Instrument `json:"data"` }
type LoginArg ¶
type LoginArg struct { ApiKey string `json:"apiKey"` Passphrase string `json:"passphrase"` Timestamp int64 `json:"timestamp"` Sign string `json:"sign"` }
func NewLoginArg ¶
type OKEXAlgoOrder ¶
type OKEXPos ¶
type OKEXPos struct { Adl string `json:"adl"` AvailPos string `json:"availPos"` AvgPx string `json:"avgPx"` CTime string `json:"cTime"` Ccy string `json:"ccy"` DeltaBS string `json:"deltaBS"` DeltaPA string `json:"deltaPA"` GammaBS string `json:"gammaBS"` GammaPA string `json:"gammaPA"` Imr string `json:"imr"` InstID string `json:"instId"` InstType string `json:"instType"` Interest string `json:"interest"` Last string `json:"last"` Lever string `json:"lever"` Liab string `json:"liab"` LiabCcy string `json:"liabCcy"` LiqPx string `json:"liqPx"` MarkPx string `json:"markPx"` Margin string `json:"margin"` MgnMode string `json:"mgnMode"` MgnRatio string `json:"mgnRatio"` Mmr string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` OptVal string `json:"optVal"` PTime string `json:"pTime"` Pos string `json:"pos"` PosCcy string `json:"posCcy"` PosID string `json:"posId"` PosSide string `json:"posSide"` ThetaBS string `json:"thetaBS"` ThetaPA string `json:"thetaPA"` TradeID string `json:"tradeId"` UTime string `json:"uTime"` Upl string `json:"upl"` UplRatio string `json:"uplRatio"` VegaBS string `json:"vegaBS"` VegaPA string `json:"vegaPA"` }
type OkxTrader ¶
type OkxTrader struct { Name string // contains filtered or unexported fields }
func NewOkxTrader ¶
func (*OkxTrader) CancelAllOrders ¶
func (*OkxTrader) CancelOrder ¶
func (*OkxTrader) GetKline ¶
func (b *OkxTrader) GetKline(symbol, bSize string, start, end time.Time) (data []*Candle, err error)
KlineChan get klines
func (*OkxTrader) Info ¶
func (b *OkxTrader) Info() exchange.ExchangeInfo
func (*OkxTrader) ProcessOrder ¶
func (*OkxTrader) SetInstType ¶
type OrderNormal ¶
type OrderNormal struct { AccFillSz string `json:"accFillSz"` AmendResult string `json:"amendResult"` AvgPx string `json:"avgPx"` CTime string `json:"cTime"` Category string `json:"category"` Ccy string `json:"ccy"` ClOrdID string `json:"clOrdId"` Code string `json:"code"` ExecType string `json:"execType"` Fee string `json:"fee"` FeeCcy string `json:"feeCcy"` FillFee string `json:"fillFee"` FillFeeCcy string `json:"fillFeeCcy"` FillNotionalUsd string `json:"fillNotionalUsd"` FillPx string `json:"fillPx"` FillSz string `json:"fillSz"` FillTime string `json:"fillTime"` InstID string `json:"instId"` InstType string `json:"instType"` Lever string `json:"lever"` Msg string `json:"msg"` NotionalUsd string `json:"notionalUsd"` OrdID string `json:"ordId"` OrdType string `json:"ordType"` Pnl string `json:"pnl"` PosSide string `json:"posSide"` Px string `json:"px"` Rebate string `json:"rebate"` RebateCcy string `json:"rebateCcy"` ReduceOnly string `json:"reduceOnly"` ReqID string `json:"reqId"` Side string `json:"side"` SlOrdPx string `json:"slOrdPx"` SlTriggerPx string `json:"slTriggerPx"` SlTriggerPxType string `json:"slTriggerPxType"` Source string `json:"source"` State string `json:"state"` Sz string `json:"sz"` Tag string `json:"tag"` TdMode string `json:"tdMode"` TgtCcy string `json:"tgtCcy"` TpOrdPx string `json:"tpOrdPx"` TpTriggerPx string `json:"tpTriggerPx"` TpTriggerPxType string `json:"tpTriggerPxType"` TradeID string `json:"tradeId"` UTime string `json:"uTime"` }
func (*OrderNormal) GetOrder ¶
func (o *OrderNormal) GetOrder() (ret *Order)
Directories ¶
Path | Synopsis |
---|---|
api
|
|
account
Package account provides primitives to interact with the openapi HTTP API.
|
Package account provides primitives to interact with the openapi HTTP API. |
market
Package market provides primitives to interact with the openapi HTTP API.
|
Package market provides primitives to interact with the openapi HTTP API. |
public
Package public provides primitives to interact with the openapi HTTP API.
|
Package public provides primitives to interact with the openapi HTTP API. |
trade
Package trade provides primitives to interact with the openapi HTTP API.
|
Package trade provides primitives to interact with the openapi HTTP API. |
Click to show internal directories.
Click to hide internal directories.