Documentation
¶
Index ¶
- Constants
- func InitSymbols(ctx context.Context) error
- func InitTestSymbols(ctx context.Context) error
- func NewBooks50TBTChannel(instId string) exchange.Channel
- func NewBooks5Channel(instId string) exchange.Channel
- func ParseMarginSymbol(sym string) (exchange.MarginSymbol, error)
- func ParseSpotSymbol(sym string) (exchange.SpotSymbol, error)
- func ParseSwapSymbol(sym string) (exchange.SwapSymbol, error)
- func ParseTimestamp(ts string) (time.Time, error)
- type AccountBalance
- type AccountDetial
- type Bill
- type BillReq
- type CancelOrderReq
- type CancelOrderResp
- type CodeC
- type CreateOrderReq
- type CreateOrderResp
- type CtType
- type CurrencyResp
- type Depth
- type DepthDS
- type ExecType
- type FetchOrderReq
- type Fill
- type FillsReq
- type FundingRate
- type InstType
- type Instrument
- type InterestAccrued
- type InterestAccruedReq
- type MarginSymbol
- type MgnMode
- type Okex5Channel
- type OrdType
- type Order
- type OrderCategory
- type OrderSide
- type OrderState
- type OrdersHistoryReq
- type PosSide
- type RawDepth
- type RestClient
- func (r *RestClient) AccountBalance(ctx context.Context, currency ...string) (*AccountBalance, error)
- func (rc *RestClient) Bills(ctx context.Context, req *BillReq) ([]Bill, error)
- func (rc *RestClient) Books(ctx context.Context, instId string, sz string) (*Depth, error)
- func (rc *RestClient) CancelOrder(ctx context.Context, req *CancelOrderReq) (*CancelOrderResp, error)
- func (rc *RestClient) CreateOrder(ctx context.Context, req *CreateOrderReq) (*CreateOrderResp, error)
- func (c *RestClient) Currencies(ctx context.Context) ([]CurrencyResp, error)
- func (rc *RestClient) FetchOrder(ctx context.Context, req *FetchOrderReq) (*Order, error)
- func (rc *RestClient) Fills(ctx context.Context, param *FillsReq) ([]Fill, error)
- func (rc *RestClient) Finance(ctx context.Context, req *exchange.FinanceReqParam) ([]exchange.Finance, error)
- func (rc *RestClient) FundingRate(ctx context.Context, instID string) ([]FundingRate, error)
- func (rc *RestClient) Instruments(ctx context.Context, typ InstType) ([]Instrument, error)
- func (rc *RestClient) InterestAccrued(ctx context.Context, iar *InterestAccruedReq) ([]InterestAccrued, error)
- func (rc *RestClient) MarginSymbols(ctx context.Context) ([]exchange.MarginSymbol, error)
- func (rc *RestClient) OrdersHistory(ctx context.Context, param *OrdersHistoryReq) ([]Order, error)
- func (rc *RestClient) Property() exchange.Property
- func (rc *RestClient) Request(ctx context.Context, method string, endPoint string, params url.Values, ...) error
- func (rc *RestClient) SpotSymbols(ctx context.Context) ([]exchange.SpotSymbol, error)
- func (rc *RestClient) SwapSymbols(ctx context.Context) ([]exchange.SwapSymbol, error)
- func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.Symbol, error)
- func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)
- func (c *RestClient) Transfer(ctx context.Context, param *TransferParam) (*TransferResp, error)
- type RestResponse
- type SpotSymbol
- type SwapSymbol
- type TDMode
- type Trade
- type TransferParam
- type TransferResp
- type WSClient
Constants ¶
View Source
const ( BillsEndPoint = "/api/v5/account/bills" InterestAccruedEndPoint = "/api/v5/account/interest-accrued" )
View Source
const ( TransferEndPoint = "/api/v5/asset/transfer" CurrenciesEndPoint = "/api/v5/asset/currencies" )
View Source
const ( CtTypeNone CtType = "" CtTypeLinear CtType = "linear" CtTypeInverse CtType = "Inverse" MgnModeCash MgnMode = "cash" MgnModeCross MgnMode = "cross" MgnModeIsolated MgnMode = "isolated" ExecTypeMaker ExecType = "M" ExecTypeTaker ExecType = "T" InstTypeSpot InstType = "SPOT" InstTypeMargin InstType = "MARGIN" InstTypeSwap InstType = "SWAP" InstTypeFutures InstType = "FUTURES" InstTypeOption InstType = "OPTION" InstTypeAny InstType = "ANY" TDModeIsolated TDMode = "isolated" TDModeCross TDMode = "cross" TDModeCash TDMode = "cash" OrderSideBuy OrderSide = "buy" OrderSideSell OrderSide = "sell" PosSideNone PosSide = "" PosSideLong PosSide = "long" PosSideShort PosSide = "short" PosSideNet PosSide = "net" OrdTypeMaket OrdType = "market" OrdTypeLimit OrdType = "limit" OrdTypePostOnly OrdType = "post_only" OrdTypeFOK OrdType = "fok" OrdTypeIOC OrdType = "ioc" OrdTypeOptimalLimitIOC OrdType = "optimal_limit_ioc" OrderStateCanceled OrderState = "canceled" OrderStateLive OrderState = "live" OrderStatePartiallyFilled OrderState = "partially_filled" OrderStateFilled OrderState = "filled" OrderCategoryUnknown OrderCategory = "" OrderCategoryNormal OrderCategory = "normal" OrderCategoryTwap OrderCategory = "twap" OrderCategoryAdl OrderCategory = "adl" OrderCategoryFullLiquidation OrderCategory = "full_liquidation" OrderCategoryPartialLiquidation OrderCategory = "partial_liquidation" OrderCategoryDelivery OrderCategory = "delivery" )
View Source
const ( CreateOrderEndPoint = "/api/v5/trade/order" FetchOrderEndPoint = CreateOrderEndPoint CancelOrderEndPoint = "/api/v5/trade/cancel-order" FillsEndPoint = "/api/v5/trade/fills" )
View Source
const ( DepthSnapshot = "snapshot" DepthUpdate = "update" Books5Channel = "books5" Books50TBTChannel = "books50-l2-tbt" )
View Source
const ( WebSocketPublicAddr = "wss://wsaws.okex.com:8443/ws/v5/public" WebSocketPrivateAddr = "wss://wsaws.okex.com:8443/ws/v5/private" WebSocketSimPublicAddr = "wss://wspap.okex.com:8443/ws/v5/public?brokerId=9999" WebSocketSimPrivateAdrr = "wss://wspap.okex.com:8443/ws/v5/private?brokerId=9999" MethodSubscribe = "subscribe" MethodUnSubscribe = "unsubscribe" )
View Source
const (
AccountBalanceEndPoint = "/api/v5/account/balance"
)
View Source
const (
BooksEndPoint = "/api/v5/market/books"
)
View Source
const (
CodeOK = "0"
)
View Source
const (
FundingEndPoint = "/api/v5/public/funding-rate"
)
View Source
const (
InstrumentEndPoint = "/api/v5/public/instruments"
)
View Source
const (
TradesChannel = "trades"
)
Variables ¶
This section is empty.
Functions ¶
func InitSymbols ¶
func InitTestSymbols ¶ added in v0.5.2
func NewBooks50TBTChannel ¶
func NewBooks5Channel ¶
func ParseMarginSymbol ¶
func ParseMarginSymbol(sym string) (exchange.MarginSymbol, error)
func ParseSpotSymbol ¶
func ParseSpotSymbol(sym string) (exchange.SpotSymbol, error)
func ParseSwapSymbol ¶
func ParseSwapSymbol(sym string) (exchange.SwapSymbol, error)
Types ¶
type AccountBalance ¶
type AccountBalance struct { UTime string `json:"uTime"` TotalEq string `json:"totalEq"` IsoEq string `json:"isoEq"` AdjEq string `json:"adjEq"` OrdFroz string `json:"ordFroz"` Imr string `json:"imr"` Nmr string `json:"nmr"` MgnRatio string `json:"mgnRatio"` NotionalUSD string `json:"notionalUsd"` Details []AccountDetial `json:"details"` }
type AccountDetial ¶
type AccountDetial struct { Ccy string `json:"ccy"` Eq string `json:"eq"` CashBal string `json:"cashBal"` UTime string `json:"uTime"` IsoEq string `json:"isoEq"` AvailEq string `json:"availEq"` DisEq string `json:"disEq"` AvailBal string `json:"availBal"` FrozenBal string `json:"frozenBal"` OrdFrozen string `json:"ordFrozen"` Liab string `json:"liab"` Upl string `json:"upl"` UplLiab string `json:"uplLiab"` CrossLiab string `json:"crossLiab"` IsoLiab string `json:"isoLiab"` MgnRatio string `json:"mgnRatio"` Interest string `json:"interest"` Twap string `json:"twap"` MaxLoan string `json:"maxLoan"` EqUsd string `json:"eqUsd"` NotionalLever string `json:"notionalLever"` }
type Bill ¶
type Bill struct { InstType InstType `json:"instType"` BillID string `json:"billId"` Type string `json:"type"` SubType string `json:"subType"` Ts string `json:"ts"` BalChg string `json:"balChg"` PosBalChg string `json:"posBalChg"` Bal string `json:"bal"` PosBal string `json:"posBal"` Sz string `json:"sz"` Ccy string `json:"ccy"` Pnl string `json:"pnl"` Fee string `json:"fee"` MgnMode MgnMode `json:"mgnMode"` InstID string `json:"instId"` OrdID string `json:"ordId"` From string `json:"from"` To string `json:"to"` Notes string `json:"notes"` }
type CancelOrderReq ¶
type CancelOrderResp ¶
type CreateOrderReq ¶
type CreateOrderReq struct { InstID string `json:"instId"` TDMode TDMode `json:"tdMode"` Ccy string `json:"ccy,omitempty"` ClOrderID string `json:"clOrderId,omitempty"` Tag string `json:"tag,omitempty"` Side OrderSide `json:"side"` PosSide PosSide `json:"posSide,omitempty"` OrdType OrdType `json:"ordType"` Sz string `json:"sz"` Px string `json:"px,omitempty"` ReduecOnly bool `json:"reduceOnly"` }
type CreateOrderResp ¶
type CurrencyResp ¶
type DepthDS ¶
type DepthDS struct {
// contains filtered or unexported fields
}
DepthDS recv okex5 RawDepth notify and calc depth
func NewDepthDS ¶
func NewDepthDS() *DepthDS
type FetchOrderReq ¶
type Fill ¶
type Fill struct { InstType InstType `json:"instType"` InstID string `json:"instId"` TradeID string `json:"tradeId"` OrdID string `json:"ordId"` ClOrdID string `json:"clOrdId"` BillID string `json:"billId"` Tag string `json:"tag"` FIllPx string `json:"fillPx"` FillSz string `json:"fillSz"` Side OrderSide `json:"side"` PosSide PosSide `json:"posSide"` ExecType ExecType `json:"execType"` FeeCcy string `json:"feeCcy"` Fee string `json:"fee"` Ts string `json:"ts"` }
type FundingRate ¶ added in v0.5.2
type Instrument ¶
type Instrument struct { InstType InstType `json:"instType"` InstID string `json:"instId"` Uly string `json:"uly"` Category string `json:"category"` BaseCcy string `json:"baseCcy"` QuoteCcy string `json:"quoteCcy"` SettleCcy string `json:"settleCcy"` CtVal string `json:"CtVal"` CtMul string `json:"CtMul"` CtValCcy string `json:"ctValCcy"` OptType string `json:"optType"` Stk string `json:"stk"` ListTime string `json:"listTime"` ExpTime string `json:"expTime"` Lever string `json:"lever"` TickSz string `json:"tickSz"` LotSz string `json:"lotSz"` MinSz string `json:"minSz"` CtType string `json:"ctType"` Alias string `json:"alias"` State string `json:"state"` }
type InterestAccrued ¶ added in v0.4.0
type InterestAccruedReq ¶ added in v0.4.0
type MarginSymbol ¶
type MarginSymbol struct {
*exchange.BaseMarginSymbol
}
func (*MarginSymbol) String ¶
func (ms *MarginSymbol) String() string
type Okex5Channel ¶
type Okex5Channel struct { Channel string `json:"channel"` InstType InstType `json:"instType,omitempty"` Uly string `json:"uly,omitempty"` InstID string `json:"instId,omitempty"` }
func NewTradesChannel ¶
func NewTradesChannel(instID string) *Okex5Channel
func (*Okex5Channel) String ¶
func (oc *Okex5Channel) String() string
type Order ¶
type Order struct { InstType InstType `json:"instType"` InstId string `json:"instId"` Ccy string `json:"ccy"` OrderID string `json:"ordId"` ClOrdID string `json:"clOrdId"` Tag string `json:"tag"` Px string `json:"px"` Sz string `json:"sz"` Pnl string `json:"pnl"` OrderType OrdType `json:"ordType"` Side OrderSide `json:"side"` PosSide PosSide `json:"posSide"` TDMode TDMode `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 OrderState `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:"rebatCcy"` Rebat string `json:"rebat"` Category OrderCategory `json:"category"` UTime string `json:"uTime"` CTime string `json:"cTime"` }
type OrderCategory ¶
type OrderCategory string
func (*OrderCategory) UnmarshalJSON ¶
func (oc *OrderCategory) UnmarshalJSON(raw []byte) error
type OrderState ¶
type OrderState string
func (*OrderState) UnmarshalJSON ¶
func (os *OrderState) UnmarshalJSON(raw []byte) error
type OrdersHistoryReq ¶ added in v0.4.2
type OrdersHistoryReq struct { InstType InstType `json:"instType"` Uly string `json:"uly"` InstID string `json:"instId"` OrdType OrdType `json:"ordType"` State string `json:"state"` Category OrderCategory `json:"category"` After string `json:"after"` Before string `json:"before"` Limit string `json:"limit"` }
type RawDepth ¶
type RawDepth struct { Asks [][4]string `json:"asks"` Bids [][4]string `json:"bids"` Ts string `json:"ts"` Checksum int32 `json:"checksum"` }
RawDepth incremental depth push
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func NewRestClient ¶
func NewRestClient(key, secret, pass string) *RestClient
func NewTestRestClient ¶
func NewTestRestClient(key, secret, pass string) *RestClient
func (*RestClient) AccountBalance ¶
func (r *RestClient) AccountBalance(ctx context.Context, currency ...string) (*AccountBalance, error)
func (*RestClient) CancelOrder ¶
func (rc *RestClient) CancelOrder(ctx context.Context, req *CancelOrderReq) (*CancelOrderResp, error)
func (*RestClient) CreateOrder ¶
func (rc *RestClient) CreateOrder(ctx context.Context, req *CreateOrderReq) (*CreateOrderResp, error)
func (*RestClient) Currencies ¶
func (c *RestClient) Currencies(ctx context.Context) ([]CurrencyResp, error)
func (*RestClient) FetchOrder ¶
func (rc *RestClient) FetchOrder(ctx context.Context, req *FetchOrderReq) (*Order, error)
func (*RestClient) Finance ¶
func (rc *RestClient) Finance(ctx context.Context, req *exchange.FinanceReqParam) ([]exchange.Finance, error)
func (*RestClient) FundingRate ¶ added in v0.5.2
func (rc *RestClient) FundingRate(ctx context.Context, instID string) ([]FundingRate, error)
func (*RestClient) Instruments ¶
func (rc *RestClient) Instruments(ctx context.Context, typ InstType) ([]Instrument, error)
func (*RestClient) InterestAccrued ¶ added in v0.4.0
func (rc *RestClient) InterestAccrued(ctx context.Context, iar *InterestAccruedReq) ([]InterestAccrued, error)
func (*RestClient) MarginSymbols ¶ added in v0.5.2
func (rc *RestClient) MarginSymbols(ctx context.Context) ([]exchange.MarginSymbol, error)
func (*RestClient) OrdersHistory ¶ added in v0.4.2
func (rc *RestClient) OrdersHistory(ctx context.Context, param *OrdersHistoryReq) ([]Order, error)
func (*RestClient) Property ¶
func (rc *RestClient) Property() exchange.Property
func (*RestClient) Request ¶
func (rc *RestClient) Request(ctx context.Context, method string, endPoint string, params url.Values, body io.Reader, sign bool, dst interface{}) error
Request do okexv5 rest request. response data field will be store into dst
func (*RestClient) SpotSymbols ¶ added in v0.5.2
func (rc *RestClient) SpotSymbols(ctx context.Context) ([]exchange.SpotSymbol, error)
func (*RestClient) SwapSymbols ¶ added in v0.5.2
func (rc *RestClient) SwapSymbols(ctx context.Context) ([]exchange.SwapSymbol, error)
func (*RestClient) Trades ¶
func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)
func (*RestClient) Transfer ¶
func (c *RestClient) Transfer(ctx context.Context, param *TransferParam) (*TransferResp, error)
type RestResponse ¶
type SpotSymbol ¶
type SpotSymbol struct {
*exchange.BaseSpotSymbol
}
func (*SpotSymbol) String ¶
func (ss *SpotSymbol) String() string
type SwapSymbol ¶
type SwapSymbol struct {
*exchange.BaseSwapSymbol
}
func (*SwapSymbol) String ¶
func (ss *SwapSymbol) String() string
type TransferParam ¶
type TransferResp ¶
type WSClient ¶
func NewTestWSPublicClient ¶
func NewTestWSPublicClient(data chan interface{}) *WSClient
func NewWSPublicClient ¶
func NewWSPublicClient(data chan interface{}) *WSClient
Click to show internal directories.
Click to hide internal directories.