use config.GetAccount to avoid error

This commit is contained in:
c9s 2022-05-19 10:01:21 +08:00
parent 13bf5d69a3
commit 40b3192e55
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -83,16 +83,7 @@ func NewExchange(sourceName types.ExchangeName, sourceExchange types.Exchange, s
endTime = time.Now()
}
configAccount, ok := config.Accounts[sourceName.String()]
if !ok {
// fallback to the legacy account syntax
configAccount, ok = config.Account[sourceName.String()]
if !ok {
return nil, fmt.Errorf("config backtest.accounts[%s] is not defined, please check your config file.", sourceName.String())
} else {
log.Warnf("config backtest.account is deprecated, please use backtest.accounts instead.")
}
}
configAccount := config.GetAccount(sourceName.String())
account := &types.Account{
MakerFeeRate: configAccount.MakerFeeRate,