Qlib TFT Workflow for CSI 300 Alpha158 Backtesting
Summary
This configuration defines a Qlib workflow for training a Temporal Fusion Transformer model on Alpha158 features for CSI 300 stocks. It sets Chinese market data from 2008 through mid-2020, using 2008–2014 for training, 2015–2016 for validation, and 2017–2020 for testing. Signal analysis and portfolio analysis are recorded as part of the task.
The portfolio stage uses a TopkDropout strategy that holds up to 50 names and can replace five holdings, with SH000300 as the benchmark. The backtest specifies a 100 million account, closing-price execution, a 9.5% limit threshold, and opening, closing, and minimum transaction costs. These settings make the file useful as a reproducible experiment outline, but it contains no model results, signal quality statistics, or returns. The configuration alone does not establish that the model generalizes; interpretation also depends on the underlying data, feature construction, execution assumptions, and potential sources of bias.
Key ideas
- The workflow trains a TFT model using Qlib's Alpha158 data handler for CSI 300 instruments.
- Training, validation, and test periods are separated across the 2008–2020 sample.
- Portfolio evaluation applies a TopkDropout strategy with a 50-stock target and five dropped holdings.
- The backtest uses SH000300 as its benchmark and specifies closing-price fills and transaction costs.
- The configuration describes an experiment setup but reports no predictive or investment performance.
Tags
Full text
# workflow_config_tft_Alpha158.yaml
```yaml
sys:
rel_path: .
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: <PRED>
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: TFTModel
module_path: tft
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
```Shown in full with attribution under the source's licence. Licence: MIT
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.