Skip to content

Commit ed12c7f

Browse files
committed
add common_infra warning and fix time bug
1 parent 7738f39 commit ed12c7f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

qlib/backtest/executor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from abc import abstractclassmethod, abstractmethod
22
import copy
3+
from qlib.log import get_module_logger
34
from types import GeneratorType
45
from qlib.backtest.account import Account
56
import warnings
@@ -104,6 +105,8 @@ def __init__(
104105
self.level_infra = LevelInfrastructure()
105106
self.level_infra.reset_infra(common_infra=common_infra)
106107
self.reset(start_time=start_time, end_time=end_time, common_infra=common_infra)
108+
if common_infra is None:
109+
get_module_logger("BaseExecutor").warning(f"`common_infra` is not set for {self}")
107110

108111
def reset_common_infra(self, common_infra):
109112
"""

qlib/backtest/order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ def __init__(self, order_list: List[Order], strategy: BaseStrategy, trade_range:
514514
self.order_list = order_list
515515
start, end = strategy.trade_calendar.get_step_time()
516516
for o in order_list:
517-
if o.start_time:
517+
if o.start_time is None:
518518
o.start_time = start
519-
if o.end_time:
519+
if o.end_time is None:
520520
o.end_time = end
521521

522522
def get_decision(self) -> List[object]:

0 commit comments

Comments
 (0)