1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-06 14:01:28 +08:00

Compare commits

...

893 Commits

Author SHA1 Message Date
Dong Zhou
5ac9dd7221 temporarily fix create exp conflicts for remote mlflow 2021-11-12 05:16:17 +00:00
you-n-g
7efec6bbc4 Fix private import 2021-11-08 09:52:55 +08:00
Young
3fa48d7017 simplify record tmp 2021-11-05 12:57:14 +00:00
Young
4f2d6b0d84 fix pytorch memory amount error 2021-11-02 20:41:39 +08:00
Young
3943b7001f fix CI bug for AyncCaller 2021-11-02 14:32:09 +08:00
Young
2593185721 Simplify TSDataset and async recorder 2021-11-02 11:07:40 +08:00
Young
7a884fa9f2 remove redundant file only when remote artifact 2021-11-01 18:55:44 +08:00
Dong Zhou
d929d4bb21 rm recorder temp file 2021-11-01 09:29:44 +00:00
Young
e54b019ee2 solve init kwargs conflictions 2021-11-01 06:22:25 +00:00
Young
426b98a3bc make the logic of online manager cleaner 2021-11-01 02:40:54 +00:00
Young
82f8ff9066 Update seperate dataframe 2021-11-01 00:51:21 +08:00
Young
31e9d529de Add multi horizon task generator 2021-10-28 00:01:19 +08:00
Young
5fa56703ae add handler pickle attr, enhance init_instance_by_config 2021-10-26 23:32:33 +08:00
Dong Zhou
c6bb11fe56 avoid trade without enough cash 2021-10-25 05:46:19 +00:00
Dong Zhou
3d7ebd1fe0 add back trade_val 2021-10-22 10:13:15 +00:00
Dong Zhou
7313b4dad0 fix impact cost 2021-10-22 08:58:37 +00:00
Dong Zhou
b70caff522 add doc 2021-10-22 08:49:20 +00:00
Dong Zhou
96b422a906 support market impact cost 2021-10-22 08:44:47 +00:00
Young
64130d9407 Fix the aggregation function of IndexData 2021-10-22 15:20:45 +08:00
Young
a58bc03a8e add sepdf(make mini project only rely on qlib) 2021-10-21 13:15:02 +00:00
Young
f537222ce3 make handler seperable 2021-10-21 12:38:24 +00:00
Dong Zhou
c427c64845 fix calendar 2021-10-19 06:17:53 +00:00
Young
22ff8fdc44 simple change log 2021-10-16 17:14:37 +00:00
Young
4efb0a75c1 Being compatible with previous Qlib version 2021-10-16 16:43:38 +00:00
Young
052aad7982 simplify signal parameter 2021-10-15 14:48:31 +00:00
Young
12f05c7182 Merge branch 'backtest_improve' of github.com:microsoft/qlib into backtest_improve 2021-10-15 11:27:33 +00:00
Young
ac08468330 Make static prediction easier 2021-10-15 11:21:03 +00:00
Dong Zhou
df9745f134 support empty order 2021-10-15 09:07:03 +00:00
Dong Zhou
2e49a5f7c0 fix order generator 2021-10-15 07:04:47 +00:00
you-n-g
3ab5721448 Fix OrderGenerator's return value 2021-10-15 14:28:08 +08:00
you-n-g
6a94b45503 Update order_generator.py 2021-10-15 13:52:55 +08:00
you-n-g
7c31012b50 Auto injecting model and dataset for Recorder (#645)
* Auto injecting model and dataset for Recorder

* Support using Feature in expression
2021-10-15 13:50:24 +08:00
you-n-g
334b92ace7 Checking dataset empty (#647)
* Checking dataset empty

* add dataset checker
2021-10-14 23:35:12 +08:00
you-n-g
9a175d7507 improve the doc of auto init (#541)
* improve the doc of auto init

* Update setup.py

* Update setup.py

* change cvxpy version

Co-authored-by: Wangwuyi123 <51237097+Wangwuyi123@users.noreply.github.com>
2021-10-12 11:58:27 +08:00
Lewen Wang
17ea44e0cf Update TCTS. (#643)
* Update TCTS.

* Update TCTS README.

* Update TCTS README.

* Update TCTS.

Co-authored-by: lewwang <lwwang@microsoft.com>
2021-10-12 10:08:48 +08:00
you-n-g
c0ce712be9 more detailed docs for workflow (#639)
* more detailed docs for workflow

* add more detailed docs for workflow
2021-10-11 15:38:18 +08:00
demon143
8e81a017c1 Update manage.py (#628)
* Update manage.py

* Update manage.py

* Update manage.py

* Create manage.py

* Update manage.py

* Update qlib/workflow/task/manage.py

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2021-10-11 15:37:50 +08:00
you-n-g
706727988c Update README.md 2021-10-09 23:37:07 +08:00
you-n-g
e99224e5c2 Update benchmark based on new backtest (#634)
* free random seed

* update model baselines

* more robust for parameters
2021-10-07 22:57:19 +08:00
Pengrong Zhu
8c8d1336de fix workflow_config_lightgbm_multi_freq.yaml (#635) 2021-10-06 17:18:27 +08:00
Pengrong Zhu
d01de411a8 add support for macos-11 (#630)
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2021-10-03 16:49:17 +08:00
Young
28fe4d4bb4 update file strategy test 2021-10-03 14:58:37 +08:00
Young
873129aa9b update fix CI tests bugs 2021-10-03 14:58:37 +08:00
Young
3a152f9b8b fix CI 2021-10-03 14:58:37 +08:00
Young
2b75b41a08 remove 3.6 2021-10-03 14:58:37 +08:00
you-n-g
00d17f0a52 Update python-publish.yml 2021-10-01 03:03:26 +08:00
you-n-g
6bec33e854 Merge pull request #438 from microsoft/nested_decision_exe
Support Highfreq Backtest with the Model/Rule/RL Strategy
2021-10-01 02:47:53 +08:00
Young
48a860c8b7 fix backtest yaml 2021-09-30 18:43:36 +00:00
Young
4099050935 Merge remote-tracking branch 'origin/main' into nested_decision_exe 2021-09-30 18:41:15 +00:00
wangwenxi-handsome
3760a18a8d Merge nested main (#597)
* MVP for Indian Stocks in qlib using yahooquery

* cleaned with black

* cleaned with black

* add YahooNormalizeIN and YahooNormalizeIN1d

* cleaned the code

* added 1min for IN and also updated readme

* update comments

* fix comments

* recorder support upload both raw file and directory

* fix comments

* Update README.md

* Fix docs of QlibRecorder

* sort index after loader (#538)

make sure the fetch method is based on a index-sorted pd.DataFrame

* refactor online serving rolling api

* refactor TRA

* format by black

* fix horizon

* fix TRA when use single head

* clean up

* improve pretrain

* update README

* fix tra when logdir is None

* fix tra when logdir is None

* Update strategy.py

* Update README.md

* Update README.md

* Conda Suggestion

* code standard docs

* Update ensemble.py (#560)

* Fix CI  Bug (#575)


Co-authored-by: yuxwang <anduinnn@foxmail.com>

* Update gen.py (#576)

* Fix multi-process loop calls (#574)

* check lexsort in the 'lazy_sort_index' function (#566)

* check lexsort

* check lexsort

* lexsort comment

* lexsort comment

* Delete .DS_Store

* Update README.md

* bug fix & use oracle transport pretrain

* mend

* Add `backend_freq_config` parameter, support multi-freq uri

* Add sample_config to QlibDataLoader, support multi-freq

* add multi-freq example

* get_cls_kwargs renamed get_callable_kwargs

* support multi-freq uri

* Add inst_processors to D.features

* Fix typo

* Fix the index type of the multi-freq example

* Fix duplicate mlflow directories in tests

* Add DataPathManager to QlibConfig && modify inst_processors to supports list only

* Modify the default value in the multi_freq example

* Modify client-server mode and dataset-cache to disable inst_processor

* Add wheel package to github CI

* fix comment

* Update FAQ.rst

* Update README.md

Fix wrong link

* Update the docs of TaskManager (#586)

* Update manage.py

* update yaml

* update run_all_model

* Modify the Feature to be case sensitive (#589)

* update README

* remove verbose

* fix spell bug

* fix typos (#592)

* Update Release Note

* fix portfolio bug

* Add calendar support for resample

* add freq kwargs

* test.yml: Remove redundant code (#595)

* Supporting shared processor (#596)

* Supporting shared processor

* fix readonly reverse bug

* remove pytests dependency

* with fit bug

* fix parameter error

* fix comments

* Fix undefined names in Python code (#599)

* Update pytorch_tabnet.py

$ `flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics`
```
./qlib/qlib/contrib/model/pytorch_tabnet.py:567:38: F821 undefined name 'inp'
            self.independ.append(GLU(inp, out_dim, vbs=vbs))
                                     ^
./qlib/examples/model_rolling/task_manager_rolling.py:75:18: F821 undefined name 'task_train'
        run_task(task_train, self.task_pool, experiment_name=self.experiment_name)
                 ^
2     F821 undefined name 'task_train'
2
```

* Fix undefined names in Python code

* from qlib.model.trainer import task_train

* update seed

* fix some docstring

* add comments

* Fix SimpleDatasetCache

* Update setup.py

updated classifiers

* Update setup.py

change to matplotlib==3.3

* Update python-publish.yml

added python 3.9

* updategrade version number

* Update model list

* fix the type of filter_pipe

* fix comment

* fix record_temp

* update cvxpy version

* Update code_standard.rst (#587)

* Update code_standard.rst

* Update docs/developer/code_standard.rst

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* Add file lock for MLflowExpManager (#619)

* fix torch version

* Share version number (#620)

* Update initialization.rst (#622)

* Update initialization.rst

* Update docs/start/initialization.rst

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* Update docs/start/initialization.rst

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* fix bugs for running previous exmaple

* fix deal amount bug

* update change doc (#623)

* Add files via upload

* Update README.md

* Update README.md

* Update README.md

* Delete change doc.gif

* Add files via upload

* Update README.md

* Delete change doc.gif

* Add files via upload

* Delete change doc.gif

* Add files via upload

* Update README.md

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* update doc

* simplify run all model

* fix run all model bug

* Fix Models (#483)

* fix gat dataset

* fix tft model

* Update tft.py

* Fix tft.py

Co-authored-by: Pengrong Zhu <zhu.pengrong@foxmail.com>

* type and skip empty exp

* fix model yaml config

* fix tft import bug

* skip empty result

* fix model and yaml bug

* fix wrong generate parameter

* Modify multi-freq example (#626)

* modify the example of multi-freq

* add Copyright

* add a comment to average_ops.py

* modify the example of multi-freq

* add comment to multi_freq_handler.py

* add the Ref expression description to multi_freq_handler.py

* add expression description to multi_freq_handler.py

* update images

* fix workflow and update framework

Co-authored-by: Gaurav <2796gaurav@gmail.com>
Co-authored-by: 2796gaurav <17353992+2796gaurav@users.noreply.github.com>
Co-authored-by: bxdd <bxd98@126.com>
Co-authored-by: Young <afe.young@gmail.com>
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
Co-authored-by: Dong Zhou <Zhou.Dong@microsoft.com>
Co-authored-by: ZhangTP1996 <ztp18@mails.tsinghua.edu.cn>
Co-authored-by: demon143 <59681577+demon143@users.noreply.github.com>
Co-authored-by: Wangwuyi123 <51237097+Wangwuyi123@users.noreply.github.com>
Co-authored-by: yuxwang <anduinnn@foxmail.com>
Co-authored-by: Pengrong Zhu <zhu.pengrong@foxmail.com>
Co-authored-by: Mark Zhao <50850474+markzhao98@users.noreply.github.com>
Co-authored-by: cslwqxx <cslwqxx@users.noreply.github.com>
Co-authored-by: Dong Zhou <evanzd@users.noreply.github.com>
Co-authored-by: SaintMalik <37118134+saintmalik@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Anurag Kumar <mailanu98@gmail.com>
Co-authored-by: demon143 <785696300@qq.com>
2021-10-01 02:15:30 +08:00
you-n-g
8cf6ed3564 Update VERSION.txt 2021-09-30 22:59:05 +08:00
you-n-g
92055d64ec Update VERSION.txt 2021-09-30 22:53:57 +08:00
you-n-g
b9809a4c33 make the prediction update more friendly (#609)
* make the prediction update more friendly

* Update test_storage.py

* LabelUpdater

* Update test_storage.py

* Update test_storage.py

* Update test_storage.py

* Update test_storage.py

* Update setup.py

* Update workflow_config_lightgbm_Alpha158.yaml

* Update workflow_config_lightgbm_Alpha158.yaml

* Update workflow_config_lightgbm_Alpha158.yaml

* Update workflow_config_lightgbm_Alpha158.yaml

* Update workflow_config_lightgbm_Alpha158.yaml

* Update setup.py

* Update setup.py

* test CI only

* test CI only

* Update workflow_config_lightgbm_Alpha158.yaml

* Update setup.py

* fix "Segmentation fault" in macos

* Update test.yml

github action no longer supported ubuntu-16.04

* Update api.rst

update doc with new_lable

* Update api.rst

Co-authored-by: Wangwuyi123 <51237097+Wangwuyi123@users.noreply.github.com>
Co-authored-by: Pengrong Zhu <zhu.pengrong@foxmail.com>
2021-09-30 20:54:44 +08:00
you-n-g
fc243fd29b Fix Models (#483)
* fix gat dataset

* fix tft model

* Update tft.py

* Fix tft.py

Co-authored-by: Pengrong Zhu <zhu.pengrong@foxmail.com>
2021-09-30 13:11:06 +08:00
demon143
b6a8bd5b80 update change doc (#623)
* Add files via upload

* Update README.md

* Update README.md

* Update README.md

* Delete change doc.gif

* Add files via upload

* Update README.md

* Delete change doc.gif

* Add files via upload

* Delete change doc.gif

* Add files via upload

* Update README.md

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2021-09-29 19:42:38 +08:00
demon143
6ee0fe366c Update initialization.rst (#622)
* Update initialization.rst

* Update docs/start/initialization.rst

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* Update docs/start/initialization.rst

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2021-09-27 21:44:06 +08:00
you-n-g
55b6ff123e Share version number (#620) 2021-09-27 16:12:12 +08:00
you-n-g
45ea4bae4e Add file lock for MLflowExpManager (#619) 2021-09-26 16:21:15 +08:00
demon143
17d472cf01 Update code_standard.rst (#587)
* Update code_standard.rst

* Update docs/developer/code_standard.rst

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2021-09-26 15:35:14 +08:00
you-n-g
c500a01226 update cvxpy version 2021-09-25 17:12:02 +08:00
zhupr
114c38b4c3 fix the type of filter_pipe 2021-09-20 19:04:59 +08:00
you-n-g
414c3082c0 Update model list 2021-09-18 12:57:58 +08:00
Young
3fc2f8c93c updategrade version number 2021-09-16 02:15:16 +00:00
Anurag Kumar
66ff3e5bf6 Update python-publish.yml
added python 3.9
2021-09-16 10:09:39 +08:00
Anurag Kumar
8ff68a182e Update setup.py
change to matplotlib==3.3
2021-09-16 10:09:39 +08:00
Anurag Kumar
a105ef1d76 Update setup.py
updated classifiers
2021-09-16 10:09:39 +08:00
zhupr
d02965ea70 Fix SimpleDatasetCache 2021-09-16 10:08:56 +08:00
Christian Clauss
b8d1e08010 Fix undefined names in Python code (#599)
* Update pytorch_tabnet.py

$ `flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics`
```
./qlib/qlib/contrib/model/pytorch_tabnet.py:567:38: F821 undefined name 'inp'
            self.independ.append(GLU(inp, out_dim, vbs=vbs))
                                     ^
./qlib/examples/model_rolling/task_manager_rolling.py:75:18: F821 undefined name 'task_train'
        run_task(task_train, self.task_pool, experiment_name=self.experiment_name)
                 ^
2     F821 undefined name 'task_train'
2
```

* Fix undefined names in Python code

* from qlib.model.trainer import task_train
2021-09-14 12:13:27 +08:00
you-n-g
163e3c6266 replace multi processing with joblib (#477)
* replace multi processing with joblib

* update class Parallel and data.py

* update class Parallel and data.py

* update class Parallel and data.py

* update class Parallel and data.py

* update class Parallel and data.py

* update class Parallel and data.py

* update class Parallel and data.py

* update class Parallel and data.py

* Fix Parallel support for maxtasksperchild

Co-authored-by: wangw <1666490690@qq.com>
Co-authored-by: zhupr <zhu.pengrong@foxmail.com>
2021-09-14 01:16:03 +08:00
you-n-g
6203e4c09e Update the docs of Report 2021-09-13 17:53:34 +08:00
you-n-g
51709c20d8 Supporting shared processor (#596)
* Supporting shared processor

* fix readonly reverse bug

* remove pytests dependency

* with fit bug

* fix parameter error
2021-09-13 17:11:08 +08:00
Christian Clauss
28c99c77be test.yml: Remove redundant code (#595) 2021-09-13 14:31:32 +08:00
you-n-g
bb5cdfe050 Update Release Note 2021-09-12 17:06:00 +08:00
SaintMalik
fb21c591bb fix typos (#592) 2021-09-12 16:39:22 +08:00
Dong Zhou
5279e71423 Merge pull request #591 from evanzd/fix_tra
Fix TRA
2021-09-11 18:48:13 +08:00
Dong Zhou
f35254c288 update README 2021-09-10 07:38:22 +00:00
Pengrong Zhu
5e82c18cb2 Modify the Feature to be case sensitive (#589) 2021-09-10 11:47:23 +08:00
demon143
2759e8c28d Update the docs of TaskManager (#586)
* Update manage.py
2021-09-09 20:13:45 +08:00
you-n-g
2461575d30 Update README.md
Fix wrong link
2021-09-09 08:28:48 +08:00
Pengrong Zhu
867667531d Update FAQ.rst 2021-09-08 18:06:51 +08:00
zhupr
0fc52333b7 Add wheel package to github CI 2021-09-07 20:41:10 +08:00
zhupr
ab9b6dc47a Modify client-server mode and dataset-cache to disable inst_processor 2021-09-07 20:41:10 +08:00
zhupr
4c5a4d5cd7 Modify the default value in the multi_freq example 2021-09-07 20:41:10 +08:00
zhupr
e84cc23589 Add DataPathManager to QlibConfig && modify inst_processors to supports list only 2021-09-07 20:41:10 +08:00
zhupr
707399a245 Fix duplicate mlflow directories in tests 2021-09-07 20:41:10 +08:00
zhupr
6e88ccca88 Fix the index type of the multi-freq example 2021-09-07 20:41:10 +08:00
zhupr
ee5f3de800 Fix typo 2021-09-07 20:41:10 +08:00
zhupr
3605cd7b96 Add inst_processors to D.features 2021-09-07 20:41:10 +08:00
zhupr
d1cbf4c3d9 support multi-freq uri 2021-09-07 20:41:10 +08:00
zhupr
6011a21308 get_cls_kwargs renamed get_callable_kwargs 2021-09-07 20:41:10 +08:00
zhupr
76a05f37a9 add multi-freq example 2021-09-07 20:41:10 +08:00
zhupr
c99494eb76 Add sample_config to QlibDataLoader, support multi-freq 2021-09-07 20:41:10 +08:00
zhupr
e8126b0c39 Add backend_freq_config parameter, support multi-freq uri 2021-09-07 20:41:10 +08:00
Young
88d2f9263e fix sum index data bug 2021-09-02 01:57:44 +00:00
wangwenxi.handsome
f71b0c1189 250s 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
919380597b close and reindex 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
4da3f3b104 broadcast_to and get single data 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
9446116642 redundant references 2021-09-02 09:56:38 +08:00
Young
5003e49197 fix metric calculation error 2021-09-02 09:56:38 +08:00
Young
5f0ee6ce68 fix bugs 2021-09-02 09:56:38 +08:00
Young
9a74471ab6 Pass basic tests 2021-09-02 09:56:38 +08:00
Young
d39c8de800 draft design 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
43a8f502ed fix bug 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
7ee4a207bc add lru 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
25f54ddaeb new high freq struc 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
d9ad8ff791 index_data 2021-09-02 09:56:38 +08:00
Young
13a9b7cea0 type error bug 2021-09-02 09:56:38 +08:00
Young
9c326fd398 add import order 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
f111e34bd2 align interface 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
be0d9e6a22 update freq 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
e134c358fd fix index data bug 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
16b954866f get_base_info 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
f7d7f1a223 fix nanmean 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
8eb7a1fddc numpy_order_indicator 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
222c2fd21a fix exchange bug 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
f67b99a30e update exchange 2021-09-02 09:56:38 +08:00
wangwenxi.handsome
2da6a8c770 fix Path re 2021-08-31 11:57:14 +00:00
Dong Zhou
8f4d320832 bug fix & use oracle transport pretrain 2021-08-30 07:32:04 +00:00
cslwqxx
e2739ac72c Update README.md 2021-08-29 12:29:11 +08:00
you-n-g
19d15ddc38 Merge pull request #513 from 2796gaurav/main
MVP for Indian Stocks in qlib using yahooquery
2021-08-26 20:59:26 +08:00
you-n-g
12af8f304b Delete .DS_Store 2021-08-26 15:36:35 +08:00
Mark Zhao
25b771ddf1 check lexsort in the 'lazy_sort_index' function (#566)
* check lexsort

* check lexsort

* lexsort comment

* lexsort comment
2021-08-25 18:07:30 +08:00
Pengrong Zhu
1158472489 Fix multi-process loop calls (#574) 2021-08-25 18:05:35 +08:00
you-n-g
84d2cb3226 Update gen.py (#576) 2021-08-25 18:05:10 +08:00
Wangwuyi123
509bfcb02e Fix CI Bug (#575)
Co-authored-by: yuxwang <anduinnn@foxmail.com>
2021-08-25 08:51:39 +08:00
Young
309dfa36cc Add a example to collecting all the decisions 2021-08-15 15:22:48 +00:00
demon143
6608a40965 Update ensemble.py (#560) 2021-08-14 18:07:49 +08:00
wangwenxi-handsome
735153a50d Cash Update (#559)
* fix negative cash

* update order test

* fix bug

* update file_order_test
2021-08-12 23:44:22 +08:00
you-n-g
3e75cead93 code standard docs 2021-08-12 09:19:57 +00:00
you-n-g
6697f209d4 Conda Suggestion 2021-08-12 16:30:46 +08:00
you-n-g
05b9fb5a47 Fix bug when Account.benchmark_config is None 2021-08-09 19:23:17 +08:00
wangwenxi.handsome
7c858803f0 add position test 2021-08-08 14:32:33 +00:00
wangwenxi.handsome
74e1ee6921 update position and negative cash 2021-08-06 04:34:30 +00:00
you-n-g
e3b57b1901 Update README.md 2021-08-06 09:59:30 +08:00
you-n-g
82a5223166 Update README.md 2021-08-06 09:59:30 +08:00
ZhangTP1996
398131cff7 Update strategy.py 2021-08-05 17:21:10 +08:00
Young
8e87950292 Print volume limitation log 2021-08-04 11:04:28 +00:00
Dong Zhou
e71e2f941c fix tra when logdir is None 2021-08-02 19:02:37 +08:00
Dong Zhou
0483406c12 fix tra when logdir is None 2021-08-02 03:57:14 -07:00
wangwenxi.handsome
3ff1d91d61 add __init__ 2021-08-02 07:45:03 +00:00
wangwenxi.handsome
f5db0e1b05 fix vol limit bug 2021-08-02 03:49:03 +00:00
wangwenxi.handsome
0f2d85d098 volume limit update 2021-08-01 16:03:08 +00:00
wangwenxi.handsome
5c2ddac7f0 volume limit 2021-07-31 09:31:01 +00:00
Dong Zhou
da1f4db968 update README 2021-07-30 16:05:07 +08:00
Dong Zhou
a7c41b6969 improve pretrain 2021-07-30 16:05:07 +08:00
Dong Zhou
5b7b48e376 clean up 2021-07-30 16:05:07 +08:00
Dong Zhou
4f9f978909 fix TRA when use single head 2021-07-30 16:05:07 +08:00
Dong Zhou
319a2f38cc fix horizon 2021-07-30 16:05:07 +08:00
Dong Zhou
a2c38c979e format by black 2021-07-30 16:05:07 +08:00
Dong Zhou
07655f2d5b refactor TRA 2021-07-30 16:05:07 +08:00
Young
9303415666 refactor online serving rolling api 2021-07-29 18:13:12 +08:00
Young
73f5cc0a2b add suspend check in twap 2021-07-29 04:11:18 +00:00
you-n-g
05d28469ad sort index after loader (#538)
make sure the fetch method is based on a index-sorted pd.DataFrame
2021-07-29 12:06:59 +08:00
Young
ab3c4a2c05 new twap (more even) 2021-07-28 03:11:56 +00:00
you-n-g
c1992b1bb1 Merge pull request #456 from ultmaster/rl-dummy
Dummy RL example on nested decision framework
2021-07-27 22:58:15 +08:00
v-mingzhehan
e817413769 Restore examples 2021-07-27 14:52:29 +00:00
v-mingzhehan
0b607da690 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-27 14:32:36 +00:00
Young
0d41ca26ab fix data format bug & twap peeking strategy 2021-07-27 14:17:59 +00:00
wangwenxi.handsome
ba1c575aa9 doc and black for indicator 2021-07-27 12:14:43 +00:00
wangwenxi.handsome
66971d5f0d fix indicator 2021-07-27 09:06:13 +00:00
Young
fcca242807 add cash settlement mechanism 2021-07-26 17:14:41 +00:00
wangwenxi.handsome
4924717276 fix black 2021-07-26 11:25:14 +00:00
wangwenxi.handsome
c202a4b1e6 fix _get_base_vol_pri clip_time_range 2021-07-26 11:21:05 +00:00
you-n-g
dc6859bdd9 Fix docs of QlibRecorder 2021-07-26 19:00:47 +08:00
you-n-g
a6f9dde006 Update README.md 2021-07-26 18:36:09 +08:00
Young
bdebe12cf2 support empty benchmark
Empty benchmark could accelerate the learning process
2021-07-26 06:14:57 +00:00
Young
1d22ee56d3 recorder support upload both raw file and directory 2021-07-25 16:35:16 +00:00
wangwenxi.handsome
e88c45e13c update position 2021-07-25 12:38:54 +00:00
wangwenxi.handsome
103d3034bf Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into nested_decision_exe 2021-07-25 12:37:04 +00:00
wangwenxi-handsome
4ffb05ae59 Update Action 2021-07-24 22:08:15 +08:00
wangwenxi.handsome
6dcbf51298 update action 2021-07-24 11:36:28 +00:00
wangwenxi-handsome
9d732e9646 Update Action 2021-07-24 10:12:59 +00:00
wangwenxi.handsome
a8ea66b83e black 2021-07-23 09:33:04 +00:00
you-n-g
9e6f4ec578 Merge pull request #520 from wangwenxi-handsome/nested_decision_exe
abstract Quote class from Exchange
2021-07-23 14:36:36 +08:00
wangwenxi.handsome
301e0477ec Merge branch 'nested_decision_exe' of https://github.com/wangwenxi-handsome/qlib into nested_decision_exe 2021-07-23 05:52:09 +00:00
wangwenxi.handsome
0ec6b87d39 fix little bug 2021-07-23 05:50:41 +00:00
you-n-g
d445f28e5f Merge branch 'main' into nested_decision_exe 2021-07-23 12:38:20 +08:00
you-n-g
bbba9600a1 Merge branch 'nested_decision_exe' into nested_decision_exe 2021-07-23 12:15:45 +08:00
wangwenxi.handsome
2c8a3ded08 high_performance_data_structure 2021-07-22 15:20:03 +00:00
panshuaiyin
3810a4cd33 Update data.rst
use own alpha-factor
2021-07-22 20:07:04 +08:00
you-n-g
48af7126b6 Update news about models 2021-07-22 11:07:09 +08:00
Ying-Tao Luo
025b1dcff9 Add two new models in model zoo 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
29e66b2dea Add two new model in zoo
Add transformer and localformer (SLGT) models for time series prediction in finance in the Quant Model Zoo.
2021-07-22 11:05:39 +08:00
Ying-Tao Luo
698e59ac72 Add performance of two new models
Add the performance of transformer and localformer.
2021-07-22 11:05:39 +08:00
Ying-Tao Luo
e006ef40ad Update pytorch_localformer_ts.py 2021-07-22 11:05:39 +08:00
Young
59d4bc9394 update run_all_model and black format 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
b07e0bffb1 Add files via upload 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
161343018f Add files via upload 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
bee031af68 Add files via upload 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
35840606a8 Update pytorch_localformer.py 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
2df9b6e076 Add files via upload 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
0c3eaf3f16 Add files via upload 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
2eee064eb8 Add files via upload 2021-07-22 11:05:39 +08:00
Ying-Tao Luo
096ef5a62b Update pytorch_transformer.py
Have passed black
2021-07-22 11:05:39 +08:00
Ying-Tao Luo
dd0eebed53 Update pytorch_localformer.py
Have passed black.
2021-07-22 11:05:39 +08:00
Ying-Tao Luo
7b20abeda1 Add files via upload
Add naive transformer model and a improved transformer model.
2021-07-22 11:05:39 +08:00
wangwenxi.handsome
10c182e2b0 add order_indicator doc 2021-07-21 14:09:12 +00:00
wangwenxi.handsome
83d4387e9f pandas_order_indicator 2021-07-21 12:47:31 +00:00
you-n-g
5519420efd Update test_macos.yml
Give more comments about the MacOS test yaml
2021-07-21 18:30:25 +08:00
zhupr
eb3c5b3088 macos-test-ci split out separately 2021-07-21 18:25:31 +08:00
zhupr
f03df874bf fix macos-test-ci 2021-07-21 18:25:31 +08:00
2796gaurav
8fa22bd2e1 added 1min for IN and also updated readme 2021-07-21 14:16:22 +05:30
Gaurav
d1c8d885aa cleaned the code 2021-07-21 17:59:50 +05:30
zhupr
bf7732e284 fix df_features.index conține np.nan 2021-07-21 14:28:20 +08:00
v-mingzhehan
9bf8c999e6 type checking update 2021-07-20 06:14:40 +00:00
Young
4e862f7d1f add print cash in verbose mode and code format 2021-07-20 05:13:05 +00:00
wuzhe1234
3f5334ab39 Update qrun to automaticly save the config to the artifacts uri 2021-07-19 13:32:14 +08:00
v-mingzhehan
62583ea6ec Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-19 04:18:17 +00:00
Young
92f2891664 fix order factor setting issue
Move the factor setting from init phase to dealing phase.
2021-07-19 02:37:44 +00:00
zhupr
c97a96363d Add a check if change is mutated to YahooNormalize1d 2021-07-18 20:28:46 +08:00
v-mingzhehan
25ff62f542 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-18 09:00:47 +00:00
slowy07
2023f714c9 [fixed] lgtm issue : unused imported module of 'signal' and change to PEP8 style code imported module 2021-07-18 15:25:18 +08:00
slowy07
f8a2b0533b lgtm issue: fixing unused import of 'time' 2021-07-18 15:25:18 +08:00
chaosyu
3183a232df update doc str 2021-07-18 15:24:23 +08:00
chaosyu
8b715268bd use list_kwargs instead filter_string 2021-07-18 15:24:23 +08:00
chaosyu
28cb827a23 fix lint issue 2021-07-18 15:24:23 +08:00
chaosyu
b723f14619 apply filter string to recorder collector 2021-07-18 15:24:23 +08:00
chaosyu
47535ba530 add mlflow filter string support to limit too much run number 2021-07-18 15:24:23 +08:00
Young
4a62e02fca add get_data_cal_avail_range method 2021-07-18 07:12:14 +00:00
v-mingzhehan
572181ef5d Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-18 03:55:39 +00:00
Young
ed12c7fca3 add common_infra warning and fix time bug 2021-07-18 03:13:15 +00:00
v-mingzhehan
5f50614dbc Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-17 16:31:31 +00:00
Young
7738f39546 filter zero base price 2021-07-17 06:54:44 +00:00
Gaurav
d70e5a4f88 add YahooNormalizeIN and YahooNormalizeIN1d 2021-07-17 10:40:16 +05:30
wangwenxi.handsome
2b8d4dc3c2 callable 2021-07-16 14:09:36 +00:00
wangwenxi.handsome
6ad52e8cf5 black and doc 2021-07-16 13:55:49 +00:00
wangwenxi.handsome
567841e1c6 get qlib data in exchange 2021-07-16 12:56:49 +00:00
wangwenxi.handsome
110141ddac add doc 2021-07-16 09:17:29 +00:00
wangwenxi.handsome
65b44349cd add PandasQuote 2021-07-16 08:29:32 +00:00
you-n-g
3b8087677c Update online.rst 2021-07-16 12:24:33 +08:00
Young
5241b2f918 Merge branch 'nested_decision_exe' of github.com:microsoft/qlib into nested_decision_exe 2021-07-16 03:17:54 +00:00
Young
344f4f69d2 add data calendar API and refine order cal api 2021-07-16 03:11:07 +00:00
wangwenxi.handsome
f295497e2c Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into nested_decision_exe 2021-07-15 13:38:38 +00:00
wangwenxi.handsome
aae4b02ab8 *tuple 2021-07-15 13:34:39 +00:00
Young
d907817ce9 unify variable names 2021-07-15 13:17:26 +00:00
zhupr
4ec41ea0e7 Add a check if change is mutated to YahooNormalize1d 2021-07-15 19:13:25 +08:00
v-mingzhehan
870f834577 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-15 08:31:39 +00:00
Young
94b456714d refactor index_range to trade_range 2021-07-15 08:02:09 +00:00
Gaurav
cfcd9fb1f8 cleaned with black 2021-07-15 11:24:41 +05:30
Gaurav
457dcaa466 cleaned with black 2021-07-14 20:12:00 +05:30
Gaurav
3c740fc2de MVP for Indian Stocks in qlib using yahooquery 2021-07-14 19:54:55 +05:30
Young
571d27cba7 exchange support expression buy sell limit 2021-07-14 13:07:14 +00:00
v-mingzhehan
831773a0d6 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-14 09:12:54 +00:00
you-n-g
6d91f28474 Update README.md 2021-07-14 10:07:02 +08:00
you-n-g
be8653c505 Update contributing section 2021-07-14 09:56:12 +08:00
wangwenxi.handsome
7b9e338a0d add docs 2021-07-14 09:45:09 +08:00
wangwenxi.handsome
0646e53d24 fix spell error 2021-07-14 09:45:09 +08:00
wangwenxi.handsome
ca14e36f7a initial account by position 2021-07-14 09:45:09 +08:00
Young
9b38e62f21 Add more friendly index range by timing 2021-07-13 14:46:53 +00:00
wangwenxi.handsome
4c4b30ebec fix base price and volumn 2021-07-13 16:15:52 +08:00
chaosyu
a8974ce535 bug fix: ClientProvider cannot set connection to calendar and instrument providers 2021-07-13 10:49:21 +08:00
chaosyu
79026e5390 fix bug that duplicate rows will cause reindex failed when dumping with csv files 2021-07-13 10:49:21 +08:00
Gaurav Chauhan
4610e16ac2 updated readme of yahoo collector where region parameter was incorrect (#504)
* updated readme of yahoo collector where region parameter was incorrect

* changes

update readme of yahoo collector where region parameter was incorrect

* update readme of yahoo collector

update readme of yahoo collector where region parameter was incorrect

* updated changes

* updated readme of cn1d data

Co-authored-by: Gaurav Chauhan01/HO/Analytics/General <Gaurav.Chauhan01@bajajallianz.in>
2021-07-13 09:46:13 +08:00
wangwenxi.handsome
b504cc6ac8 update readme and rst 2021-07-12 21:51:08 +08:00
v-mingzhehan
c29e5b2621 Fix circular import 2021-07-12 13:50:13 +00:00
Young
d5059e609f change to dev version 2021-07-12 02:49:25 +00:00
Young
215f7e0d22 update version for release 0.7.0 2021-07-11 14:34:44 +00:00
Young
45bde7527e move the pa sign from last step to first 2021-07-11 01:53:21 +00:00
Young
155019ba35 move the pa sign from last step to first 2021-07-09 10:34:18 +00:00
v-mingzhehan
ece7b662e2 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-09 09:32:15 +00:00
Young
80f5426693 update docsting 2021-07-09 08:29:19 +00:00
Young
cbd52b7905 align range limit 2021-07-09 08:17:10 +00:00
Young
17d8b8a7cc fix calculating base_price 2021-07-09 08:16:01 +00:00
Young
eada8640b9 align range limit 2021-07-09 08:12:13 +00:00
Young
32ae6e4259 fix calculating base_price 2021-07-08 05:54:36 +00:00
v-mingzhehan
5c5379e09d Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-07 12:26:43 +00:00
Young
e8f5a1e491 black format 2021-07-07 10:52:52 +00:00
Young
0c946cffd6 add supporting setting trade unit in exchange 2021-07-07 10:47:54 +00:00
you-n-g
1fb50d521b Merge branch 'main' into nested_decision_exe 2021-07-07 17:30:31 +08:00
wangwenxi.handsome
8c743a46c7 use init_instance_by_config 2021-07-07 17:27:29 +08:00
wangwenxi.handsome
93796bdcef add exchange kwargs 2021-07-07 17:27:29 +08:00
wangwenxi.handsome
267ee3555d fix all example 2021-07-07 17:27:29 +08:00
wangwenxi.handsome
8b28575dad fill placehorder dict and list 2021-07-07 17:27:29 +08:00
wangwenxi.handsome
4488c3b625 code optimization 2021-07-07 17:27:29 +08:00
wangwenxi.handsome
bd6080b8f5 yaml update 2021-07-07 17:27:29 +08:00
wangwenxi.handsome
cbe7c5285a high_fre_yaml 2021-07-07 17:27:29 +08:00
Wenxi Wang (FA Talent)
85c75a6639 config_extend 2021-07-07 17:27:29 +08:00
xixi
d1b8ed9613 fix qrun 2021-07-07 17:27:29 +08:00
xixi
d6984a3f2d fill_placehorder 2021-07-07 17:27:29 +08:00
Young
e42aa67f52 Supporting skip empty decisions 2021-07-06 12:27:07 +00:00
Young
4e41e9c8f2 simplify the portfolio-based report 2021-07-06 12:27:01 +00:00
Young
6fd50a5bfa Supporting skip empty decisions 2021-07-06 12:08:53 +00:00
Young
dd8231edeb simplify the portfolio-based report 2021-07-06 11:10:13 +00:00
Young
03d6facbd2 fix TWAP strategy 2021-07-06 10:02:20 +00:00
v-mingzhehan
354f7e68c2 Constrain TWAP trade step 2021-07-06 08:47:55 +00:00
v-mingzhehan
e214557e3a Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-06 06:43:34 +00:00
Young
bdac9f4dda supporting seperated buy and sell price 2021-07-06 06:35:10 +00:00
Young
cb72857710 fix annotation recursive error 2021-07-06 05:23:13 +00:00
v-mingzhehan
82645233e7 Support order dataframe 2021-07-06 03:50:34 +00:00
xiaowuhu
dafef0ac08 Update workflow.rst
should be China instead of china
2021-07-06 09:22:11 +08:00
xiaowuhu
1cb43ea69b Update workflow.rst
remove 空格 before module_path, kwargs, etc, otherwise, yaml parser will report error: ruamel.yaml.scanner.ScannerError: mapping values are not allowed here
2021-07-06 09:21:14 +08:00
you-n-g
7ca9cf79f7 Update README.md 2021-07-05 19:47:49 +08:00
v-mingzhehan
e063d3536c Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-07-05 09:37:22 +00:00
you-n-g
35f090a6e4 Update what's new 2021-07-04 16:47:33 +08:00
Lewen Wang
ace7484304 Update TCTS. (#495)
* Update TCTS Model.

Co-authored-by: lewwang <lwwang@microsoft.com>
2021-07-04 16:45:05 +08:00
Young
7048bef7c6 fix ffr and order amount 2021-07-04 08:11:17 +00:00
Young
50c0e99f98 fix ffr and order amount 2021-07-04 08:08:03 +00:00
bxdd
9b74a19b14 Merge pull request #493 from bxdd/optimize_resam_data
optimize performance of resam data in rule_strategy & exchange
2021-07-04 02:44:53 +08:00
bxdd
ecf2f24d59 fix comments 2021-07-03 18:42:40 +00:00
Young
ef7fe8aa75 support parallel HF trading 2021-07-03 09:22:23 +00:00
bxdd
2d4f0e80f9 black format 2021-07-02 08:47:52 +08:00
bxdd
946c9392a1 support check_transform_proc module_path 2021-07-02 08:47:52 +08:00
bxdd
8dd5788bac fix comments & update resam ts_last method 2021-07-01 16:31:58 +00:00
bxdd
8b85b9eee7 optimize performance of resam data in rule_strategy & exchange 2021-07-01 14:35:49 +00:00
v-mingzhehan
2b4a493617 Order patch 2021-07-01 09:41:08 +00:00
Young
a401f1eafe improve the docstring 2021-06-30 08:50:03 +00:00
v-mingzhehan
24d5a3127b Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-06-30 08:30:33 +00:00
Young
bbf5d1bbbb add file order strategy 2021-06-30 07:34:23 +00:00
bxdd
b242d6e1e1 delMiniTimer in haandler storage test 2021-06-30 11:34:08 +08:00
bxdd
8d1b1979d9 update handler_storage test 2021-06-30 11:34:08 +08:00
bxdd
9985befe69 update HashingStockStorage 2021-06-30 11:34:08 +08:00
lzh222333
b523b27d5a add docstring 2021-06-30 10:59:34 +08:00
lzh222333
0b83fb3564 more general exception 2021-06-30 10:59:34 +08:00
lzh222333
d96f7a67c6 bug & docs fixed 2021-06-30 10:59:34 +08:00
lzh222333
a7862387a2 fixed update bugs 2021-06-30 10:59:34 +08:00
lzh222333
c4c438249c modify OnlineToolR 2021-06-30 10:59:34 +08:00
you-n-g
90bbf2b7c6 Fix account update bar_count bug 2021-06-30 08:29:47 +08:00
bxdd
e1b6f310c9 add Handler Storage 2021-06-28 20:06:15 +00:00
Yuge Zhang
20d566ceee Merge branch 'rl-dummy' of github.com:ultmaster/qlib into rl-dummy 2021-06-28 18:01:41 +08:00
Yuge Zhang
8e8bba1a96 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-06-28 18:01:02 +08:00
Young
27f0db669f black format & add comments & add randStrategy direction 2021-06-28 17:47:30 +08:00
Young
72c9593aa7 adapting strategies to latest interfaces. 2021-06-28 17:47:30 +08:00
Young
c907d8deb4 fix bugs of random strategy 2021-06-28 17:47:30 +08:00
Young
e78cdd4a08 return the detailed order indicator 2021-06-28 17:47:30 +08:00
Young
9b91758aed performance optimization for cal_sam_minute 2021-06-28 17:47:30 +08:00
Young
b41267fa59 successful run random order gen in day script 2021-06-28 17:47:30 +08:00
Young
b68294da93 add InfPosition 2021-06-28 17:47:30 +08:00
Young
4f384d37ce API enhancement 2021-06-28 17:47:30 +08:00
bxdd
284d96761b fix bug in resam feature 2021-06-27 17:49:49 +00:00
you-n-g
8709dde65b Merge pull request #481 from ai4stocks/working_workflow_fix_ipynb
examples/workflow_by_code.ipynd: fix an error in R.get_recorder() par…
2021-06-26 19:57:24 +08:00
Guodong Xu
d66733c358 examples/workflow_by_code.ipynd: fix an error in R.get_recorder() parameters
get_recorder() needs specify 'recorder_id='. However workflow_by_code.ipynd
didn't. This patch fixes it.

Without this fix, here is the error message jupyter-notebook reports:

"---------------------------------------------------------------------------
TypeError Traceback (most recent call last)

<ipython-input-7-e6a7b5f4da00> in <module>
26 # backtest and analysis
27 with R.start(experiment_name="backtest_analysis"):
---> 28 recorder = R.get_recorder(rid, experiment_name="train_model")
29 model = recorder.load_object("trained_model")
30

TypeError: get_recorder() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given"

Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
2021-06-26 18:25:47 +08:00
Dong Zhou
9cf574b697 Merge pull request #479 from linhx25/main
Add TRA Model
2021-06-25 18:08:23 +08:00
linhx25
107e40f3ee Add TRA Model 2021-06-25 16:12:50 +08:00
bxdd
b6564cd760 support trade decision update 2021-06-24 19:09:36 +00:00
bxdd
1517a9eb91 add default executor config & update bug in indicator 2021-06-24 13:59:10 +00:00
you-n-g
4837ba8db3 Merge pull request #476 from bxdd/qlib_ops_config
Support using config to register custom operators
2021-06-24 20:41:48 +08:00
Qian Chen
2ab4a9adb3 Set self.fitted = True instead of self._fitted. 2021-06-24 20:40:59 +08:00
bxdd
8d0b673341 add custom_ops docstring 2021-06-24 15:00:45 +08:00
you-n-g
8ebdb1e873 Merge pull request #463 from zhupr/support_extend_data
Support extend data
2021-06-24 13:53:30 +08:00
zhupr
39340fbf06 fix: typo 2021-06-24 11:07:40 +08:00
zhupr
0e277723a3 Merge remote-tracking branch 'qlib/main' into qlib_main
# Conflicts:
#	scripts/data_collector/yahoo/README.md
2021-06-24 00:09:54 +08:00
zhupr
1418417034 fix automatic update of daily frequency data 2021-06-23 23:59:59 +08:00
you-n-g
b261f7b501 Update README.md 2021-06-23 20:51:21 +08:00
zhupr
bab50e8837 fix YahooNormalize1min && update docs 2021-06-23 16:13:26 +08:00
bxdd
0eee4a0f2e support config custom_ops 2021-06-23 15:56:36 +08:00
Young
21eb71d4a9 update framework for online serving 2021-06-23 02:05:38 +00:00
v-mingzhehan
583fbbef3c Resolve init conflict 2021-06-22 07:07:19 +00:00
v-mingzhehan
d226ac8c32 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-06-22 07:07:07 +00:00
bxdd
ab97e82484 fix bug in Exchange 2021-06-22 15:03:05 +08:00
v-mingzhehan
7525854bed Add shortcut in init 2021-06-22 03:47:39 +00:00
v-mingzhehan
56cf43da44 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-06-22 03:27:34 +00:00
zhupr
46714adf4c modify the YahooNormalize1min factor calculation 2021-06-22 11:15:09 +08:00
bxdd
4ac6e6e246 fix account bug & update indicator_analysis & fix some comments 2021-06-22 02:42:09 +08:00
zhupr
99fb49650a add end_date parameter to collector.normalize_data 2021-06-21 17:20:37 +08:00
zhupr
985fd0816c Fix cn_index.collector network error 2021-06-21 17:18:04 +08:00
Young
d0f54343c7 support subclass of TSDatasetH 2021-06-21 00:24:31 +08:00
Young
a3679e6758 simplify the code and prevent float when shifting 2021-06-21 00:24:31 +08:00
zhupr
b6c31540e8 add function to automatically update daily frequency data 2021-06-17 23:07:56 +08:00
zhupr
a4f6e04199 modify dump_update starts with the last end date of each symbol 2021-06-17 22:33:31 +08:00
you-n-g
0aee46ee79 Merge pull request #466 from you-n-g/online_hotfix
Online bug fix, enhancement &  docs for dataset, workflow, trainer ...
2021-06-17 11:38:44 +08:00
Young
9c8d423a86 fix ModelUpdater 2021-06-16 14:10:51 +00:00
zhupr
b4efbd53b2 Fix 'report' compatibility with matplotlib versions 2021-06-16 22:00:43 +08:00
you-n-g
5a50d7c952 Merge pull request #471 from Derek-Wds/main
Update Recorder Wrapper to prevent reinitialization
2021-06-16 17:46:31 +08:00
Jactus
0fe8b281ba Update R wrapper logic 2021-06-16 12:28:20 +08:00
lewwang
5331ab93f8 Update TCTS README. 2021-06-16 12:23:22 +08:00
Jactus
64582e9d46 Add QlibException 2021-06-15 15:02:11 +08:00
Jactus
9e0e2ff736 Update QlibRecorder wrapper 2021-06-15 14:46:31 +08:00
bxdd
9e45528165 update backtest time range 2021-06-14 22:31:31 +08:00
bxdd
f78e90171b fix comments & add VAStrategy & add trade indicator 2021-06-14 21:32:18 +08:00
Young
973c4137e4 fix mlflow & task bug 2021-06-12 13:54:26 +00:00
Young
730f6258d6 add warning and * 2021-06-11 10:40:56 +00:00
Young
5850490b24 simplify the code and add docs 2021-06-11 08:29:10 +00:00
Young
d4b36bdab4 Online fix
- Skip duplicated qlib.auto_init()
- Fix TSDatasetH flt_col bug!
- Resolve qlib log attribute confliction
- Trainer API enhancement
- More docs and user-friendly warning
2021-06-11 02:06:07 +00:00
you-n-g
40416d8c30 Merge pull request #464 from lwwang1995/main
Add TCTS baseline.
2021-06-10 10:18:20 +08:00
lewwang
567e42840c asdf 2021-06-09 18:37:25 +08:00
lewwang
65ddca133f asdf 2021-06-09 18:36:12 +08:00
lewwang
d199256d34 asdf 2021-06-09 18:35:14 +08:00
lewwang
073fe4668e asdf 2021-06-09 18:34:31 +08:00
lewwang
89d53853e5 asdf 2021-06-09 18:30:42 +08:00
lewwang
bb6c1572ca asdf 2021-06-09 18:29:55 +08:00
lewwang
4c4e77b11f asdf 2021-06-09 18:28:31 +08:00
lewwang
38c7b7303a dsaf 2021-06-09 18:26:50 +08:00
lewwang
02d0eedd68 update 2021-06-09 18:21:16 +08:00
lewwang
5a3dde93a8 update 2021-06-09 18:15:06 +08:00
lewwang
177f6a59d2 asdf 2021-06-09 17:47:24 +08:00
lewwang
492a62a569 tcts demo page 2021-06-09 17:32:24 +08:00
zhupr
9a44fbf9c1 fix PEP8: qlib/scripts/data_collector/fund/collector.py 2021-06-08 22:52:31 +08:00
zhupr
03eb0882de fix YahooNormalizeCN1minOffline bugs 2021-06-08 22:23:05 +08:00
zhupr
a845a2271b add normalize 1min to use local data && change the default parameters for collecting 1min 2021-06-08 14:45:20 +08:00
you-n-g
ba021f6007 Merge pull request #462 from arisliang/patch-1
Remove non-existing parameter description
2021-06-08 13:03:43 +08:00
al
7d9544fb91 Remove non-existing parameter from doc
Remove non-existing TradeExchange parameter from generate_target_weight_position doc
2021-06-08 09:35:36 +08:00
you-n-g
12b7be333d Merge pull request #461 from Derek-Wds/main
Fix exception hook bug
2021-06-07 21:07:33 +08:00
Jactus
ed54f1213c Fix exception hook bug 2021-06-07 17:13:36 +08:00
Yuge Zhang
76be5d50e5 Refine example 2021-06-07 10:56:12 +08:00
zhupr
554b9c7826 fix YahooCollector getting 1min data occasionally missing 2021-06-05 23:43:48 +08:00
zhupr
6f150f3fd6 Add YahooCollector support for extend data 2021-06-04 22:28:42 +08:00
Yuge Zhang
a06fa2bc44 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-06-04 15:06:00 +08:00
bxdd
46d253b457 update Exchange.deal_order 2021-06-04 14:41:38 +08:00
Yuge Zhang
1581ef12ac Update impl for robustness 2021-06-04 13:01:49 +08:00
Yuge Zhang
c43805eff6 Update end-to-end example and requirements 2021-06-04 12:20:27 +08:00
bxdd
8aee853a11 update Exchange 2021-06-04 00:55:10 +08:00
you-n-g
2a0d991d9b Merge pull request #459 from you-n-g/online_srv
fix DelayTrainerRM
2021-06-03 15:55:11 +08:00
lzh222333
1320e53f81 fix DelayTrainerRM 2021-06-03 03:23:48 +00:00
Yuge Zhang
bf02fc23f8 Add RL strategy demo 2021-06-02 23:20:27 +08:00
Yuge Zhang
f5ac6230e1 Refactor for strategy 2021-06-02 22:04:54 +08:00
Young
8222795ac4 fix format with black 2021-06-02 09:16:46 +00:00
you-n-g
616a742db7 Merge pull request #435 from you-n-g/online_srv
Multiprocessing support for Online Serving
2021-06-02 17:12:19 +08:00
lzh222333
811d2c975e update & fix 2021-06-02 08:56:15 +00:00
Yuge Zhang
2314405613 Rename files 2021-06-02 16:53:39 +08:00
Yuge Zhang
cc8339acd9 Add a few comments 2021-06-02 16:49:52 +08:00
Yuge Zhang
d515efb46e Finish RL dummy example 2021-06-02 16:41:18 +08:00
lzh222333
6272ce108f Merge remote-tracking branch 'microsoft/main' into online_srv 2021-06-02 08:32:12 +00:00
you-n-g
64896745d0 Merge pull request #457 from zhupr/fix_XGBoost_predict_error
fix XGBoost predict error
2021-06-02 16:14:18 +08:00
Yuge Zhang
3200bb88c8 Update an initial version of RL 2021-06-02 15:11:38 +08:00
zhupr
b2fe2385d5 fix XGBoost predict error 2021-06-01 21:02:32 +08:00
bxdd
4d48c96d30 fix CI 2021-06-01 18:50:50 +08:00
Yuge Zhang
83535bff6a Playground checkpoint 2021-06-01 18:08:11 +08:00
Yuge Zhang
a8e96e59f8 Merge branch 'nested_decision_exe' of https://github.com/microsoft/qlib into rl-dummy 2021-06-01 17:51:39 +08:00
Yuge Zhang
449e3f40c8 Update init in backtest 2021-06-01 17:51:29 +08:00
bxdd
04fff8ca36 solve conflict 2021-06-01 17:46:47 +08:00
bxdd
a183d8a631 update workflow_by_code & update executor 2021-06-01 17:44:22 +08:00
lzh222333
8d05cd2daf modify tests.config.py 2021-06-01 09:40:53 +00:00
lzh222333
231bdf8608 Merge remote-tracking branch 'microsoft/main' into online_srv 2021-06-01 08:29:02 +00:00
bxdd
a46d99a2be black format 2021-06-01 16:20:21 +08:00
bxdd
bf16e1ab47 update Order with dataclass 2021-06-01 16:19:01 +08:00
lzh222333
ab6b88ce14 delete useless import 2021-06-01 07:48:14 +00:00
lzh222333
94ab4bbf3f add docs 2021-06-01 07:45:39 +00:00
Yuge Zhang
cdc59a78f0 Merge branch 'nested_decision_exe' into rl-dummy 2021-06-01 11:34:45 +08:00
Yuge Zhang
d3dac068df Update simple playground 2021-06-01 11:33:44 +08:00
bxdd
60e082e446 add infra interface & fix no KeyboardInterpret bug 2021-05-31 20:40:11 +08:00
you-n-g
4ff0c4fb0f Update strategy.rst 2021-05-31 08:52:41 +08:00
you-n-g
b3eece155f Merge pull request #452 from arisliang/patch-1
Add import stock pool in doc
2021-05-30 09:44:47 +08:00
al
02e34eb9e9 Add import stock pool (csi300) in documentation 2021-05-30 08:27:21 +08:00
bxdd
bf3b757294 fix bugs 2021-05-29 00:31:40 +08:00
bxdd
96e393b599 del DEBUG log 2021-05-28 22:32:33 +08:00
bxdd
029b63c9dd fix bugs & add highfreq backtest example 2021-05-28 22:29:21 +08:00
Yuge Zhang
c26bee126b Support loading for backtest 2021-05-28 17:31:08 +08:00
you-n-g
3033fdf4b7 Merge pull request #444 from zhupr/feature_importance
add get_feature_importance to model interpret
2021-05-28 16:23:53 +08:00
zhupr
ef11a9d95c modify the default value of exists_skip in the GetData.qlib_data parameter to False 2021-05-28 14:57:06 +08:00
zhupr
98eacf8f88 add test/config.py 2021-05-28 13:24:47 +08:00
you-n-g
43cad1ec27 Merge pull request #442 from arisliang/patch-3
Update 1min demo data in CSV format
2021-05-28 11:22:10 +08:00
you-n-g
e7aa7ffcdd Merge pull request #447 from arisliang/patch-2
Remove repeated package from requirements
2021-05-28 10:46:58 +08:00
you-n-g
ed3c9d9212 Merge pull request #448 from arisliang/patch-4
Update integration.rst
2021-05-28 10:46:25 +08:00
you-n-g
2f3fbae73b Merge pull request #450 from arisliang/patch-5
Update report.rst
2021-05-28 10:45:52 +08:00
al
e409bee9b9 Update report.rst
typo
2021-05-28 07:54:45 +08:00
al
7ceec37848 Update integration.rst
Fix typo
2021-05-27 22:35:43 +08:00
bxdd
6a636546c4 Merge github.com:microsoft/qlib into bxdd-qlib_highfreq_backtest 2021-05-27 21:16:35 +08:00
bxdd
4085b447aa move backtest to core, fix calendar bugs, add some docstring 2021-05-27 21:14:39 +08:00
al
c12c861b7a Remove repeated package from requirements 2021-05-27 19:37:57 +08:00
bxdd
2ad61f12b3 rename var in backtest 2021-05-27 17:03:53 +08:00
zhupr
0a4e241608 add get_feature_importance to model interpret 2021-05-27 14:19:10 +08:00
lzh222333
ca0363ded8 update trainer and manage 2021-05-27 06:04:46 +00:00
al
5a382d7e99 Update data.rst
Update csv format according to feedback
2021-05-27 12:40:55 +08:00
al
9b431bc503 Update 1min demo data in CSV format 2021-05-26 22:01:15 +08:00
you-n-g
cbbf6cd822 Merge pull request #441 from zhupr/fix_yahoo_collector
Fix YahooCollector can't download 1min data
2021-05-26 21:41:14 +08:00
you-n-g
928bae08f4 Merge pull request #440 from arisliang/patch-2
Update collector.py
2021-05-26 21:40:23 +08:00
you-n-g
c65fc226bd Merge pull request #439 from arisliang/patch-1
Update README.md
2021-05-26 21:39:53 +08:00
zhupr
114162693f Fix YahooCollector can't download 1min data 2021-05-26 18:29:41 +08:00
al
b884c8c571 Update collector.py
fix typo
2021-05-26 18:00:23 +08:00
al
6222940b9c Update README.md
fix typo
2021-05-26 17:50:49 +08:00
you-n-g
bb0c555803 Merge pull request #372 from zhupr/data_storage
add data storage
2021-05-26 14:30:46 +08:00
zhupr
5da33562dd remove uri parameter from storage && modify file_storage 2021-05-26 12:33:57 +08:00
bxdd
ee74489c37 solve the conflict 2021-05-25 02:53:44 +08:00
bxdd
75fcb3800d Merge branch 'qlib_highfreq_backtest' of github.com:bxdd/qlib into bxdd-qlib_highfreq_backtest 2021-05-25 02:40:34 +08:00
bxdd
0c6e505455 fix comments 2021-05-25 02:38:34 +08:00
lzh222333
a467e10974 Merge remote-tracking branch 'microsoft/main' into online_srv 2021-05-24 05:10:15 +00:00
lzh222333
6dfbf00a23 Merge branch 'microsoft_main' into online_srv 2021-05-24 05:07:53 +00:00
lzh222333
b24af7fff6 multiprocessing support 2021-05-24 05:07:38 +00:00
you-n-g
db3aa8b887 Merge pull request #433 from arisliang/patch-1
Update README.md
2021-05-23 23:53:49 +08:00
al
ae32d79549 Update README.md
fix typo
2021-05-23 16:54:14 +08:00
you-n-g
a80369b80a Update README.md 2021-05-22 19:00:43 +08:00
you-n-g
369177acf9 Update README.md 2021-05-22 19:00:14 +08:00
you-n-g
2ac5ceb4de Update README.md 2021-05-22 17:58:21 +08:00
zhupr
602f78b568 add documentation on which storage methods are used in qlib 2021-05-22 08:30:12 +08:00
zhupr
669f6bd6f5 modify exception message hint for storage.py && fix FileFeatureStorage[:] bug 2021-05-22 02:06:15 +08:00
you-n-g
3d71fd1966 Merge pull request #431 from evanzd/fix_get_module
Fix `get_module_by_module_path` to support pickle module loaded from arbitrage source file
2021-05-21 12:53:14 +08:00
zhupr
b887d2ec32 code for formatting storage.py using black(v21.5) 2021-05-21 10:29:39 +08:00
zhupr
8e6c744a1b Merge remote-tracking branch 'microsoft/main' into data_storage 2021-05-21 09:49:29 +08:00
zhupr
9e296a8a4e replace the type of numpy deprecated 2021-05-21 08:56:44 +08:00
zhupr
4ba4512619 add write method to FeatureStorage && remove extend 2021-05-21 08:45:11 +08:00
you-n-g
26d75b71b0 Update sample.py 2021-05-19 15:06:47 +08:00
you-n-g
dda509da0b Update record_temp.py 2021-05-19 15:02:04 +08:00
Dong Zhou
2fa7ef32fb fix picker error on importlib loaded module 2021-05-18 22:37:31 +08:00
Dong Zhou
c72ee9091e fix picker error on importlib loaded module 2021-05-18 22:12:41 +08:00
you-n-g
19eda8f4f0 Update README.md 2021-05-17 17:45:31 +08:00
you-n-g
d08146c30f Merge pull request #290 from you-n-g/online_srv
init version of online serving and rolling
2021-05-17 17:35:29 +08:00
lzh222333
8c3a08b18d Finally! 2021-05-17 07:27:55 +00:00
you-n-g
142a9dca3c Merge pull request #423 from ChengYen-Tang/LightGBM-Hyperparameter
LightGBM hyperparameter
2021-05-16 19:43:59 +08:00
Kenneth Tang
41ab130807 Fix CI lint with black 2021-05-18 00:01:45 +08:00
Kenneth Tang
8f67010b58 Fix CI lint with black 2021-05-17 23:09:42 +08:00
lzh222333
a986379deb bug fixed 2021-05-14 11:31:50 +00:00
bxdd
eaa719df17 optimize rule_strategy performance 2021-05-14 15:50:27 +08:00
lzh222333
aef3f186c1 format code 2021-05-14 06:58:02 +00:00
lzh222333
ebd01e0de5 Online Serving V11 2021-05-14 06:44:16 +00:00
bxdd
ea60e608ba update rule_startegy & add README, notebook for multi-level trading 2021-05-14 01:51:43 +08:00
Kenneth Tang
f51e04a1cc LightGBM hyperparameter 2021-05-13 23:12:29 +08:00
bxdd
de2658a8db fix rule_strategy bug 2021-05-13 22:39:19 +08:00
lzh222333
d71a666904 Online serving V11 2021-05-13 09:43:42 +00:00
you-n-g
8b15ffc027 Merge pull request #419 from Derek-Wds/main
Fix bug and update doc
2021-05-13 16:38:22 +08:00
you-n-g
f15ca39df8 Merge pull request #418 from zhupr/set_global_logger_level
Modify set_global_logger_level use of contextmanager
2021-05-13 16:36:40 +08:00
Jactus
bd37f5d953 Fix bug and update doc 2021-05-13 14:21:54 +08:00
bxdd
c703dabcc7 fix rule_strategy reset method 2021-05-13 00:46:17 +08:00
bxdd
07eaada31e fix comments 2021-05-13 00:33:57 +08:00
zhupr
76c5c5d1b6 Add docstrings to set_global_logger_level 2021-05-12 22:38:50 +08:00
zhupr
b8e64dc526 Modify set_global_logger_level use of contextmanager 2021-05-12 17:58:39 +08:00
you-n-g
df7c882fe3 Merge pull request #416 from zhupr/configurable_dataset
Add configurable dataset to examples
2021-05-12 09:03:56 +08:00
bxdd
621cb243c2 fix some comments and add docstring 2021-05-12 02:17:39 +08:00
zhupr
9bd77bd89f Add configurable dataset to examples 2021-05-11 17:36:55 +08:00
you-n-g
c43a0b208d Merge pull request #413 from Derek-Wds/stale
Stale bot update
2021-05-10 21:15:36 +08:00
Jactus
8ba5e93d04 Skip enhancement in stale bot 2021-05-10 12:33:58 +08:00
lzh222333
370b6aad74 logger & doc 2021-05-09 11:58:06 +00:00
lzh222333
f5ded06a15 Merge remote-tracking branch 'microsoft/main' into online_srv 2021-05-09 10:53:41 +00:00
lzh222333
4c232610f1 Merge branch 'online_srv' of https://github.com/you-n-g/qlib into online_srv 2021-05-09 10:52:07 +00:00
Dingsu Wang
81bd2ca8fb Merge branch 'microsoft:main' into stale 2021-05-09 17:59:46 +08:00
Jactus
143c257fa2 Update stale bot 2021-05-09 17:56:37 +08:00
Jactus
724f9ba8d2 Update stale bot 2021-05-09 17:52:18 +08:00
you-n-g
aa1f9b464b Merge pull request #412 from zhupr/set_global_logger_level
Add set_global_logger_level
2021-05-09 11:25:56 +08:00
zhupr
d2daba99d3 Add set_global_logger_level 2021-05-09 09:05:57 +08:00
you-n-g
1c605e505a Merge pull request #14 from you-n-g/online_srv_blin
Online srv blin
2021-05-07 21:07:47 +08:00
you-n-g
060a32e0f6 Merge branch 'online_srv' into online_srv_blin 2021-05-07 21:07:27 +08:00
binlins
08edb92461 add flt_data doc 2021-05-07 12:56:58 +00:00
binlins
bec65ddf94 add document and reindex 2021-05-07 11:47:47 +00:00
lzh222333
9dfd001f6f online serving v10 2021-05-07 09:59:15 +00:00
you-n-g
95a4a98de8 Update README.md 2021-05-07 10:56:57 +08:00
you-n-g
d4639b7df9 Update README.md
Update high-frequency trading link
2021-05-07 10:46:45 +08:00
bxdd
f7d30960c1 update the internal bar strategy 2021-05-07 00:10:44 +08:00
bxdd
bc3eada02d black format 2021-05-06 21:34:31 +08:00
bxdd
7540ecde11 fix trade time bug 2021-05-06 21:33:33 +08:00
blin
846c64f6c6 fix param 2021-05-06 12:00:41 +00:00
lzh222333
84c56f13bd docs and bug fixed 2021-05-06 04:18:55 +00:00
lzh222333
1c99fb35da Merge remote-tracking branch 'microsoft/main' into online_srv 2021-05-06 02:24:16 +00:00
you-n-g
5bc2b96346 Update data.rst 2021-05-03 12:34:08 +08:00
bxdd
ae339506b3 del old strategy 2021-04-30 23:35:28 +08:00
bxdd
e30df11a0b solve the conflict 2021-04-30 23:23:56 +08:00
bxdd
d297a493b8 fix bugs 2021-04-30 22:56:21 +08:00
you-n-g
ee269b0914 Merge pull request #407 from Derek-Wds/log
Fix logger pickling error
2021-04-30 17:33:42 +08:00
you-n-g
2a2d2cf709 Merge pull request #404 from Derek-Wds/main
Support start exp with given exp & recorder id
2021-04-30 16:46:46 +08:00
Jactus
5eb9dfff16 Remove redundant 2021-04-30 15:28:37 +08:00
Jactus
694ae34027 Update api 2021-04-30 13:27:19 +08:00
Jactus
51b649ec39 Update QlibLogger 2021-04-30 13:13:05 +08:00
bxdd
a109df3f46 fix bug in recorder 2021-04-30 01:06:05 +08:00
Jactus
ca92cb980c Update meta logger 2021-04-29 22:40:52 +08:00
Jactus
f58c61a2e0 Fix logger pickling error 2021-04-29 16:54:51 +08:00
lzh222333
2b7ffa100f Merge remote-tracking branch 'microsoft/main' into online_srv 2021-04-29 05:23:42 +00:00
lzh222333
67c5740c83 OnlineServing V9 2021-04-29 04:30:09 +00:00
bxdd
f404a031f3 black format 2021-04-29 02:29:29 +08:00
bxdd
49cdaf8f5d update port_ana_record 2021-04-29 02:28:22 +08:00
bxdd
86a6f565e8 trade_account support multi bar report 2021-04-29 02:15:34 +08:00
lzh222333
6f669348a8 Merge branch 'online_srv' of https://github.com/you-n-g/qlib into online_srv 2021-04-28 09:23:13 +00:00
lzh222333
40cf83e557 online serving V9 middle status 2021-04-28 09:23:07 +00:00
blin
fa4511cb0a filter 2021-04-28 07:30:22 +00:00
blin
45c6dfc5da filter 2021-04-28 07:25:19 +00:00
blin
36ab078fbd filter 2021-04-28 07:15:59 +00:00
you-n-g
5a7f9ef720 Merge pull request #405 from zhupr/future_trading_date_collector
Add future trading date collector
2021-04-28 10:07:08 +08:00
zhupr
8b8d21107c Add future trading date collector 2021-04-27 21:20:47 +08:00
Jactus
eab19de080 Support start exp with given exp & recorder id 2021-04-27 16:56:07 +08:00
lzh222333
42f510024c update collector 2021-04-27 04:12:08 +00:00
Young
5a7eecabee black formating (black is upgraded in github) 2021-04-27 04:04:43 +00:00
bxdd
8920c1967f del outdate file 2021-04-26 20:54:10 +08:00
lzh222333
0058f7d0dc Online Serving V8 2021-04-26 09:31:47 +00:00
you-n-g
9a74fe34f6 Merge pull request #401 from zhupr/online_fix
Fix online mode bugs
2021-04-26 12:29:55 +08:00
zhupr
e15ea06122 Fix ClientProvider not supporting LocalInstrumentProvider && online using the latest python-socketio 2021-04-25 23:50:29 +08:00
lzh222333
319396c815 online serving V8 2021-04-25 06:26:45 +00:00
bxdd
af0053eb17 fix bug 2021-04-24 22:37:36 +08:00
bxdd
b14efa1129 update trade calendar & backtest workflow 2021-04-24 02:29:42 +08:00
you-n-g
50be7a9171 Merge pull request #393 from Derek-Wds/main
Update qlib logger
2021-04-23 12:41:05 +08:00
Jactus
e410caaa8f Simplify meta class 2021-04-23 10:08:12 +08:00
Jactus
fbff4c271a Remove redundant methods in meta 2021-04-23 00:38:45 +08:00
bxdd
39deb7d27f update env & strategy, add workflow 2021-04-22 22:28:01 +08:00
you-n-g
ee91503973 Merge pull request #399 from Derek-Wds/doc
Update doc
2021-04-22 20:37:40 +08:00
lzh222333
de0a0c083d bug fixed 2021-04-22 08:09:15 +00:00
Jactus
8adfafa6aa Black format 2021-04-22 14:17:25 +08:00
Jactus
aafaff45d2 Update doc 2021-04-22 14:13:36 +08:00
bxdd
8979d786a9 update report & account 2021-04-22 02:04:40 +08:00
bxdd
971d6a2847 update strategy 2021-04-21 16:42:16 +08:00
Jactus
6a05d4e255 Enable IDEs docstrings 2021-04-19 11:36:00 +08:00
Jactus
cbf1fa721e Update 2021-04-17 15:47:49 +08:00
Jactus
4ebf684794 Update workflow logging 2021-04-16 15:35:11 +08:00
Jactus
f4bfe8e619 First trial of adding docstring 2021-04-16 14:35:05 +08:00
lzh222333
cec318fbfe online serving V7 2021-04-16 05:37:13 +00:00
Jactus
78bb8882cd Format 2021-04-16 12:00:18 +08:00
Jactus
848d953226 Update qlib logger 2021-04-16 09:58:55 +08:00
you-n-g
a3a2b5ae0b Merge pull request #358 from javaThonc/high_freq_demp
update high freq demo
2021-04-14 20:05:07 +08:00
Alex Wang
941c980d06 update tabnet 2021-04-14 17:35:19 +08:00
Alex Wang
fe190dec4b update readme 2021-04-14 14:40:28 +08:00
lzh222333
5095b2a470 simulator & examples 2021-04-13 09:45:16 +00:00
zhupr
317357b50d Modify data.storage 2021-04-13 10:47:01 +08:00
Young
b15e5e33fd Fix the multi-processing bug 2021-04-12 06:33:31 +00:00
Young
cca43cf102 Refactor update & modification when running NN 2021-04-11 14:39:19 +00:00
Young
a366c11d67 Update features for hyb nn 2021-04-09 13:48:01 +00:00
Young
18bf4b5477 parameter adjustment 2021-04-08 03:52:58 +00:00
lzh222333
c20eb5c8a6 format code 2021-04-08 03:30:24 +00:00
Young
71605794a2 Merge branch 'online_srv_wd' into online_srv 2021-04-07 05:17:07 +00:00
Young
1dbb561744 Fix some API(for lb nn) 2021-04-07 03:53:56 +00:00
lzh222333
cb42e99bee bug fixed & examples fire 2021-04-07 03:33:27 +00:00
lzh222333
431a9c92c1 online serving v5 2021-04-02 07:09:29 +00:00
lzh222333
bd7a1c11b9 trainer & group & collect & ensemble 2021-04-02 04:27:14 +00:00
zhupr
70fc58104b Modify FileStorage 2021-04-01 12:58:34 +08:00
lzh222333
edcd7b1ff9 bug fixed & code format 2021-03-31 03:08:48 +00:00
lzh222333
3724273d73 Merge remote-tracking branch 'microsoft/qlib/main' into online_srv 2021-03-31 02:54:05 +00:00
lzh222333
544365f3a9 ensemble & get_exp & dataset_pickle 2021-03-31 02:39:14 +00:00
Alex Wang
bed1175e24 update dataset 2021-03-30 19:29:17 +08:00
you-n-g
70c84cbc77 Merge pull request #381 from D-X-Y/main
Fix print issue
2021-03-30 17:25:26 +08:00
you-n-g
da59b35c0a Merge pull request #380 from Derek-Wds/main
Modify get_exp & get_recorder api
2021-03-30 16:54:01 +08:00
lzh222333
eae94d1ee8 Merge remote-tracking branch 'microsoft/qlib/main' into online_srv 2021-03-30 07:16:56 +00:00
lzh222333
1f2d2c9b69 online debug 2021-03-30 06:56:04 +00:00
Jactus
b6df11b6b4 Modify get_exp & get_recorder api 2021-03-30 14:41:56 +08:00
you-n-g
ae57110f64 Merge pull request #374 from bxdd/qlib_loaderhandler
Add DataLoader Based on DataHandler & Add Rolling Process Example & Restructure the Config & Setup_data
2021-03-30 13:37:55 +08:00
bxdd
7a2203f116 update comments 2021-03-30 11:03:07 +08:00
bxdd
023603479c fix readme 2021-03-30 01:00:12 +08:00
bxdd
f8da79b802 fix readme 2021-03-30 00:54:00 +08:00
bxdd
136830bc2b update comments 2021-03-30 00:38:15 +08:00
you-n-g
45f78676ea Merge pull request #379 from zhupr/fix_usinex_collector
Fix us_index collector
2021-03-29 23:54:05 +08:00
bxdd
1074284666 fix docstring 2021-03-29 20:38:09 +08:00
bxdd
d18c367497 update README 2021-03-29 20:34:36 +08:00
bxdd
8743576f72 black format 2021-03-29 20:16:00 +08:00
bxdd
fb7f84f31e fix ubg 2021-03-29 20:15:42 +08:00
bxdd
31bc85bf86 restructure data layer config & setup 2021-03-29 19:49:30 +08:00
D-X-Y
968930e85f Fix print issue 2021-03-29 04:46:38 +00:00
zhupr
4b66304978 Fix us_index collector 2021-03-29 11:25:24 +08:00
you-n-g
253378a44e Merge pull request #378 from D-X-Y/main
Add MultiSegRecord and add segment kwargs in model.pred
2021-03-29 01:06:41 +08:00
D-X-Y
f809f0a063 Remove un-used imports 2021-03-28 10:50:25 +00:00
D-X-Y
0386df7b16 Collect all contrib models in __init__ and add unit tests for init 2021-03-28 10:39:28 +00:00
D-X-Y
8a2e7b62af Add segment args for pred and refine MultiSegRecord 2021-03-28 08:30:16 +00:00
D-X-Y
9d04ae4676 Add MultiSegRecord in contrib.workflow and decouple its tests from test_all_pipeline 2021-03-28 00:33:59 -07:00
zhupr
9b8acd9a82 Fix FileStorage 2021-03-27 01:15:33 +08:00
lzh222333
ee45a7833e Merge branch 'main' into online_srv 2021-03-26 08:20:21 +00:00
zhupr
d395c904f2 Add FileStorage 2021-03-26 16:14:45 +08:00
lzh222333
9bf819e653 Merge branch 'online_srv' of https://github.com/you-n-g/qlib into online_srv 2021-03-26 04:32:20 +00:00
lzh222333
46cd57688e Online Serving V4 2021-03-26 04:20:25 +00:00
you-n-g
0387eaf7ab Merge pull request #373 from lewwang1995/main
debug
2021-03-26 11:59:20 +08:00
bxdd
4ee0240c24 black format 2021-03-25 22:08:39 +08:00
bxdd
5f60d18dfe fix config_data bug 2021-03-25 22:08:23 +08:00
bxdd
194217fb07 fix bug 2021-03-25 21:47:17 +08:00
bxdd
d6ff764bb2 black format 2021-03-25 20:36:45 +08:00
bxdd
9cc3b18e4e fix but 2021-03-25 20:36:07 +08:00
LewenWang
56eaacd931 debug 2021-03-25 20:34:45 +08:00
bxdd
e119c8576c black format 2021-03-25 19:59:22 +08:00
bxdd
68246b3b6d update workflow 2021-03-25 19:58:55 +08:00
bxdd
a04c6bd6c9 balck format 2021-03-25 19:56:22 +08:00
bxdd
efe134e9f4 update workflow 2021-03-25 19:56:04 +08:00
bxdd
4ec300787e update rolling workflow 2021-03-25 19:54:52 +08:00
you-n-g
3886022669 Merge pull request #371 from Derek-Wds/main
Update notebook
2021-03-25 18:13:54 +08:00
zhupr
8264033a72 add data-storage 2021-03-25 17:22:05 +08:00
Jactus
4861552d28 Update notebook 2021-03-25 17:13:52 +08:00
you-n-g
834f9bd9b8 Update README.md 2021-03-25 16:58:35 +08:00
bxdd
f6dc25b229 update rolling process 2021-03-25 16:14:22 +08:00
bxdd
1fcfe8e4ba add rolling process data 2021-03-25 01:37:17 +08:00
bxdd
b1a28358ad black format 2021-03-25 01:30:31 +08:00
bxdd
1ca3c6a61c add DataHandlerDL 2021-03-25 01:29:59 +08:00
Alex Wang
e3739bb980 fix naming and code style 2021-03-24 15:47:26 +08:00
you-n-g
419629e4d2 Merge pull request #365 from Flouse/main
fix docs
2021-03-24 13:12:15 +08:00
Flouse
e490e83a16 fix docs 2021-03-24 11:37:09 +08:00
you-n-g
fda144e66f Merge pull request #362 from D-X-Y/main
Add load_object function for R
2021-03-23 22:47:49 +08:00
you-n-g
4dc10d27e0 Merge pull request #359 from bxdd/doc0
Fix data doc
2021-03-23 21:40:27 +08:00
D-X-Y
0a0c6a3185 Add load_object function for R 2021-03-23 10:10:17 +00:00
lzh222333
d66d4ec93d Merge branch 'main' into online_srv 2021-03-23 11:20:02 +08:00
bxdd
4b56a4e907 fix doc 2021-03-22 18:45:27 +08:00
bxdd
7370d5af9e add label doc 2021-03-22 18:37:44 +08:00
bxdd
c6b67cb8fe fix doc 2021-03-22 18:37:13 +08:00
Alex Wang
3bf6c7f95f update format 2021-03-22 15:37:54 +08:00
Alex Wang
1ad237f89f update high freq demo 2021-03-22 14:20:44 +08:00
you-n-g
2b74b4dfa4 Merge pull request #357 from zhupr/fix_yahoo_collector
Fix yahoo_collector
2021-03-22 12:41:17 +08:00
zhupr
598ee875a0 Fix yahoo_collector 2021-03-22 10:29:07 +08:00
bxdd
d3a1e03a11 add sample & base class 2021-03-20 00:11:19 +08:00
Young
84d5318bda Merge branch 'online_srv_wd' into online_srv 2021-03-19 07:49:16 +00:00
you-n-g
ba56e4071e Merge pull request #292 from wangershi/addFund
Add fund data as an example
2021-03-19 11:05:29 +08:00
wangershi
d3160e9439 remove some useless code 2021-03-18 21:15:45 +08:00
you-n-g
06c90d654d Merge pull request #350 from zhupr/fix_dump_bin
Fix dump_bin.py && check_dump_bin.py
2021-03-18 18:39:40 +08:00
you-n-g
f72771cc81 Merge pull request #351 from wendili-cs/patch-1
Update __init__.py
2021-03-18 18:28:18 +08:00
lzh222333
8abdd63869 online_serving V3 2021-03-18 09:30:01 +00:00
Wendi Li
38f35658e7 Update __init__.py 2021-03-18 13:19:27 +08:00
zhupr
d245242f2f Fix dump_bin.py && check_dump_bin.py 2021-03-18 11:21:25 +08:00
lwwang1995
45f73361e3 add tcts baseline 2021-03-18 11:17:42 +08:00
you-n-g
6ef204f190 Merge pull request #348 from microsoft/you-n-g-patch-1
Update Contact Us Information
2021-03-17 16:29:28 +08:00
Young
dad18074ac update image 2021-03-17 08:27:59 +00:00
you-n-g
3cf84f8859 Update Contact Us Information 2021-03-17 16:16:00 +08:00
you-n-g
0403237232 Update Contact US 2021-03-17 15:41:16 +08:00
you-n-g
689774c6be Merge pull request #340 from Derek-Wds/main
Support resuming recorder
2021-03-17 14:48:59 +08:00
Jactus
d78e42e2fe Update exp base method 2021-03-17 13:37:17 +08:00
you-n-g
4de628c736 Merge pull request #347 from 2young-2simple-sometimes-naive/patch-1
fix bug of consider TURE as boolean instead of stock code
2021-03-17 12:08:57 +08:00
you-n-g
023c1fedfe Merge pull request #280 from yongzhengqi/main
Implement Enhanced Indexing as a Portfolio Optimizer
2021-03-17 12:07:39 +08:00
you-n-g
9be6866972 Update README.md 2021-03-17 12:03:53 +08:00
you-n-g
be55e0e3fe Fix Typos 2021-03-17 12:03:00 +08:00
you-n-g
619a3bb25d Update plan and news on Index Page 2021-03-17 12:02:24 +08:00
you-n-g
4bd2cd4611 Add feature news on index page 2021-03-17 11:36:12 +08:00
you-n-g
aa552fdb20 Merge pull request #345 from D-X-Y/main
Fix errors when SignalRecord is not called before SigAna/PortAna
2021-03-17 10:47:00 +08:00
安阁锐
5520463395 fix bug of consider TURE as boolean instead of stock code 2021-03-16 22:18:11 -04:00
D-X-Y
872ddc6f95 Fix black error 2021-03-16 22:57:26 +08:00
D-X-Y
88b0871c12 Add RMSE for contrib.workflow.record_temp and unit tests 2021-03-16 22:55:28 +08:00
D-X-Y
d4aa681652 Add MSERecord in contrib.workflow 2021-03-16 12:54:12 +00:00
Jactus
34f0be2836 Fix arg error 2021-03-16 17:18:48 +08:00
Jactus
447fed8e54 Update structure for resuming 2021-03-16 17:16:00 +08:00
D-X-Y
4cb74d77d1 add error type for record_temp 2021-03-16 09:01:10 +00:00
D-X-Y
b0fd0d2395 Add tests for SigAnaRecord 2021-03-16 08:30:46 +00:00
D-X-Y
6559d44c7d Add tests for SigAnaRecord 2021-03-16 08:17:13 +00:00
D-X-Y
9f57681032 Fix errors when SignalRecord is not called before SigAna/PortAna 2021-03-16 08:11:05 +00:00
lzh222333
d33041dc24 format example 2021-03-16 02:52:20 +00:00
lzh222333
5953365af3 finished update_online_pred demo 2021-03-16 02:43:12 +00:00
lzh222333
e3730b32d7 more clearly structure 2021-03-16 02:23:28 +00:00
Jactus
08b44ed727 Update docs 2021-03-15 14:12:35 +08:00
Jactus
83fb482f1e Fix Bug 2021-03-15 13:55:57 +08:00
Jactus
734bb9ee3c Support resuming recorder 2021-03-15 13:50:10 +08:00
you-n-g
d47e35d64e Merge pull request #337 from D-X-Y/main
Fix bugs in Ghost BN in TabNet and typos in README
2021-03-15 12:42:48 +08:00
lzh222333
0bc49dab60 add task management to index.rst 2021-03-15 03:58:05 +00:00
lzh222333
646d899f8d update docstring and document 2021-03-15 03:50:43 +00:00
D-X-Y
07434da8b0 Remove unused imports 2021-03-15 03:35:34 +00:00
D-X-Y
53a6b72ce5 Fix black errors 2021-03-15 03:09:52 +00:00
D-X-Y
a51dafcb4c Remove unnecessary codes 2021-03-15 03:07:25 +00:00
Young
8362780e22 fix import bug 2021-03-14 15:16:38 +00:00
D-X-Y
358de88602 Fix typos in README and add TabNet config for Alpha360 2021-03-14 07:42:24 +00:00
D-X-Y
32a7be9964 Fix typos in README 2021-03-14 07:31:18 +00:00
D-X-Y
d5f9395e51 Fix Ghost BN bugs in TabNet and simplify its implementation 2021-03-14 07:25:09 +00:00
wangershi
4e7a147759 use base.py 2021-03-14 14:24:14 +08:00
wangershi
1344c40598 Merge remote-tracking branch 'remoteGit/main' into addFund 2021-03-14 11:19:01 +08:00
you-n-g
1d2b2f4f01 Merge pull request #333 from Rekind1e/main
another typo of docs
2021-03-13 20:05:25 +08:00
Hy
373f6e0900 another typo of docs 2021-03-13 15:47:26 +08:00
you-n-g
ba64758c24 Merge pull request #332 from Rekind1e/main
Fix typo of docs
2021-03-13 14:48:02 +08:00
Hy
abddcfccdf fix typo of docs 2021-03-13 14:32:01 +08:00
you-n-g
6d5381f9b1 Merge pull request #311 from withshubh/main
Fixed code quality issues
2021-03-12 18:31:02 +08:00
Young
e4e8a4abcd fix task name & add cur_path 2021-03-12 10:17:16 +00:00
Shubhendra Singh Chauhan
e41373b8ad revert fix 2021-03-12 14:10:52 +05:30
lzh222333
9d84d389ab format code and add example 2021-03-12 08:24:21 +00:00
lzh222333
6d8aa215d6 the second version of online serving 2021-03-12 08:04:08 +00:00
shubhendra
0969c3e7e0 formatted with black 2021-03-12 13:29:20 +05:30
Young
5de7870f9b Merge branch 'online_srv' of github.com:you-n-g/qlib into online_srv 2021-03-12 07:52:31 +00:00
Young
44a7dc004d update docs and fix duplicated pred bug 2021-03-12 07:50:17 +00:00
Shubhendra Singh Chauhan
5f8d0e0436 Merge branch 'main' into main 2021-03-12 13:08:45 +05:30
shubhendra
4fbb5a03c1 revert fixes that failed unit test 2021-03-12 13:05:48 +05:30
you-n-g
0cffb87cbc Merge pull request #329 from D-X-Y/main
Fix Various Bugs for contrib.pytorch_ models
2021-03-12 12:30:08 +08:00
you-n-g
df56e3bdf9 Merge pull request #324 from zhupr/add_base_collector
Add BaseCollector
2021-03-12 12:20:24 +08:00
D-X-Y
1d435248e2 Add return for use_gpu.. 2021-03-11 19:28:00 -08:00
D-X-Y
593553f573 Fix bug in MLP 2021-03-11 19:15:18 -08:00
D-X-Y
d38b8d6001 Fix bugs in use_gpu 2021-03-11 19:10:32 -08:00
D-X-Y
db59713d36 Add torch.no_grad for evaluation 2021-03-12 02:46:04 +00:00
D-X-Y
67fbdafe76 Fix many bugs in TabNet and use_gpu 2021-03-12 02:42:25 +00:00
zhupr
42be8ac312 Add BaseCollector 2021-03-12 10:30:38 +08:00
lzh222333
0df88c07f6 bug fixed and update collect.py 2021-03-11 16:25:46 +00:00
you-n-g
f6b019dcec Merge pull request #328 from D-X-Y/fshare
Move get_path to get_or_create_path, use the best model of SFM / TabNet
2021-03-11 22:07:20 +08:00
D-X-Y
e626264d5a Merge branch 'main' of github.com:microsoft/qlib into fshare 2021-03-11 12:54:04 +00:00
D-X-Y
b99de068f8 Move save_path to get_or_create_path, and fix bugs in sfm / tabnet 2021-03-11 12:52:26 +00:00
you-n-g
e8beaa5257 Merge pull request #314 from D-X-Y/fshare
(1) Fix /0 bug in double_ensemble, (2) remove _default_uri for R/expm, (3) support model size in pytorch models
2021-03-11 20:51:16 +08:00
D-X-Y
0ef7c8e0e6 Fix bugs for get_local_dir 2021-03-11 03:05:31 +00:00
lzh222333
48f0fc147f first version of online serving 2021-03-11 03:00:30 +00:00
D-X-Y
cda96be8c3 Refine default uri in expm 2021-03-11 02:49:03 +00:00
D-X-Y
f6ed175070 Remove set_log_basic_config, refine count_parameters, rename root_uri as get_local_dir 2021-03-11 02:33:00 +00:00
lzh222333
2ca2071d95 format code 2021-03-10 17:06:08 +00:00
you-n-g
0054a4db2a Merge pull request #322 from Derek-Wds/bug
Fix pytorch ts model loader bug
2021-03-10 19:47:56 +08:00
lzh222333
e2f58274ba update task manager 2021-03-10 10:58:49 +00:00
Jactus
119fe90570 Fix pytorch ts model loader bug 2021-03-10 16:43:32 +08:00
you-n-g
e2817ab87c Merge pull request #319 from Derek-Wds/main
Update Filter doc
2021-03-10 15:38:39 +08:00
you-n-g
2e37033e35 Merge pull request #318 from microsoft/bxdd-patch-2
Fix code in ops
2021-03-10 14:45:35 +08:00
Jactus
105fe1d3ed Remove deprecated warning for numpy>=1.20.0 2021-03-10 10:38:43 +08:00
Jactus
78bc2c8748 Update Filter doc 2021-03-09 17:31:27 +08:00
lzh222333
83dbdfb45e finished document and example 2021-03-09 17:22:36 +08:00
bxdd
81987bb143 Update ops.py 2021-03-09 15:38:04 +08:00
Charles Young
53cf89d7c2 Reformat with black. 2021-03-08 19:43:03 +08:00
Charles Young
8b9065c166 Reformat with black. 2021-03-08 19:32:13 +08:00
Charles Young
6a305c73ae Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589166529 2021-03-08 19:08:55 +08:00
Charles Young
7022675d00 Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589169489 2021-03-08 19:07:28 +08:00
Charles Young
2f9af1af8f Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589169769 2021-03-08 19:02:40 +08:00
Charles Young
fc89fec46d Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589168764 2021-03-08 18:56:54 +08:00
Charles Young
c6675be792 Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589166143 2021-03-08 17:51:36 +08:00
Charles Young
351d598c9f Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589165409 2021-03-08 17:49:59 +08:00
Charles Young
81b86f8022 Update test to cover changes in structured_cov_estimator 2021-03-08 17:18:07 +08:00
Charles Young
4d5a30b30b Resolve https://github.com/microsoft/qlib/pull/280\#discussion_r589167776 2021-03-08 17:14:29 +08:00
Charles Young
79c1142d3e Pass nan_option to structured covariance estimator. 2021-03-08 17:09:33 +08:00
D-X-Y
e061443560 Fix lint error with Black 2021-03-08 08:27:58 +00:00
D-X-Y
03ef918dd8 Fix bugs in count_parameters 2021-03-08 08:24:23 +00:00
D-X-Y
ca48345b29 Simplify count_parameters 2021-03-08 08:16:17 +00:00
lzh222333
def132e140 modified format and added TaskCollector 2021-03-08 16:10:16 +08:00
D-X-Y
7bed3b4c2e Fix python format by black 2021-03-08 06:39:03 +00:00
D-X-Y
4266492a34 Merge branch 'main' of github.com:microsoft/qlib into fshare 2021-03-08 06:12:49 +00:00
you-n-g
91eef93386 Merge pull request #302 from D-X-Y/main
Update repr for dataset/workflow classes and add uri kwarg for QlibRecorder
2021-03-08 14:01:53 +08:00
lzh222333
a244f87f95 modified the comments 2021-03-08 13:25:11 +08:00
wangershi
9df0361262 black 2021-03-07 19:35:50 +08:00
wangershi
6bcd88973b resolve one bug 2021-03-07 19:32:37 +08:00
D-X-Y
d13c9ae018 Avoid dividing zero in model.double_ensemble 2021-03-07 11:25:53 +00:00
wangershi
11412727ef add normalizer 2021-03-07 18:51:38 +08:00
D-X-Y
73b7107ee8 Remove useless verbose kwarg 2021-03-07 00:52:27 -08:00
D-X-Y
91fd53ab4d Add reset_default_uri func for R and expm 2021-03-06 05:33:08 -08:00
shubhendra
aab5c5b311 Refactor the comparison involving not
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:35 +05:30
shubhendra
dc86a6abc5 Refactor unnecessary else / elif when if block has a continue statement
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:34 +05:30
shubhendra
a62d1a1b36 Use literal syntax to create data structure
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:34 +05:30
shubhendra
5015d218ff Remove methods with unnecessary super delegation.
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:34 +05:30
shubhendra
6f034ccb5d Remove unnecessary use of comprehension
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:33 +05:30
shubhendra
07eef18337 Remove length check in favour of truthiness of the object
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:33 +05:30
shubhendra
f277a66582 Add .deepsource.toml
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-03-06 13:01:32 +05:30
D-X-Y
49697b1f15 Show model size for pytorch models 2021-03-05 12:46:41 +00:00
D-X-Y
131f0e2e67 Add count_parameters for pytorch models in contrib 2021-03-05 12:07:43 +00:00
D-X-Y
b14a559a52 Merge branch 'main' of github.com:D-X-Y/qlib into fshare 2021-03-05 07:25:18 +00:00
D-X-Y
b115ca5353 Merge branch 'main' of github.com:microsoft/qlib into main 2021-03-04 23:19:33 -08:00
D-X-Y
b40bfb1ea5 Merge branch 'main' of github.com:microsoft/qlib into fshare 2021-03-05 07:17:09 +00:00
D-X-Y
4f980a0266 Merge branch 'fshare' of github.com:D-X-Y/qlib into fshare 2021-03-05 07:15:46 +00:00
D-X-Y
19d93744f3 Add set_log_basic_config function support re-directing log stream 2021-03-05 07:15:25 +00:00
D-X-Y
e327f404e3 Fix pylint issues 2021-03-04 22:37:58 -08:00
D-X-Y
452fb8f013 Make mlflow client consistant with uri 2021-03-04 22:33:35 -08:00
D-X-Y
c4d6e00470 Fix logic of uri in ExpM and add test 2021-03-04 21:04:01 -08:00
Charles Young
0f3e3d206b Update __init__.py. 2021-03-04 22:47:42 +08:00
Charles Young
83c6e74783 Reindex files. 2021-03-04 22:30:38 +08:00
Charles Young
2bff6eb781 Split classes in riskmodel.py & optimizer.py into seperate files. 2021-03-04 22:08:11 +08:00
D-X-Y
ee7eb79277 Fix unexpected mlruns folder error 2021-03-04 06:15:24 +00:00
D-X-Y
592db903b3 Update repr for Experiment & Recorder 2021-03-04 05:02:56 +00:00
wangershi
34b7da1dd8 add calendar list by threshold 2021-03-03 22:49:48 +08:00
lzh222333
2882929c5d Add an example about workflow using RollingGen. 2021-03-03 16:58:05 +08:00
lzh222333
fd2c1ba1ed Update some hint 2021-03-03 16:36:15 +08:00
lzh222333
05cf0e1edc add task_generator method and update some hint 2021-03-03 15:42:39 +08:00
D-X-Y
229a39d0d3 Fix typos in DataHandler's doc 2021-03-03 07:30:55 +00:00
D-X-Y
a9a70dfddf Update repr for DatasetH and ExpManager 2021-03-03 06:47:52 +00:00
you-n-g
b8cf229b05 Merge pull request #272 from ChengYen-Tang/Fix_collector_doc
Fix collector doc
2021-03-03 14:14:07 +08:00
you-n-g
7258340e0c Merge pull request #300 from bxdd/qlib_2021_03_02
Update FAQ doc & Update ops docstring
2021-03-03 14:11:11 +08:00
lzh222333
b84156fde8 Consider more situations about task_config.
Save the "param" file which is collect.py need.
2021-03-03 11:25:37 +08:00
you-n-g
d1d70616a3 Merge pull request #298 from D-X-Y/main
Update the Wrapper class to have an informative str representation
2021-03-03 11:17:00 +08:00
bxdd
5378d261b4 update ops.py docstring 2021-03-03 00:47:50 +09:00
bxdd
a1fb10f7cf update FAQ doc 2021-03-03 00:44:52 +09:00
D-X-Y
dbc8ca7379 Fix pylint by black -l 120 2021-03-02 22:15:30 +08:00
D-X-Y
c48b4c9971 Make Wrapper with a informative str repr. 2021-03-02 21:06:32 +08:00
you-n-g
b592669d1f Update Index Report 2021-03-02 20:23:27 +08:00
you-n-g
0bcaab3a5a Merge pull request #286 from meng-ustc/main
Add a new method to benchmarks: DoubleEnsemble
2021-03-02 18:34:17 +08:00
meng-ustc
1de4def444 Update parameter names: 'k' and 'base' 2021-03-02 16:14:56 +09:00
meng-ustc
ee4692a355 Merge branch 'main' of https://github.com/meng-ustc/qlib 2021-03-02 12:20:45 +09:00
meng-ustc
6e2ce6f1dc Add the results of DoubleEnsemble 2021-03-02 12:17:05 +09:00
lzh222333
c4733f601f Merge pull request #1 from you-n-g/online_srv
qlib auto init basedon project & black format
2021-03-02 10:06:45 +08:00
wangershi
82353b20e1 black format 2021-03-01 21:10:46 +08:00
wangershi
51baf57b40 Merge remote-tracking branch 'remoteGit/main' into addFund 2021-02-28 19:29:18 +08:00
wangershi
3082f6ac1b ready for dump_bin 2021-02-28 19:06:40 +08:00
wangershi
db80b620d8 ready for collector 2021-02-28 17:03:14 +08:00
wangershi
6e56396217 add crawler 2021-02-28 12:24:26 +08:00
Young
24024d51c7 qlib auto init basedon project & black format 2021-02-27 09:44:01 +00:00
Wendi Li
a96f0c2e5f Update README.md
Typos fixed.
2021-02-27 11:37:45 +08:00
Young
1e5cf1c174 init version of online serving and rolling 2021-02-26 09:14:40 +00:00
wangershi
719074d306 touch file 2021-02-25 19:20:14 +08:00
Meng Dong
70575e8a1c Delete workflow_by_code_lgb_risk_demo.py 2021-02-24 16:10:38 +08:00
meng-ustc
ce60097722 Add README and Formatted 2021-02-24 16:59:31 +09:00
meng-ustc
1a990fdd25 Add Risk Prediction Demo 2021-02-23 19:08:11 +09:00
Charles Young
527718a440 Allow enhanced indexing to generate portfolio without industry related restriction. 2021-02-22 19:04:31 +08:00
Charles Young
d3caea60ee Add unittest for TestStructuredCovEstimator. 2021-02-22 17:32:03 +08:00
Charles Young
f947a2fdef Correct two mistakes in annotation. 2021-02-22 15:15:51 +08:00
Jactus
dc4aa67503 Black format 2021-02-22 11:42:36 +08:00
Charles Young
37871389b9 Format code with the latest version of black. 2021-02-22 11:25:42 +08:00
Charles Young
2f9d45e03a Reformat code with black. 2021-02-22 10:29:29 +08:00
Charles Young
b8647c13c7 Reformat code to follow PEP 8. 2021-02-22 10:20:51 +08:00
Charles Young
164687d54b Add scikit-learn to dependencies. 2021-02-22 10:13:08 +08:00
Charles Young
58f74cfd84 Reformat code to follow PEP 8. 2021-02-22 10:07:03 +08:00
Charles Young
f7d3e56561 Merge optimization related portfolio construction back to portfolio/optimizer. 2021-02-22 09:57:41 +08:00
Charles Young
42f882504e Reformat code to follow PEP 8. 2021-02-22 09:25:48 +08:00
Charles Young
9448a6e2c7 Add a abstract class as the base class for all optimization related portfolio constructions. 2021-02-22 09:23:48 +08:00
Charles Young
2cc057e438 Fix minor mismatches of type hints. 2021-02-22 09:09:03 +08:00
Charles Young
b2e2142594 Applied slight modification to follow PEP 8. 2021-02-22 09:00:12 +08:00
Charles Young
4000518698 Separate specific implementation of Portfolio Optimizer to folder. 2021-02-22 08:41:35 +08:00
you-n-g
fa8f1cba06 Update filter.py 2021-02-19 22:23:22 +08:00
you-n-g
a72911e4f8 Update filter.py 2021-02-19 22:23:22 +08:00
meng-ustc
cd5b721bc6 Update 2021-02-19 11:56:50 +09:00
meng-ustc
42590972e4 Modify run_all_model.py 2021-02-18 19:15:02 +09:00
meng-ustc
d27dc8bab8 Add A New Baseline: DoubleEnsemble 2021-02-18 19:02:33 +09:00
Young
50d5fcf61e yml afe load 2021-02-18 08:43:12 +08:00
Young
77830a546e safe yaml loader 2021-02-18 08:43:12 +08:00
Young
83237ba4ed yml afe load 2021-02-17 05:17:18 +00:00
Young
04b916c8ae safe yaml loader 2021-02-16 15:07:14 +00:00
Kenneth Tang
b90bd66ac6 Merge branch 'main' into Fix_collector_doc 2021-02-16 14:16:53 +08:00
Kenneth Tang
63d05e4a1a Fix typo 2021-02-16 14:08:58 +08:00
lbaiao
0b11dc5167 Update workflow.rst
Corrected an identation problem on the configuration.yaml file.
2021-02-11 10:54:32 +08:00
Charles Young
9c2653f125 Add an implementation of Enhanced Indexing to optimizer.py 2021-02-09 20:31:00 +08:00
Charles Young
7b01c5cae7 Add an implementation of Enhanced Indexing to optimizer.py 2021-02-09 20:30:26 +08:00
Charles Young
988b42e159 Add Structured Covariance Estimator to riskmodel.py 2021-02-09 20:28:42 +08:00
Miae Kim
12c8bfa545 Fix typo in Data Layer
Commit changes
2021-02-08 10:29:37 +08:00
Jactus
c948385e76 Add model saving for qrun and workflow example 2021-02-07 21:32:35 +08:00
bxdd
07b905c153 update 2021-02-05 16:09:06 +08:00
bxdd
0192f28bf4 add docstring & fix code 2021-02-05 16:09:06 +08:00
bxdd
cbf97f56a4 fix market 2021-02-05 16:09:06 +08:00
bxdd
d702c8bcb1 add Cut ops 2021-02-05 16:09:06 +08:00
Jactus
b84686b215 Update models to enable save/load 2021-02-05 13:14:12 +08:00
bxdd
6a670828a5 Update serial.rst 2021-02-05 12:33:47 +08:00
bxdd
ca6c2ffc27 Update serial.rst 2021-02-05 12:33:47 +08:00
bxdd
914637b3ef update index 2021-02-05 12:33:47 +08:00
bxdd
d8da94de10 update docs 2021-02-05 12:33:47 +08:00
bxdd
477a548fe9 update data.rst docs 2021-02-05 12:33:47 +08:00
bxdd
35af9ad954 update docs 2021-02-05 12:33:47 +08:00
bxdd
8a91e7d34d black format 2021-02-05 12:33:47 +08:00
bxdd
4ed8b8e233 add docs & fix reinit of datatset 2021-02-05 12:33:47 +08:00
Jactus
c71b645777 Update docs about record-temp 2021-02-05 12:32:47 +08:00
HUAN-PING SU
f2ffb80a0b Update workflow_by_code.py 2021-02-04 17:01:34 +08:00
HUAN-PING SU
cda1d4be40 Update workflow_by_code.py
Fix typo in workflow_by_code.py
2021-02-04 17:01:34 +08:00
zhupr
fc1431cd4e update 1min docs 2021-02-04 16:49:58 +08:00
Jactus
06158fb621 Update readme and setup.py 2021-02-04 16:09:36 +08:00
Jactus
1e2e02368c Update readme 2021-02-03 14:42:58 +08:00
Jactus
d87d29aca9 Update Windows CI 2021-02-03 14:42:58 +08:00
Jactus
005da6306c Update CI 2021-02-03 14:42:58 +08:00
bxdd
090b68e44e Update workflow.py 2021-02-03 13:12:19 +08:00
Young
bf748ba4b7 update version number to dev 2021-02-03 05:11:39 +00:00
Meng Dong
fd5c68a7d1 Update workflow_config_doubleensemble_Alpha158.yaml 2021-02-02 12:39:07 +08:00
meng-ustc
8c3ec164ff Add A New Baseline: DoubleEnsemble 2021-02-02 11:46:37 +09:00
meng-ustc
acdc469e39 Add A New Baseline: DoubleEnsemble 2021-02-01 21:05:34 +09:00
316 changed files with 29987 additions and 5239 deletions

12
.deepsource.toml Normal file
View File

@@ -0,0 +1,12 @@
version = 1
test_patterns = ["tests/test_*.py"]
exclude_patterns = ["examples/**"]
[[analyzers]]
name = "python"
enabled = true
[analyzers.meta]
runtime_version = "3.x.x"

62
.github/stale.yml vendored
View File

@@ -1,62 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- bug
- pinned
- security
- "[Status] Maybe Later"
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: wontfix
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
# closeComment: >
# Your comment here.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.
# issues:
# exemptLabels:
# - confirmed

View File

@@ -12,8 +12,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
os: [windows-latest, macos-latest, macos-11]
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
@@ -44,7 +45,8 @@ jobs:
- name: Build wheel on Linux
uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2010_x86_64
with:
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38'
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-versions: 'cp37-cp37m cp38-cp38'
build-requirements: 'numpy cython'
- name: Set up Python
uses: actions/setup-python@v2

24
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 0/3 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open for three months with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days'
stale-pr-message: 'This PR is stale because it has been open for a year with no activity. Remove the stale label or comment on the PR otherwise this will be closed in 5 days'
stale-issue-label: 'stale'
stale-pr-label: 'stale'
days-before-stale: 90
days-before-close: 5
operations-per-run: 100
exempt-issue-labels: 'bug,enhancement'
remove-stale-when-updated: true

View File

@@ -1,4 +1,4 @@
name: Test
name: Test
on:
push:
@@ -12,8 +12,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
os: [windows-latest, ubuntu-18.04, ubuntu-20.04]
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
@@ -25,94 +26,41 @@ jobs:
- name: Lint with Black
run: |
cd ..
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install black
$CONDA\\python.exe -m black qlib -l 120 --check --diff
else
sudo $CONDA/bin/python -m pip install black
$CONDA/bin/python -m black qlib -l 120 --check --diff
fi
shell: bash
pip install --upgrade pip
pip install black wheel
black qlib -l 120 --check --diff
# Test Qlib installed with pip
- name: Install Qlib with pip
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install pyqlib --ignore-installed ruamel.yaml --user
else
sudo $CONDA/bin/python -m pip install pyqlib --ignore-installed ruamel.yaml
fi
shell: bash
- name: Install Lightgbm for MacOS
if: runner.os == 'macOS'
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
pip install numpy==1.19.5 ruamel.yaml
pip install pyqlib --ignore-installed
- name: Test data downloads
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
else
$CONDA/bin/python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
fi
shell: bash
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
- name: Test workflow by config (install from pip)
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe qlib\\workflow\\cli.py examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158.yaml
$CONDA\\python.exe -m pip uninstall -y pyqlib
else
$CONDA/bin/python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
sudo $CONDA/bin/python -m pip uninstall -y pyqlib
fi
shell: bash
# Test Qlib installed from source
python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
python -m pip uninstall -y pyqlib
# Test Qlib installed from source
- name: Install Qlib from source
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install --upgrade cython
$CONDA\\python.exe -m pip install numpy jupyter jupyter_contrib_nbextensions
$CONDA\\python.exe -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
$CONDA\\python.exe setup.py install
else
sudo $CONDA/bin/python -m pip install --upgrade cython
sudo $CONDA/bin/python -m pip install numpy jupyter jupyter_contrib_nbextensions
sudo $CONDA/bin/python -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
sudo $CONDA/bin/python setup.py install
fi
shell: bash
pip install --upgrade cython jupyter jupyter_contrib_nbextensions numpy scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
pip install -e .
- name: Install test dependencies
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install --upgrade pip
$CONDA\\python.exe -m pip install black pytest
else
sudo $CONDA/bin/python -m pip install --upgrade pip
sudo $CONDA/bin/python -m pip install black pytest
fi
shell: bash
pip install --upgrade pip
pip install black pytest
- name: Unit tests with Pytest
run: |
cd tests
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pytest . --durations=0
else
$CONDA/bin/python -m pytest . --durations=0
fi
shell: bash
python -m pytest . --durations=10
- name: Test workflow by config (install from source)
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe qlib\\workflow\\cli.py examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158.yaml
else
$CONDA/bin/python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
fi
shell: bash
python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml

75
.github/workflows/test_macos.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
# There are some issues (in the downloading data phase) on MacOS when running with other tests. So we split it into an individual config.
name: Test MacOS
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-latest]
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Lint with Black
run: |
cd ..
python -m pip install pip --upgrade
python -m pip install wheel --upgrade
python -m pip install black
python -m black qlib -l 120 --check --diff
# Test Qlib installed with pip
- name: Install Qlib with pip
run: |
python -m pip install numpy==1.19.5
python -m pip install pyqlib --ignore-installed ruamel.yaml numpy
- name: Install Lightgbm for MacOS
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
# FIX MacOS error: Segmentation fault
# reference: https://github.com/microsoft/LightGBM/issues/4229
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb
brew unlink libomp
brew install libomp.rb
- name: Test data downloads
run: |
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
- name: Test workflow by config (install from pip)
run: |
python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
python -m pip uninstall -y pyqlib
# Test Qlib installed from source
- name: Install Qlib from source
run: |
python -m pip install --upgrade cython
python -m pip install numpy jupyter jupyter_contrib_nbextensions
python -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
python setup.py install
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U pyopenssl idna
python -m pip install black pytest
- name: Unit tests with Pytest
run: |
cd tests
python -m pytest . --durations=0
- name: Test workflow by config (install from source)
run: |
python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml

5
.gitignore vendored
View File

@@ -20,6 +20,7 @@ dist/
.nvimrc
.vscode
qlib/VERSION.txt
qlib/data/_libs/expanding.cpp
qlib/data/_libs/rolling.cpp
examples/estimator/estimator_example/
@@ -34,3 +35,7 @@ tags
.pytest_cache/
.vscode/
*.swp
./pretrain

View File

@@ -159,6 +159,21 @@ Version 0.5.0
- Add baselines
- public data crawler
Version greater than Version 0.5.0
Version 0.8.0
--------------------
- The backtest is greatly refactored.
- Nested decision execution framework is supported
- There are lots of changes for daily trading, it is hard to list all of them. But a few important changes could be noticed
- The trading limitation is more accurate;
- In `previous version <https://github.com/microsoft/qlib/blob/v0.7.2/qlib/contrib/backtest/exchange.py#L160>`_, longing and shorting actions share the same action.
- In `current verison <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/backtest/exchange.py#L304>`_, the trading limitation is different between loging and shorting action.
- The constant is different when calculating annualized metrics.
- `Current version <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/contrib/evaluate.py#L42>`_ uses more accurate constant than `previous version <https://github.com/microsoft/qlib/blob/v0.7.2/qlib/contrib/evaluate.py#L22>`_
- `A new version <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/tests/data.py#L17>`_ of data is released. Due to the unstability of Yahoo data source, the data may be different after downloading data again.
- Users could chec kout the backtesting results between `Current version <https://github.com/microsoft/qlib/tree/7c31012b507a3823117bddcc693fc64899460b2a/examples/benchmarks>`_ and `previous version <https://github.com/microsoft/qlib/tree/v0.7.2/examples/benchmarks>`_
Other Versions
----------------------------------
Please refer to `Github release Notes <https://github.com/microsoft/qlib/releases>`_

1
MANIFEST.in Normal file
View File

@@ -0,0 +1 @@
include qlib/VERSION.txt

151
README.md
View File

@@ -7,9 +7,25 @@
[![License](https://img.shields.io/pypi/l/pyqlib)](LICENSE)
[![Join the chat at https://gitter.im/Microsoft/qlib](https://badges.gitter.im/Microsoft/qlib.svg)](https://gitter.im/Microsoft/qlib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## :newspaper: **What's NEW!** &nbsp; :sparkling_heart:
Recent released features
| Feature | Status |
| -- | ------ |
|Temporal Routing Adaptor (TRA) | [Released](https://github.com/microsoft/qlib/pull/531) on July 30, 2021 |
| Transformer & Localformer | [Released](https://github.com/microsoft/qlib/pull/508) on July 22, 2021 |
| Release Qlib v0.7.0 | [Released](https://github.com/microsoft/qlib/releases/tag/v0.7.0) on July 12, 2021 |
| TCTS Model | [Released](https://github.com/microsoft/qlib/pull/491) on July 1, 2021 |
| Online serving and automatic model rolling | :star: [Released](https://github.com/microsoft/qlib/pull/290) on May 17, 2021 |
| DoubleEnsemble Model | [Released](https://github.com/microsoft/qlib/pull/286) on Mar 2, 2021 |
| High-frequency data processing example | [Released](https://github.com/microsoft/qlib/pull/257) on Feb 5, 2021 |
| High-frequency trading example | [Part of code released](https://github.com/microsoft/qlib/pull/227) on Jan 28, 2021 |
| High-frequency data(1min) | [Released](https://github.com/microsoft/qlib/pull/221) on Jan 27, 2021 |
| Tabnet Model | [Released](https://github.com/microsoft/qlib/pull/205) on Jan 22, 2021 |
Features released before 2021 are not listed here.
<p align="center">
<img src="http://fintech.msra.cn/images_v060/logo/1.png" />
<img src="http://fintech.msra.cn/images_v070/logo/1.png" />
</p>
@@ -17,17 +33,18 @@ Qlib is an AI-oriented quantitative investment platform, which aims to realize t
It contains the full ML pipeline of data processing, model training, back-testing; and covers the entire chain of quantitative investment: alpha seeking, risk modeling, portfolio optimization, and order execution.
With Qlib, user can easily try ideas to create better Quant investment strategies.
With Qlib, users can easily try ideas to create better Quant investment strategies.
For more details, please refer to our paper ["Qlib: An AI-oriented Quantitative Investment Platform"](https://arxiv.org/abs/2009.11189).
- [**Plans**](#plans)
- [Framework of Qlib](#framework-of-qlib)
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Data Preparation](#data-preparation)
- [Auto Quant Research Workflow](#auto-quant-research-workflow)
- [Building Customized Quant Research Workflow by Code](#building-customized-quant-research-workflow-by-code)
- [**Quant Model Zoo**](#quant-model-zoo)
- [**Quant Model(Paper) Zoo**](#quant-model-paper-zoo)
- [Run a single model](#run-a-single-model)
- [Run multiple models](#run-multiple-models)
- [**Quant Dataset Zoo**](#quant-dataset-zoo)
@@ -35,22 +52,33 @@ For more details, please refer to our paper ["Qlib: An AI-oriented Quantitative
- [Offline Mode and Online Mode](#offline-mode-and-online-mode)
- [Performance of Qlib Data Server](#performance-of-qlib-data-server)
- [Related Reports](#related-reports)
- [Contact Us](#contact-us)
- [Contributing](#contributing)
# Plans
New features under development(order by estimated release time).
Your feedbacks about the features are very important.
| Feature | Status |
| -- | ------ |
| Planning-based portfolio optimization | Under review: https://github.com/microsoft/qlib/pull/280 |
| Fund data supporting and analysis | Under review: https://github.com/microsoft/qlib/pull/292 |
| Point-in-Time database | Under review: https://github.com/microsoft/qlib/pull/343 |
| High-frequency trading | Under review: https://github.com/microsoft/qlib/pull/408 |
| Meta-Learning-based data selection | Initial opensource version under development |
# Framework of Qlib
<div style="align: center">
<img src="http://fintech.msra.cn/images_v060/framework.png?v=0.1" />
<img src="docs/_static/img/framework.svg" />
</div>
At the module level, Qlib is a platform that consists of the above components. The components are designed as loose-coupled modules and each component could be used stand-alone.
At the module level, Qlib is a platform that consists of the above components. The components are designed as loose-coupled modules, and each component could be used stand-alone.
| Name | Description |
| ------ | ----- |
| `Infrastructure` layer | `Infrastructure` layer provides underlying support for Quant research. `DataServer` provides high-performance infrastructure for users to manage and retrieve raw data. `Trainer` provides flexible interface to control the training process of models which enable algorithms controlling the training process. |
| `Infrastructure` layer | `Infrastructure` layer provides underlying support for Quant research. `DataServer` provides a high-performance infrastructure for users to manage and retrieve raw data. `Trainer` provides a flexible interface to control the training process of models, which enable algorithms to control the training process. |
| `Workflow` layer | `Workflow` layer covers the whole workflow of quantitative investment. `Information Extractor` extracts data for models. `Forecast Model` focuses on producing all kinds of forecast signals (e.g. _alpha_, risk) for other modules. With these signals `Portfolio Generator` will generate the target portfolio and produce orders to be executed by `Order Executor`. |
| `Interface` layer | `Interface` layer tries to present a user-friendly interface for the underlying system. `Analyser` module will provide users detailed analysis reports of forecasting signals, portfolios and execution results |
@@ -72,14 +100,14 @@ Here is a quick **[demo](https://terminalizer.com/view/3f24561a4470)** shows how
This table demonstrates the supported Python version of `Qlib`:
| | install with pip | install from source | plot |
| ------------- |:---------------------:|:--------------------:|:----:|
| Python 3.6 | :heavy_check_mark: | :heavy_check_mark: (only with `Anaconda`) | :heavy_check_mark: |
| Python 3.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.8 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.9 | :x: | :heavy_check_mark: | :x: |
**Note**:
1. **Conda** is suggested for managing your Python environment.
1. Please pay attention that installing cython in Python 3.6 will raise some error when installing ``Qlib`` from source. If users use Python 3.6 on their machines, it is recommended to *upgrade* Python to version 3.7 or use `conda`'s Python to install ``Qlib`` from source.
2. For Python 3.9, `Qlib` supports running workflows such as training models, doing backtest and plot most of the related figures (those included in [notebook](examples/workflow_by_code.ipynb)). However, plotting for the *model performance* is not supported for now and we will fix this when the dependent packages are upgraded in the future.
1. For Python 3.9, `Qlib` supports running workflows such as training models, doing backtest and plot most of the related figures (those included in [notebook](examples/workflow_by_code.ipynb)). However, plotting for the *model performance* is not supported for now and we will fix this when the dependent packages are upgraded in the future.
### Install with pip
Users can easily install ``Qlib`` by pip according to the following command.
@@ -118,14 +146,42 @@ Also, users can install the latest dev version ``Qlib`` by the source code accor
## Data Preparation
Load and prepare data by running the following code:
```bash
# get 1d data
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
# get 1min data
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min
```
This dataset is created by public data collected by [crawler scripts](scripts/data_collector/), which have been released in
the same repository.
Users could create the same dataset with it.
*Please pay **ATTENTION** that the data is collected from [Yahoo Finance](https://finance.yahoo.com/lookup) and the data might not be perfect. We recommend users to prepare their own data if they have high-quality dataset. For more information, users can refer to the [related document](https://qlib.readthedocs.io/en/latest/component/data.html#converting-csv-format-into-qlib-format)*.
*Please pay **ATTENTION** that the data is collected from [Yahoo Finance](https://finance.yahoo.com/lookup), and the data might not be perfect.
We recommend users to prepare their own data if they have a high-quality dataset. For more information, users can refer to the [related document](https://qlib.readthedocs.io/en/latest/component/data.html#converting-csv-format-into-qlib-format)*.
### Automatic update of daily frequency data (from yahoo finance)
> It is recommended that users update the data manually once (--trading_date 2021-05-25) and then set it to update automatically.
> For more information refer to: [yahoo collector](https://github.com/microsoft/qlib/tree/main/scripts/data_collector/yahoo#automatic-update-of-daily-frequency-datafrom-yahoo-finance)
* Automatic update of data to the "qlib" directory each trading day(Linux)
* use *crontab*: `crontab -e`
* set up timed tasks:
```
* * * * 1-5 python <script path> update_data_to_bin --qlib_data_1d_dir <user data dir>
```
* **script path**: *scripts/data_collector/yahoo/collector.py*
* Manual update of data
```
python scripts/data_collector/yahoo/collector.py update_data_to_bin --qlib_data_1d_dir <user data dir> --trading_date <start date> --end_date <end date>
```
* *trading_date*: start of trading day
* *end_date*: end of trading day(not included)
<!--
- Run the initialization code and get stock data:
@@ -190,19 +246,19 @@ Qlib provides a tool named `qrun` to run the whole workflow automatically (inclu
2. Graphical Reports Analysis: Run `examples/workflow_by_code.ipynb` with `jupyter notebook` to get graphical reports
- Forecasting signal (model prediction) analysis
- Cumulative Return of groups
![Cumulative Return](http://fintech.msra.cn/images_v060/analysis/analysis_model_cumulative_return.png?v=0.1)
![Cumulative Return](http://fintech.msra.cn/images_v070/analysis/analysis_model_cumulative_return.png?v=0.1)
- Return distribution
![long_short](http://fintech.msra.cn/images_v060/analysis/analysis_model_long_short.png?v=0.1)
![long_short](http://fintech.msra.cn/images_v070/analysis/analysis_model_long_short.png?v=0.1)
- Information Coefficient (IC)
![Information Coefficient](http://fintech.msra.cn/images_v060/analysis/analysis_model_IC.png?v=0.1)
![Monthly IC](http://fintech.msra.cn/images_v060/analysis/analysis_model_monthly_IC.png?v=0.1)
![IC](http://fintech.msra.cn/images_v060/analysis/analysis_model_NDQ.png?v=0.1)
![Information Coefficient](http://fintech.msra.cn/images_v070/analysis/analysis_model_IC.png?v=0.1)
![Monthly IC](http://fintech.msra.cn/images_v070/analysis/analysis_model_monthly_IC.png?v=0.1)
![IC](http://fintech.msra.cn/images_v070/analysis/analysis_model_NDQ.png?v=0.1)
- Auto Correlation of forecasting signal (model prediction)
![Auto Correlation](http://fintech.msra.cn/images_v060/analysis/analysis_model_auto_correlation.png?v=0.1)
![Auto Correlation](http://fintech.msra.cn/images_v070/analysis/analysis_model_auto_correlation.png?v=0.1)
- Portfolio analysis
- Backtest return
![Report](http://fintech.msra.cn/images_v060/analysis/report.png?v=0.1)
![Report](http://fintech.msra.cn/images_v070/analysis/report.png?v=0.1)
<!--
- Score IC
![Score IC](docs/_static/img/score_ic.png)
@@ -213,25 +269,31 @@ Qlib provides a tool named `qrun` to run the whole workflow automatically (inclu
- Rank Label
![Rank Label](docs/_static/img/rank_label.png)
-->
- [Explanation](https://qlib.readthedocs.io/en/latest/component/report.html) of above results
## Building Customized Quant Research Workflow by Code
The automatic workflow may not suite the research workflow of all Quant researchers. To support a flexible Quant research workflow, Qlib also provides a modularized interface to allow researchers to build their own workflow by code. [Here](examples/workflow_by_code.ipynb) is a demo for customized Quant research workflow by code.
The automatic workflow may not suit the research workflow of all Quant researchers. To support a flexible Quant research workflow, Qlib also provides a modularized interface to allow researchers to build their own workflow by code. [Here](examples/workflow_by_code.ipynb) is a demo for customized Quant research workflow by code.
# [Quant Model Zoo](examples/benchmarks)
# [Quant Model (Paper) Zoo](examples/benchmarks)
Here is a list of models built on `Qlib`.
- [GBDT based on XGBoost (Tianqi Chen, et al. 2016)](qlib/contrib/model/xgboost.py)
- [GBDT based on LightGBM (Guolin Ke, et al. 2017)](qlib/contrib/model/gbdt.py)
- [GBDT based on Catboost (Liudmila Prokhorenkova, et al. 2017)](qlib/contrib/model/catboost_model.py)
- [GBDT based on XGBoost (Tianqi Chen, et al. KDD 2016)](qlib/contrib/model/xgboost.py)
- [GBDT based on LightGBM (Guolin Ke, et al. NIPS 2017)](qlib/contrib/model/gbdt.py)
- [GBDT based on Catboost (Liudmila Prokhorenkova, et al. NIPS 2018)](qlib/contrib/model/catboost_model.py)
- [MLP based on pytorch](qlib/contrib/model/pytorch_nn.py)
- [LSTM based on pytorch (Sepp Hochreiter, et al. 1997)](qlib/contrib/model/pytorch_lstm.py)
- [LSTM based on pytorch (Sepp Hochreiter, et al. Neural omputation 1997)](qlib/contrib/model/pytorch_lstm.py)
- [GRU based on pytorch (Kyunghyun Cho, et al. 2014)](qlib/contrib/model/pytorch_gru.py)
- [ALSTM based on pytorch (Yao Qin, et al. 2017)](qlib/contrib/model/pytorch_alstm.py)
- [ALSTM based on pytorch (Yao Qin, et al. IJCAI 2017)](qlib/contrib/model/pytorch_alstm.py)
- [GATs based on pytorch (Petar Velickovic, et al. 2017)](qlib/contrib/model/pytorch_gats.py)
- [SFM based on pytorch (Liheng Zhang, et al. 2017)](qlib/contrib/model/pytorch_sfm.py)
- [TFT based on tensorflow (Bryan Lim, et al. 2019)](examples/benchmarks/TFT/tft.py)
- [TabNet based on pytorch (Sercan O. Arik, et al. 2019)](qlib/contrib/model/pytorch_tabnet.py)
- [SFM based on pytorch (Liheng Zhang, et al. KDD 2017)](qlib/contrib/model/pytorch_sfm.py)
- [TFT based on tensorflow (Bryan Lim, et al. International Journal of Forecasting 2019)](examples/benchmarks/TFT/tft.py)
- [TabNet based on pytorch (Sercan O. Arik, et al. AAAI 2019)](qlib/contrib/model/pytorch_tabnet.py)
- [DoubleEnsemble based on LightGBM (Chuheng Zhang, et al. ICDM 2020)](qlib/contrib/model/double_ensemble.py)
- [TCTS based on pytorch (Xueqing Wu, et al. ICML 2021)](qlib/contrib/model/pytorch_tcts.py)
- [Transformer based on pytorch (Ashish Vaswani, et al. NeurIPS 2017)](qlib/contrib/model/pytorch_transformer.py)
- [Localformer based on pytorch (Juyong Jiang, et al.)](qlib/contrib/model/pytorch_localformer.py)
- [TRA based on pytorch (Hengxu, Dong, et al. KDD 2021)](qlib/contrib/model/pytorch_tra.py)
Your PR of new Quant models is highly welcomed.
@@ -241,19 +303,20 @@ The performance of each model on the `Alpha158` and `Alpha360` dataset can be fo
All the models listed above are runnable with ``Qlib``. Users can find the config files we provide and some details about the model through the [benchmarks](examples/benchmarks) folder. More information can be retrieved at the model files listed above.
`Qlib` provides three different ways to run a single model, users can pick the one that fits their cases best:
- User can use the tool `qrun` mentioned above to run a model's workflow based from a config file.
- User can create a `workflow_by_code` python script based on the [one](examples/workflow_by_code.py) listed in the `examples` folder.
- Users can use the tool `qrun` mentioned above to run a model's workflow based from a config file.
- Users can create a `workflow_by_code` python script based on the [one](examples/workflow_by_code.py) listed in the `examples` folder.
- User can use the script [`run_all_model.py`](examples/run_all_model.py) listed in the `examples` folder to run a model. Here is an example of the specific shell command to be used: `python run_all_model.py --models=lightgbm`, where the `--models` arguments can take any number of models listed above(the available models can be found in [benchmarks](examples/benchmarks/)). For more use cases, please refer to the file's [docstrings](examples/run_all_model.py).
- Users can use the script [`run_all_model.py`](examples/run_all_model.py) listed in the `examples` folder to run a model. Here is an example of the specific shell command to be used: `python run_all_model.py run --models=lightgbm`, where the `--models` arguments can take any number of models listed above(the available models can be found in [benchmarks](examples/benchmarks/)). For more use cases, please refer to the file's [docstrings](examples/run_all_model.py).
- **NOTE**: Each baseline has different environment dependencies, please make sure that your python version aligns with the requirements(e.g. TFT only supports Python 3.6~3.7 due to the limitation of `tensorflow==1.15.0`)
## Run multiple models
`Qlib` also provides a script [`run_all_model.py`](examples/run_all_model.py) which can run multiple models for several iterations. (**Note**: the script only support *Linux* for now. Other OS will be supported in the future. Besides, it doesn't support parrallel running the same model for multiple times as well, and this will be fixed in the future development too.)
`Qlib` also provides a script [`run_all_model.py`](examples/run_all_model.py) which can run multiple models for several iterations. (**Note**: the script only support *Linux* for now. Other OS will be supported in the future. Besides, it doesn't support parallel running the same model for multiple times as well, and this will be fixed in the future development too.)
The script will create a unique virtual environment for each model, and delete the environments after training. Thus, only experiment results such as `IC` and `backtest` results will be generated and stored.
Here is an example of running all the models for 10 iterations:
```python
python run_all_model.py 10
python run_all_model.py run 10
```
It also provides the API to run specific models at once. For more use cases, please refer to the file's [docstrings](examples/run_all_model.py).
@@ -307,21 +370,39 @@ which creates a dataset (14 features/factors) from the basic OHLCV daily data of
* `+(-)E` indicates with (out) `ExpressionCache`
* `+(-)D` indicates with (out) `DatasetCache`
Most general-purpose databases take too much time on loading data. After looking into the underlying implementation, we find that data go through too many layers of interfaces and unnecessary format transformations in general-purpose database solutions.
Most general-purpose databases take too much time to load data. After looking into the underlying implementation, we find that data go through too many layers of interfaces and unnecessary format transformations in general-purpose database solutions.
Such overheads greatly slow down the data loading process.
Qlib data are stored in a compact format, which is efficient to be combined into arrays for scientific computation.
# Related Reports
- [Guide To Qlib: Microsofts AI Investment Platform](https://analyticsindiamag.com/qlib/)
- [【华泰金工林晓明团队】微软AI量化投资平台Qlib体验——华泰人工智能系列之四十](https://mp.weixin.qq.com/s/Brcd7im4NibJOJzZfMn6tQ)
- [微软也搞AI量化平台还是开源的](https://mp.weixin.qq.com/s/47bP5YwxfTp2uTHjUBzJQQ)
- [微矿Qlib业内首个AI量化投资开源平台](https://mp.weixin.qq.com/s/vsJv7lsgjEi-ALYUz4CvtQ)
# Contact Us
- If you have any issues, please create issue [here](https://github.com/microsoft/qlib/issues/new/choose) or send messages in [gitter](https://gitter.im/Microsoft/qlib).
- If you want to make contributions to `Qlib`, please [create pull requests](https://github.com/microsoft/qlib/compare).
- For other reasons, you are welcome to contact us by email([qlib@microsoft.com](mailto:qlib@microsoft.com)).
- We are recruiting new members(both FTEs and interns), your resumes are welcome!
Join IM discussion groups:
|[Gitter](https://gitter.im/Microsoft/qlib)|
|----|
|![image](http://fintech.msra.cn/images_v070/qrcode/gitter_qr.png)|
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
This project welcomes contributions and suggestions.
**Here are some
[code standards](docs/developer/code_standard.rst) when you submit a pull request.**
If you want to contribute to Qlib's document, you can follow the steps in the figure below.
<p align="center">
<img src="https://github.com/demon143/qlib/blob/main/docs/_static/img/change%20doc.gif" />
</p>
Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the right to use your contribution. For details, visit https://cla.opensource.microsoft.com.

1
VERSION.txt Normal file
View File

@@ -0,0 +1 @@
0.7.2.99

View File

@@ -70,3 +70,84 @@ If the issue is not resolved, use ``keys *`` to find if multiple keys exist. If
Also, feel free to post a new issue in our GitHub repository. We always check each issue carefully and try our best to solve them.
3. ModuleNotFoundError: No module named 'qlib.data._libs.rolling'
------------------------------------------------------------------------------------------------------------------------------------
.. code-block:: python
#### Do not import qlib package in the repository directory in case of importing qlib from . without compiling #####
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "qlib/qlib/__init__.py", line 19, in init
from .data.cache import H
File "qlib/qlib/data/__init__.py", line 8, in <module>
from .data import (
File "qlib/qlib/data/data.py", line 20, in <module>
from .cache import H
File "qlib/qlib/data/cache.py", line 36, in <module>
from .ops import Operators
File "qlib/qlib/data/ops.py", line 19, in <module>
from ._libs.rolling import rolling_slope, rolling_rsquare, rolling_resi
ModuleNotFoundError: No module named 'qlib.data._libs.rolling'
- If the error occurs when importing ``qlib`` package with ``PyCharm`` IDE, users can execute the following command in the project root folder to compile Cython files and generate executable files:
.. code-block:: bash
python setup.py build_ext --inplace
- If the error occurs when importing ``qlib`` package with command ``python`` , users need to change the running directory to ensure that the script does not run in the project directory.
4. BadNamespaceError: / is not a connected namespace
------------------------------------------------------------------------------------------------------------------------------------
.. code-block:: python
File "qlib_online.py", line 35, in <module>
cal = D.calendar()
File "e:\code\python\microsoft\qlib_latest\qlib\qlib\data\data.py", line 973, in calendar
return Cal.calendar(start_time, end_time, freq, future=future)
File "e:\code\python\microsoft\qlib_latest\qlib\qlib\data\data.py", line 798, in calendar
self.conn.send_request(
File "e:\code\python\microsoft\qlib_latest\qlib\qlib\data\client.py", line 101, in send_request
self.sio.emit(request_type + "_request", request_content)
File "G:\apps\miniconda\envs\qlib\lib\site-packages\python_socketio-5.3.0-py3.8.egg\socketio\client.py", line 369, in emit
raise exceptions.BadNamespaceError(
BadNamespaceError: / is not a connected namespace.
- The version of ``python-socketio`` in qlib needs to be the same as the version of ``python-socketio`` in qlib-server:
.. code-block:: bash
pip install -U python-socketio==<qlib-server python-socketio version>
5. TypeError: send() got an unexpected keyword argument 'binary'
------------------------------------------------------------------------------------------------------------------------------------
.. code-block:: python
File "qlib_online.py", line 35, in <module>
cal = D.calendar()
File "e:\code\python\microsoft\qlib_latest\qlib\qlib\data\data.py", line 973, in calendar
return Cal.calendar(start_time, end_time, freq, future=future)
File "e:\code\python\microsoft\qlib_latest\qlib\qlib\data\data.py", line 798, in calendar
self.conn.send_request(
File "e:\code\python\microsoft\qlib_latest\qlib\qlib\data\client.py", line 101, in send_request
self.sio.emit(request_type + "_request", request_content)
File "G:\apps\miniconda\envs\qlib\lib\site-packages\socketio\client.py", line 263, in emit
self._send_packet(packet.Packet(packet.EVENT, namespace=namespace,
File "G:\apps\miniconda\envs\qlib\lib\site-packages\socketio\client.py", line 339, in _send_packet
self.eio.send(ep, binary=binary)
TypeError: send() got an unexpected keyword argument 'binary'
- The ``python-engineio`` version needs to be compatible with the ``python-socketio`` version, reference: https://github.com/miguelgrinberg/python-socketio#version-compatibility
.. code-block:: bash
pip install -U python-engineio==<compatible python-socketio version>
# or
pip install -U python-socketio==3.1.2 python-engineio==3.13.2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 93 KiB

BIN
docs/_static/img/change doc.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 208 KiB

4
docs/_static/img/framework.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 98 KiB

BIN
docs/_static/img/online_serving.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

BIN
docs/_static/img/qrcode/gitter_qr.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

45
docs/advanced/serial.rst Normal file
View File

@@ -0,0 +1,45 @@
.. _serial:
=================================
Serialization
=================================
.. currentmodule:: qlib
Introduction
===================
``Qlib`` supports dumping the state of ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc. into a disk and reloading them.
Serializable Class
========================
``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped into or loaded from disk in `pickle` format.
When users dump the state of a ``Serializable`` instance, the attributes of the instance whose name **does not** start with `_` will be saved on the disk.
However, users can use ``config`` method or override ``default_dump_all`` attribute to prevent this feature.
Users can also override ``pickle_backend`` attribute to choose a pickle backend. The supported value is "pickle" (default and common) and "dill" (dump more things such as function, more information in `here <https://pypi.org/project/dill/>`_).
Example
==========================
``Qlib``'s serializable class includes ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc., which are subclass of ``qlib.utils.serial.Serializable``.
Specifically, ``qlib.data.dataset.DatasetH`` is one of them. Users can serialize ``DatasetH`` as follows.
.. code-block:: Python
##=============dump dataset=============
dataset.to_pickle(path="dataset.pkl") # dataset is an instance of qlib.data.dataset.DatasetH
##=============reload dataset=============
with open("dataset.pkl", "rb") as file_dataset:
dataset = pickle.load(file_dataset)
.. note::
Only state of ``DatasetH`` should be saved on the disk, such as some `mean` and `variance` used for data normalization, etc.
After reloading the ``DatasetH``, users need to reinitialize it. It means that users can reset some states of ``DatasetH`` or ``QlibDataHandler`` such as `instruments`, `start_time`, `end_time` and `segments`, etc., and generate new data according to the states (data is not state and should not be saved on the disk).
A more detailed example is in this `link <https://github.com/microsoft/qlib/tree/main/examples/highfreq>`_.
API
===================
Please refer to `Serializable API <../reference/api.html#module-qlib.utils.serial.Serializable>`_.

View File

@@ -0,0 +1,89 @@
.. _task_management:
=================================
Task Management
=================================
.. currentmodule:: qlib
Introduction
=============
The `Workflow <../component/introduction.html>`_ part introduces how to run research workflow in a loosely-coupled way. But it can only execute one ``task`` when you use ``qrun``.
To automatically generate and execute different tasks, ``Task Management`` provides a whole process including `Task Generating`_, `Task Storing`_, `Task Training`_ and `Task Collecting`_.
With this module, users can run their ``task`` automatically at different periods, in different losses, or even by different models.
This whole process can be used in `Online Serving <../component/online.html>`_.
An example of the entire process is shown `here <https://github.com/microsoft/qlib/tree/main/examples/model_rolling/task_manager_rolling.py>`_.
Task Generating
===============
A ``task`` consists of `Model`, `Dataset`, `Record`, or anything added by users.
The specific task template can be viewed in
`Task Section <../component/workflow.html#task-section>`_.
Even though the task template is fixed, users can customize their ``TaskGen`` to generate different ``task`` by task template.
Here is the base class of ``TaskGen``:
.. autoclass:: qlib.workflow.task.gen.TaskGen
:members:
``Qlib`` provides a class `RollingGen <https://github.com/microsoft/qlib/tree/main/qlib/workflow/task/gen.py>`_ to generate a list of ``task`` of the dataset in different date segments.
This class allows users to verify the effect of data from different periods on the model in one experiment. More information is `here <../reference/api.html#TaskGen>`_.
Task Storing
===============
To achieve higher efficiency and the possibility of cluster operation, ``Task Manager`` will store all tasks in `MongoDB <https://www.mongodb.com/>`_.
``TaskManager`` can fetch undone tasks automatically and manage the lifecycle of a set of tasks with error handling.
Users **MUST** finish the configuration of `MongoDB <https://www.mongodb.com/>`_ when using this module.
Users need to provide the MongoDB URL and database name for using ``TaskManager`` in `initialization <../start/initialization.html#Parameters>`_ or make a statement like this.
.. code-block:: python
from qlib.config import C
C["mongo"] = {
"task_url" : "mongodb://localhost:27017/", # your MongoDB url
"task_db_name" : "rolling_db" # database name
}
.. autoclass:: qlib.workflow.task.manage.TaskManager
:members:
More information of ``Task Manager`` can be found in `here <../reference/api.html#TaskManager>`_.
Task Training
===============
After generating and storing those ``task``, it's time to run the ``task`` which is in the *WAITING* status.
``Qlib`` provides a method called ``run_task`` to run those ``task`` in task pool, however, users can also customize how tasks are executed.
An easy way to get the ``task_func`` is using ``qlib.model.trainer.task_train`` directly.
It will run the whole workflow defined by ``task``, which includes *Model*, *Dataset*, *Record*.
.. autofunction:: qlib.workflow.task.manage.run_task
Meanwhile, ``Qlib`` provides a module called ``Trainer``.
.. autoclass:: qlib.model.trainer.Trainer
:members:
``Trainer`` will train a list of tasks and return a list of model recorders.
``Qlib`` offer two kinds of Trainer, TrainerR is the simplest way and TrainerRM is based on TaskManager to help manager tasks lifecycle automatically.
If you do not want to use ``Task Manager`` to manage tasks, then use TrainerR to train a list of tasks generated by ``TaskGen`` is enough.
`Here <../reference/api.html#Trainer>`_ are the details about different ``Trainer``.
Task Collecting
===============
To collect the results of ``task`` after training, ``Qlib`` provides `Collector <../reference/api.html#Collector>`_, `Group <../reference/api.html#Group>`_ and `Ensemble <../reference/api.html#Ensemble>`_ to collect the results in a readable, expandable and loosely-coupled way.
`Collector <../reference/api.html#Collector>`_ can collect objects from everywhere and process them such as merging, grouping, averaging and so on. It has 2 step action including ``collect`` (collect anything in a dict) and ``process_collect`` (process collected dict).
`Group <../reference/api.html#Group>`_ also has 2 steps including ``group`` (can group a set of object based on `group_func` and change them to a dict) and ``reduce`` (can make a dict become an ensemble based on some rule).
For example: {(A,B,C1): object, (A,B,C2): object} ---``group``---> {(A,B): {C1: object, C2: object}} ---``reduce``---> {(A,B): object}
`Ensemble <../reference/api.html#Ensemble>`_ can merge the objects in an ensemble.
For example: {C1: object, C2: object} ---``Ensemble``---> object
So the hierarchy is ``Collector``'s second step corresponds to ``Group``. And ``Group``'s second step correspond to ``Ensemble``.
For more information, please see `Collector <../reference/api.html#Collector>`_, `Group <../reference/api.html#Group>`_ and `Ensemble <../reference/api.html#Ensemble>`_, or the `example <https://github.com/microsoft/qlib/tree/main/examples/model_rolling/task_manager_rolling.py>`_.

View File

@@ -30,7 +30,7 @@ The simple example of the default strategy is as follows.
from qlib.contrib.evaluate import backtest
# pred_score is the prediction score
report, positions = backtest(pred_score, topk=50, n_drop=0.5, verbose=False, limit_threshold=0.0095)
report, positions = backtest(pred_score, topk=50, n_drop=0.5, limit_threshold=0.0095)
To know more about backtesting with a specific ``Strategy``, please refer to `Portfolio Strategy <strategy.html>`_.

View File

@@ -31,7 +31,7 @@ Qlib Format Data
We've specially designed a data structure to manage financial data, please refer to the `File storage design section in Qlib paper <https://arxiv.org/abs/2009.11189>`_ for detailed information.
Such data will be stored with filename suffix `.bin` (We'll call them `.bin` file, `.bin` format, or qlib format). `.bin` file is designed for scientific computing on finance data.
``Qlib`` provides two different off-the-shelf dataset, which can be accessed through this `link <https://github.com/microsoft/qlib/blob/main/qlib/contrib/data/handler.py>`_:
``Qlib`` provides two different off-the-shelf datasets, which can be accessed through this `link <https://github.com/microsoft/qlib/blob/main/qlib/contrib/data/handler.py>`_:
======================== ================= ================
Dataset US Market China Market
@@ -41,6 +41,7 @@ Alpha360 √ √
Alpha158 √ √
======================== ================= ================
Also, ``Qlib`` provides a high-frequency dataset. Users can run a high-frequency dataset example through this `link <https://github.com/microsoft/qlib/tree/main/examples/highfreq>`_.
Qlib Format Dataset
--------------------
@@ -48,31 +49,70 @@ Qlib Format Dataset
.. code-block:: bash
# download 1d
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
# download 1min
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/qlib_cn_1min --region cn --interval 1min
In addition to China-Stock data, ``Qlib`` also includes a US-Stock dataset, which can be downloaded with the following command:
.. code-block:: bash
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/us_data --region us
After running the above command, users can find china-stock and us-stock data in ``Qlib`` format in the ``~/.qlib/csv_data/cn_data`` directory and ``~/.qlib/csv_data/us_data`` directory respectively.
After running the above command, users can find china-stock and us-stock data in ``Qlib`` format in the ``~/.qlib/qlib_data/cn_data`` directory and ``~/.qlib/qlib_data/us_data`` directory respectively.
``Qlib`` also provides the scripts in ``scripts/data_collector`` to help users crawl the latest data on the Internet and convert it to qlib format.
When ``Qlib`` is initialized with this dataset, users could build and evaluate their own models with it. Please refer to `Initialization <../start/initialization.html>`_ for more details.
Automatic update of daily frequency data
----------------------------------------
**It is recommended that users update the data manually once (\-\-trading_date 2021-05-25) and then set it to update automatically.**
For more information refer to: `yahoo collector <https://github.com/microsoft/qlib/tree/main/scripts/data_collector/yahoo#Automatic-update-of-daily-frequency-data>`_
- Automatic update of data to the "qlib" directory each trading day(Linux)
- use *crontab*: `crontab -e`
- set up timed tasks:
.. code-block:: bash
* * * * 1-5 python <script path> update_data_to_bin --qlib_data_1d_dir <user data dir>
- **script path**: *scripts/data_collector/yahoo/collector.py*
- Manual update of data
.. code-block:: bash
python scripts/data_collector/yahoo/collector.py update_data_to_bin --qlib_data_1d_dir <user data dir> --trading_date <start date> --end_date <end date>
- *trading_date*: start of trading day
- *end_date*: end of trading day(not included)
Converting CSV Format into Qlib Format
-------------------------------------------
``Qlib`` has provided the script ``scripts/dump_bin.py`` to convert **any** data in CSV format into `.bin` files (``Qlib`` format) as long as they are in the correct format.
Users can download the demo china-stock data in CSV format as follows for reference to the CSV format.
Besides downloading the prepared demo data, users could download demo data directly from the Collector as follows for reference to the CSV format.
Here are some example:
.. code-block:: bash
for daily data:
.. code-block:: bash
python scripts/get_data.py csv_data_cn --target_dir ~/.qlib/csv_data/cn_data
for 1min data:
.. code-block:: bash
python scripts/data_collector/yahoo/collector.py download_data --source_dir ~/.qlib/stock_data/source/cn_1min --region CN --start 2021-05-20 --end 2021-05-23 --delay 0.1 --interval 1min --limit_nums 10
Users can also provide their own data in CSV format. However, the CSV data **must satisfies** following criterions:
- CSV file is named after a specific stock *or* the CSV file includes a column of the stock name
@@ -139,6 +179,17 @@ After conversion, users can find their Qlib format data in the directory `~/.qli
The Restoration factor. Normally, ``factor = adjusted_price / original_price``, `adjusted price` reference: `split adjusted <https://www.investopedia.com/terms/s/splitadjusted.asp>`_
In the convention of `Qlib` data processing, `open, close, high, low, volume, money and factor` will be set to NaN if the stock is suspended.
If you want to use your own alpha-factor which can't be calculate by OCHLV, like PE, EPS and so on, you could add it to the CSV files with OHCLV together and then dump it to the Qlib format data.
Stock Pool (Market)
--------------------------------
``Qlib`` defines `stock pool <https://github.com/microsoft/qlib/blob/main/examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml#L4>`_ as stock list and their date ranges. Predefined stock pools (e.g. csi300) may be imported as follows.
.. code-block:: bash
python collector.py --index_name CSI300 --qlib_dir <user qlib data dir> --method parse_instruments
Multiple Stock Modes
--------------------------------
@@ -158,7 +209,7 @@ The `trade unit` defines the unit number of stocks can be used in a trade, and t
- If users use ``Qlib`` in china-stock mode, china-stock data is required. Users can use ``Qlib`` in china-stock mode according to the following steps:
- Download china-stock in qlib format, please refer to section `Qlib Format Dataset <#qlib-format-dataset>`_.
- Initialize ``Qlib`` in china-stock mode
Supposed that users download their Qlib format data in the directory ``~/.qlib/csv_data/cn_data``. Users only need to initialize ``Qlib`` as follows.
Supposed that users download their Qlib format data in the directory ``~/.qlib/qlib_data/cn_data``. Users only need to initialize ``Qlib`` as follows.
.. code-block:: python
@@ -167,9 +218,9 @@ The `trade unit` defines the unit number of stocks can be used in a trade, and t
- If users use ``Qlib`` in US-stock mode, US-stock data is required. ``Qlib`` also provides a script to download US-stock data. Users can use ``Qlib`` in US-stock mode according to the following steps:
- Download china-stock in qlib format, please refer to section `Qlib Format Dataset <#qlib-format-dataset>`_.
- Download us-stock in qlib format, please refer to section `Qlib Format Dataset <#qlib-format-dataset>`_.
- Initialize ``Qlib`` in US-stock mode
Supposed that users prepare their Qlib format data in the directory ``~/.qlib/csv_data/us_data``. Users only need to initialize ``Qlib`` as follows.
Supposed that users prepare their Qlib format data in the directory ``~/.qlib/qlib_data/us_data``. Users only need to initialize ``Qlib`` as follows.
.. code-block:: python
@@ -177,6 +228,11 @@ The `trade unit` defines the unit number of stocks can be used in a trade, and t
qlib.init(provider_uri='~/.qlib/qlib_data/us_data', region=REG_US)
.. note::
PRs for new data source are highly welcome! Users could commit the code to crawl data as a PR like `the examples here <https://github.com/microsoft/qlib/tree/main/scripts>`_. And then we will use the code to create data cache on our server which other users could use directly.
Data API
========================
@@ -213,6 +269,25 @@ Filter
- `cross-sectional features filter` \: rule_expression = '$rank($close)<10'
- `time-sequence features filter`: rule_expression = '$Ref($close, 3)>100'
Here is a simple example showing how to use filter in a basic ``Qlib`` workflow configuration file:
.. code-block:: yaml
filter: &filter
filter_type: ExpressionDFilter
rule_expression: "Ref($close, -2) / Ref($close, -1) > 1"
filter_start_time: 2010-01-01
filter_end_time: 2010-01-07
keep: False
data_handler_config: &data_handler_config
start_time: 2010-01-01
end_time: 2021-01-22
fit_start_time: 2010-01-01
fit_end_time: 2015-12-31
instruments: *market
filter_pipe: [*filter]
To know more about ``Filter``, please refer to `Filter API <../reference/api.html#module-qlib.data.filter>`_.
Reference
@@ -274,9 +349,10 @@ Here are some important interfaces that ``DataHandlerLP`` provides:
.. autoclass:: qlib.data.dataset.handler.DataHandlerLP
:members: __init__, fetch, get_cols
If users want to load features and labels by config, users can inherit ``qlib.data.dataset.handler.ConfigDataHandler``, ``Qlib`` also provides some preprocess method in this subclass.
If users want to use qlib data, `QLibDataHandler` is recommended. Users can inherit their custom class from `QLibDataHandler`, which is also a subclass of `ConfigDataHandler`.
If users want to load features and labels by config, users can define a new handler and call the static method `parse_config_to_fields` of ``qlib.contrib.data.handler.Alpha158``.
Also, users can pass ``qlib.contrib.data.processor.ConfigSectionProcessor`` that provides some preprocess methods for features defined by config into the new handler.
Processor
@@ -313,7 +389,6 @@ Qlib provides implemented data handler `Alpha158`. The following example shows h
.. note:: Users need to initialize ``Qlib`` with `qlib.init` first, please refer to `initialization <../start/initialization.html>`_.
.. code-block:: Python
import qlib
@@ -340,6 +415,9 @@ Qlib provides implemented data handler `Alpha158`. The following example shows h
# fetch all the features
print(h.fetch(col_set="feature"))
.. note:: In the ``Alpha158``, ``Qlib`` uses the label `Ref($close, -2)/Ref($close, -1) - 1` that means the change from T+1 to T+2, rather than `Ref($close, -1)/$close - 1`, of which the reason is that when getting the T day close price of a china stock, the stock can be bought on T+1 day and sold on T+2 day.
API
---------
@@ -364,8 +442,7 @@ The ``DatasetH`` class is the `dataset` with `Data Handler`. Here is the most im
API
---------
To know more about ``Dataset``, please refer to `Dataset API <../reference/api.html#module-qlib.data.dataset.__init__>`_.
To know more about ``Dataset``, please refer to `Dataset API <../reference/api.html#dataset>`_.
Cache

120
docs/component/highfreq.rst Normal file
View File

@@ -0,0 +1,120 @@
.. _highfreq:
============================================
Design of hierarchical order execution framework
============================================
.. currentmodule:: qlib
Introduction
===================
In order to support reinforcement learning algorithms for high-frequency trading, a corresponding framework is required. None of the publicly available high-frequency trading frameworks now consider multi-layer trading mechanisms, and the currently designed algorithms cannot directly use existing frameworks.
In addition to supporting the basic intraday multi-layer trading, the linkage with the day-ahead strategy is also a factor that affects the performance evaluation of the strategy. Different day strategies generate different order distributions and different patterns on different stocks. To verify that high-frequency trading strategies perform well on real trading orders, it is necessary to support day-frequency and high-frequency multi-level linkage trading. In addition to more accurate backtesting of high-frequency trading algorithms, if the distribution of day-frequency orders is considered when training a high-frequency trading model, the algorithm can also be optimized more for product-specific day-frequency orders.
Therefore, innovation in the high-frequency trading framework is necessary to solve the various problems mentioned above, for which we designed a hierarchical order execution framework that can link daily-frequency and intra-day trading at different granularities.
.. image:: ../_static/img/framework.svg
The design of the framework is shown in the figure above. At each layer consists of Trading Agent and Execution Env. The Trading Agent has its own data processing module (Information Extractor), forecasting module (Forecast Model) and decision generator (Decision Generator). The trading algorithm generates the corresponding decisions by the Decision Generator based on the forecast signals output by the Forecast Module, and the decisions generated by the trading algorithm are passed to the Execution Env, which returns the execution results. Here the frequency of trading algorithm, decision content and execution environment can be customized by users (e.g. intra-day trading, daily-frequency trading, weekly-frequency trading), and the execution environment can be nested with finer-grained trading algorithm and execution environment inside (i.e. sub-workflow in the figure, e.g. daily-frequency orders can be turned into finer-grained decisions by splitting orders within the day). The hierarchical order execution framework is user-defined in terms of hierarchy division and decision frequency, making it easy for users to explore the effects of combining different levels of trading algorithms and breaking down the barriers between different levels of trading algorithm optimization.
In addition to the innovation in the framework, the hierarchical order execution framework also takes into account various details of the real backtesting environment, minimizing the differences with the final real environment as much as possible. At the same time, the framework is designed to unify the interface between online and offline (e.g. data pre-processing level supports using the same set of code to process both offline and online data) to reduce the cost of strategy go-live as much as possible.
Prepare Data
===================
.. _data:: ../../examples/highfreq/README.md
Example
===========================
Here is an example of highfreq execution.
.. code-block:: python
import qlib
# init qlib
provider_uri_day = "~/.qlib/qlib_data/cn_data"
provider_uri_1min = "~/.qlib/qlib_data/cn_data_1min"
provider_uri_map = {"1min": provider_uri_1min, "day": provider_uri_day}
qlib.init(provider_uri=provider_uri_day, expression_cache=None, dataset_cache=None)
# data freq and backtest time
freq = "1min"
inst_list = D.list_instruments(D.instruments("all"), as_list=True)
start_time = "2020-01-01"
start_time = "2020-01-31"
When initializing qlib, if the default data is used, then both daily and minute frequency data need to be passed in.
.. code-block:: python
# random order strategy config
strategy_config = {
"class": "RandomOrderStrategy",
"module_path": "qlib.contrib.strategy.rule_strategy",
"kwargs": {
"trade_range": TradeRangeByTime("9:30", "15:00"),
"sample_ratio": 1.0,
"volume_ratio": 0.01,
"market": market,
},
}
.. code-block:: python
# backtest config
backtest_config = {
"start_time": start_time,
"end_time": end_time,
"account": 100000000,
"benchmark": None,
"exchange_kwargs": {
"freq": freq,
"limit_threshold": 0.095,
"deal_price": "close",
"open_cost": 0.0005,
"close_cost": 0.0015,
"min_cost": 5,
"codes": market,
},
"pos_type": "InfPosition", # Position with infinitive position
}
please refer to "../../qlib/backtest".
.. code-block:: python
# excutor config
executor_config = {
"class": "NestedExecutor",
"module_path": "qlib.backtest.executor",
"kwargs": {
"time_per_step": "day",
"inner_executor": {
"class": "SimulatorExecutor",
"module_path": "qlib.backtest.executor",
"kwargs": {
"time_per_step": freq,
"generate_portfolio_metrics": True,
"verbose": False,
# "verbose": True,
"indicator_config": {
"show_indicator": False,
},
},
},
"inner_strategy": {
"class": "TWAPStrategy",
"module_path": "qlib.contrib.strategy.rule_strategy",
},
"track_data": True,
"generate_portfolio_metrics": True,
"indicator_config": {
"show_indicator": True,
},
},
}
NestedExecutor represents not the innermost layer, the initialization parameters should contain inner_executor and inner_strategy. simulatorExecutor represents the current excutor is the innermost layer, the innermost strategy used here is the TWAP strategy, the framework currently also supports the VWAP strategy
.. code-block:: python
# backtest
portfolio_metrics_dict, indicator_dict = backtest(executor=executor_config, strategy=strategy_config, **backtest_config)
The metrics of backtest are included in the portfolio_metrics_dict and indicator_dict.

48
docs/component/online.rst Normal file
View File

@@ -0,0 +1,48 @@
.. _online:
=================================
Online Serving
=================================
.. currentmodule:: qlib
Introduction
=============
.. image:: ../_static/img/online_serving.png
:align: center
In addition to backtesting, one way to test a model is effective is to make predictions in real market conditions or even do real trading based on those predictions.
``Online Serving`` is a set of modules for online models using the latest data,
which including `Online Manager <#Online Manager>`_, `Online Strategy <#Online Strategy>`_, `Online Tool <#Online Tool>`_, `Updater <#Updater>`_.
`Here <https://github.com/microsoft/qlib/tree/main/examples/online_srv>`_ are several examples for reference, which demonstrate different features of ``Online Serving``.
If you have many models or `task` needs to be managed, please consider `Task Management <../advanced/task_management.html>`_.
The `examples <https://github.com/microsoft/qlib/tree/main/examples/online_srv>`_ are based on some components in `Task Management <../advanced/task_management.html>`_ such as ``TrainerRM`` or ``Collector``.
**NOTE**: User should keep his data source updated to support online serving. For example, Qlib provides `a batch of scripts <https://github.com/microsoft/qlib/blob/main/scripts/data_collector/yahoo/README.md#automatic-update-of-daily-frequency-datafrom-yahoo-finance>`_ to help users update Yahoo daily data.
Online Manager
=============
.. automodule:: qlib.workflow.online.manager
:members:
Online Strategy
=============
.. automodule:: qlib.workflow.online.strategy
:members:
Online Tool
=============
.. automodule:: qlib.workflow.online.utils
:members:
Updater
=============
.. automodule:: qlib.workflow.online.update
:members:

View File

@@ -34,6 +34,7 @@ Here is a general view of the structure of the system:
- Recorder 2
- ...
- ...
This experiment management system defines a set of interface and provided a concrete implementation ``MLflowExpManager``, which is based on the machine learning platform: ``MLFlow`` (`link <https://mlflow.org/>`_).
If users set the implementation of ``ExpManager`` to be ``MLflowExpManager``, they can use the command `mlflow ui` to visualize and check the experiment results. For more information, pleaes refer to the related documents `here <https://www.mlflow.org/docs/latest/cli.html#mlflow-ui>`_.
@@ -94,6 +95,51 @@ The ``RecordTemp`` class is a class that enables generate experiment results suc
- ``SignalRecord``: This class generates the `prediction` results of the model.
- ``SigAnaRecord``: This class generates the `IC`, `ICIR`, `Rank IC` and `Rank ICIR` of the model.
Here is a simple example of what is done in ``SigAnaRecord``, which users can refer to if they want to calculate IC, Rank IC, Long-Short Return with their own prediction and label.
.. code-block:: Python
from qlib.contrib.eva.alpha import calc_ic, calc_long_short_return
ic, ric = calc_ic(pred.iloc[:, 0], label.iloc[:, 0])
long_short_r, long_avg_r = calc_long_short_return(pred.iloc[:, 0], label.iloc[:, 0])
- ``PortAnaRecord``: This class generates the results of `backtest`. The detailed information about `backtest` as well as the available `strategy`, users can refer to `Strategy <../component/strategy.html>`_ and `Backtest <../component/backtest.html>`_.
Here is a simple exampke of what is done in ``PortAnaRecord``, which users can refer to if they want to do backtest based on their own prediction and label.
.. code-block:: Python
from qlib.contrib.strategy.strategy import TopkDropoutStrategy
from qlib.contrib.evaluate import (
backtest as normal_backtest,
risk_analysis,
)
# backtest
STRATEGY_CONFIG = {
"topk": 50,
"n_drop": 5,
}
BACKTEST_CONFIG = {
"limit_threshold": 0.095,
"account": 100000000,
"benchmark": BENCHMARK,
"deal_price": "close",
"open_cost": 0.0005,
"close_cost": 0.0015,
"min_cost": 5,
}
strategy = TopkDropoutStrategy(**STRATEGY_CONFIG)
report_normal, positions_normal = normal_backtest(pred_score, strategy=strategy, **BACKTEST_CONFIG)
# analysis
analysis = dict()
analysis["excess_return_without_cost"] = risk_analysis(report_normal["return"] - report_normal["bench"])
analysis["excess_return_with_cost"] = risk_analysis(report_normal["return"] - report_normal["bench"] - report_normal["cost"])
analysis_df = pd.concat(analysis) # type: pd.DataFrame
print(analysis_df)
For more information about the APIs, please refer to `Record Template API <../reference/api.html#module-qlib.workflow.record_temp>`_.

View File

@@ -101,7 +101,7 @@ Graphical Result
- Axis Y:
- `ic`
The `Pearson correlation coefficient` series between `label` and `prediction score`.
In the above example, the `label` is formulated as `Ref($close, -1)/$close - 1`. Please refer to `Data Featrue <data.html#feature>`_ for more details.
In the above example, the `label` is formulated as `Ref($close, -1)/$close - 1`. Please refer to `Data Feature <data.html#feature>`_ for more details.
- `rank_ic`
The `Spearman's rank correlation coefficient` series between `label` and `prediction score`.

View File

@@ -93,7 +93,6 @@ Usage & Example
"n_drop": 5,
}
BACKTEST_CONFIG = {
"verbose": False,
"limit_threshold": 0.095,
"account": 100000000,
"benchmark": BENCHMARK,
@@ -111,8 +110,6 @@ Usage & Example
pred_score, strategy=strategy, **BACKTEST_CONFIG
)
Also, the above example has been given in ``examples/train_backtest_analyze.ipynb``.
To know more about the `prediction score` `pred_score` output by ``Forecast Model``, please refer to `Forecast Model: Model Training & Prediction <model.html>`_.
To know more about ``Intraday Trading``, please refer to `Intraday Trading: Model&Strategy Testing <backtest.html>`_.

View File

@@ -53,8 +53,10 @@ Below is a typical config file of ``qrun``.
kwargs:
topk: 50
n_drop: 5
signal:
- <MODEL>
- <DATASET>
backtest:
verbose: False
limit_threshold: 0.095
account: 100000000
benchmark: *benchmark
@@ -90,12 +92,12 @@ Below is a typical config file of ``qrun``.
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
module_path: qlib.workflow.record_temp
kwargs: {}
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
After saving the config into `configuration.yaml`, users could start the workflow and test their ideas with a single command below.
@@ -142,7 +144,7 @@ The meaning of each field is as follows:
- `region`
- If `region` == "us", ``Qlib`` will be initialized in US-stock mode.
- If `region` == "cn", ``Qlib`` will be initialized in china-stock mode.
- If `region` == "cn", ``Qlib`` will be initialized in China-stock mode.
.. note::
@@ -241,8 +243,10 @@ The following script is the configuration of `backtest` and the `strategy` used
kwargs:
topk: 50
n_drop: 5
signal:
- <MODEL>
- <DATASET>
backtest:
verbose: False
limit_threshold: 0.095
account: 100000000
benchmark: *benchmark

View File

@@ -0,0 +1,22 @@
.. _code_standard:
=================================
Code Standard
=================================
Docstring
=================================
Please use the `Numpydoc Style <https://stackoverflow.com/a/24385103>`_.
Continuous Integration
=================================
Continuous Integration (CI) tools help you stick to the quality standards by running tests every time you push a new commit and reporting the results to a pull request.
When you submit a PR request, you can check whether your code passes the CI tests in the "check" section at the bottom of the web page.
A common error is the mixed use of space and tab. You can fix the bug by inputing the following code in the command line.
.. code-block:: python
pip install black
python -m black . -l 120

View File

@@ -93,7 +93,6 @@ We write a simple configuration example as following,
fend_time: 2018-12-11
backtest:
normal_backtest_args:
verbose: False
limit_threshold: 0.095
account: 500000
benchmark: SH000905
@@ -306,7 +305,6 @@ About the data and backtest
fend_time: 2018-12-11
backtest:
normal_backtest_args:
verbose: False
limit_threshold: 0.095
account: 500000
benchmark: SH000905

View File

@@ -42,6 +42,7 @@ Document Structure
Intraday Trading: Model&Strategy Testing <component/backtest.rst>
Qlib Recorder: Experiment Management <component/recorder.rst>
Analysis: Evaluation & Results Analysis <component/report.rst>
Online Serving: Online Management & Strategy & Tool <component/online.rst>
.. toctree::
:maxdepth: 3
@@ -49,6 +50,8 @@ Document Structure
Building Formulaic Alphas <advanced/alpha.rst>
Online & Offline mode <advanced/server.rst>
Serialization <advanced/serial.rst>
Task Management <advanced/task_management.rst>
.. toctree::
:maxdepth: 3

View File

@@ -15,7 +15,7 @@ With ``Qlib``, users can easily try their ideas to create better Quant investmen
Framework
===================
.. image:: ../_static/img/framework.png
.. image:: ../_static/img/framework.svg
:align: center

View File

@@ -53,6 +53,34 @@ Cache
.. autoclass:: qlib.data.cache.DiskDatasetCache
:members:
Storage
-------------
.. autoclass:: qlib.data.storage.storage.BaseStorage
:members:
.. autoclass:: qlib.data.storage.storage.CalendarStorage
:members:
.. autoclass:: qlib.data.storage.storage.InstrumentStorage
:members:
.. autoclass:: qlib.data.storage.storage.FeatureStorage
:members:
.. autoclass:: qlib.data.storage.file_storage.FileStorageMixin
:members:
.. autoclass:: qlib.data.storage.file_storage.FileCalendarStorage
:members:
.. autoclass:: qlib.data.storage.file_storage.FileInstrumentStorage
:members:
.. autoclass:: qlib.data.storage.file_storage.FileFeatureStorage
:members:
Dataset
---------------
@@ -152,4 +180,82 @@ Recorder
Record Template
--------------------
.. automodule:: qlib.workflow.record_temp
:members:
:members:
Task Management
====================
TaskGen
--------------------
.. automodule:: qlib.workflow.task.gen
:members:
TaskManager
--------------------
.. automodule:: qlib.workflow.task.manage
:members:
Trainer
--------------------
.. automodule:: qlib.model.trainer
:members:
Collector
--------------------
.. automodule:: qlib.workflow.task.collect
:members:
Group
--------------------
.. automodule:: qlib.model.ens.group
:members:
Ensemble
--------------------
.. automodule:: qlib.model.ens.ensemble
:members:
Utils
--------------------
.. automodule:: qlib.workflow.task.utils
:members:
Online Serving
====================
Online Manager
--------------------
.. automodule:: qlib.workflow.online.manager
:members:
Online Strategy
--------------------
.. automodule:: qlib.workflow.online.strategy
:members:
Online Tool
--------------------
.. automodule:: qlib.workflow.online.utils
:members:
RecordUpdater
--------------------
.. automodule:: qlib.workflow.online.update
:members:
Utils
====================
Serializable
--------------------
.. automodule:: qlib.utils.serial.Serializable
:members:

View File

@@ -75,3 +75,15 @@ Besides `provider_uri` and `region`, `qlib.init` has other parameters. The follo
"default_exp_name": "Experiment",
}
})
- `mongo`
Type: dict, optional parameter, the setting of `MongoDB <https://www.mongodb.com/>`_ which will be used in some features such as `Task Management <../advanced/task_management.html>`_, with high performance and clustered processing.
Users need to follow the steps in `installation <https://www.mongodb.com/try/download/community>`_ to install MongoDB firstly and then access it via a URI.
Users can access mongodb with credential by setting "task_url" to a string like `"mongodb://%s:%s@%s" % (user, pwd, host + ":" + port)`.
.. code-block:: Python
# For example, you can initialize qlib below
qlib.init(provider_uri=provider_uri, region=REG_CN, mongo={
"task_url": "mongodb://localhost:27017/", # your mongo url
"task_db_name": "rolling_db", # the database name of Task Management
})

View File

@@ -82,7 +82,7 @@ The Custom models need to inherit `qlib.model.base.Model <../reference/api.html#
return pd.Series(self.model.predict(x_test.values), index=x_test.index)
- Override the `finetune` method (Optional)
- This method is optional to the users, and when users one to use this method on their own models, they should inherit the ``ModelFT`` base class, which includes the interface of `finetune`.
- This method is optional to the users. When users want to use this method on their own models, they should inherit the ``ModelFT`` base class, which includes the interface of `finetune`.
- The parameters must include the parameter `dataset`.
- Code Example: In the following example, users will use `LightGBM` as the model and finetune it.
.. code-block:: Python

View File

@@ -34,19 +34,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: ALSTM
@@ -81,7 +86,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -26,19 +26,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: ALSTM
@@ -71,7 +76,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -80,4 +87,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -12,19 +12,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: CatBoostModel
@@ -53,7 +58,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -19,19 +19,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: CatBoostModel
@@ -60,7 +65,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -0,0 +1,4 @@
# DoubleEnsemble
* DoubleEnsemble is an ensemble framework leveraging learning trajectory based sample reweighting and shuffling based feature selection, to solve both the low signal-to-noise ratio and increasing number of features problems. They identify the key samples based on the training dynamics on each sample and elicit key features based on the ablation impact of each feature via shuffling. The model is applicable to a wide range of base models, capable of extracting complex patterns, while mitigating the overfitting and instability issues for financial market prediction.
* This code used in Qlib is implemented by ourselves.
* Paper: DoubleEnsemble: A New Ensemble Method Based on Sample Reweighting and Feature Selection for Financial Data Analysis [https://arxiv.org/pdf/2010.01265.pdf](https://arxiv.org/pdf/2010.01265.pdf).

View File

@@ -0,0 +1,3 @@
pandas==1.1.2
numpy==1.17.4
lightgbm==3.1.0

View File

@@ -0,0 +1,97 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &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: *market
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: DEnsembleModel
module_path: qlib.contrib.model.double_ensemble
kwargs:
base_model: "gbm"
loss: mse
num_models: 6
enable_sr: True
enable_fs: True
alpha1: 1
alpha2: 1
bins_sr: 10
bins_fs: 5
decay: 0.5
sample_ratios:
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
sub_weights:
- 1
- 0.2
- 0.2
- 0.2
- 0.2
- 0.2
epochs: 28
colsample_bytree: 0.8879
learning_rate: 0.2
subsample: 0.8789
lambda_l1: 205.6999
lambda_l2: 580.9768
max_depth: 8
num_leaves: 210
num_threads: 20
verbosity: -1
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Alpha158
module_path: qlib.contrib.data.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -0,0 +1,104 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &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: *market
infer_processors: []
learn_processors:
- class: DropnaLabel
- class: CSRankNorm
kwargs:
fields_group: label
label: ["Ref($close, -2) / Ref($close, -1) - 1"]
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: DEnsembleModel
module_path: qlib.contrib.model.double_ensemble
kwargs:
base_model: "gbm"
loss: mse
num_models: 6
enable_sr: True
enable_fs: True
alpha1: 1
alpha2: 1
bins_sr: 10
bins_fs: 5
decay: 0.5
sample_ratios:
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
sub_weights:
- 1
- 0.2
- 0.2
- 0.2
- 0.2
- 0.2
epochs: 136
colsample_bytree: 0.8879
learning_rate: 0.0421
subsample: 0.8789
lambda_l1: 205.6999
lambda_l2: 580.9768
max_depth: 8
num_leaves: 210
num_threads: 20
verbosity: -1
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Alpha360
module_path: qlib.contrib.data.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -33,19 +33,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: GATs
@@ -61,7 +66,6 @@ task:
metric: loss
loss: mse
base_model: LSTM
with_pretrain: True
model_path: "benchmarks/LSTM/csi300_lstm_ts.pkl"
GPU: 0
dataset:
@@ -80,7 +84,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -89,4 +95,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -26,19 +26,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: GATs
@@ -54,7 +59,6 @@ task:
metric: loss
loss: mse
base_model: LSTM
with_pretrain: True
model_path: "benchmarks/LSTM/model_lstm_csi300.pkl"
GPU: 0
dataset:
@@ -72,7 +76,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -81,4 +87,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -34,19 +34,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: GRU
@@ -80,7 +85,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -26,19 +26,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: GRU
@@ -70,7 +75,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -79,4 +86,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -29,24 +29,29 @@ data_handler_config: &data_handler_config
- class: CSRankNorm
kwargs:
fields_group: label
label: ["Ref($close, -2) / Ref($close, -1) - 1"]
label: ["Ref($close, -2) / Ref($close, -1) - 1"]
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LSTM
@@ -80,7 +85,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -26,19 +26,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LSTM
@@ -70,7 +75,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -79,4 +86,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -0,0 +1,18 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pandas as pd
from qlib.data.inst_processor import InstProcessor
from qlib.utils.resam import resam_calendar
class ResampleNProcessor(InstProcessor):
def __init__(self, target_frq: str, **kwargs):
self.target_frq = target_frq
def __call__(self, df: pd.DataFrame, *args, **kwargs):
df.index = pd.to_datetime(df.index)
res_index = resam_calendar(df.index, "1min", self.target_frq)
df = df.resample(self.target_frq).last().reindex(res_index)
return df

View File

@@ -0,0 +1,16 @@
import datetime
import pandas as pd
from qlib.data.inst_processor import InstProcessor
class Resample1minProcessor(InstProcessor):
def __init__(self, hour: int, minute: int, **kwargs):
self.hour = hour
self.minute = minute
def __call__(self, df: pd.DataFrame, *args, **kwargs):
df.index = pd.to_datetime(df.index)
df = df.loc[df.index.time == datetime.time(self.hour, self.minute)]
df.index = df.index.normalize()
return df

View File

@@ -0,0 +1,135 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pandas as pd
from qlib.data.dataset.loader import QlibDataLoader
from qlib.contrib.data.handler import DataHandlerLP, _DEFAULT_LEARN_PROCESSORS, check_transform_proc
class Avg15minLoader(QlibDataLoader):
def load(self, instruments=None, start_time=None, end_time=None) -> pd.DataFrame:
df = super(Avg15minLoader, self).load(instruments, start_time, end_time)
if self.is_group:
# feature_day(day freq) and feature_15min(1min freq, Average every 15 minutes) renamed feature
df.columns = df.columns.map(lambda x: ("feature", x[1]) if x[0].startswith("feature") else x)
return df
class Avg15minHandler(DataHandlerLP):
def __init__(
self,
instruments="csi500",
start_time=None,
end_time=None,
freq="day",
infer_processors=[],
learn_processors=_DEFAULT_LEARN_PROCESSORS,
fit_start_time=None,
fit_end_time=None,
process_type=DataHandlerLP.PTYPE_A,
filter_pipe=None,
inst_processor=None,
**kwargs,
):
infer_processors = check_transform_proc(infer_processors, fit_start_time, fit_end_time)
learn_processors = check_transform_proc(learn_processors, fit_start_time, fit_end_time)
data_loader = Avg15minLoader(
config=self.loader_config(), filter_pipe=filter_pipe, freq=freq, inst_processor=inst_processor
)
super().__init__(
instruments=instruments,
start_time=start_time,
end_time=end_time,
data_loader=data_loader,
infer_processors=infer_processors,
learn_processors=learn_processors,
process_type=process_type,
)
def loader_config(self):
# Results for dataset: df: pd.DataFrame
# len(df.columns) == 6 + 6 * 16, len(df.index.get_level_values(level="datetime").unique()) == T
# df.columns: close0, close1, ..., close16, open0, ..., open16, ..., vwap16
# freq == day:
# close0, open0, low0, high0, volume0, vwap0
# freq == 1min:
# close1, ..., close16, ..., vwap1, ..., vwap16
# df.index.name == ["datetime", "instrument"]: pd.MultiIndex
# Example:
# feature ... label
# close0 open0 low0 ... vwap1 vwap16 LABEL0
# datetime instrument ...
# 2020-10-09 SH600000 11.794546 11.819587 11.769505 ... NaN NaN -0.005214
# 2020-10-15 SH600000 12.044961 11.944795 11.932274 ... NaN NaN -0.007202
# ... ... ... ... ... ... ... ...
# 2021-05-28 SZ300676 6.369684 6.495406 6.306568 ... NaN NaN -0.001321
# 2021-05-31 SZ300676 6.601626 6.465643 6.465130 ... NaN NaN -0.023428
# features day: len(columns) == 6, freq = day
# $close is the closing price of the current trading day:
# if the user needs to get the `close` before the last T days, use Ref($close, T-1), for example:
# $close Ref($close, 1) Ref($close, 2) Ref($close, 3) Ref($close, 4)
# instrument datetime
# SH600519 2021-06-01 244.271530
# 2021-06-02 242.205917 244.271530
# 2021-06-03 242.229889 242.205917 244.271530
# 2021-06-04 245.421524 242.229889 242.205917 244.271530
# 2021-06-07 247.547089 245.421524 242.229889 242.205917 244.271530
# WARNING: Ref($close, N), if N == 0, Ref($close, N) ==> $close
fields = ["$close", "$open", "$low", "$high", "$volume", "$vwap"]
# names: close0, open0, ..., vwap0
names = list(map(lambda x: x.strip("$") + "0", fields))
config = {"feature_day": (fields, names)}
# features 15min: len(columns) == 6 * 16, freq = 1min
# $close is the closing price of the current trading day:
# if the user gets 'close' for the i-th 15min of the last T days, use `Ref(Mean($close, 15), (T-1) * 240 + i * 15)`, for example:
# Ref(Mean($close, 15), 225) Ref(Mean($close, 15), 465) Ref(Mean($close, 15), 705)
# instrument datetime
# SH600519 2021-05-31 241.769897 243.077942 244.712997
# 2021-06-01 244.271530 241.769897 243.077942
# 2021-06-02 242.205917 244.271530 241.769897
# WARNING: Ref(Mean($close, 15), N), if N == 0, Ref(Mean($close, 15), N) ==> Mean($close, 15)
# Results of the current script:
# time: 09:00 --> 09:14, ..., 14:45 --> 14:59
# fields: Ref(Mean($close, 15), 225), ..., Mean($close, 15)
# name: close1, ..., close16
#
# Expression description: take close as an example
# Mean($close, 15) ==> df["$close"].rolling(15, min_periods=1).mean()
# Ref(Mean($close, 15), 15) ==> df["$close"].rolling(15, min_periods=1).mean().shift(15)
# NOTE: The last data of each trading day, which is the average of the i-th 15 minutes
# Average:
# Average of the i-th 15-minute period of each trading day: 1 <= i <= 250 // 16
# Avg(15minutes): Ref(Mean($close, 15), 240 - i * 15)
#
# Average of the first 15 minutes of each trading day; i = 1
# Avg(09:00 --> 09:14), df.index.loc["09:14"]: Ref(Mean($close, 15), 240- 1 * 15) ==> Ref(Mean($close, 15), 225)
# Average of the last 15 minutes of each trading day; i = 16
# Avg(14:45 --> 14:59), df.index.loc["14:59"]: Ref(Mean($close, 15), 240 - 16 * 15) ==> Ref(Mean($close, 15), 0) ==> Mean($close, 15)
# 15min resample to day
# df.resample("1d").last()
tmp_fields = []
tmp_names = []
for i, _f in enumerate(fields):
_fields = [f"Ref(Mean({_f}, 15), {j * 15})" for j in range(1, 240 // 15)]
_names = [f"{names[i][:-1]}{int(names[i][-1])+j}" for j in range(240 // 15 - 1, 0, -1)]
_fields.append(f"Mean({_f}, 15)")
_names.append(f"{names[i][:-1]}{int(names[i][-1])+240 // 15}")
tmp_fields += _fields
tmp_names += _names
config["feature_15min"] = (tmp_fields, tmp_names)
# label
config["label"] = (["Ref($close, -2)/Ref($close, -1) - 1"], ["LABEL0"])
return config

View File

@@ -12,19 +12,23 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
model: <MODEL>
dataset: <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LGBModel
@@ -54,7 +58,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -63,4 +69,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -0,0 +1,86 @@
qlib_init:
provider_uri:
day: "~/.qlib/qlib_data/cn_data"
1min: "~/.qlib/qlib_data/cn_data_1min"
region: cn
dataset_cache: null
maxtasksperchild: 1
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: 2008-01-01
# 1min closing time is 15:00:00
end_time: "2020-08-01 15:00:00"
fit_start_time: 2008-01-01
fit_end_time: 2014-12-31
instruments: *market
freq:
label: day
feature: 1min
# with label as reference
inst_processor:
feature:
- class: Resample1minProcessor
module_path: features_sample.py
kwargs:
hour: 14
minute: 56
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
kwargs:
topk: 50
n_drop: 5
signal:
- <MODEL>
- <DATASET>
backtest:
verbose: False
limit_threshold: 0.095
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LGBModel
module_path: qlib.contrib.model.gbdt
kwargs:
loss: mse
colsample_bytree: 0.8879
learning_rate: 0.2
subsample: 0.8789
lambda_l1: 205.6999
lambda_l2: 580.9768
max_depth: 8
num_leaves: 210
num_threads: 20
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Alpha158
module_path: qlib.contrib.data.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -19,19 +19,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LGBModel
@@ -61,7 +66,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -70,4 +77,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -0,0 +1,88 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: 2008-01-01
end_time: 2020-08-01
instruments: *market
data_loader:
class: QlibDataLoader
kwargs:
config:
feature:
- ["Resi($close, 15)/$close", "Std(Abs($close/Ref($close, 1)-1)*$volume, 5)/(Mean(Abs($close/Ref($close, 1)-1)*$volume, 5)+1e-12)", "Rsquare($close, 5)", "($high-$low)/$open", "Rsquare($close, 10)", "Corr($close, Log($volume+1), 5)", "Corr($close/Ref($close,1), Log($volume/Ref($volume, 1)+1), 5)", "Corr($close, Log($volume+1), 10)", "Rsquare($close, 20)", "Corr($close/Ref($close,1), Log($volume/Ref($volume, 1)+1), 60)", "Corr($close/Ref($close,1), Log($volume/Ref($volume, 1)+1), 10)", "Corr($close, Log($volume+1), 20)", "(Less($open, $close)-$low)/$open"]
- ["RESI5", "WVMA5", "RSQR5", "KLEN", "RSQR10", "CORR5", "CORD5", "CORR10", "RSQR20", "CORD60", "CORD10", "CORR20", "KLOW"]
label:
- ["Ref($close, -2)/Ref($close, -1) - 1"]
- ["LABEL0"]
freq: day
learn_processors:
- class: DropnaLabel
- class: CSZScoreNorm
kwargs:
fields_group: label
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LGBModel
module_path: qlib.contrib.model.gbdt
kwargs:
loss: mse
colsample_bytree: 0.8879
learning_rate: 0.2
subsample: 0.8789
lambda_l1: 205.6999
lambda_l2: 580.9768
max_depth: 8
num_leaves: 210
num_threads: 20
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: DataHandlerLP
module_path: qlib.data.dataset.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -0,0 +1,90 @@
qlib_init:
provider_uri:
day: "~/.qlib/qlib_data/cn_data"
1min: "~/.qlib/qlib_data/cn_data_1min"
region: cn
dataset_cache: null
maxtasksperchild: null
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: 2008-01-01
# 1min closing time is 15:00:00
end_time: "2020-08-01 15:00:00"
fit_start_time: 2008-01-01
fit_end_time: 2014-12-31
instruments: *market
freq:
label: day
feature_15min: 1min
feature_day: day
# with label as reference
inst_processor:
feature_15min:
- class: ResampleNProcessor
module_path: features_resample_N.py
kwargs:
target_frq: 1d
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LGBModel
module_path: qlib.contrib.model.gbdt
kwargs:
loss: mse
colsample_bytree: 0.8879
learning_rate: 0.2
subsample: 0.8789
lambda_l1: 205.6999
lambda_l2: 580.9768
max_depth: 8
num_leaves: 210
num_threads: 20
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Avg15minHandler
module_path: multi_freq_handler.py
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -26,19 +26,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LinearModel
@@ -57,16 +62,18 @@ task:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
kwargs:
ana_long_short: True
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
kwargs:
config: *port_analysis_config

View File

@@ -0,0 +1,3 @@
numpy==1.17.4
pandas==1.1.2
torch==1.2.0

View File

@@ -0,0 +1,89 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &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: *market
infer_processors:
- class: FilterCol
kwargs:
fields_group: feature
col_list: ["RESI5", "WVMA5", "RSQR5", "KLEN", "RSQR10", "CORR5", "CORD5", "CORR10",
"ROC60", "RESI10", "VSTD5", "RSQR60", "CORR60", "WVMA60", "STD5",
"RSQR20", "CORD60", "CORD10", "CORR20", "KLOW"
]
- class: RobustZScoreNorm
kwargs:
fields_group: feature
clip_outlier: true
- class: Fillna
kwargs:
fields_group: feature
learn_processors:
- class: DropnaLabel
- class: CSRankNorm
kwargs:
fields_group: label
label: ["Ref($close, -2) / Ref($close, -1) - 1"]
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LocalformerModel
module_path: qlib.contrib.model.pytorch_localformer_ts
kwargs:
seed: 0
n_jobs: 20
dataset:
class: TSDatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Alpha158
module_path: qlib.contrib.data.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
step_len: 20
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -0,0 +1,80 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &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: *market
infer_processors:
- class: RobustZScoreNorm
kwargs:
fields_group: feature
clip_outlier: true
- class: Fillna
kwargs:
fields_group: feature
learn_processors:
- class: DropnaLabel
- class: CSRankNorm
kwargs:
fields_group: label
label: ["Ref($close, -2) / Ref($close, -1) - 1"]
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: LocalformerModel
module_path: qlib.contrib.model.pytorch_localformer
kwargs:
d_feat: 6
seed: 0
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Alpha360
module_path: qlib.contrib.data.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -39,19 +39,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: DNNModelPytorch
@@ -83,7 +88,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -92,4 +99,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -27,19 +27,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: DNNModelPytorch
@@ -70,7 +75,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
@@ -79,4 +86,4 @@ task:
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config
config: *port_analysis_config

View File

@@ -1,35 +1,60 @@
# Benchmarks Performance
Here are the results of each benchmark model running on Qlib's `Alpha360` and `Alpha158` dataset with China's A shared-stock & CSI300 data respectively. The values of each metric are the mean and std calculated based on 20 runs.
Here are the results of each benchmark model running on Qlib's `Alpha360` and `Alpha158` dataset with China's A shared-stock & CSI300 data respectively. The values of each metric are the mean and std calculated based on 20 runs with different random seeds.
The numbers shown below demonstrate the performance of the entire `workflow` of each model. We will update the `workflow` as well as models in the near future for better results.
<!--
> If you need to reproduce the results below, please use the **v1** dataset: `python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/qlib_cn_1d --region cn --version v1`
>
> In the new version of qlib, the default dataset is **v2**. Since the data is collected from the YahooFinance API (which is not very stable), the results of *v2* and *v1* may differ -->
> NOTE:
> The backtest start from 0.8.0 is quite different from previous version. Please check out the changelog for the difference.
## Alpha360 dataset
| Model Name | Dataset | IC | ICIR | Rank IC | Rank ICIR | Annualized Return | Information Ratio | Max Drawdown |
|---|---|---|---|---|---|---|---|---|
| Linear | Alpha360 | 0.0150±0.00 | 0.1049±0.00| 0.0284±0.00 | 0.1970±0.00 | -0.0659±0.00 | -0.7072±0.00| -0.2955±0.00 |
| CatBoost (Liudmila Prokhorenkova, et al.) | Alpha360 | 0.0397±0.00 | 0.2878±0.00| 0.0470±0.00 | 0.3703±0.00 | 0.0342±0.00 | 0.4092±0.00| -0.1057±0.00 |
| XGBoost (Tianqi Chen, et al.) | Alpha360 | 0.0400±0.00 | 0.3031±0.00| 0.0461±0.00 | 0.3862±0.00 | 0.0528±0.00 | 0.6307±0.00| -0.1113±0.00 |
| LightGBM (Guolin Ke, et al.) | Alpha360 | 0.0399±0.00 | 0.3075±0.00| 0.0492±0.00 | 0.4019±0.00 | 0.0323±0.00 | 0.4370±0.00| -0.0917±0.00 |
| MLP | Alpha360 | 0.0285±0.00 | 0.1981±0.02| 0.0402±0.00 | 0.2993±0.02 | 0.0073±0.02 | 0.0880±0.22| -0.1446±0.03 |
| GRU (Kyunghyun Cho, et al.) | Alpha360 | 0.0490±0.01 | 0.3787±0.05| 0.0581±0.00 | 0.4664±0.04 | 0.0726±0.02 | 0.9817±0.34| -0.0902±0.03 |
| LSTM (Sepp Hochreiter, et al.) | Alpha360 | 0.0443±0.01 | 0.3401±0.05| 0.0536±0.01 | 0.4248±0.05 | 0.0627±0.03 | 0.8441±0.48| -0.0882±0.03 |
| ALSTM (Yao Qin, et al.) | Alpha360 | 0.0493±0.01 | 0.3778±0.06| 0.0585±0.00 | 0.4606±0.04 | 0.0513±0.03 | 0.6727±0.38| -0.1085±0.02 |
| GATs (Petar Velickovic, et al.) | Alpha360 | 0.0475±0.00 | 0.3515±0.02| 0.0592±0.00 | 0.4585±0.01 | 0.0876±0.02 | 1.1513±0.27| -0.0795±0.02 |
## Alpha158 dataset
| Model Name | Dataset | IC | ICIR | Rank IC | Rank ICIR | Annualized Return | Information Ratio | Max Drawdown |
|---|---|---|---|---|---|---|---|---|
| Linear | Alpha158 | 0.0393±0.00 | 0.2980±0.00| 0.0475±0.00 | 0.3546±0.00 | 0.0795±0.00 | 1.0712±0.00| -0.1449±0.00 |
| CatBoost (Liudmila Prokhorenkova, et al.) | Alpha158 | 0.0503±0.00 | 0.3586±0.00| 0.0483±0.00 | 0.3667±0.00 | 0.1080±0.00 | 1.1561±0.00| -0.0787±0.00 |
| XGBoost (Tianqi Chen, et al.) | Alpha158 | 0.0481±0.00 | 0.3659±0.00| 0.0495±0.00 | 0.4033±0.00 | 0.1111±0.00 | 1.2915±0.00| -0.0893±0.00 |
| LightGBM (Guolin Ke, et al.) | Alpha158 | 0.0475±0.00 | 0.3979±0.00| 0.0485±0.00 | 0.4123±0.00 | 0.1143±0.00 | 1.2744±0.00| -0.0800±0.00 |
| MLP | Alpha158 | 0.0358±0.00 | 0.2738±0.03| 0.0425±0.00 | 0.3221±0.01 | 0.0836±0.02 | 1.0323±0.25| -0.1127±0.02 |
| TabNet with pretrain (Sercan O. Arikm et al) | Alpha158 | 0.0344±0.00|0.205±0.11|0.0398±0.00 |0.3479±0.01|0.0827±0.02|1.1141±0.32 |-0.0925±0.02 |
| TFT (Bryan Lim, et al.) | Alpha158 (with selected 20 features) | 0.0343±0.00 | 0.2071±0.02| 0.0107±0.00 | 0.0660±0.02 | 0.0623±0.02 | 0.5818±0.20| -0.1762±0.01 |
| GRU (Kyunghyun Cho, et al.) | Alpha158 (with selected 20 features) | 0.0311±0.00 | 0.2418±0.04| 0.0425±0.00 | 0.3434±0.02 | 0.0330±0.02 | 0.4805±0.30| -0.1021±0.02 |
| LSTM (Sepp Hochreiter, et al.) | Alpha158 (with selected 20 features) | 0.0312±0.00 | 0.2394±0.04| 0.0418±0.00 | 0.3324±0.03 | 0.0298±0.02 | 0.4198±0.33| -0.1348±0.03 |
| ALSTM (Yao Qin, et al.) | Alpha158 (with selected 20 features) | 0.0385±0.01 | 0.3022±0.06| 0.0478±0.00 | 0.3874±0.04 | 0.0486±0.03 | 0.7141±0.45| -0.1088±0.03 |
| GATs (Petar Velickovic, et al.) | Alpha158 (with selected 20 features) | 0.0349±0.00 | 0.2511±0.01| 0.0457±0.00 | 0.3537±0.01 | 0.0578±0.02 | 0.8221±0.25| -0.0824±0.02 |
| Model Name | Dataset | IC | ICIR | Rank IC | Rank ICIR | Annualized Return | Information Ratio | Max Drawdown |
|------------------------------------------|-------------------------------------|-------------|-------------|-------------|-------------|-------------------|-------------------|--------------|
| TabNet(Sercan O. Arik, et al.) | Alpha158 | 0.0204±0.01 | 0.1554±0.07 | 0.0333±0.00 | 0.2552±0.05 | 0.0227±0.04 | 0.3676±0.54 | -0.1089±0.08 |
| Transformer(Ashish Vaswani, et al.) | Alpha158 | 0.0264±0.00 | 0.2053±0.02 | 0.0407±0.00 | 0.3273±0.02 | 0.0273±0.02 | 0.3970±0.26 | -0.1101±0.02 |
| GRU(Kyunghyun Cho, et al.) | Alpha158(with selected 20 features) | 0.0315±0.00 | 0.2450±0.04 | 0.0428±0.00 | 0.3440±0.03 | 0.0344±0.02 | 0.5160±0.25 | -0.1017±0.02 |
| LSTM(Sepp Hochreiter, et al.) | Alpha158(with selected 20 features) | 0.0318±0.00 | 0.2367±0.04 | 0.0435±0.00 | 0.3389±0.03 | 0.0381±0.03 | 0.5561±0.46 | -0.1207±0.04 |
| Localformer(Juyong Jiang, et al.) | Alpha158 | 0.0356±0.00 | 0.2756±0.03 | 0.0468±0.00 | 0.3784±0.03 | 0.0438±0.02 | 0.6600±0.33 | -0.0952±0.02 |
| SFM(Liheng Zhang, et al.) | Alpha158 | 0.0379±0.00 | 0.2959±0.04 | 0.0464±0.00 | 0.3825±0.04 | 0.0465±0.02 | 0.5672±0.29 | -0.1282±0.03 |
| ALSTM (Yao Qin, et al.) | Alpha158(with selected 20 features) | 0.0362±0.01 | 0.2789±0.06 | 0.0463±0.01 | 0.3661±0.05 | 0.0470±0.03 | 0.6992±0.47 | -0.1072±0.03 |
| GATs (Petar Velickovic, et al.) | Alpha158(with selected 20 features) | 0.0349±0.00 | 0.2511±0.01 | 0.0462±0.00 | 0.3564±0.01 | 0.0497±0.01 | 0.7338±0.19 | -0.0777±0.02 |
| TRA(Hengxu Lin, et al.) | Alpha158(with selected 20 features) | 0.0404±0.00 | 0.3197±0.05 | 0.0490±0.00 | 0.4047±0.04 | 0.0649±0.02 | 1.0091±0.30 | -0.0860±0.02 |
| Linear | Alpha158 | 0.0397±0.00 | 0.3000±0.00 | 0.0472±0.00 | 0.3531±0.00 | 0.0692±0.00 | 0.9209±0.00 | -0.1509±0.00 |
| TRA(Hengxu Lin, et al.) | Alpha158 | 0.0440±0.00 | 0.3535±0.05 | 0.0540±0.00 | 0.4451±0.03 | 0.0718±0.02 | 1.0835±0.35 | -0.0760±0.02 |
| CatBoost(Liudmila Prokhorenkova, et al.) | Alpha158 | 0.0481±0.00 | 0.3366±0.00 | 0.0454±0.00 | 0.3311±0.00 | 0.0765±0.00 | 0.8032±0.01 | -0.1092±0.00 |
| XGBoost(Tianqi Chen, et al.) | Alpha158 | 0.0498±0.00 | 0.3779±0.00 | 0.0505±0.00 | 0.4131±0.00 | 0.0780±0.00 | 0.9070±0.00 | -0.1168±0.00 |
| TFT (Bryan Lim, et al.) | Alpha158(with selected 20 features) | 0.0358±0.00 | 0.2160±0.03 | 0.0116±0.01 | 0.0720±0.03 | 0.0847±0.02 | 0.8131±0.19 | -0.1824±0.03 |
| MLP | Alpha158 | 0.0376±0.00 | 0.2846±0.02 | 0.0429±0.00 | 0.3220±0.01 | 0.0895±0.02 | 1.1408±0.23 | -0.1103±0.02 |
| LightGBM(Guolin Ke, et al.) | Alpha158 | 0.0448±0.00 | 0.3660±0.00 | 0.0469±0.00 | 0.3877±0.00 | 0.0901±0.00 | 1.0164±0.00 | -0.1038±0.00 |
| DoubleEnsemble(Chuheng Zhang, et al.) | Alpha158 | 0.0544±0.00 | 0.4340±0.00 | 0.0523±0.00 | 0.4284±0.01 | 0.1168±0.01 | 1.3384±0.12 | -0.1036±0.01 |
## Alpha360 dataset
| Model Name | Dataset | IC | ICIR | Rank IC | Rank ICIR | Annualized Return | Information Ratio | Max Drawdown |
|-------------------------------------------|----------|-------------|-------------|-------------|-------------|-------------------|-------------------|--------------|
| Transformer(Ashish Vaswani, et al.) | Alpha360 | 0.0114±0.00 | 0.0716±0.03 | 0.0327±0.00 | 0.2248±0.02 | -0.0270±0.03 | -0.3378±0.37 | -0.1653±0.05 |
| TabNet(Sercan O. Arik, et al.) | Alpha360 | 0.0099±0.00 | 0.0593±0.00 | 0.0290±0.00 | 0.1887±0.00 | -0.0369±0.00 | -0.3892±0.00 | -0.2145±0.00 |
| MLP | Alpha360 | 0.0273±0.00 | 0.1870±0.02 | 0.0396±0.00 | 0.2910±0.02 | 0.0029±0.02 | 0.0274±0.23 | -0.1385±0.03 |
| Localformer(Juyong Jiang, et al.) | Alpha360 | 0.0404±0.00 | 0.2932±0.04 | 0.0542±0.00 | 0.4110±0.03 | 0.0246±0.02 | 0.3211±0.21 | -0.1095±0.02 |
| CatBoost((Liudmila Prokhorenkova, et al.) | Alpha360 | 0.0378±0.00 | 0.2714±0.00 | 0.0467±0.00 | 0.3659±0.00 | 0.0292±0.00 | 0.3781±0.00 | -0.0862±0.00 |
| XGBoost(Tianqi Chen, et al.) | Alpha360 | 0.0394±0.00 | 0.2909±0.00 | 0.0448±0.00 | 0.3679±0.00 | 0.0344±0.00 | 0.4527±0.02 | -0.1004±0.00 |
| DoubleEnsemble(Chuheng Zhang, et al.) | Alpha360 | 0.0404±0.00 | 0.3023±0.00 | 0.0495±0.00 | 0.3898±0.00 | 0.0468±0.01 | 0.6302±0.20 | -0.0860±0.01 |
| LightGBM(Guolin Ke, et al.) | Alpha360 | 0.0400±0.00 | 0.3037±0.00 | 0.0499±0.00 | 0.4042±0.00 | 0.0558±0.00 | 0.7632±0.00 | -0.0659±0.00 |
| ALSTM (Yao Qin, et al.) | Alpha360 | 0.0497±0.00 | 0.3829±0.04 | 0.0599±0.00 | 0.4736±0.03 | 0.0626±0.02 | 0.8651±0.31 | -0.0994±0.03 |
| LSTM(Sepp Hochreiter, et al.) | Alpha360 | 0.0448±0.00 | 0.3474±0.04 | 0.0549±0.00 | 0.4366±0.03 | 0.0647±0.03 | 0.8963±0.39 | -0.0875±0.02 |
| GRU(Kyunghyun Cho, et al.) | Alpha360 | 0.0493±0.00 | 0.3772±0.04 | 0.0584±0.00 | 0.4638±0.03 | 0.0720±0.02 | 0.9730±0.33 | -0.0821±0.02 |
| GATs (Petar Velickovic, et al.) | Alpha360 | 0.0476±0.00 | 0.3508±0.02 | 0.0598±0.00 | 0.4604±0.01 | 0.0824±0.02 | 1.1079±0.26 | -0.0894±0.03 |
| TCTS(Xueqing Wu, et al.) | Alpha360 | 0.0508±0.00 | 0.3931±0.04 | 0.0599±0.00 | 0.4756±0.03 | 0.0893±0.03 | 1.2256±0.36 | -0.0857±0.02 |
| TRA(Hengxu Lin, et al.) | Alpha360 | 0.0485±0.00 | 0.3787±0.03 | 0.0587±0.00 | 0.4756±0.03 | 0.0920±0.03 | 1.2789±0.42 | -0.0834±0.02 |
- The selected 20 features are based on the feature importance of a lightgbm-based model.
- The base model of DoubleEnsemble is LGBM.
- The base model of TCTS is GRU.

View File

@@ -1,4 +1,4 @@
pandas==1.1.2
numpy==1.17.4
scikit_learn==0.23.2
torch==1.7.0
torch==1.7.0

View File

@@ -26,19 +26,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: SFM
@@ -73,7 +78,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -0,0 +1,38 @@
# Temporally Correlated Task Scheduling for Sequence Learning
### Background
Sequence learning has attracted much research attention from the machine learning community in recent years. In many applications, a sequence learning task is usually associated with multiple temporally correlated auxiliary tasks, which are different in terms of how much input information to use or which future step to predict. In stock trend forecasting, as demonstrated in Figure1, one can predict the price of a stock in different future days (e.g., tomorrow, the day after tomorrow). In this paper, we propose a framework to make use of those temporally correlated tasks to help each other.
### Method
Given that there are usually multiple temporally correlated tasks, the key challenge lies in which tasks to use and when to use them in the training process. This work introduces a learnable task scheduler for sequence learning, which adaptively selects temporally correlated tasks during the training process. The scheduler accesses the model status and the current training data (e.g., in the current minibatch) and selects the best auxiliary task to help the training of the main task. The scheduler and the model for the main task are jointly trained through bi-level optimization: the scheduler is trained to maximize the validation performance of the model, and the model is trained to minimize the training loss guided by the scheduler. The process is demonstrated in Figure2.
<p align="center">
<img src="workflow.png"/>
</p>
At step <img src="https://latex.codecogs.com/png.latex?s" title="s" />, with training data <img src="https://latex.codecogs.com/png.latex?x_s,y_s" title="x_s,y_s" />, the scheduler <img src="https://latex.codecogs.com/png.latex?\varphi" title="\varphi" /> chooses a suitable task <img src="https://latex.codecogs.com/png.latex?T_{i_s}" title="T_{i_s}" /> (green solid lines) to update the model <img src="https://latex.codecogs.com/png.latex?f" title="f" /> (blue solid lines). After <img src="https://latex.codecogs.com/png.latex?S" title="S" /> steps, we evaluate the model <img src="https://latex.codecogs.com/png.latex?f" title="f" /> on the validation set and update the scheduler <img src="https://latex.codecogs.com/png.latex?\varphi" title="\varphi" /> (green dashed lines).
### Experiments
Due to different data versions and different Qlib versions, the original data and data preprocessing methods of the experimental settings in the paper are different from those experimental settings in the existing Qlib version. Therefore, we provide two versions of the code according to the two kinds of settings, 1) the [code](https://github.com/lwwang1995/tcts) that can be used to reproduce the experimental results and 2) the [code](https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_tcts.py) in the current Qlib baseline.
#### Setting1
* Dataset: We use the historical transaction data for 300 stocks on [CSI300](http://www.csindex.com.cn/en/indices/index-detail/000300) from 01/01/2008 to 08/01/2020. We split the data into training (01/01/2008-12/31/2013), validation (01/01/2014-12/31/2015), and test sets (01/01/2016-08/01/2020) based on the transaction time.
* The main tasks <img src="https://latex.codecogs.com/png.latex?T_k" title="T_k" /> refers to forecasting return of stock <img src="https://latex.codecogs.com/png.latex?i" title="i" /> as following,
<div align=center>
<img src="https://latex.codecogs.com/png.image?\dpi{110}&space;r_{i}^{t,k}&space;=&space;\frac{price_i^{t&plus;k}}{price_i^{t&plus;k-1}}-1" title="r_{i}^{t,k} = \frac{price_i^{t+k}}{price_i^{t+k-1}}-1" />
</div>
* Temporally correlated task sets <img src="https://latex.codecogs.com/png.latex?\mathcal{T}_k&space;=&space;\{T_1,&space;T_2,&space;...&space;,&space;T_k\}" title="\mathcal{T}_k = \{T_1, T_2, ... , T_k\}" />, in this paper, <img src="https://latex.codecogs.com/png.latex?\mathcal{T}_3" title="\mathcal{T}_3" />, <img src="https://latex.codecogs.com/png.latex?\mathcal{T}_5" title="\mathcal{T}_5" /> and <img src="https://latex.codecogs.com/png.latex?\mathcal{T}_{10}" title="\mathcal{T}_{10}" /> are used in <img src="https://latex.codecogs.com/png.latex?T_1" title="T_1" />, <img src="https://latex.codecogs.com/png.latex?T_2" title="T_2" />, and <img src="https://latex.codecogs.com/png.latex?T_3" title="T_3" />.
#### Setting2
* Dataset: We use the historical transaction data for 300 stocks on [CSI300](http://www.csindex.com.cn/en/indices/index-detail/000300) from 01/01/2008 to 08/01/2020. We split the data into training (01/01/2008-12/31/2014), validation (01/01/2015-12/31/2016), and test sets (01/01/2017-08/01/2020) based on the transaction time.
* The main tasks <img src="https://latex.codecogs.com/png.latex?T_k" title="T_k" /> refers to forecasting return of stock <img src="https://latex.codecogs.com/png.latex?i" title="i" /> as following,
<div align=center>
<img src="https://latex.codecogs.com/png.image?\dpi{110}&space;r_{i}^{t,k}&space;=&space;\frac{price_i^{t&plus;1&plus;k}}{price_i^{t&plus;1}}-1" title="r_{i}^{t,k} = \frac{price_i^{t+1+k}}{price_i^{t+1}}-1" />
</div>
* In Qlib baseline, <img src="https://latex.codecogs.com/png.latex?\mathcal{T}_3" title="\mathcal{T}_3" />, is used in <img src="https://latex.codecogs.com/png.latex?T_1" title="T_1" />.
### Experimental Result
You can find the experimental result of setting1 in the [paper](http://proceedings.mlr.press/v139/wu21e/wu21e.pdf) and the experimental result of setting2 in this [page](https://github.com/microsoft/qlib/tree/main/examples/benchmarks).

View File

@@ -0,0 +1,4 @@
pandas==1.1.2
numpy==1.17.4
scikit_learn==0.23.2
torch==1.7.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -0,0 +1,98 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &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: *market
infer_processors:
- class: RobustZScoreNorm
kwargs:
fields_group: feature
clip_outlier: true
- class: Fillna
kwargs:
fields_group: feature
learn_processors:
- class: DropnaLabel
- class: CSRankNorm
kwargs:
fields_group: label
label: ["Ref($close, -2) / Ref($close, -1) - 1",
"Ref($close, -3) / Ref($close, -1) - 1",
"Ref($close, -4) / Ref($close, -1) - 1"]
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: TCTS
module_path: qlib.contrib.model.pytorch_tcts
kwargs:
d_feat: 6
hidden_size: 64
num_layers: 2
dropout: 0.3
n_epochs: 200
early_stop: 20
batch_size: 800
metric: loss
loss: mse
GPU: 0
fore_optimizer: adam
weight_optimizer: adam
output_dim: 3
fore_lr: 2e-3
weight_lr: 2e-3
steps: 3
target_label: 0
lowest_valid_performance: 0.993
dataset:
class: DatasetH
module_path: qlib.data.dataset
kwargs:
handler:
class: Alpha360
module_path: qlib.contrib.data.handler
kwargs: *data_handler_config
segments:
train: [2008-01-01, 2014-12-31]
valid: [2015-01-01, 2016-12-31]
test: [2017-01-01, 2020-08-01]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
ana_long_short: False
ann_scaler: 252
- class: PortAnaRecord
module_path: qlib.workflow.record_temp
kwargs:
config: *port_analysis_config

View File

@@ -8,7 +8,7 @@
Users can follow the ``workflow_by_code_tft.py`` to run the benchmark.
### Notes
1. Please be **aware** that this script can only support `Python 3.5 - 3.8`.
1. Please be **aware** that this script can only support `Python 3.6 - 3.7`.
2. If the CUDA version on your machine is not 10.0, please remember to run the following commands `conda install anaconda cudatoolkit=10.0` and `conda install cudnn` on your machine.
3. The model must run in GPU, or an error will be raised.
4. New datasets should be registered in ``data_formatters``, for detail please visit the source.

View File

@@ -132,7 +132,7 @@ class GenericDataFormatter(abc.ABC):
return -1, -1
def get_column_definition(self):
""""Returns formatted column definition in order expected by the TFT."""
"""Returns formatted column definition in order expected by the TFT."""
column_definition = self._column_definition

View File

@@ -195,7 +195,8 @@ class Alpha158Formatter(GenericDataFormatter):
for col in column_names:
if col not in {"forecast_time", "identifier"}:
output[col] = self._target_scaler.inverse_transform(predictions[col])
# Using [col] is for aligning with the format when fitting
output[col] = self._target_scaler.inverse_transform(predictions[[col]])
return output

View File

@@ -1,3 +1,2 @@
tensorflow-gpu==1.15.0
numpy == 1.19.4
pandas==1.1.0
pandas==1.1.0

View File

@@ -1,6 +1,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from pathlib import Path
from typing import Union
import numpy as np
import pandas as pd
import tensorflow.compat.v1 as tf
@@ -243,7 +245,7 @@ class TFTModel(ModelFT):
# extract_numerical_data(targets), extract_numerical_data(p90_forecast),
# 0.9)
tf.keras.backend.set_session(default_keras_session)
print("Training completed.".format(dte.datetime.now()))
print("Training completed at {}.".format(dte.datetime.now()))
# ===========================Training Process===========================
def predict(self, dataset):
@@ -289,3 +291,31 @@ class TFTModel(ModelFT):
dataset for finetuning
"""
pass
def to_pickle(self, path: Union[Path, str]):
"""
Tensorflow model can't be dumped directly.
So the data should be save seperatedly
**TODO**: Please implement the function to load the files
Parameters
----------
path : Union[Path, str]
the target path to be dumped
"""
# FIXME: implementing saving tensorflow models
# save tensorflow model
# path = Path(path)
# path.mkdir(parents=True)
# self.model.save(path)
# save qlib model wrapper
drop_attrs = ["model", "tf_graph", "sess", "data_formatter"]
orig_attr = {}
for attr in drop_attrs:
orig_attr[attr] = getattr(self, attr)
setattr(self, attr, None)
super(TFTModel, self).to_pickle(path)
for attr in drop_attrs:
setattr(self, attr, orig_attr[attr])

View File

@@ -14,19 +14,24 @@ data_handler_config: &data_handler_config
port_analysis_config: &port_analysis_config
strategy:
class: TopkDropoutStrategy
module_path: qlib.contrib.strategy.strategy
module_path: qlib.contrib.strategy
kwargs:
signal:
- <MODEL>
- <DATASET>
topk: 50
n_drop: 5
backtest:
verbose: False
limit_threshold: 0.095
start_time: 2017-01-01
end_time: 2020-08-01
account: 100000000
benchmark: *benchmark
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
exchange_kwargs:
limit_threshold: 0.095
deal_price: close
open_cost: 0.0005
close_cost: 0.0015
min_cost: 5
task:
model:
class: TFTModel
@@ -46,7 +51,9 @@ task:
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
kwargs: {}
kwargs:
model: <MODEL>
dataset: <DATASET>
- class: SigAnaRecord
module_path: qlib.workflow.record_temp
kwargs:

View File

@@ -0,0 +1,93 @@
# Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport
Temporal Routing Adaptor (TRA) is designed to capture multiple trading patterns in the stock market data. Please refer to [our paper](http://arxiv.org/abs/2106.12950) for more details.
If you find our work useful in your research, please cite:
```
@inproceedings{HengxuKDD2021,
author = {Hengxu Lin and Dong Zhou and Weiqing Liu and Jiang Bian},
title = {Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport},
booktitle = {Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery \& Data Mining},
series = {KDD '21},
year = {2021},
publisher = {ACM},
}
@article{yang2020qlib,
title={Qlib: An AI-oriented Quantitative Investment Platform},
author={Yang, Xiao and Liu, Weiqing and Zhou, Dong and Bian, Jiang and Liu, Tie-Yan},
journal={arXiv preprint arXiv:2009.11189},
year={2020}
}
```
## Usage (Recommended)
**Update**: `TRA` has been moved to `qlib.contrib.model.pytorch_tra` to support other `Qlib` components like `qlib.workflow` and `Alpha158/Alpha360` dataset.
Please follow the official [doc](https://qlib.readthedocs.io/en/latest/component/workflow.html) to use `TRA` with `workflow`. Here we also provide several example config files:
- `workflow_config_tra_Alpha360.yaml`: running `TRA` with `Alpha360` dataset
- `workflow_config_tra_Alpha158.yaml`: running `TRA` with `Alpha158` dataset (with feature subsampling)
- `workflow_config_tra_Alpha158_full.yaml`: running `TRA` with `Alpha158` dataset (without feature subsampling)
The performances of `TRA` are reported in [Benchmarks](https://github.com/microsoft/qlib/tree/main/examples/benchmarks).
## Usage (Not Maintained)
This section is used to reproduce the results in the paper.
### Running
We attach our running scripts for the paper in `run.sh`.
And here are two ways to run the model:
* Running from scripts with default parameters
You can directly run from Qlib command `qrun`:
```
qrun configs/config_alstm.yaml
```
* Running from code with self-defined parameters
Setting different parameters is also allowed. See codes in `example.py`:
```
python example.py --config_file configs/config_alstm.yaml
```
Here we trained TRA on a pretrained backbone model. Therefore we run `*_init.yaml` before TRA's scipts.
### Results
After running the scripts, you can find result files in path `./output`:
* `info.json` - config settings and result metrics.
* `log.csv` - running logs.
* `model.bin` - the model parameter dictionary.
* `pred.pkl` - the prediction scores and output for inference.
Evaluation metrics reported in the paper:
This result is generated by qlib==0.7.1.
| Methods | MSE| MAE| IC | ICIR | AR | AV | SR | MDD |
|-------|-------|------|-----|-----|-----|-----|-----|-----|
|Linear|0.163|0.327|0.020|0.132|-3.2%|16.8%|-0.191|32.1%|
|LightGBM|0.160(0.000)|0.323(0.000)|0.041|0.292|7.8%|15.5%|0.503|25.7%|
|MLP|0.160(0.002)|0.323(0.003)|0.037|0.273|3.7%|15.3%|0.264|26.2%|
|SFM|0.159(0.001) |0.321(0.001) |0.047 |0.381 |7.1% |14.3% |0.497 |22.9%|
|ALSTM|0.158(0.001) |0.320(0.001) |0.053 |0.419 |12.3% |13.7% |0.897 |20.2%|
|Trans.|0.158(0.001) |0.322(0.001) |0.051 |0.400 |14.5% |14.2% |1.028 |22.5%|
|ALSTM+TS|0.160(0.002) |0.321(0.002) |0.039 |0.291 |6.7% |14.6% |0.480|22.3%|
|Trans.+TS|0.160(0.004) |0.324(0.005) |0.037 |0.278 |10.4% |14.7% |0.722 |23.7%|
|ALSTM+TRA(Ours)|0.157(0.000) |0.318(0.000) |0.059 |0.460 |12.4% |14.0% |0.885 |20.4%|
|Trans.+TRA(Ours)|0.157(0.000) |0.320(0.000) |0.056 |0.442 |16.1% |14.2% |1.133 |23.1%|
A more detailed demo for our experiment results in the paper can be found in `Report.ipynb`.
## Common Issues
For help or issues using TRA, please submit a GitHub issue.
Sometimes we might encounter situation where the loss is `NaN`, please check the `epsilon` parameter in the sinkhorn algorithm, adjusting the `epsilon` according to input's scale is important.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
data_loader_config: &data_loader_config
class: StaticDataLoader
module_path: qlib.data.dataset.loader
kwargs:
config:
feature: data/feature.pkl
label: data/label.pkl
model_config: &model_config
input_size: 16
hidden_size: 256
num_layers: 2
num_heads: 2
use_attn: True
dropout: 0.1
num_states: &num_states 1
tra_config: &tra_config
num_states: *num_states
hidden_size: 16
tau: 1.0
src_info: LR_TPE
task:
model:
class: TRAModel
module_path: src/model.py
kwargs:
lr: 0.0002
n_epochs: 500
max_steps_per_epoch: 100
early_stop: 20
seed: 1000
logdir: output/test/alstm
model_type: LSTM
model_config: *model_config
tra_config: *tra_config
lamb: 1.0
rho: 0.99
freeze_model: False
model_init_state:
dataset:
class: MTSDatasetH
module_path: src/dataset.py
kwargs:
handler:
class: DataHandler
module_path: qlib.data.dataset.handler
kwargs:
data_loader: *data_loader_config
segments:
train: [2007-10-30, 2016-05-27]
valid: [2016-09-26, 2018-05-29]
test: [2018-09-21, 2020-06-30]
seq_len: 60
horizon: 21
num_states: *num_states
batch_size: 1024

View File

@@ -0,0 +1,63 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
data_loader_config: &data_loader_config
class: StaticDataLoader
module_path: qlib.data.dataset.loader
kwargs:
config:
feature: data/feature.pkl
label: data/label.pkl
model_config: &model_config
input_size: 16
hidden_size: 256
num_layers: 2
num_heads: 2
use_attn: True
dropout: 0.1
num_states: &num_states 10
tra_config: &tra_config
num_states: *num_states
hidden_size: 16
tau: 1.0
src_info: LR_TPE
task:
model:
class: TRAModel
module_path: src/model.py
kwargs:
lr: 0.0001
n_epochs: 500
max_steps_per_epoch: 100
early_stop: 20
seed: 1000
logdir: output/test/alstm_tra
model_type: LSTM
model_config: *model_config
tra_config: *tra_config
lamb: 2.0
rho: 0.99
freeze_model: True
model_init_state: output/test/alstm_tra_init/model.bin
dataset:
class: MTSDatasetH
module_path: src/dataset.py
kwargs:
handler:
class: DataHandler
module_path: qlib.data.dataset.handler
kwargs:
data_loader: *data_loader_config
segments:
train: [2007-10-30, 2016-05-27]
valid: [2016-09-26, 2018-05-29]
test: [2018-09-21, 2020-06-30]
seq_len: 60
horizon: 21
num_states: *num_states
batch_size: 1024

View File

@@ -0,0 +1,63 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
data_loader_config: &data_loader_config
class: StaticDataLoader
module_path: qlib.data.dataset.loader
kwargs:
config:
feature: data/feature.pkl
label: data/label.pkl
model_config: &model_config
input_size: 16
hidden_size: 256
num_layers: 2
num_heads: 2
use_attn: True
dropout: 0.1
num_states: &num_states 3
tra_config: &tra_config
num_states: *num_states
hidden_size: 16
tau: 1.0
src_info: LR_TPE
task:
model:
class: TRAModel
module_path: src/model.py
kwargs:
lr: 0.0002
n_epochs: 500
max_steps_per_epoch: 100
early_stop: 20
seed: 1000
logdir: output/test/alstm_tra_init
model_type: LSTM
model_config: *model_config
tra_config: *tra_config
lamb: 1.0
rho: 0.99
freeze_model: False
model_init_state:
dataset:
class: MTSDatasetH
module_path: src/dataset.py
kwargs:
handler:
class: DataHandler
module_path: qlib.data.dataset.handler
kwargs:
data_loader: *data_loader_config
segments:
train: [2007-10-30, 2016-05-27]
valid: [2016-09-26, 2018-05-29]
test: [2018-09-21, 2020-06-30]
seq_len: 60
horizon: 21
num_states: *num_states
batch_size: 512

View File

@@ -0,0 +1,63 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
data_loader_config: &data_loader_config
class: StaticDataLoader
module_path: qlib.data.dataset.loader
kwargs:
config:
feature: data/feature.pkl
label: data/label.pkl
model_config: &model_config
input_size: 16
hidden_size: 64
num_layers: 2
num_heads: 4
use_attn: False
dropout: 0.1
num_states: &num_states 1
tra_config: &tra_config
num_states: *num_states
hidden_size: 16
tau: 1.0
src_info: LR_TPE
task:
model:
class: TRAModel
module_path: src/model.py
kwargs:
lr: 0.0002
n_epochs: 500
max_steps_per_epoch: 100
early_stop: 20
seed: 1000
logdir: output/test/transformer
model_type: Transformer
model_config: *model_config
tra_config: *tra_config
lamb: 1.0
rho: 0.99
freeze_model: False
model_init_state:
dataset:
class: MTSDatasetH
module_path: src/dataset.py
kwargs:
handler:
class: DataHandler
module_path: qlib.data.dataset.handler
kwargs:
data_loader: *data_loader_config
segments:
train: [2007-10-30, 2016-05-27]
valid: [2016-09-26, 2018-05-29]
test: [2018-09-21, 2020-06-30]
seq_len: 60
horizon: 21
num_states: *num_states
batch_size: 1024

View File

@@ -0,0 +1,63 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
data_loader_config: &data_loader_config
class: StaticDataLoader
module_path: qlib.data.dataset.loader
kwargs:
config:
feature: data/feature.pkl
label: data/label.pkl
model_config: &model_config
input_size: 16
hidden_size: 64
num_layers: 2
num_heads: 4
use_attn: False
dropout: 0.1
num_states: &num_states 3
tra_config: &tra_config
num_states: *num_states
hidden_size: 16
tau: 1.0
src_info: LR_TPE
task:
model:
class: TRAModel
module_path: src/model.py
kwargs:
lr: 0.0005
n_epochs: 500
max_steps_per_epoch: 100
early_stop: 20
seed: 1000
logdir: output/test/transformer_tra
model_type: Transformer
model_config: *model_config
tra_config: *tra_config
lamb: 1.0
rho: 0.99
freeze_model: True
model_init_state: output/test/transformer_tra_init/model.bin
dataset:
class: MTSDatasetH
module_path: src/dataset.py
kwargs:
handler:
class: DataHandler
module_path: qlib.data.dataset.handler
kwargs:
data_loader: *data_loader_config
segments:
train: [2007-10-30, 2016-05-27]
valid: [2016-09-26, 2018-05-29]
test: [2018-09-21, 2020-06-30]
seq_len: 60
horizon: 21
num_states: *num_states
batch_size: 512

View File

@@ -0,0 +1,63 @@
qlib_init:
provider_uri: "~/.qlib/qlib_data/cn_data"
region: cn
data_loader_config: &data_loader_config
class: StaticDataLoader
module_path: qlib.data.dataset.loader
kwargs:
config:
feature: data/feature.pkl
label: data/label.pkl
model_config: &model_config
input_size: 16
hidden_size: 64
num_layers: 2
num_heads: 4
use_attn: False
dropout: 0.1
num_states: &num_states 3
tra_config: &tra_config
num_states: *num_states
hidden_size: 16
tau: 1.0
src_info: LR_TPE
task:
model:
class: TRAModel
module_path: src/model.py
kwargs:
lr: 0.0002
n_epochs: 500
max_steps_per_epoch: 100
early_stop: 20
seed: 1000
logdir: output/test/transformer_tra_init
model_type: Transformer
model_config: *model_config
tra_config: *tra_config
lamb: 1.0
rho: 0.99
freeze_model: False
model_init_state:
dataset:
class: MTSDatasetH
module_path: src/dataset.py
kwargs:
handler:
class: DataHandler
module_path: qlib.data.dataset.handler
kwargs:
data_loader: *data_loader_config
segments:
train: [2007-10-30, 2016-05-27]
valid: [2016-09-26, 2018-05-29]
test: [2018-09-21, 2020-06-30]
seq_len: 60
horizon: 21
num_states: *num_states
batch_size: 512

View File

@@ -0,0 +1 @@
Data Link: https://drive.google.com/drive/folders/1fMqZYSeLyrHiWmVzygeI4sw3vp5Gt8cY?usp=sharing

View File

@@ -0,0 +1,39 @@
import argparse
import qlib
import ruamel.yaml as yaml
from qlib.utils import init_instance_by_config
def main(seed, config_file="configs/config_alstm.yaml"):
# set random seed
with open(config_file) as f:
config = yaml.safe_load(f)
# seed_suffix = "/seed1000" if "init" in config_file else f"/seed{seed}"
seed_suffix = ""
config["task"]["model"]["kwargs"].update(
{"seed": seed, "logdir": config["task"]["model"]["kwargs"]["logdir"] + seed_suffix}
)
# initialize workflow
qlib.init(
provider_uri=config["qlib_init"]["provider_uri"],
region=config["qlib_init"]["region"],
)
dataset = init_instance_by_config(config["task"]["dataset"])
model = init_instance_by_config(config["task"]["model"])
# train model
model.fit(dataset)
if __name__ == "__main__":
# set params from cmd
parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--seed", type=int, default=1000, help="random seed")
parser.add_argument("--config_file", type=str, default="configs/config_alstm.yaml", help="config file")
args = parser.parse_args()
main(**vars(args))

View File

@@ -0,0 +1,5 @@
pandas==1.1.2
numpy==1.17.4
scikit_learn==0.23.2
torch==1.7.0
seaborn

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# we used random seed(1 1000 2000 3000 4000 5000) in our experiments
# Directly run from Qlib command `qrun`
qrun configs/config_alstm.yaml
qrun configs/config_transformer.yaml
qrun configs/config_transformer_tra_init.yaml
qrun configs/config_transformer_tra.yaml
qrun configs/config_alstm_tra_init.yaml
qrun configs/config_alstm_tra.yaml
# Or setting different parameters with example.py
python example.py --config_file configs/config_alstm.yaml
python example.py --config_file configs/config_transformer.yaml
python example.py --config_file configs/config_transformer_tra_init.yaml
python example.py --config_file configs/config_transformer_tra.yaml
python example.py --config_file configs/config_alstm_tra_init.yaml
python example.py --config_file configs/config_alstm_tra.yaml

Some files were not shown because too many files have changed in this diff Show More