mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
add start time and end time to the report struct
This commit is contained in:
parent
555e2581a0
commit
5b443f0aeb
|
@ -11,6 +11,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Report struct {
|
type Report struct {
|
||||||
|
StartTime time.Time `json:"startTime"`
|
||||||
|
EndTime time.Time `json:"endTime"`
|
||||||
Symbol string `json:"symbol,omitempty"`
|
Symbol string `json:"symbol,omitempty"`
|
||||||
LastPrice fixedpoint.Value `json:"lastPrice,omitempty"`
|
LastPrice fixedpoint.Value `json:"lastPrice,omitempty"`
|
||||||
StartPrice fixedpoint.Value `json:"startPrice,omitempty"`
|
StartPrice fixedpoint.Value `json:"startPrice,omitempty"`
|
||||||
|
|
|
@ -150,13 +150,11 @@ var BacktestCmd = &cobra.Command{
|
||||||
|
|
||||||
// set default start time to the past 6 months
|
// set default start time to the past 6 months
|
||||||
// userConfig.Backtest.StartTime = now.AddDate(0, -6, 0).Format("2006-01-02")
|
// userConfig.Backtest.StartTime = now.AddDate(0, -6, 0).Format("2006-01-02")
|
||||||
|
|
||||||
if userConfig.Backtest.EndTime != nil {
|
if userConfig.Backtest.EndTime != nil {
|
||||||
endTime = userConfig.Backtest.EndTime.Time()
|
endTime = userConfig.Backtest.EndTime.Time()
|
||||||
} else {
|
} else {
|
||||||
endTime = now
|
endTime = now
|
||||||
}
|
}
|
||||||
_ = endTime
|
|
||||||
|
|
||||||
log.Infof("starting backtest with startTime %s", startTime.Format(time.ANSIC))
|
log.Infof("starting backtest with startTime %s", startTime.Format(time.ANSIC))
|
||||||
|
|
||||||
|
@ -468,6 +466,8 @@ var BacktestCmd = &cobra.Command{
|
||||||
|
|
||||||
if jsonOutputEnabled {
|
if jsonOutputEnabled {
|
||||||
result := backtest.Report{
|
result := backtest.Report{
|
||||||
|
StartTime: startTime,
|
||||||
|
EndTime: endTime,
|
||||||
Symbol: symbol,
|
Symbol: symbol,
|
||||||
LastPrice: lastPrice,
|
LastPrice: lastPrice,
|
||||||
StartPrice: startPrice,
|
StartPrice: startPrice,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user