1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-29 00:51:19 +08:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Linlang
209f208ff6 fix: gen_training_orders.py bugs 2025-09-26 12:14:49 +08:00
Kei YAMAZAKI
7d66e4b788 docs: update Docker run command in README.md to specify the correct image name (#2010) 2025-09-15 17:09:36 +08:00
Linlang
213eb6c2cd fix: the bug when auto_mount=True (#2009)
* fix: the bug when auto_mount=True

* fix: the bug when auto_mount=True
2025-09-11 20:05:17 +08:00
13 changed files with 22 additions and 19 deletions

View File

@@ -324,7 +324,7 @@ We recommend users to prepare their own data if they have a high-quality dataset
```
2. Start a new Docker container
```bash
docker run -it --name <container name> -v <Mounted local directory>:/app qlib_image_stable
docker run -it --name <container name> -v <Mounted local directory>:/app pyqlib/qlib_image_stable:stable
```
3. At this point you are in the docker environment and can run the qlib scripts. An example:
```bash

View File

@@ -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:
return False
df["date"] = df["datetime"].dt.date.astype("datetime64")
df["date"] = df["datetime"].dt.date.astype("datetime64[ns]")
df = df.set_index(["instrument", "datetime", "date"])
df = df.groupby("date", group_keys=False).take(range(start_idx, end_idx)).droplevel(level=0)
df = df.groupby("date", group_keys=True).take(range(start_idx, end_idx)).droplevel(level=0)
order_all = pd.DataFrame(df.groupby(level=(2, 0), group_keys=False).mean().dropna())
order_all = pd.DataFrame(df.groupby(level=(2, 0), group_keys=True).mean().dropna())
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_type"] = 0

View File

@@ -45,7 +45,7 @@ dependencies = [
"pymongo",
"loguru",
"lightgbm",
"gymnasium<=0.26.2",
"gym",
"cvxpy",
"joblib",
"matplotlib",

View File

@@ -140,7 +140,10 @@ def _mount_nfs_uri(provider_uri, mount_path, auto_mount: bool = False):
_command_log = [line for line in _command_log if _remote_uri in line]
if len(_command_log) > 0:
for _c in _command_log:
_temp_mount = _c.decode("utf-8").split(" ")[2]
if isinstance(_c, str):
_temp_mount = _c.split(" ")[2]
else:
_temp_mount = _c.decode("utf-8").split(" ")[2]
_temp_mount = _temp_mount[:-1] if _temp_mount.endswith("/") else _temp_mount
if _temp_mount == _mount_path:
_is_mount = True

View File

@@ -5,9 +5,9 @@ from __future__ import annotations
from typing import Any, Generic, TypeVar
import gymnasium as gym
import gym
import numpy as np
from gymnasium import spaces
from gym import spaces
from qlib.typehint import final
from .simulator import ActType, StateType

View File

@@ -8,7 +8,7 @@ from typing import Any, List, Optional, cast
import numpy as np
import pandas as pd
from gymnasium import spaces
from gym import spaces
from qlib.constant import EPS
from qlib.rl.data.base import ProcessedDataProvider

View File

@@ -6,11 +6,11 @@ from __future__ import annotations
from pathlib import Path
from typing import Any, Dict, Generator, Iterable, Optional, OrderedDict, Tuple, cast
import gymnasium as gym
import gym
import numpy as np
import torch
import torch.nn as nn
from gymnasium.spaces import Discrete
from gym.spaces import Discrete
from tianshou.data import Batch, ReplayBuffer, to_torch
from tianshou.policy import BasePolicy, PPOPolicy, DQNPolicy

View File

@@ -6,8 +6,8 @@ from __future__ import annotations
import weakref
from typing import Any, Callable, cast, Dict, Generic, Iterable, Iterator, Optional, Tuple
import gymnasium as gym
from gymnasium import Space
import gym
from gym import Space
from qlib.rl.aux_info import AuxiliaryInfoCollector
from qlib.rl.interpreter import ActionInterpreter, ObsType, PolicyActType, StateInterpreter

View File

@@ -13,7 +13,7 @@ import warnings
from contextlib import contextmanager
from typing import Any, Callable, Dict, Generator, List, Optional, Set, Tuple, Type, Union, cast
import gymnasium as gym
import gym
import numpy as np
from tianshou.env import BaseVectorEnv, DummyVectorEnv, ShmemVectorEnv, SubprocVectorEnv

View File

@@ -45,7 +45,7 @@ class InfoCollector:
"pymongo",
"loguru",
"lightgbm",
"gymnasium",
"gym",
"cvxpy",
"joblib",
"matplotlib",

View File

@@ -3,7 +3,7 @@
from collections import Counter
import gymnasium as gym
import gym
import numpy as np
from tianshou.data import Batch, Collector
from tianshou.policy import BasePolicy

View File

@@ -7,10 +7,10 @@ import logging
import re
from typing import Any, Tuple
import gymnasium as gym
import gym
import numpy as np
import pandas as pd
from gymnasium import spaces
from gym import spaces
from tianshou.data import Collector, Batch
from tianshou.policy import BasePolicy

View File

@@ -7,7 +7,7 @@ import pytest
import torch
import torch.nn as nn
from gymnasium import spaces
from gym import spaces
from tianshou.policy import PPOPolicy
from qlib.config import C