forked from microsoft/qlib
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the HIST and IGMTF model on Alpha360 (microsoft#1040)
* Commit the code of HIST and IGMTF on Alpha360 * add stock index * Update README.md * delete useless code * fix the bug of code format with black * fix pylint bugs * fix the bugs of pylint * fix pylint bugs * fix flake8
- Loading branch information
Showing
11 changed files
with
1,149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# HIST | ||
* Code: [https://github.com/Wentao-Xu/HIST](https://github.com/Wentao-Xu/HIST) | ||
* Paper: [HIST: A Graph-based Framework for Stock Trend Forecasting via Mining Concept-Oriented Shared InformationAdaRNN: Adaptive Learning and Forecasting for Time Series](https://arxiv.org/abs/2110.13716). |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pandas==1.1.2 | ||
numpy==1.21.0 | ||
scikit_learn==0.23.2 | ||
torch==1.7.0 |
92 changes: 92 additions & 0 deletions
92
examples/benchmarks/HIST/workflow_config_hist_Alpha360.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
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: HIST | ||
module_path: qlib.contrib.model.pytorch_hist | ||
kwargs: | ||
d_feat: 6 | ||
hidden_size: 64 | ||
num_layers: 2 | ||
dropout: 0 | ||
n_epochs: 200 | ||
lr: 1e-4 | ||
early_stop: 20 | ||
metric: ic | ||
loss: mse | ||
base_model: LSTM | ||
model_path: "benchmarks/LSTM/model_lstm_csi300.pkl" | ||
stock2concept: "benchmarks/HIST/qlib_csi300_stock2concept.npy" | ||
stock_index: "benchmarks/HIST/qlib_csi300_stock_index.npy" | ||
GPU: 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# IGMTF | ||
* Code: [https://github.com/Wentao-Xu/IGMTF](https://github.com/Wentao-Xu/IGMTF) | ||
* Paper: [IGMTF: An Instance-wise Graph-based Framework for | ||
Multivariate Time Series Forecasting](https://arxiv.org/abs/2109.06489). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pandas==1.1.2 | ||
numpy==1.21.0 | ||
scikit_learn==0.23.2 | ||
torch==1.7.0 |
89 changes: 89 additions & 0 deletions
89
examples/benchmarks/IGMTF/workflow_config_igmtf_Alpha360.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: 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: | ||
model: <MODEL> | ||
dataset: <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: IGMTF | ||
module_path: qlib.contrib.model.pytorch_igmtf | ||
kwargs: | ||
d_feat: 6 | ||
hidden_size: 64 | ||
num_layers: 2 | ||
dropout: 0 | ||
n_epochs: 200 | ||
lr: 1e-4 | ||
early_stop: 20 | ||
metric: ic | ||
loss: mse | ||
base_model: LSTM | ||
model_path: "benchmarks/LSTM/model_lstm_csi300.pkl" | ||
GPU: 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.