From 77966c2957d9c42a67715f225ba48a87ee47545e Mon Sep 17 00:00:00 2001 From: Huoran Li Date: Tue, 26 Jul 2022 11:01:23 +0800 Subject: [PATCH] Adjust file structure --- qlib/rl/{order_execution => }/from_neutrader/__init__.py | 0 qlib/rl/{order_execution => }/from_neutrader/config.py | 0 qlib/rl/{order_execution => }/from_neutrader/feature.py | 0 qlib/rl/order_execution/simulator_qlib.py | 6 +++--- qlib/rl/order_execution/tests/test_simulator_qlib.py | 6 +++--- qlib/rl/order_execution/utils.py | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) rename qlib/rl/{order_execution => }/from_neutrader/__init__.py (100%) rename qlib/rl/{order_execution => }/from_neutrader/config.py (100%) rename qlib/rl/{order_execution => }/from_neutrader/feature.py (100%) diff --git a/qlib/rl/order_execution/from_neutrader/__init__.py b/qlib/rl/from_neutrader/__init__.py similarity index 100% rename from qlib/rl/order_execution/from_neutrader/__init__.py rename to qlib/rl/from_neutrader/__init__.py diff --git a/qlib/rl/order_execution/from_neutrader/config.py b/qlib/rl/from_neutrader/config.py similarity index 100% rename from qlib/rl/order_execution/from_neutrader/config.py rename to qlib/rl/from_neutrader/config.py diff --git a/qlib/rl/order_execution/from_neutrader/feature.py b/qlib/rl/from_neutrader/feature.py similarity index 100% rename from qlib/rl/order_execution/from_neutrader/feature.py rename to qlib/rl/from_neutrader/feature.py diff --git a/qlib/rl/order_execution/simulator_qlib.py b/qlib/rl/order_execution/simulator_qlib.py index 237656f8f..bcf607d9e 100644 --- a/qlib/rl/order_execution/simulator_qlib.py +++ b/qlib/rl/order_execution/simulator_qlib.py @@ -4,7 +4,7 @@ """Placeholder for qlib-based simulator.""" from __future__ import annotations -from typing import Callable, Generator, List, Optional, Tuple, cast +from typing import Callable, cast, Generator, List, Optional, Tuple import numpy as np import pandas as pd @@ -14,8 +14,8 @@ from qlib.backtest.executor import BaseExecutor, NestedExecutor from qlib.backtest.utils import CommonInfrastructure from qlib.constant import EPS from qlib.rl.data.pickle_styled import QlibIntradayBacktestData -from qlib.rl.order_execution.from_neutrader.config import ExchangeConfig -from qlib.rl.order_execution.from_neutrader.feature import init_qlib +from qlib.rl.from_neutrader.config import ExchangeConfig +from qlib.rl.from_neutrader.feature import init_qlib from qlib.rl.order_execution.simulator_simple import SAOEMetrics, SAOEState from qlib.rl.order_execution.utils import ( _convert_tick_str_to_int, diff --git a/qlib/rl/order_execution/tests/test_simulator_qlib.py b/qlib/rl/order_execution/tests/test_simulator_qlib.py index 532f095e9..c49eb4e26 100644 --- a/qlib/rl/order_execution/tests/test_simulator_qlib.py +++ b/qlib/rl/order_execution/tests/test_simulator_qlib.py @@ -45,9 +45,9 @@ def get_simulator(order: Order) -> SingleAssetQlibSimulator: # fmt: off qlib_config = { - "provider_uri_day": Path("./data/cn/qlib_amc_1d"), - "provider_uri_1min": Path("./data/cn/qlib_amc_1min"), - "feature_root_dir": Path("./data/cn/qlib_amc_handler_stock"), + "provider_uri_day": Path(".data/cn/qlib_amc_1d"), + "provider_uri_1min": Path(".data/cn/qlib_amc_1min"), + "feature_root_dir": Path(".data/cn/qlib_amc_handler_stock"), "feature_columns_today": [ "$open", "$high", "$low", "$close", "$vwap", "$bid", "$ask", "$volume", "$bidV", "$bidV1", "$bidV3", "$bidV5", "$askV", "$askV1", "$askV3", "$askV5", diff --git a/qlib/rl/order_execution/utils.py b/qlib/rl/order_execution/utils.py index 915e5fa69..3610f432a 100644 --- a/qlib/rl/order_execution/utils.py +++ b/qlib/rl/order_execution/utils.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, List, Optional, Tuple, cast +from typing import Any, cast, List, Optional, Tuple import numpy as np import pandas as pd @@ -9,8 +9,8 @@ from qlib.backtest import CommonInfrastructure, get_exchange from qlib.backtest.account import Account from qlib.backtest.decision import OrderDir from qlib.backtest.executor import BaseExecutor -from qlib.rl.order_execution.from_neutrader.config import ExchangeConfig -from qlib.rl.order_execution.simulator_simple import ONE_SEC, _float_or_ndarray +from qlib.rl.from_neutrader.config import ExchangeConfig +from qlib.rl.order_execution.simulator_simple import _float_or_ndarray, ONE_SEC from qlib.utils.time import Freq