load account before connecting

This commit is contained in:
c9s 2020-09-19 11:25:48 +08:00
parent 0f01fdc572
commit 4663e51e3a

View File

@ -82,6 +82,14 @@ func (trader *Trader) Subscribe(exchange string, channel string, symbol string,
func (trader *Trader) Connect(ctx context.Context) error { func (trader *Trader) Connect(ctx context.Context) error {
for n, ex := range trader.Exchanges { for n, ex := range trader.Exchanges {
account, err := LoadAccount(ctx, ex)
if err != nil {
return err
}
trader.ExchangeAccounts[n] = account
stream, err := ex.NewPrivateStream() stream, err := ex.NewPrivateStream()
if err != nil { if err != nil {
return err return err