mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-13 07:46:53 +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:
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user