mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pkg/bbgo, pkg/types: add new interface PrivateChannelSymbolSetter
This commit is contained in:
parent
580c6d2030
commit
720fe2e12e
|
@ -58,6 +58,10 @@ type ExchangeSession struct {
|
|||
// This option is exchange specific
|
||||
PrivateChannels []string `json:"privateChannels,omitempty" yaml:"privateChannels,omitempty"`
|
||||
|
||||
// PrivateChannelSymbols is used for filtering the private user data channel, .e.g, order symbol subscription.
|
||||
// This option is exchange specific
|
||||
PrivateChannelSymbols []string `json:"privateChannelSymbols,omitempty" yaml:"privateChannelSymbols,omitempty"`
|
||||
|
||||
Margin bool `json:"margin,omitempty" yaml:"margin"`
|
||||
IsolatedMargin bool `json:"isolatedMargin,omitempty" yaml:"isolatedMargin,omitempty"`
|
||||
IsolatedMarginSymbol string `json:"isolatedMarginSymbol,omitempty" yaml:"isolatedMarginSymbol,omitempty"`
|
||||
|
@ -248,6 +252,11 @@ func (session *ExchangeSession) Init(ctx context.Context, environ *Environment)
|
|||
setter.SetPrivateChannels(session.PrivateChannels)
|
||||
}
|
||||
}
|
||||
if len(session.PrivateChannelSymbols) > 0 {
|
||||
if setter, ok := session.UserDataStream.(types.PrivateChannelSymbolSetter); ok {
|
||||
setter.SetPrivateChannelSymbols(session.PrivateChannelSymbols)
|
||||
}
|
||||
}
|
||||
|
||||
logger.Infof("querying account balances...")
|
||||
account, err := session.Exchange.QueryAccount(ctx)
|
||||
|
|
|
@ -46,6 +46,10 @@ type PrivateChannelSetter interface {
|
|||
SetPrivateChannels(channels []string)
|
||||
}
|
||||
|
||||
type PrivateChannelSymbolSetter interface {
|
||||
SetPrivateChannelSymbols(symbols []string)
|
||||
}
|
||||
|
||||
type Unsubscriber interface {
|
||||
// Unsubscribe unsubscribes the all subscriptions.
|
||||
Unsubscribe()
|
||||
|
|
Loading…
Reference in New Issue
Block a user