Skip to content
All library documents

Qlib High-Frequency Alpha158 Classification Workflow Configuration

Code Qlib

Summary

This configuration describes a Qlib workflow for training a binary LightGBM model on one-minute CSI 300 data from China. It uses the Alpha158 feature handler, robust feature normalization, missing-value filling, and cross-sectional label ranking. The label is based on the ratio between future close prices at adjacent forward offsets. The configured model uses binary log loss and AUC as its evaluation metrics, with training, validation, and test periods specified in the configuration.

The file also defines signal-recording components for workflow outputs. Its value is as a reproducible configuration example rather than a complete trading strategy: it does not specify portfolio construction, entry and exit rules, transaction costs, or reported results. The date ranges are limited to the period shown, and interpretation depends on the exact Qlib implementation of the feature handler, label expression, and model classes. No evidence is included about out-of-sample performance or practical execution.

Key ideas

  • The workflow trains a binary LightGBM classifier on one-minute CSI 300 data using Alpha158 features.
  • Feature preprocessing applies robust normalization and fills missing values.
  • The label compares two forward close-price references, while evaluation uses binary log loss and AUC.
  • The configuration defines training, validation, and test periods but provides no performance results.
  • Portfolio construction, trading rules, and transaction costs are outside the scope of this file.

Tags

Full text
# workflow_config_High_Freq_Tree_Alpha158.yaml


```yaml
qlib_init:
    provider_uri: "~/.qlib/qlib_data/cn_data_1min"
    region: cn
market: &market 'csi300'
start_time: &start_time "2020-09-15 00:00:00"
end_time: &end_time "2021-01-18 16:00:00"
train_end_time: &train_end_time "2020-11-15 16:00:00"
valid_start_time: &valid_start_time "2020-11-16 00:00:00"
valid_end_time: &valid_end_time "2020-11-30 16:00:00"
test_start_time: &test_start_time "2020-12-01 00:00:00"
data_handler_config: &data_handler_config
    start_time: *start_time
    end_time: *end_time
    fit_start_time: *start_time
    fit_end_time: *train_end_time
    instruments: *market
    freq: '1min'
    infer_processors:
        - class: 'RobustZScoreNorm'
          kwargs:
              fields_group: 'feature'
              clip_outlier: false
        - class: "Fillna"
          kwargs:
              fields_group: 'feature'
    learn_processors:
        - class: 'DropnaLabel'
        - class: 'CSRankNorm'
          kwargs:
              fields_group: 'label'
    label: ["Ref($close, -2) / Ref($close, -1) - 1"]
    
task:
    model:
        class: "HFLGBModel"
        module_path: "qlib.contrib.model.highfreq_gdbt_model"
        kwargs:
            objective: 'binary'
            metric: ['binary_logloss','auc']
            verbosity: -1
            learning_rate: 0.01
            max_depth: 8
            num_leaves: 150
            lambda_l1: 1.5
            lambda_l2: 1
            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: [*start_time, *train_end_time]
                valid: [*train_end_time, *valid_end_time]
                test: [*test_start_time, *end_time]
    record: 
        - class: "SignalRecord"
          module_path: "qlib.workflow.record_temp"
          kwargs: {}
        - class: "HFSignalRecord"
          module_path: "qlib.workflow.record_temp"
          kwargs: {}
```

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.