퀀트 투자/Qlib

[Qlib] CH2. 플랫폼 Overview

SKY-STONE 2024. 1. 9. 13:19

Microsoft Qlib Framework

Contents

  1. Installation
  2. Framework Overview
  3. Main Component
    • Dataset
    • Train
    • Backtest
  4. Examples

 

CH2. Framework Overview

Introduction
  1. Qlib는 AI 기반 퀀트 투자 연구 목적으로 마이크로 소프트에서 제작한 툴로 두가지 특장점이 있음
  2. Framework UX: 다양한 Layer로 퀀트 투자에 필요한 모든 기능이 포함된 all-in-one 플랫폼임
  3. Framework UI: Configuration 정의와 qrun 실행 명령어로 코딩없이 누구든 쉽게 사용하게 만들었음
 

Qlib: Quantitative Platform — QLib 0.9.3.99 documentation

Introduction Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment. With Qlib, users can easily try their ideas to create bette

qlib.readthedocs.io


1. Framework UX(User Experience)
  • 데이터 준비 단계(Infrastracture) 부터 Interface(Onlie Serving) 까지 end2end로 Framework 하나에 전체가 구성됨

Qlib Framework Overview

 

2. Framework UI(User Interface)
  • Configuration Setting: 소스코딩 없이 간단한 Configuration file의 옵션 변경으로 쉽게 다양한 실험 가능
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.strategy
        kwargs:
            topk: 50
            n_drop: 5
            signal: <PRED>
    backtest:
        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.0421
            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: PortAnaRecord
          module_path: qlib.workflow.record_temp
          kwargs:
              config: *port_analysis_config
  • Run the framework
qrun configuration.yaml