mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-19 18:27:38 +08:00
Compare commits
3 Commits
fix_gen_tr
...
4933fcefc4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4933fcefc4 | ||
|
|
bb7ab1cf14 | ||
|
|
3dc5a7d299 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -0,0 +1,12 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [0.9.8](https://github.com/microsoft/qlib/compare/v0.9.7...v0.9.8) (2025-10-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* download orderbook data error ([#1990](https://github.com/microsoft/qlib/issues/1990)) ([136b2dd](https://github.com/microsoft/qlib/commit/136b2ddf9a16e4106d62b8d1336a56273a8abef0))
|
||||||
|
* replace deprecated pandas fillna(method=) with ffill()/bfill() ([#1987](https://github.com/microsoft/qlib/issues/1987)) ([7095e75](https://github.com/microsoft/qlib/commit/7095e755fa57e011f0483d24b45fc5bd5a4deaf8))
|
||||||
|
* spelling errors ([#1996](https://github.com/microsoft/qlib/issues/1996)) ([f26b341](https://github.com/microsoft/qlib/commit/f26b3417363410531dbbb39e425bce6cf05528a1))
|
||||||
|
* the bug when auto_mount=True ([#2009](https://github.com/microsoft/qlib/issues/2009)) ([213eb6c](https://github.com/microsoft/qlib/commit/213eb6c2cd12342b6ec98f21300217e1659f3d58))
|
||||||
|
* typo in integration documentation: 'userd' -> 'used' ([#2034](https://github.com/microsoft/qlib/issues/2034)) ([3dc5a7d](https://github.com/microsoft/qlib/commit/3dc5a7d299074f0fa45a4b7bb50ab446a8824a32))
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ For example, it looks quite long and complicated:
|
|||||||
|
|
||||||
|
|
||||||
But using string is not the only way to implement the expression. You can also implement expression by code.
|
But using string is not the only way to implement the expression. You can also implement expression by code.
|
||||||
Here is an exmaple which does the same thing as above examples.
|
Here is an example which does the same thing as above examples.
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ The Custom models need to inherit `qlib.model.base.Model <../reference/api.html#
|
|||||||
)
|
)
|
||||||
|
|
||||||
- Override the `predict` method
|
- Override the `predict` method
|
||||||
- The parameters must include the parameter `dataset`, which will be userd to get the test dataset.
|
- The parameters must include the parameter `dataset`, which will be used to get the test dataset.
|
||||||
- Return the `prediction score`.
|
- Return the `prediction score`.
|
||||||
- Please refer to `Model API <../reference/api.html#module-qlib.model.base>`_ for the parameter types of the fit method.
|
- Please refer to `Model API <../reference/api.html#module-qlib.model.base>`_ for the parameter types of the fit method.
|
||||||
- Code Example: In the following example, users need to use `LightGBM` to predict the label(such as `preds`) of test data `x_test` and return it.
|
- Code Example: In the following example, users need to use `LightGBM` to predict the label(such as `preds`) of test data `x_test` and return it.
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ def generate_order(stock: str, start_idx: int, end_idx: int) -> bool:
|
|||||||
if len(df) == 0 or df.isnull().values.any() or min(df["$volume0"]) < 1e-5:
|
if len(df) == 0 or df.isnull().values.any() or min(df["$volume0"]) < 1e-5:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
df["date"] = df["datetime"].dt.date.astype("datetime64[ns]")
|
df["date"] = df["datetime"].dt.date.astype("datetime64")
|
||||||
df = df.set_index(["instrument", "datetime", "date"])
|
df = df.set_index(["instrument", "datetime", "date"])
|
||||||
df = df.groupby("date", group_keys=True).take(range(start_idx, end_idx)).droplevel(level=0)
|
df = df.groupby("date", group_keys=False).take(range(start_idx, end_idx)).droplevel(level=0)
|
||||||
|
|
||||||
order_all = pd.DataFrame(df.groupby(level=(2, 0), group_keys=True).mean().dropna())
|
order_all = pd.DataFrame(df.groupby(level=(2, 0), group_keys=False).mean().dropna())
|
||||||
order_all["amount"] = np.random.lognormal(-3.28, 1.14) * order_all["$volume0"]
|
order_all["amount"] = np.random.lognormal(-3.28, 1.14) * order_all["$volume0"]
|
||||||
order_all = order_all[order_all["amount"] > 0.0]
|
order_all = order_all[order_all["amount"] > 0.0]
|
||||||
order_all["order_type"] = 0
|
order_all["order_type"] = 0
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ def get_calendar_list(bench_code="CSI300") -> List[pd.Timestamp]:
|
|||||||
if bench_code.upper() == "ALL":
|
if bench_code.upper() == "ALL":
|
||||||
|
|
||||||
@deco_retry
|
@deco_retry
|
||||||
def _get_calendar(month):
|
def _get_calendar_from_month(month):
|
||||||
_cal = []
|
_cal = []
|
||||||
try:
|
try:
|
||||||
resp = requests.get(
|
resp = requests.get(
|
||||||
@@ -98,7 +98,7 @@ def get_calendar_list(bench_code="CSI300") -> List[pd.Timestamp]:
|
|||||||
month_range = pd.date_range(start="2000-01", end=pd.Timestamp.now() + pd.Timedelta(days=31), freq="M")
|
month_range = pd.date_range(start="2000-01", end=pd.Timestamp.now() + pd.Timedelta(days=31), freq="M")
|
||||||
calendar = []
|
calendar = []
|
||||||
for _m in month_range:
|
for _m in month_range:
|
||||||
cal = _get_calendar(_m.strftime("%Y-%m"))
|
cal = _get_calendar_from_month(_m.strftime("%Y-%m"))
|
||||||
if cal:
|
if cal:
|
||||||
calendar += cal
|
calendar += cal
|
||||||
calendar = list(filter(lambda x: x <= pd.Timestamp.now(), calendar))
|
calendar = list(filter(lambda x: x <= pd.Timestamp.now(), calendar))
|
||||||
|
|||||||
@@ -613,10 +613,6 @@ class YahooNormalize1min(YahooNormalize, ABC):
|
|||||||
def symbol_to_yahoo(self, symbol):
|
def symbol_to_yahoo(self, symbol):
|
||||||
raise NotImplementedError("rewrite symbol_to_yahoo")
|
raise NotImplementedError("rewrite symbol_to_yahoo")
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def _get_1d_calendar_list(self) -> Iterable[pd.Timestamp]:
|
|
||||||
raise NotImplementedError("rewrite _get_1d_calendar_list")
|
|
||||||
|
|
||||||
|
|
||||||
class YahooNormalizeUS:
|
class YahooNormalizeUS:
|
||||||
def _get_calendar_list(self) -> Iterable[pd.Timestamp]:
|
def _get_calendar_list(self) -> Iterable[pd.Timestamp]:
|
||||||
|
|||||||
Reference in New Issue
Block a user