mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +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
|
||||
}
|
||||
|
||||
// NewDefaultEnvironment prepares the exchange sessions from the viper settings.
|
||||
func NewDefaultEnvironment(db *sqlx.DB) *Environment {
|
||||
environment := NewEnvironment(db)
|
||||
|
||||
|
@ -89,8 +90,6 @@ func (environ *Environment) Init(ctx context.Context) (err error) {
|
|||
}
|
||||
|
||||
session.markets = markets
|
||||
session.Account = &types.Account{}
|
||||
session.Stream = session.Exchange.NewStream()
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -37,6 +37,8 @@ func NewExchangeSession(name string, exchange types.Exchange) *ExchangeSession {
|
|||
return &ExchangeSession{
|
||||
Name: name,
|
||||
Exchange: exchange,
|
||||
Stream: exchange.NewStream(),
|
||||
Account: &types.Account{},
|
||||
Subscriptions: make(map[types.Subscription]types.Subscription),
|
||||
markets: make(map[string]types.Market),
|
||||
Trades: make(map[string][]types.Trade),
|
||||
|
|
Loading…
Reference in New Issue
Block a user