Documentation
¶
Index ¶
- Constants
- func Init(ctx context.Context) error
- func NewDepth5Channel(sym exchange.SpotSymbol) exchange.Channel
- func NewTickerChannel(sym exchange.SpotSymbol) exchange.Channel
- func ParseSymbol(symbol string) (exchange.SpotSymbol, error)
- func TestnetInit(ctx context.Context) error
- type AccountResp
- type Accounts
- type Depth5
- type Depth5Channel
- type DepthElem
- type FetchOrderResponse
- type Fill
- type OkexSymbol
- type OrderParam
- type OrderResponse
- 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) FetchAccounts(ctx context.Context) (Accounts, error)
- func (rc *RestClient) FetchOrder(ctx context.Context, order *exchange.Order) (*exchange.Order, error)
- func (rc *RestClient) Fills(ctx context.Context, instrumentID, orderID string, before, after, limit string) ([]Fill, error)
- func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SpotSymbol, error)
- type Symbol
- type Ticker
- type TickerChannel
- type Trade
- type TradeChannel
Constants ¶
View Source
const ( OrderSideBuy = "buy" OrderSideSell = "sell" OrderTypeMarket = "market" OrderTypeLimit = "limit" OrderTypeNoraml = "0" OrderTypePostOnly = "1" OrderTypeFOK = "2" OrderTypeIOC = "3" CreateOrderEndPoint = "/api/spot/v3/orders" )
View Source
const (
AccountEndPoint = "/api/spot/v3/accounts"
)
View Source
const (
FillsEndPoint = "/api/spot/v3/fills"
)
View Source
const (
TradeTable = "spot/trade"
)
Variables ¶
This section is empty.
Functions ¶
func NewDepth5Channel ¶
func NewDepth5Channel(sym exchange.SpotSymbol) exchange.Channel
func NewTickerChannel ¶
func NewTickerChannel(sym exchange.SpotSymbol) exchange.Channel
func ParseSymbol ¶ added in v0.3.0
func ParseSymbol(symbol string) (exchange.SpotSymbol, error)
func TestnetInit ¶ added in v0.3.0
Types ¶
type AccountResp ¶ added in v0.3.0
type Accounts ¶ added in v0.3.0
type Accounts []AccountResp
type Depth5Channel ¶
type Depth5Channel struct {
// contains filtered or unexported fields
}
func (*Depth5Channel) String ¶
func (dc *Depth5Channel) String() string
type FetchOrderResponse ¶ added in v0.3.0
type FetchOrderResponse struct { OrderID string `json:"order_id"` ClientOID string `json:"client_oid"` Price string `json:"price"` Size string `json:"size"` OrderType string `json:"order_type"` Notional string `json:"notional"` InstrumentID string `json:"instrument_id"` Side string `json:"side"` Type string `json:"type"` Timestamp string `json:"timestamp"` FilledSize string `json:"filled_size"` FilledNotional string `json:"filled_notional"` State string `json:"state"` PriceAvg string `json:"price_avg"` FeeCurrency string `json:"fee_currency"` Fee string `json:"fee"` RebateCurrency string `json:"rebate_currency"` Rebate string `json:"rebate"` }
type Fill ¶ added in v0.3.0
type Fill struct { LedgerID string `json:"ledger_id"` TradeID string `json:"trade_id"` InstrumentID string `json:"instrument_id"` Price decimal.Decimal `json:"price"` Size decimal.Decimal `json:"size"` OrderID string `json:"order_id"` ExecType string `json:"exec_type"` Timestamp string `json:"timestamp"` Fee decimal.Decimal `json:"fee"` Side string `json:"side"` Currency string `json:"currency"` }
type OkexSymbol ¶ added in v0.3.0
type OkexSymbol struct { InstrumentID string `json:"instrument_id"` BaseCurrency string `json:"base_currency"` QuoteCurrency string `json:"quote_currency"` MinSize decimal.Decimal `json:"min_size"` SizeIncrement decimal.Decimal `json:"size_increment"` TickSize decimal.Decimal `json:"tick_size"` Category string `json:"category"` }
func (*OkexSymbol) Transform ¶ added in v0.3.0
func (os *OkexSymbol) Transform() (exchange.SpotSymbol, error)
type OrderParam ¶ added in v0.3.0
type OrderParam struct { Type string `json:"type"` Side string `json:"side"` InstrumentID string `json:"instrument_id"` Size string `json:"size"` ClinetOID string `json:"client_oid"` Price string `json:"price,omitempty"` OrderType string `json:"order_type"` Notional string `json:"notional,omitempty"` }
type OrderResponse ¶ added in v0.3.0
type RestClient ¶ added in v0.3.0
type RestClient struct {
*okex.RestClient
}
func NewRestClient ¶ added in v0.3.0
func NewRestClient(key, secret, pass string) *RestClient
func NewTestRestClient ¶ added in v0.3.0
func NewTestRestClient(key, secret, pass string) *RestClient
func (*RestClient) CancelOrder ¶ added in v0.3.0
func (*RestClient) CreateOrder ¶ added in v0.3.0
func (rc *RestClient) CreateOrder(ctx context.Context, req *exchange.OrderRequest, options ...exchange.OrderReqOption) (*exchange.Order, error)
CreateOrder create a spot order
func (*RestClient) FetchAccounts ¶ added in v0.3.0
func (rc *RestClient) FetchAccounts(ctx context.Context) (Accounts, error)
func (*RestClient) FetchOrder ¶ added in v0.3.0
func (*RestClient) Fills ¶ added in v0.3.0
func (rc *RestClient) Fills(ctx context.Context, instrumentID, orderID string, before, after, limit string) ([]Fill, error)
Fills return okex fills in time descent order
func (*RestClient) Symbols ¶ added in v0.3.0
func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SpotSymbol, error)
type Symbol ¶ added in v0.3.0
type Symbol struct {
*exchange.BaseSpotSymbol
}
type Ticker ¶
type Ticker struct { Symbol exchange.SpotSymbol 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 BaseVolume24H decimal.Decimal QuoteVolume24H 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.1
type TradeChannel ¶ added in v0.5.1
type TradeChannel struct {
// contains filtered or unexported fields
}
func NewTradeChannel ¶ added in v0.5.1
func NewTradeChannel(sym exchange.Symbol) *TradeChannel
func (*TradeChannel) String ¶ added in v0.5.1
func (s *TradeChannel) String() string
Click to show internal directories.
Click to hide internal directories.