Strategy using timer takes different actions when feed with PandasData and GenericCSVData
Wang Guosong last edited by
As i tested monthly automatic investment by using timer, I found that my strategy takes different actions when feed with PandasData and GenericCSVData, setting param 'when' with 'SESSION_END'.
- Result from PandasData feed with SESSION_END:
- Result from GenericCSVData feed with SESSION_END:
Try to find the difference source, i change 'when' to 'SESSION_START'. Getting result for these two scenarios:
- Result from PandasData feed with SESSION_START:
- Result from GenericCSVData feed with SESSION_START:
I found that these two data feed get the same result with SESSION_START， but the time stamps are different. And i found the default time value in GenericCSVData is 23:59:59:999990 though we know that we get datetime.time(0,0) when we read a file with no time setting, which leads to the default time in PandasData is 00:00:00.
Found out the real value of SESSION_START and SESSION_END, i get this:
So we know that:
- If we use SESSION_END: the bar from PandasData time is earlier than SESSION_END(default: 23:59:59:999990), but bar GenericCSVData can fit the requirement and execute the command.
- If we use SESSION_START: the bar from PandasData time is the same with SESSION_START(default: 00:00:00), and bar GenericCSVData is later than SESSION_START, so it can also be executed.
ab_trader last edited by
I think for daily an higher time frame, use of the
session_endparameters meaningless and they can be skipped.