# hzjken/hft-price-prediction architecture

> Architecture diagram of the GitHub repository hzjken/hft-price-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hzjken/hft-price-prediction
- Repository: https://github.com/hzjken/hft-price-prediction

## Overview

This is a high-frequency trading price-movement classification project. Its workflow transforms market data, engineers and selects features, trains tree-based classifiers, and uses saved models and selected features for prediction. The README documents preprocessing, correlation filtering, feature engineering, hybrid selection, and LightGBM tuning; the excerpt shows parts of the implementation and prediction path. Some training orchestration is omitted, so links for that flow rely on the README rather than an inspected full pipeline.

Main entry points: [`modelling_pipeline.py`](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py) (Price prediction), [`data.csv`](https://github.com/hzjken/hft-price-prediction/blob/master/data.csv) (Market data), [`rf.joblib`](https://github.com/hzjken/hft-price-prediction/blob/master/rf.joblib) (Saved RF model), [`lgbm.joblib`](https://github.com/hzjken/hft-price-prediction/blob/master/lgbm.joblib) (Saved LightGBM model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_market_data["Market data<br/>[data.csv]"]
  node_preprocess["Preprocessing"]
end

subgraph group_features["Feature processing"]
  node_correlation["Correlation filter"]
  node_feature_engineering["Feature engineering"]
  node_feature_selection["Feature selection"]
  node_selected_features["Selected features<br/>[features.txt]"]
end

subgraph group_models["Modeling and prediction"]
  node_rf["Random forest"]
  node_lightgbm["LightGBM"]
  node_tuning["Parameter tuning"]
  node_rf_model[("Saved RF model<br/>[rf.joblib]")]
  node_lgbm_model[("Saved LightGBM model<br/>[lgbm.joblib]")]
  node_prediction["Price prediction"]
  node_result["Class prediction"]
end

node_user(("Analyst"))

node_user -->|"provides"| node_market_data
node_market_data -->|"preprocesses"| node_preprocess
node_preprocess -->|"filters"| node_correlation
node_correlation -->|"engineers"| node_feature_engineering
node_feature_engineering -->|"selects"| node_feature_selection
node_feature_selection -->|"uses selection"| node_rf
node_feature_selection -->|"uses selection"| node_lightgbm
node_lightgbm -->|"tunes parameters"| node_tuning
node_user -.->|"requests prediction"| node_prediction
node_prediction -->|"preprocesses"| node_preprocess
node_prediction -->|"loads features"| node_selected_features
node_prediction -->|"loads model"| node_rf_model
node_prediction -->|"loads model"| node_lgbm_model
node_prediction -->|"returns prediction"| node_result
node_rf -->|"saves model"| node_rf_model
node_lightgbm -->|"saves model"| node_lgbm_model

click node_market_data "https://github.com/hzjken/hft-price-prediction/blob/master/data.csv"
click node_preprocess "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_correlation "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_feature_engineering "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_feature_selection "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_selected_features "https://github.com/hzjken/hft-price-prediction/blob/master/features.txt"
click node_rf "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_lightgbm "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_tuning "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"
click node_rf_model "https://github.com/hzjken/hft-price-prediction/blob/master/rf.joblib"
click node_lgbm_model "https://github.com/hzjken/hft-price-prediction/blob/master/lgbm.joblib"
click node_prediction "https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_market_data,node_preprocess toneBlue
class node_correlation,node_feature_engineering,node_feature_selection,node_selected_features toneAmber
class node_rf,node_lightgbm,node_tuning,node_rf_model,node_lgbm_model,node_prediction,node_result toneMint
class node_user toneIndigo
```

## Components

### Data preparation

- [Market data](https://github.com/hzjken/hft-price-prediction/blob/master/data.csv): `data.csv`
- [Preprocessing](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`

### Feature processing

- [Correlation filter](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- [Feature engineering](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- [Feature selection](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- [Selected features](https://github.com/hzjken/hft-price-prediction/blob/master/features.txt): `features.txt`

### Modeling and prediction

- [Random forest](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- [LightGBM](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- [Parameter tuning](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- [Saved RF model](https://github.com/hzjken/hft-price-prediction/blob/master/rf.joblib): `rf.joblib`
- [Saved LightGBM model](https://github.com/hzjken/hft-price-prediction/blob/master/lgbm.joblib): `lgbm.joblib`
- [Price prediction](https://github.com/hzjken/hft-price-prediction/blob/master/modelling_pipeline.py): `modelling_pipeline.py`
- **Class prediction**

### Other components

- **Analyst**

## Connections

- Analyst → Market data: provides (evidence: `README.md`)
- Market data → Preprocessing: preprocesses (evidence: `README.md`)
- Preprocessing → Correlation filter: filters (evidence: `README.md`)
- Correlation filter → Feature engineering: engineers (evidence: `README.md`)
- Feature engineering → Feature selection: selects (evidence: `README.md`)
- Feature selection → Random forest: uses selection (evidence: `README.md`)
- Feature selection → LightGBM: uses selection (evidence: `README.md`)
- LightGBM → Parameter tuning: tunes parameters (evidence: `README.md`)
- Analyst → Price prediction: requests prediction
- Price prediction → Preprocessing: preprocesses (evidence: `modelling_pipeline.py`)
- Price prediction → Selected features: loads features (evidence: `modelling_pipeline.py`)
- Price prediction → Saved RF model: loads model (evidence: `modelling_pipeline.py`)
- Price prediction → Saved LightGBM model: loads model (evidence: `modelling_pipeline.py`)
- Price prediction → Class prediction: returns prediction (evidence: `modelling_pipeline.py`)
- Random forest → Saved RF model: saves model (evidence: `modelling_pipeline.py`)
- LightGBM → Saved LightGBM model: saves model (evidence: `modelling_pipeline.py`)
