cmd: document tradeStats binding

This commit is contained in:
c9s 2023-08-15 17:54:24 +08:00
parent 5f54c303fb
commit 874b647191
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -308,6 +308,8 @@ var BacktestCmd = &cobra.Command{
var reportDir = outputDirectory
var sessionTradeStats = make(map[string]map[string]*types.TradeStats)
// for each exchange session, iterate the positions and
// allocate trade collector to calculate the tradeStats
var tradeCollectorList []*core.TradeCollector
for _, exSource := range exchangeSources {
sessionName := exSource.Session.Name
@ -335,6 +337,7 @@ var BacktestCmd = &cobra.Command{
}
sessionTradeStats[sessionName] = tradeStatsMap
}
kLineHandlers = append(kLineHandlers, func(k types.KLine, _ *backtest.ExchangeDataSource) {
if k.Interval == types.Interval1d && k.Closed {
for _, collector := range tradeCollectorList {