mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
Merge pull request #582 from c9s/rename-backtest-account-to-accounts
improve: backtest: rename backtest.account to backtest.accounts
This commit is contained in:
commit
159c972d8b
|
@ -83,7 +83,16 @@ func NewExchange(sourceName types.ExchangeName, sourceExchange types.Exchange, s
|
||||||
endTime = time.Now()
|
endTime = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
configAccount := config.Account[sourceName.String()]
|
configAccount, ok := config.Accounts[sourceName.String()]
|
||||||
|
if !ok {
|
||||||
|
// fallback to the legacy account syntax
|
||||||
|
configAccount, ok = config.Account[sourceName.String()]
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("config backtest.accounts is not defined, please check your config file.")
|
||||||
|
} else {
|
||||||
|
log.Warnf("config backtest.account is deprecated, please use backtest.accounts instead.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
account := &types.Account{
|
account := &types.Account{
|
||||||
MakerFeeRate: configAccount.MakerFeeRate,
|
MakerFeeRate: configAccount.MakerFeeRate,
|
||||||
|
|
|
@ -105,7 +105,10 @@ type Backtest struct {
|
||||||
|
|
||||||
// RecordTrades is an option, if set to true, back-testing should record the trades into database
|
// RecordTrades is an option, if set to true, back-testing should record the trades into database
|
||||||
RecordTrades bool `json:"recordTrades,omitempty" yaml:"recordTrades,omitempty"`
|
RecordTrades bool `json:"recordTrades,omitempty" yaml:"recordTrades,omitempty"`
|
||||||
|
|
||||||
|
// Account is deprecated, use Accounts instead
|
||||||
Account map[string]BacktestAccount `json:"account" yaml:"account"`
|
Account map[string]BacktestAccount `json:"account" yaml:"account"`
|
||||||
|
Accounts map[string]BacktestAccount `json:"accounts" yaml:"accounts"`
|
||||||
Symbols []string `json:"symbols" yaml:"symbols"`
|
Symbols []string `json:"symbols" yaml:"symbols"`
|
||||||
Sessions []string `json:"sessions" yaml:"sessions"`
|
Sessions []string `json:"sessions" yaml:"sessions"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user