1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-13 15:56:57 +08:00

RL backtest with simulator (#1299)

* RL backtest with simulator

* Minor modification in init_qlib

* Cherry pick PR 1302

* Resolve PR comments

* Fix missing data processing

* Minor bugfix

* Add TODOs and docs

* Add a comment
This commit is contained in:
Huoran Li
2022-10-12 16:44:28 +08:00
committed by GitHub
parent 54928e956d
commit 216a8ec2de
11 changed files with 354 additions and 92 deletions

View File

@@ -32,16 +32,7 @@ def get_order() -> Order:
)
def get_configs(order: Order) -> Tuple[dict, dict, dict]:
strategy_config = {
"class": "SingleOrderStrategy",
"module_path": "qlib.rl.strategy.single_order",
"kwargs": {
"order": order,
"trade_range": TradeRangeByTime(order.start_time.time(), order.end_time.time()),
},
}
def get_configs(order: Order) -> Tuple[dict, dict]:
executor_config = {
"class": "NestedExecutor",
"module_path": "qlib.backtest.executor",
@@ -93,7 +84,7 @@ def get_configs(order: Order) -> Tuple[dict, dict, dict]:
"trade_unit": None,
}
return strategy_config, executor_config, exchange_config
return executor_config, exchange_config
def get_simulator(order: Order) -> SingleAssetOrderExecution:
@@ -115,12 +106,11 @@ def get_simulator(order: Order) -> SingleAssetOrderExecution:
}
# fmt: on
strategy_config, executor_config, exchange_config = get_configs(order)
executor_config, exchange_config = get_configs(order)
return SingleAssetOrderExecution(
order=order,
qlib_config=qlib_config,
strategy_config=strategy_config,
executor_config=executor_config,
exchange_config=exchange_config,
)