subscriptions: Add templating support and integrate with Binance (#1568)

* Subscriptions: Add List.AssetPairs

* Subscriptions: Add Template and QualifiedChannel

These fields separate the concept of what the channel is from the
qualified resource name

* Subscriptions: Add List.SetStates()

* Subscriptions: Add List.QualifiedChannels

* Subscriptions: Rename testsubs.EqualLists

* Binance: Switch to ExpandTemplates

* Binance: Update ConfigTest format

* Subscriptions: Test Coverage improvements

* Subscriptions: Reenterant List.ExpandTemplates

* Subscriptions: Move templates from subscriptions to exchanges

* Binance: Inline subscription template and improvements
This commit is contained in:
Gareth Kirwan
2024-07-09 12:53:00 +07:00
committed by GitHub
parent 00c5c95468
commit c601575c66
27 changed files with 886 additions and 232 deletions

View File

@@ -2,6 +2,7 @@ package exchange
import (
"context"
"text/template"
"time"
"github.com/thrasher-corp/gocryptotrader/common/key"
@@ -78,8 +79,10 @@ type IBotExchange interface {
SubscribeToWebsocketChannels(channels subscription.List) error
UnsubscribeToWebsocketChannels(channels subscription.List) error
GetSubscriptions() (subscription.List, error)
GetSubscriptionTemplate(*subscription.Subscription) (*template.Template, error)
FlushWebsocketChannels() error
AuthenticateWebsocket(ctx context.Context) error
CanUseAuthenticatedWebsocketEndpoints() bool
GetOrderExecutionLimits(a asset.Item, cp currency.Pair) (order.MinMaxLevel, error)
CheckOrderExecutionLimits(a asset.Item, cp currency.Pair, price, amount float64, orderType order.Type) error
UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error