Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Supporting Arctic Backend Provider & Orderbook, Tick Data Example #744

Merged
merged 36 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b81e566
change weight_decay & batchsize
bxdd Dec 8, 2020
3dc5e6d
del weight_decay
bxdd Dec 8, 2020
60a03d5
big weight_decay
bxdd Dec 8, 2020
1521adf
mid weight_decay
bxdd Dec 8, 2020
7792f79
small layer
bxdd Dec 8, 2020
c53d6a1
2 layer
bxdd Dec 8, 2020
2bbd04c
full layer
bxdd Dec 8, 2020
ab4abc7
no weight decay
bxdd Dec 8, 2020
0342850
divide into two data source
wangwenxi-handsome Nov 16, 2021
ace8920
change parse field
wangwenxi-handsome Nov 16, 2021
91e1f82
delete some debug
wangwenxi-handsome Nov 16, 2021
f308d2c
add Toperator
wangwenxi-handsome Nov 17, 2021
518341f
new format of arctic
wangwenxi-handsome Nov 17, 2021
556786a
fix cache bug to arctic read
wangwenxi-handsome Nov 17, 2021
5ae2b5c
fix connection problem
wangwenxi-handsome Nov 18, 2021
acc5fc9
add some operator
luocy16 Nov 19, 2021
b0c3c2f
final version for arcitc
luocy16 Dec 9, 2021
f679602
merge microsoft qlib
luocy16 Dec 13, 2021
e4ff5bd
clear HZ cache
luocy16 Dec 13, 2021
95417c3
remove not used function
luocy16 Dec 14, 2021
33cc78a
add topswrappers
luocy16 Dec 15, 2021
d12ece6
successfully import data and run first test
you-n-g Jan 6, 2022
31d8e1b
Merge remote-tracking branch 'origin/main' into lcy_main
you-n-g Jan 6, 2022
2779b0d
A simpler version to support arctic
you-n-g Jan 14, 2022
a7092bb
Merge remote-tracking branch 'origin/main' into lcy_main
you-n-g Jan 14, 2022
2ea1b82
Successfully run all high-freq expressions
you-n-g Jan 17, 2022
1736ebe
Merge remote-tracking branch 'origin/main' into lcy_main
you-n-g Jan 17, 2022
8f4a717
Black format and fix add docs
you-n-g Jan 17, 2022
2bb154f
Add docs for download and test data
you-n-g Jan 17, 2022
5e21100
update scripts and docs
you-n-g Jan 17, 2022
6ed3d0a
Add docs
you-n-g Jan 17, 2022
2251402
fix bug
you-n-g Jan 17, 2022
0c9d8d7
Refine docs
you-n-g Jan 17, 2022
e59dc16
fix test bug
you-n-g Jan 17, 2022
97685b0
fix CI error
you-n-g Jan 17, 2022
ef7da9e
clean code
you-n-g Jan 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions qlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import platform
import subprocess
from .log import get_module_logger

from arctic import Arctic

# init qlib
def init(default_conf="client", **kwargs):
from .config import C
from .data.cache import H
from .config import C, Arctic_Connection_List
from .data.cache import H, HZ

# FIXME: this logger ignored the level in config
logger = get_module_logger("Initialization", level=logging.INFO)
Expand All @@ -28,7 +28,11 @@ def init(default_conf="client", **kwargs):
logger.warning("Skip initialization because `skip_if_reg is True`")
return

if len(Arctic_Connection_List) == 0:
Arctic_Connection_List.append(Arctic(C.arctic_uri))

H.clear()
HZ.clear()
C.set(default_conf, **kwargs)

# mount nfs
Expand Down
38 changes: 37 additions & 1 deletion qlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def set_conf_from_C(self, config_c):
PROTOCOL_VERSION = 4

NUM_USABLE_CPU = max(multiprocessing.cpu_count() - 2, 1)
NUM_USABLE_CPU_FOR_ARCTIC = min(NUM_USABLE_CPU, 30)
ARCTIC_TIME_INTERVAL = 1
ARCTIC_RETRY_TIME = 5

DISK_DATASET_CACHE = "DiskDatasetCache"
SIMPLE_DATASET_CACHE = "SimpleDatasetCache"
Expand All @@ -103,13 +106,19 @@ def set_conf_from_C(self, config_c):
# 2. backend_config: backend_obj["kwargs"]["provider_uri_map"]
# 3. qlib.init: provider_uri
"provider_uri": "",
"arctic_uri": "",
"arctic_time_interval": ARCTIC_TIME_INTERVAL,
"arctic_retry_time": ARCTIC_RETRY_TIME,
# cache
"expression_cache": None,
"dataset_cache": None,
"calendar_cache": None,
# for market transaction time
"market_transaction_time_list": [("09:15", "11:30"), ("13:00", "15:00")],
# for simple dataset cache
"local_cache_path": None,
"kernels": NUM_USABLE_CPU,
"arctic_kernels": NUM_USABLE_CPU_FOR_ARCTIC,
# pickle.dump protocol version
"dump_protocol_version": PROTOCOL_VERSION,
# How many tasks belong to one process. Recommend 1 for high-frequency data and None for daily data.
Expand All @@ -122,7 +131,7 @@ def set_conf_from_C(self, config_c):
# default 1 hour
"mem_cache_expire": 60 * 60,
# memory cache space limit, default 5GB, only in used client
"mem_cache_space_limit": 1024 * 1024 * 1024 * 5,
"mem_cache_space_limit": 1024 * 1024 * 1024,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it necessary to change the default memory size?

# cache dir name
"dataset_cache_dir_name": "dataset_cache",
"features_cache_dir_name": "features_cache",
Expand Down Expand Up @@ -232,6 +241,31 @@ def set_conf_from_C(self, config_c):
# if element of custom_ops is dict, it represents the config of custom operator and should include `class` and `module_path` keys.
"custom_ops": [],
},
"arctic_client": {
# data provider config
"calendar_provider": "LocalCalendarProvider",
"instrument_provider": "LocalInstrumentProvider",
"feature_provider": "LocalFeatureProvider",
"expression_provider": "LocalExpressionProvider",
"dataset_provider": "LocalDatasetProvider",
"provider": "LocalProvider",
# config it in user's own code
"provider_uri": "~/.qlib/qlib_data/cn_data",
# cache
# Using parameter 'remote' to announce the client is using server_cache, and the writing access will be disabled.
"expression_cache": None,
"dataset_cache": None,
"calendar_cache": None,
# client config
"kernels": NUM_USABLE_CPU,
"mount_path": None,
"auto_mount": False, # The nfs is already mounted on our server[auto_mount: False].
# The nfs should be auto-mounted by qlib on other
# serversS(such as PAI) [auto_mount:True]
"timeout": 100,
"logging_level": "INFO",
"region": REG_CN,
},
}

HIGH_FREQ_CONFIG = {
Expand Down Expand Up @@ -450,3 +484,5 @@ def registered(self):

# global config
C = QlibConfig(_default_config)
# for arctic connection
Arctic_Connection_List = []
1 change: 0 additions & 1 deletion qlib/contrib/model/pytorch_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

class DNNModelPytorch(Model):
"""DNN Model

Parameters
----------
input_dim : int
Expand Down
Loading