Documentation
¶
Index ¶
- Constants
- type ActionType
- type BookEvent
- type ChannelType
- type Exchange
- func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) error
- 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) 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) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error)
- type InstType
- type KLine
- type KLineEvent
- type KLineSlice
- type MarketTrade
- type MarketTradeEvent
- type MarketTradeSlice
- type SideType
- type Stream
- func (s *Stream) EmitBookEvent(o BookEvent)
- func (s *Stream) EmitKLineEvent(o KLineEvent)
- func (s *Stream) EmitMarketTradeEvent(o MarketTradeEvent)
- func (s *Stream) OnBookEvent(cb func(o BookEvent))
- func (s *Stream) OnKLineEvent(cb func(o KLineEvent))
- func (s *Stream) OnMarketTradeEvent(cb func(o MarketTradeEvent))
- func (s *Stream) Unsubscribe()
- type WsArg
- type WsEvent
- type WsEventType
- type WsOp
Constants ¶
View Source
const ( ID = "bitget" PlatformToken = "BGB" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶ added in v1.53.0
type ActionType string
const ( ActionTypeSnapshot ActionType = "snapshot" ActionTypeUpdate ActionType = "update" )
type BookEvent ¶ added in v1.53.0
type BookEvent struct {
Events []struct {
// Order book on sell side, ascending order
Asks types.PriceVolumeSlice `json:"asks"`
// Order book on buy side, descending order
Bids types.PriceVolumeSlice `json:"bids"`
Ts types.MillisecondTimestamp `json:"ts"`
Checksum int `json:"checksum"`
}
// contains filtered or unexported fields
}
{
"asks":[
[
"28350.78",
"0.2082"
],
],
"bids":[
[
"28350.70",
"0.5585"
],
],
"checksum":0,
"ts":"1697593934630"
}
func (*BookEvent) ToGlobalOrderBooks ¶ added in v1.53.0
func (e *BookEvent) ToGlobalOrderBooks() []types.SliceOrderBook
type ChannelType ¶ added in v1.53.0
type ChannelType string
const ( // ChannelOrderBook snapshot and update might return less than 200 bids/asks as per symbol's orderbook various from // each other; The number of bids/asks is not a fixed value and may vary in the future ChannelOrderBook ChannelType = "books" // ChannelOrderBook5 top 5 order book of "books" that begins from bid1/ask1 ChannelOrderBook5 ChannelType = "books5" // ChannelOrderBook15 top 15 order book of "books" that begins from bid1/ask1 ChannelOrderBook15 ChannelType = "books15" ChannelTrade ChannelType = "trade" )
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func (*Exchange) CancelOrders ¶ added in v1.53.0
func (*Exchange) Name ¶
func (e *Exchange) Name() types.ExchangeName
func (*Exchange) PlatformFeeCurrency ¶
func (*Exchange) QueryAccount ¶ added in v1.53.0
func (*Exchange) QueryAccountBalances ¶ added in v1.53.0
func (*Exchange) QueryClosedOrders ¶ added in v1.53.0
func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error)
QueryClosedOrders queries closed order by time range(`CTime`) and id. The order of the response is in descending order. If you need to retrieve all data, please utilize the function pkg/exchange/batch.ClosedOrderBatchQuery.
** Since is inclusive, Until is exclusive. If you use a time range to query, you must provide both a start time and an end time. ** ** Since and Until cannot exceed 90 days. ** ** Since from the last 90 days can be queried. **
func (*Exchange) QueryKLines ¶ added in v1.53.0
func (*Exchange) QueryMarkets ¶ added in v1.53.0
func (*Exchange) QueryOpenOrders ¶ added in v1.53.0
func (*Exchange) QueryTicker ¶ added in v1.53.0
func (*Exchange) QueryTickers ¶ added in v1.53.0
func (*Exchange) SubmitOrder ¶ added in v1.53.0
type KLine ¶ added in v1.53.0
type KLine struct {
StartTime types.MillisecondTimestamp
OpenPrice fixedpoint.Value
HighestPrice fixedpoint.Value
LowestPrice fixedpoint.Value
ClosePrice fixedpoint.Value
Volume fixedpoint.Value
}
type KLineEvent ¶ added in v1.53.0
type KLineEvent struct {
Events KLineSlice
// contains filtered or unexported fields
}
func (KLineEvent) CacheKey ¶ added in v1.53.0
func (k KLineEvent) CacheKey() string
type KLineSlice ¶ added in v1.53.0
type KLineSlice []KLine
func (*KLineSlice) UnmarshalJSON ¶ added in v1.53.0
func (m *KLineSlice) UnmarshalJSON(b []byte) error
type MarketTrade ¶ added in v1.53.0
type MarketTrade struct {
Ts types.MillisecondTimestamp
Price fixedpoint.Value
Size fixedpoint.Value
Side SideType
}
type MarketTradeEvent ¶ added in v1.53.0
type MarketTradeEvent struct {
Events MarketTradeSlice
// contains filtered or unexported fields
}
type MarketTradeSlice ¶ added in v1.53.0
type MarketTradeSlice []MarketTrade
func (*MarketTradeSlice) UnmarshalJSON ¶ added in v1.53.0
func (m *MarketTradeSlice) UnmarshalJSON(b []byte) error
type Stream ¶ added in v1.53.0
type Stream struct {
types.StandardStream
KLineEventCallbacks []func(o KLineEvent)
// contains filtered or unexported fields
}
func (*Stream) EmitBookEvent ¶ added in v1.53.0
func (*Stream) EmitKLineEvent ¶ added in v1.53.0
func (s *Stream) EmitKLineEvent(o KLineEvent)
func (*Stream) EmitMarketTradeEvent ¶ added in v1.53.0
func (s *Stream) EmitMarketTradeEvent(o MarketTradeEvent)
func (*Stream) OnBookEvent ¶ added in v1.53.0
func (*Stream) OnKLineEvent ¶ added in v1.53.0
func (s *Stream) OnKLineEvent(cb func(o KLineEvent))
func (*Stream) OnMarketTradeEvent ¶ added in v1.53.0
func (s *Stream) OnMarketTradeEvent(cb func(o MarketTradeEvent))
func (*Stream) Unsubscribe ¶ added in v1.53.0
func (s *Stream) Unsubscribe()
type WsArg ¶ added in v1.53.0
type WsArg struct {
InstType InstType `json:"instType"`
Channel ChannelType `json:"channel"`
// InstId Instrument ID. e.q. BTCUSDT, ETHUSDT
InstId string `json:"instId"`
}
type WsEvent ¶ added in v1.53.0
type WsEvent struct {
// for comment event
Arg WsArg `json:"arg"`
// for op event
Event WsEventType `json:"event"`
Code int `json:"code"`
Msg string `json:"msg"`
Op string `json:"op"`
// for data event
Action ActionType `json:"action"`
Data json.RawMessage `json:"data"`
}
WsEvent is the lowest level of event type. We use this struct to convert the received data, so that we will know whether the event belongs to `op` or `data`.
type WsEventType ¶ added in v1.53.0
type WsEventType string
const ( WsEventSubscribe WsEventType = "subscribe" WsEventUnsubscribe WsEventType = "unsubscribe" WsEventError WsEventType = "error" )
type WsOp ¶ added in v1.53.0
type WsOp struct {
Op WsEventType `json:"op"`
Args []WsArg `json:"args"`
}
Click to show internal directories.
Click to hide internal directories.