Documentation
¶
Index ¶
- Constants
- func Init(ctx context.Context) error
- func NewDepth5Channel(sym exchange.SwapSymbol) exchange.Channel
- func NewOrderChannel(symbol exchange.SwapSymbol) exchange.Channel
- func NewTickerChannel(sym exchange.SwapSymbol) exchange.Channel
- func ParseSymbol(symbol string) (exchange.SwapSymbol, error)
- type Depth5
- type Depth5Channel
- type DepthElem
- type Fill
- type MarginPosition
- type OkexSymbol
- type Order
- type OrderChannel
- type Position
- type RestClient
- func (rc *RestClient) CancelOrder(ctx context.Context, order *exchange.Order) error
- func (rc *RestClient) CreateOrder(ctx context.Context, req *exchange.OrderRequest, ...) (*exchange.Order, error)
- func (rc *RestClient) FetchPosition(ctx context.Context, sym ...exchange.Symbol) ([]*exchange.Position, error)
- func (rc *RestClient) Fills(ctx context.Context, instrumentID string, orderID string, ...) ([]Fill, error)
- func (rc *RestClient) Finance(ctx context.Context, req *exchange.FinanceReqParam) ([]exchange.Finance, error)
- func (rc *RestClient) Ledgers(ctx context.Context, instrumentID string, before, after, limit, typ string) ([]okex.Ledger, error)
- func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SwapSymbol, error)
- func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)
- type Symbol
- type Ticker
- type TickerChannel
- type Trade
- type TradeChannel
Constants ¶
View Source
const ( MarginModeFixed = "fixed" MarginModeCrossed = "crossed" )
View Source
const ( FillsEndPoint = "/api/swap/v3/fills" ExecTypeTaker = "T" ExecTypeMaker = "M" TradeTable = "swap/trade" )
View Source
const (
TickerTable = "swap/ticker"
)
Variables ¶
This section is empty.
Functions ¶
func NewDepth5Channel ¶
func NewDepth5Channel(sym exchange.SwapSymbol) exchange.Channel
func NewOrderChannel ¶
func NewOrderChannel(symbol exchange.SwapSymbol) exchange.Channel
func NewTickerChannel ¶
func NewTickerChannel(sym exchange.SwapSymbol) exchange.Channel
func ParseSymbol ¶ added in v0.3.0
func ParseSymbol(symbol string) (exchange.SwapSymbol, error)
Types ¶
type Depth5Channel ¶
type Depth5Channel struct {
// contains filtered or unexported fields
}
func (*Depth5Channel) String ¶
func (dc *Depth5Channel) String() string
type Fill ¶ added in v0.3.0
type Fill struct { TradeID string `json:"trade_id"` FillID string `json:"fill_id"` InstrumentID string `json:"instrument_id"` OrderID string `json:"order_id"` Price decimal.Decimal `json:"price"` OrderQty decimal.Decimal `json:"order_qty"` Fee decimal.Decimal `json:"fee"` Timestamp string `json:"timestamp"` ExecType string `json:"exec_type"` Side string `json:"side"` OrderSide string `json:"order_side"` Type string `json:"type"` }
type MarginPosition ¶
type OkexSymbol ¶ added in v0.3.0
type OkexSymbol struct { InstrumentID string `json:"instrument_id"` Underlying string `json:"underlying"` BaseCurrency string `json:"base_currency"` QuoteCurrency string `json:"quote_currency"` SettlementCurrency string `json:"settlement_currency"` ContractVal decimal.Decimal `json:"contract_val"` Listing string `json:"listing"` Delivery string `json:"delivery"` SizeIncrement decimal.Decimal `json:"size_increment"` TickSize decimal.Decimal `json:"tick_size"` IsInverse string `json:"is_inverse"` Category string `json:"category"` ContractValCurrency string `json:"contract_val_currency"` CurrencyIndex string `json:"currency_index"` }
func (*OkexSymbol) Parse ¶ added in v0.3.0
func (os *OkexSymbol) Parse() (*Symbol, error)
type Order ¶
type Order struct { InstrumentID string `json:"instrument_id"` Size decimal.Decimal `json:"size"` Timestamp string `json:"timestamp"` FilledQty decimal.Decimal `json:"filled_qty"` Fee decimal.Decimal `json:"fee"` OrderID string `json:"order_id"` ClientID string `json:"client_id"` Price decimal.Decimal `json:"price"` PriceAvg decimal.Decimal `json:"price_avg"` Type string `json:"type"` ContractVal decimal.Decimal `json:"contract_val"` OrderType string `json:"order_type"` State string `json:"state"` }
type OrderChannel ¶
type OrderChannel struct {
// contains filtered or unexported fields
}
func (*OrderChannel) String ¶
func (oc *OrderChannel) String() string
type Position ¶
type Position struct { LiquidationPrice decimal.Decimal `json:"liquidation_price"` Position decimal.Decimal `json:"position"` AvailPosition decimal.Decimal `json:"avail_position"` Margin decimal.Decimal `json:"margin"` AvgCost decimal.Decimal `json:"avg_cost"` SettlementPrice decimal.Decimal `json:"settlement_price"` InstrumentID string `json:"instrument_id"` Leverage decimal.Decimal `json:"leverage"` RealizedPNL decimal.Decimal `json:"realized_pnl"` Side string `json:"side"` Timestamp string `json:"timestamp"` MaintMarginRatio decimal.Decimal `json:"maint_margin_ratio"` SettlePNL decimal.Decimal `json:"settle_pnl"` Last decimal.Decimal `json:"last"` UnRealizedPNL decimal.Decimal `json:"unrealized_pnl"` }
type RestClient ¶
type RestClient struct {
*okex.RestClient
}
func NewRestClient ¶ added in v0.3.0
func NewRestClient(key, secret, password string) *RestClient
func (*RestClient) CancelOrder ¶
func (*RestClient) CreateOrder ¶
func (rc *RestClient) CreateOrder(ctx context.Context, req *exchange.OrderRequest, options ...exchange.OrderReqOption) (*exchange.Order, error)
func (*RestClient) FetchPosition ¶
func (*RestClient) Finance ¶ added in v0.3.0
func (rc *RestClient) Finance(ctx context.Context, req *exchange.FinanceReqParam) ([]exchange.Finance, error)
func (*RestClient) Symbols ¶
func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SwapSymbol, error)
Symbols return swap symbol
func (*RestClient) Trades ¶ added in v0.3.0
func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)
type Symbol ¶
type Symbol struct { *exchange.BaseSwapSymbol // contains filtered or unexported fields }
type Ticker ¶
type Ticker struct { Symbol exchange.SwapSymbol Last decimal.Decimal LastQty decimal.Decimal BestBid decimal.Decimal BestBidSize decimal.Decimal BestAsk decimal.Decimal BestAskSize decimal.Decimal Open24H decimal.Decimal High24H decimal.Decimal Low24H decimal.Decimal Volume24H decimal.Decimal VolumeToken24H decimal.Decimal OpenInterest decimal.Decimal Time time.Time }
type TickerChannel ¶
type TickerChannel struct {
// contains filtered or unexported fields
}
func (*TickerChannel) String ¶
func (tc *TickerChannel) String() string
type Trade ¶ added in v0.5.4
type TradeChannel ¶ added in v0.5.4
type TradeChannel struct {
exchange.SwapSymbol
}
func NewTradeChannel ¶ added in v0.5.4
func NewTradeChannel(symbol exchange.SwapSymbol) *TradeChannel
func (*TradeChannel) String ¶ added in v0.5.4
func (s *TradeChannel) String() string
Click to show internal directories.
Click to hide internal directories.