You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport
2
2
3
-
This code provides a PyTorch implementation for TRA (Temporal Routing Adaptor), as described in the paper [Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport](http://arxiv.org/abs/2106.12950).
3
+
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.
4
4
5
-
* TRA (Temporal Routing Adaptor) is a lightweight module that consists of a set of independent predictors for learning multiple patterns as well as a router to dispatch samples to different predictors.
6
-
* We also design a learning algorithm based on Optimal Transport (OT) to obtain the optimal sample to predictor assignment and effectively optimize the router with such assignment through an auxiliary loss term.
5
+
If you find our work useful in your research, please cite:
6
+
```
7
+
@inproceedings{HengxuKDD2021,
8
+
author = {Hengxu Lin and Dong Zhou and Weiqing Liu and Jiang Bian},
9
+
title = {Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport},
10
+
booktitle = {Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery \& Data Mining},
11
+
series = {KDD '21},
12
+
year = {2021},
13
+
publisher = {ACM},
14
+
}
15
+
16
+
@article{yang2020qlib,
17
+
title={Qlib: An AI-oriented Quantitative Investment Platform},
18
+
author={Yang, Xiao and Liu, Weiqing and Zhou, Dong and Bian, Jiang and Liu, Tie-Yan},
19
+
journal={arXiv preprint arXiv:2009.11189},
20
+
year={2020}
21
+
}
22
+
```
23
+
24
+
## Usage (Recommended)
25
+
26
+
**Update**: `TRA` has been moved to `qlib.contrib.model.pytorch_tra` to support other `Qlib` components like `qlib.workflow` and `Alpha158/Alpha360` dataset.
27
+
28
+
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:
29
+
30
+
-`workflow_config_tra_Alpha360.yaml`: running `TRA` with `Alpha360` dataset
31
+
-`workflow_config_tra_Alpha158.yaml`: running `TRA` with `Alpha158` dataset (with feature subsampling)
32
+
-`workflow_config_tra_Alpha158_full.yaml`: running `TRA` with `Alpha158` dataset (without feature subsampling)
7
33
34
+
The performances of `TRA` are reported in [Benchmarks](https://github.com/microsoft/qlib/tree/main/examples/benchmarks).
8
35
9
-
#Running TRA
36
+
## Usage (Not Maintained)
10
37
11
-
## Requirements
12
-
- Install `Qlib` main branch
38
+
This section is used to reproduce the results in the paper.
13
39
14
-
## Running
40
+
###Running
15
41
16
42
We attach our running scripts for the paper in `run.sh`.
17
43
18
44
And here are two ways to run the model:
19
45
20
46
* Running from scripts with default parameters
21
-
You can directly run from Qlib command `qrun`:
22
-
```
23
-
qrun configs/config_alstm.yaml
24
-
```
47
+
48
+
You can directly run from Qlib command `qrun`:
49
+
```
50
+
qrun configs/config_alstm.yaml
51
+
```
25
52
26
53
* Running from code with self-defined parameters
27
-
Setting different parameters is also allowed. See codes in `example.py`:
@@ -61,21 +85,8 @@ After running the scripts, you can find result files in path `./output`:
61
85
62
86
A more detailed demo for our experiment results in the paper can be found in `Report.ipynb`.
63
87
64
-
# Common Issues
88
+
##Common Issues
65
89
66
90
For help or issues using TRA, please submit a GitHub issue.
67
91
68
-
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.
69
-
70
-
# Citation
71
-
If you find this repository useful in your research, please cite:
72
-
```
73
-
@inproceedings{HengxuKDD2021,
74
-
author = {Hengxu Lin and Dong Zhou and Weiqing Liu and Jiang Bian},
75
-
title = {Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport},
76
-
booktitle = {Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery \& Data Mining},
77
-
series = {KDD '21},
78
-
year = {2021},
79
-
publisher = {ACM},
80
-
}
81
-
```
92
+
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.
0 commit comments