mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pkg/exchange: add comment
This commit is contained in:
parent
1dedd32f42
commit
a7aa34c396
|
@ -97,6 +97,10 @@ func convertSubscription(s types.Subscription) (WebsocketSubscription, error) {
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
case types.BookChannel:
|
case types.BookChannel:
|
||||||
|
if s.Options.Depth != types.DepthLevel400 {
|
||||||
|
return WebsocketSubscription{}, fmt.Errorf("%s depth not supported", s.Options.Depth)
|
||||||
|
}
|
||||||
|
|
||||||
return WebsocketSubscription{
|
return WebsocketSubscription{
|
||||||
Channel: ChannelBooks,
|
Channel: ChannelBooks,
|
||||||
InstrumentID: toLocalSymbol(s.Symbol),
|
InstrumentID: toLocalSymbol(s.Symbol),
|
||||||
|
|
|
@ -48,7 +48,7 @@ func TestStream(t *testing.T) {
|
||||||
|
|
||||||
t.Run("book test", func(t *testing.T) {
|
t.Run("book test", func(t *testing.T) {
|
||||||
s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{
|
s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{
|
||||||
Depth: types.DepthLevel50,
|
Depth: types.DepthLevel400,
|
||||||
})
|
})
|
||||||
s.SetPublicOnly()
|
s.SetPublicOnly()
|
||||||
err := s.Connect(context.Background())
|
err := s.Connect(context.Background())
|
||||||
|
@ -97,7 +97,7 @@ func TestStream(t *testing.T) {
|
||||||
|
|
||||||
t.Run("Subscribe/Unsubscribe test", func(t *testing.T) {
|
t.Run("Subscribe/Unsubscribe test", func(t *testing.T) {
|
||||||
s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{
|
s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{
|
||||||
Depth: types.DepthLevel50,
|
Depth: types.DepthLevel400,
|
||||||
})
|
})
|
||||||
s.SetPublicOnly()
|
s.SetPublicOnly()
|
||||||
err := s.Connect(context.Background())
|
err := s.Connect(context.Background())
|
||||||
|
@ -119,7 +119,7 @@ func TestStream(t *testing.T) {
|
||||||
|
|
||||||
t.Run("Resubscribe test", func(t *testing.T) {
|
t.Run("Resubscribe test", func(t *testing.T) {
|
||||||
s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{
|
s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{
|
||||||
Depth: types.DepthLevel50,
|
Depth: types.DepthLevel400,
|
||||||
})
|
})
|
||||||
s.SetPublicOnly()
|
s.SetPublicOnly()
|
||||||
err := s.Connect(context.Background())
|
err := s.Connect(context.Background())
|
||||||
|
|
|
@ -547,6 +547,7 @@ const (
|
||||||
DepthLevel20 Depth = "20"
|
DepthLevel20 Depth = "20"
|
||||||
DepthLevel50 Depth = "50"
|
DepthLevel50 Depth = "50"
|
||||||
DepthLevel200 Depth = "200"
|
DepthLevel200 Depth = "200"
|
||||||
|
DepthLevel400 Depth = "400"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Speed string
|
type Speed string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user