mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-15 16:56:54 +08:00
Format code
This commit is contained in:
@@ -91,7 +91,7 @@ def init_qlib(config: dict, part: Optional[str] = None) -> None:
|
|||||||
"class": "FileCalendarStorage",
|
"class": "FileCalendarStorage",
|
||||||
"module_path": "qlib.data.storage.file_storage",
|
"module_path": "qlib.data.storage.file_storage",
|
||||||
"kwargs": {"provider_uri_map": provider_uri_map},
|
"kwargs": {"provider_uri_map": provider_uri_map},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
feature_provider={
|
feature_provider={
|
||||||
@@ -102,7 +102,7 @@ def init_qlib(config: dict, part: Optional[str] = None) -> None:
|
|||||||
"class": "FileFeatureStorage",
|
"class": "FileFeatureStorage",
|
||||||
"module_path": "qlib.data.storage.file_storage",
|
"module_path": "qlib.data.storage.file_storage",
|
||||||
"kwargs": {"provider_uri_map": provider_uri_map},
|
"kwargs": {"provider_uri_map": provider_uri_map},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
provider_uri=provider_uri_map,
|
provider_uri=provider_uri_map,
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ from __future__ import annotations
|
|||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from qlib.rl.reward import Reward
|
from qlib.rl.reward import Reward
|
||||||
|
|
||||||
from .simulator_simple import SAOEState, SAOEMetrics
|
from .simulator_simple import SAOEMetrics, SAOEState
|
||||||
|
|
||||||
__all__ = ["PAPenaltyReward"]
|
__all__ = ["PAPenaltyReward"]
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ from qlib.rl.order_execution.utils import (
|
|||||||
_convert_tick_str_to_int,
|
_convert_tick_str_to_int,
|
||||||
_dataframe_append,
|
_dataframe_append,
|
||||||
_get_common_infra,
|
_get_common_infra,
|
||||||
_get_portfolio_and_indicator, _get_ticks_slice,
|
_get_portfolio_and_indicator,
|
||||||
|
_get_ticks_slice,
|
||||||
_price_advantage,
|
_price_advantage,
|
||||||
)
|
)
|
||||||
from qlib.rl.simulator import Simulator
|
from qlib.rl.simulator import Simulator
|
||||||
@@ -83,7 +84,7 @@ class SingleOrderStrategy(BaseStrategy):
|
|||||||
code=self._instrument,
|
code=self._instrument,
|
||||||
amount=self._order.amount,
|
amount=self._order.amount,
|
||||||
direction=Order.parse_dir(self._order.direction),
|
direction=Order.parse_dir(self._order.direction),
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
return TradeDecisionWO(order_list, self, self._trade_range)
|
return TradeDecisionWO(order_list, self, self._trade_range)
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ class StateMaintainer:
|
|||||||
execute_result[0][0].start_time,
|
execute_result[0][0].start_time,
|
||||||
execute_result[-1][0].start_time,
|
execute_result[-1][0].start_time,
|
||||||
method=None,
|
method=None,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
trade_value = all_indicators["1min"].iloc[-num_step:]["value"].values
|
trade_value = all_indicators["1min"].iloc[-num_step:]["value"].values
|
||||||
@@ -153,8 +154,13 @@ class StateMaintainer:
|
|||||||
self.history_steps,
|
self.history_steps,
|
||||||
[
|
[
|
||||||
self._collect_single_order_metric(
|
self._collect_single_order_metric(
|
||||||
execute_order, execute_order.start_time, market_volume, market_price, exec_vol.sum(), exec_vol,
|
execute_order,
|
||||||
)
|
execute_order.start_time,
|
||||||
|
market_volume,
|
||||||
|
market_price,
|
||||||
|
exec_vol.sum(),
|
||||||
|
exec_vol,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, cast, List, Optional, Tuple
|
from typing import Any, List, Optional, Tuple, cast
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@@ -10,7 +10,7 @@ from qlib.backtest.account import Account
|
|||||||
from qlib.backtest.decision import OrderDir
|
from qlib.backtest.decision import OrderDir
|
||||||
from qlib.backtest.executor import BaseExecutor
|
from qlib.backtest.executor import BaseExecutor
|
||||||
from qlib.rl.order_execution.from_neutrader.config import ExchangeConfig
|
from qlib.rl.order_execution.from_neutrader.config import ExchangeConfig
|
||||||
from qlib.rl.order_execution.simulator_simple import _float_or_ndarray, ONE_SEC
|
from qlib.rl.order_execution.simulator_simple import ONE_SEC, _float_or_ndarray
|
||||||
from qlib.utils.time import Freq
|
from qlib.utils.time import Freq
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user