Documentation ¶
Overview ¶
Code generated by go generate; DO NOT EDIT.
Index ¶
- Constants
- Variables
- type Exchange
- func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (errs error)
- func (e *Exchange) IsSupportedInterval(interval types.Interval) bool
- func (e *Exchange) Name() types.ExchangeName
- func (e *Exchange) NewStream() types.Stream
- func (e *Exchange) PlatformFeeCurrency() string
- func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error)
- func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error)
- func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error)
- func (e *Exchange) QueryDepth(ctx context.Context, symbol string) (types.SliceOrderBook, int64, error)
- func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, ...) ([]types.KLine, error)
- func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error)
- func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error)
- func (e *Exchange) QueryTicker(ctx context.Context, symbol string) (*types.Ticker, error)
- func (e *Exchange) QueryTickers(ctx context.Context, symbols ...string) (map[string]types.Ticker, error)
- func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) (trades []types.Trade, err error)
- func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error)
- func (e *Exchange) SupportedInterval() map[types.Interval]int
- type Stream
- func (s *Stream) EmitAccountBalanceEvent(e *WebSocketAccountBalanceEvent)
- func (s *Stream) EmitCandleEvent(candle *WebSocketCandleEvent, e *WebSocketEvent)
- func (s *Stream) EmitOrderBookL2Event(e *WebSocketOrderBookL2Event)
- func (s *Stream) EmitPrivateOrderEvent(e *WebSocketPrivateOrderEvent)
- func (s *Stream) EmitTickerEvent(e *WebSocketTickerEvent)
- func (s *Stream) OnAccountBalanceEvent(cb func(e *WebSocketAccountBalanceEvent))
- func (s *Stream) OnCandleEvent(cb func(candle *WebSocketCandleEvent, e *WebSocketEvent))
- func (s *Stream) OnOrderBookL2Event(cb func(e *WebSocketOrderBookL2Event))
- func (s *Stream) OnPrivateOrderEvent(cb func(e *WebSocketPrivateOrderEvent))
- func (s *Stream) OnTickerEvent(cb func(e *WebSocketTickerEvent))
- type StreamEventHub
- type WebSocketAccountBalanceEvent
- type WebSocketCandleEvent
- type WebSocketCommand
- type WebSocketConnector
- type WebSocketEvent
- type WebSocketMessageType
- type WebSocketOrderBookL2Event
- type WebSocketPrivateOrderEvent
- type WebSocketSubject
- type WebSocketTickerEvent
Constants ¶
const KCS = "KCS"
KCS is the platform currency of Kucoin, pre-allocate static string here
Variables ¶
var ErrMissingSequence = errors.New("sequence is missing")
Functions ¶
This section is empty.
Types ¶
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func (*Exchange) CancelOrders ¶
func (*Exchange) IsSupportedInterval ¶
func (*Exchange) Name ¶
func (e *Exchange) Name() types.ExchangeName
func (*Exchange) PlatformFeeCurrency ¶
func (*Exchange) QueryAccount ¶
func (*Exchange) QueryAccountBalances ¶
func (*Exchange) QueryClosedOrders ¶
func (*Exchange) QueryDepth ¶
func (*Exchange) QueryKLines ¶
func (*Exchange) QueryMarkets ¶
func (*Exchange) QueryOpenOrders ¶
func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error)
QueryOpenOrders
Documentation from the Kucoin API page ¶
Any order on the exchange order book is in active status. Orders removed from the order book will be marked with done status. After an order becomes done, there may be a few milliseconds latency before it’s fully settled.
You can check the orders in any status. If the status parameter is not specified, orders of done status will be returned by default.
When you query orders in active status, there is no time limit. However, when you query orders in done status, the start and end time range cannot exceed 7* 24 hours. An error will occur if the specified time window exceeds the range.
If you specify the end time only, the system will automatically calculate the start time as end time minus 7*24 hours, and vice versa.
The history for cancelled orders is only kept for one month. You will not be able to query for cancelled orders that have happened more than a month ago.
func (*Exchange) QueryTicker ¶
func (*Exchange) QueryTickers ¶
func (*Exchange) QueryTrades ¶
func (*Exchange) SubmitOrder ¶
type Stream ¶
type Stream struct { types.StandardStream // contains filtered or unexported fields }
func (*Stream) EmitAccountBalanceEvent ¶
func (s *Stream) EmitAccountBalanceEvent(e *WebSocketAccountBalanceEvent)
func (*Stream) EmitCandleEvent ¶
func (s *Stream) EmitCandleEvent(candle *WebSocketCandleEvent, e *WebSocketEvent)
func (*Stream) EmitOrderBookL2Event ¶
func (s *Stream) EmitOrderBookL2Event(e *WebSocketOrderBookL2Event)
func (*Stream) EmitPrivateOrderEvent ¶
func (s *Stream) EmitPrivateOrderEvent(e *WebSocketPrivateOrderEvent)
func (*Stream) EmitTickerEvent ¶
func (s *Stream) EmitTickerEvent(e *WebSocketTickerEvent)
func (*Stream) OnAccountBalanceEvent ¶
func (s *Stream) OnAccountBalanceEvent(cb func(e *WebSocketAccountBalanceEvent))
func (*Stream) OnCandleEvent ¶
func (s *Stream) OnCandleEvent(cb func(candle *WebSocketCandleEvent, e *WebSocketEvent))
func (*Stream) OnOrderBookL2Event ¶
func (s *Stream) OnOrderBookL2Event(cb func(e *WebSocketOrderBookL2Event))
func (*Stream) OnPrivateOrderEvent ¶
func (s *Stream) OnPrivateOrderEvent(cb func(e *WebSocketPrivateOrderEvent))
func (*Stream) OnTickerEvent ¶
func (s *Stream) OnTickerEvent(cb func(e *WebSocketTickerEvent))
type StreamEventHub ¶
type StreamEventHub interface { OnCandleEvent(cb func(candle *WebSocketCandleEvent, e *WebSocketEvent)) OnOrderBookL2Event(cb func(e *WebSocketOrderBookL2Event)) OnTickerEvent(cb func(e *WebSocketTickerEvent)) OnAccountBalanceEvent(cb func(e *WebSocketAccountBalanceEvent)) OnPrivateOrderEvent(cb func(e *WebSocketPrivateOrderEvent)) }
type WebSocketAccountBalanceEvent ¶
type WebSocketAccountBalanceEvent struct { Total fixedpoint.Value `json:"total"` Available fixedpoint.Value `json:"available"` AvailableChange fixedpoint.Value `json:"availableChange"` Currency string `json:"currency"` Hold fixedpoint.Value `json:"hold"` HoldChange fixedpoint.Value `json:"holdChange"` RelationEvent string `json:"relationEvent"` RelationEventId string `json:"relationEventId"` RelationContext struct { Symbol string `json:"symbol"` TradeId string `json:"tradeId"` OrderId string `json:"orderId"` } `json:"relationContext"` Time string `json:"time"` }
type WebSocketCandleEvent ¶
type WebSocketCandleEvent struct { Symbol string `json:"symbol"` Candles []string `json:"candles"` Time types.MillisecondTimestamp `json:"time"` // Interval is an injected field (not from the payload) Interval types.Interval // Is a new candle or not Add bool }
func (*WebSocketCandleEvent) KLine ¶
func (e *WebSocketCandleEvent) KLine() types.KLine
type WebSocketCommand ¶
type WebSocketCommand struct { Id int64 `json:"id"` Type WebSocketMessageType `json:"type"` Topic string `json:"topic"` PrivateChannel bool `json:"privateChannel"` Response bool `json:"response"` }
func (*WebSocketCommand) JSON ¶
func (c *WebSocketCommand) JSON() ([]byte, error)
type WebSocketConnector ¶
type WebSocketEvent ¶
type WebSocketEvent struct { Type WebSocketMessageType `json:"type"` Topic string `json:"topic"` Subject WebSocketSubject `json:"subject"` Data json.RawMessage `json:"data"` Code int `json:"code"` // used in type error // Object is used for storing the parsed Data Object interface{} `json:"-"` }
type WebSocketMessageType ¶
type WebSocketMessageType string
const ( WebSocketMessageTypePing WebSocketMessageType = "ping" WebSocketMessageTypeSubscribe WebSocketMessageType = "subscribe" WebSocketMessageTypeUnsubscribe WebSocketMessageType = "unsubscribe" WebSocketMessageTypeAck WebSocketMessageType = "ack" WebSocketMessageTypeError WebSocketMessageType = "error" WebSocketMessageTypePong WebSocketMessageType = "pong" WebSocketMessageTypeWelcome WebSocketMessageType = "welcome" WebSocketMessageTypeMessage WebSocketMessageType = "message" )
type WebSocketOrderBookL2Event ¶
type WebSocketOrderBookL2Event struct { SequenceStart int64 `json:"sequenceStart"` SequenceEnd int64 `json:"sequenceEnd"` Symbol string `json:"symbol"` Changes struct { Asks types.PriceVolumeSlice `json:"asks"` Bids types.PriceVolumeSlice `json:"bids"` } `json:"changes"` Time types.MillisecondTimestamp `json:"time"` }
type WebSocketPrivateOrderEvent ¶
type WebSocketPrivateOrderEvent struct { OrderId string `json:"orderId"` TradeId string `json:"tradeId"` Symbol string `json:"symbol"` OrderType string `json:"orderType"` Side string `json:"side"` Type string `json:"type"` OrderTime types.NanosecondTimestamp `json:"orderTime"` Price fixedpoint.Value `json:"price"` Size fixedpoint.Value `json:"size"` FilledSize fixedpoint.Value `json:"filledSize"` RemainSize fixedpoint.Value `json:"remainSize"` Liquidity string `json:"liquidity"` MatchPrice fixedpoint.Value `json:"matchPrice"` MatchSize fixedpoint.Value `json:"matchSize"` ClientOid string `json:"clientOid"` Status string `json:"status"` Ts types.MillisecondTimestamp `json:"ts"` }
type WebSocketSubject ¶
type WebSocketSubject string
const ( WebSocketSubjectTradeTicker WebSocketSubject = "trade.ticker" WebSocketSubjectTradeSnapshot WebSocketSubject = "trade.snapshot" // ticker snapshot WebSocketSubjectTradeL2Update WebSocketSubject = "trade.l2update" // order book L2 WebSocketSubjectLevel2 WebSocketSubject = "level2" // level2 WebSocketSubjectTradeCandlesUpdate WebSocketSubject = "trade.candles.update" WebSocketSubjectTradeCandlesAdd WebSocketSubject = "trade.candles.add" // private subjects WebSocketSubjectOrderChange WebSocketSubject = "orderChange" WebSocketSubjectAccountBalance WebSocketSubject = "account.balance" WebSocketSubjectStopOrder WebSocketSubject = "stopOrder" )
type WebSocketTickerEvent ¶
type WebSocketTickerEvent struct { Sequence string `json:"sequence"` Price fixedpoint.Value `json:"price"` Size fixedpoint.Value `json:"size"` BestAsk fixedpoint.Value `json:"bestAsk"` BestAskSize fixedpoint.Value `json:"bestAskSize"` BestBid fixedpoint.Value `json:"bestBid"` BestBidSize fixedpoint.Value `json:"bestBidSize"` }