Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions qlib/rl/order_execution/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ def forward(
self,
obs: torch.Tensor,
state: torch.Tensor = None,
info: dict = {},
info: dict = None,
) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
if info is None:
info = {}
feature = self.extractor(to_torch(obs, device=auto_device(self)))
out = self.layer_out(feature)
return out, state
Expand All @@ -93,8 +95,10 @@ def forward(
self,
obs: torch.Tensor,
state: torch.Tensor = None,
info: dict = {},
info: dict = None,
) -> torch.Tensor:
if info is None:
info = {}
feature = self.extractor(to_torch(obs, device=auto_device(self)))
return self.value_out(feature).squeeze(dim=-1)

Expand Down
9 changes: 7 additions & 2 deletions qlib/rl/order_execution/simulator_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def __init__(
self,
order: Order,
data_dir: Path,
feature_columns_today: List[str] = [],
feature_columns_yesterday: List[str] = [],
feature_columns_today: List[str] = None,
feature_columns_yesterday: List[str] = None,
data_granularity: int = 1,
ticks_per_step: int = 30,
vol_threshold: Optional[float] = None,
Expand All @@ -89,6 +89,11 @@ def __init__(

assert ticks_per_step % data_granularity == 0

if feature_columns_today is None:
feature_columns_today = []
if feature_columns_yesterday is None:
feature_columns_yesterday = []

self.order = order
self.data_dir = data_dir
self.feature_columns_today = feature_columns_today
Expand Down