mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
assign account and stream when allocating session object
This commit is contained in:
parent
1f71fa623c
commit
b1a9a66dba
|
@ -38,6 +38,7 @@ type Environment struct {
|
||||||
sessions map[string]*ExchangeSession
|
sessions map[string]*ExchangeSession
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewDefaultEnvironment prepares the exchange sessions from the viper settings.
|
||||||
func NewDefaultEnvironment(db *sqlx.DB) *Environment {
|
func NewDefaultEnvironment(db *sqlx.DB) *Environment {
|
||||||
environment := NewEnvironment(db)
|
environment := NewEnvironment(db)
|
||||||
|
|
||||||
|
@ -89,8 +90,6 @@ func (environ *Environment) Init(ctx context.Context) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
session.markets = markets
|
session.markets = markets
|
||||||
session.Account = &types.Account{}
|
|
||||||
session.Stream = session.Exchange.NewStream()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -37,6 +37,8 @@ func NewExchangeSession(name string, exchange types.Exchange) *ExchangeSession {
|
||||||
return &ExchangeSession{
|
return &ExchangeSession{
|
||||||
Name: name,
|
Name: name,
|
||||||
Exchange: exchange,
|
Exchange: exchange,
|
||||||
|
Stream: exchange.NewStream(),
|
||||||
|
Account: &types.Account{},
|
||||||
Subscriptions: make(map[types.Subscription]types.Subscription),
|
Subscriptions: make(map[types.Subscription]types.Subscription),
|
||||||
markets: make(map[string]types.Market),
|
markets: make(map[string]types.Market),
|
||||||
Trades: make(map[string][]types.Trade),
|
Trades: make(map[string][]types.Trade),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user