From 4663e51e3a79114feb1d451726696dfa2b2af0be Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 19 Sep 2020 11:25:48 +0800 Subject: [PATCH] load account before connecting --- bbgo/trader.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bbgo/trader.go b/bbgo/trader.go index 4d095d406..afc69d922 100644 --- a/bbgo/trader.go +++ b/bbgo/trader.go @@ -82,6 +82,14 @@ func (trader *Trader) Subscribe(exchange string, channel string, symbol string, func (trader *Trader) Connect(ctx context.Context) error { for n, ex := range trader.Exchanges { + account, err := LoadAccount(ctx, ex) + if err != nil { + return err + } + + trader.ExchangeAccounts[n] = account + + stream, err := ex.NewPrivateStream() if err != nil { return err