1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 06:46:56 +08:00

format code and add example

This commit is contained in:
lzh222333
2021-03-12 08:24:21 +00:00
parent 6d8aa215d6
commit 9d84d389ab
8 changed files with 310 additions and 216 deletions

View File

@@ -5,12 +5,12 @@ from qlib.config import REG_CN
import fire
data_handler_config = {
"start_time": "2008-01-01",
"end_time": "2020-08-01",
"fit_start_time": "2008-01-01",
"fit_end_time": "2014-12-31",
"instruments": "csi100",
}
"start_time": "2008-01-01",
"end_time": "2020-08-01",
"fit_start_time": "2008-01-01",
"fit_end_time": "2014-12-31",
"instruments": "csi100",
}
task = {
"model": {
@@ -44,22 +44,26 @@ task = {
},
},
},
"record": {"class": "SignalRecord", "module_path": "qlib.workflow.record_temp",},
"record": {
"class": "SignalRecord",
"module_path": "qlib.workflow.record_temp",
},
}
provider_uri = "~/.qlib/qlib_data/cn_data" # target_dir
def first_train(experiment_name="online_svr"):
qlib.init(provider_uri=provider_uri, region=REG_CN)
model_updater = ModelUpdater(experiment_name)
rid = task_train(task_config=task, experiment_name=experiment_name)
model_updater.reset_online_model(rid)
def update_online_pred(experiment_name="online_svr"):
qlib.init(provider_uri=provider_uri, region=REG_CN)
model_updater = ModelUpdater(experiment_name)
@@ -68,8 +72,9 @@ def update_online_pred(experiment_name="online_svr"):
print(rid)
model_updater.update_online_pred()
if __name__ == '__main__':
if __name__ == "__main__":
fire.Fire()
# to train a model and set it to online model, use the command below
# python update_online_pred.py first_train