# vinamra3215/prism architecture

> Architecture diagram of the GitHub repository vinamra3215/prism, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinamra3215/prism
- Repository: https://github.com/vinamra3215/prism

## Overview

PRISM is a research codebase for adapting the Kronos financial time-series foundation model to Indian equities and evaluating cross-sectional stock rankings. Its documented workflow is NSE OHLCV preparation, parameter-efficient fine-tuning, market-conditioned representations, then walk-forward ranking backtests. The tree also contains multiple experiment branches and plotting utilities, rather than a single evident production service. The README documents the market-gating and ranking stages, but the sampled excerpts do not show their implementation; those links are therefore documented at a high level. Other relationships are limited to visible imports or documented capabilities.

Main entry points: [`Kronos/het/predict_lora_ka_loda.py`](https://github.com/vinamra3215/prism/blob/main/Kronos/het/predict_lora_ka_loda.py) (Stock Forecast), [`Kronos/download_data.py`](https://github.com/vinamra3215/prism/blob/main/Kronos/download_data.py) (Data Download), [`__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/full_pipeline_tune_predict_full_param.py`](https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/full_pipeline_tune_predict_full_param.py) (NIFTY Data Prep), [`Kronos/het/lora_ka_loda.py`](https://github.com/vinamra3215/prism/blob/main/Kronos/het/lora_ka_loda.py) (LoRA Fine-tuning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Market Data"]
  node_data_download["Data Download<br/>[download_data.py]"]
  node_feature_selection["Feature Selection<br/>[features.py]"]
  node_nifty_data_prep["NIFTY Data Prep"]
end

subgraph group_model["Model Adaptation"]
  node_kronos["Kronos Model<br/>[kronos.py]"]
  node_kronos_layers["Model Layers<br/>[module.py]"]
  node_lora_finetune["LoRA Fine-tuning<br/>[lora_ka_loda.py]"]
  node_rolling_adaptation["Rolling Adaptation"]
  node_market_gating["Market Gating"]
end

subgraph group_strategy["Ranking Strategy"]
  node_forecast["Stock Forecast"]
  node_cross_section_rank["Cross-Sectional Rank"]
end

subgraph group_evaluation["Evaluation"]
  node_walk_forward["Walk-Forward Backtest"]
  node_metrics["Forecast Metrics<br/>[metrics_engine.py]"]
  node_visualization["Result Visualization"]
end

node_researcher(("Researcher"))
node_nse_data[("NSE OHLCV")]

node_researcher -.->|"initiates research"| node_data_download
node_nse_data -.->|"provides prices"| node_data_download
node_data_download -.->|"prepares data"| node_nifty_data_prep
node_nse_data -->|"provides OHLCV"| node_nifty_data_prep
node_nifty_data_prep -.->|"trains on data"| node_lora_finetune
node_feature_selection -.->|"selects signals"| node_market_gating
node_kronos -->|"uses layers"| node_kronos_layers
node_kronos -->|"adapts backbone"| node_lora_finetune
node_lora_finetune -.->|"provides adaptation"| node_rolling_adaptation
node_rolling_adaptation -.->|"generates forecasts"| node_forecast
node_market_gating -.->|"conditions ranking"| node_cross_section_rank
node_forecast -.->|"ranks stocks"| node_cross_section_rank
node_cross_section_rank -.->|"evaluates strategy"| node_walk_forward
node_walk_forward -.->|"reports performance"| node_metrics
node_forecast -.->|"plots results"| node_visualization

click node_data_download "https://github.com/vinamra3215/prism/blob/main/Kronos/download_data.py"
click node_feature_selection "https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/het-uchiha/phase_2/features_selection/features.py"
click node_nifty_data_prep "https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/full_pipeline_tune_predict_full_param.py"
click node_kronos "https://github.com/vinamra3215/prism/blob/main/Kronos/model/kronos.py"
click node_kronos_layers "https://github.com/vinamra3215/prism/blob/main/Kronos/model/module.py"
click node_lora_finetune "https://github.com/vinamra3215/prism/blob/main/Kronos/het/lora_ka_loda.py"
click node_rolling_adaptation "https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/nifty50_multistock_individual_lora_pipeline.py"
click node_market_gating "https://github.com/vinamra3215/prism/tree/main/Kronos"
click node_forecast "https://github.com/vinamra3215/prism/blob/main/Kronos/het/predict_lora_ka_loda.py"
click node_cross_section_rank "https://github.com/vinamra3215/prism/tree/main/Kronos"
click node_walk_forward "https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/my_kronos_project/train_and_predict_walk_forward.py"
click node_metrics "https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/metrics_engine.py"
click node_visualization "https://github.com/vinamra3215/prism/blob/main/Kronos/visualise_result.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_data_download,node_feature_selection,node_nifty_data_prep toneBlue
class node_kronos,node_kronos_layers,node_lora_finetune,node_rolling_adaptation,node_market_gating,node_nse_data toneAmber
class node_forecast,node_cross_section_rank toneMint
class node_walk_forward,node_metrics,node_visualization toneRose
class node_researcher toneIndigo
```

## Components

### Market Data

- [Data Download](https://github.com/vinamra3215/prism/blob/main/Kronos/download_data.py): `Kronos/download_data.py`
- [Feature Selection](https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/het-uchiha/phase_2/features_selection/features.py): `__shutupandbendover/het-uchiha/phase_2/features_selection/features.py`
- [NIFTY Data Prep](https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/full_pipeline_tune_predict_full_param.py): `__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/full_pipeline_tune_predict_full_param.py`

### Model Adaptation

- [Kronos Model](https://github.com/vinamra3215/prism/blob/main/Kronos/model/kronos.py): `Kronos/model/kronos.py`
- [Model Layers](https://github.com/vinamra3215/prism/blob/main/Kronos/model/module.py): `Kronos/model/module.py`
- [LoRA Fine-tuning](https://github.com/vinamra3215/prism/blob/main/Kronos/het/lora_ka_loda.py): `Kronos/het/lora_ka_loda.py`
- [Rolling Adaptation](https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/nifty50_multistock_individual_lora_pipeline.py): `__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/nifty50_multistock_individual_lora_pipeline.py`
- [Market Gating](https://github.com/vinamra3215/prism/tree/main/Kronos): `Kronos`

### Ranking Strategy

- [Stock Forecast](https://github.com/vinamra3215/prism/blob/main/Kronos/het/predict_lora_ka_loda.py): `Kronos/het/predict_lora_ka_loda.py`
- [Cross-Sectional Rank](https://github.com/vinamra3215/prism/tree/main/Kronos): `Kronos`

### Evaluation

- [Walk-Forward Backtest](https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/my_kronos_project/train_and_predict_walk_forward.py): `__shutupandbendover/devansh-swc-wala/Block1/my_kronos_project/train_and_predict_walk_forward.py`
- [Forecast Metrics](https://github.com/vinamra3215/prism/blob/main/__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/metrics_engine.py): `__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/metrics_engine.py`
- [Result Visualization](https://github.com/vinamra3215/prism/blob/main/Kronos/visualise_result.py): `Kronos/visualise_result.py`

### Other components

- **Researcher**
- **NSE OHLCV**

## Connections

- Researcher → Data Download: initiates research
- NSE OHLCV → Data Download: provides prices
- Data Download → NIFTY Data Prep: prepares data
- NSE OHLCV → NIFTY Data Prep: provides OHLCV (evidence: `__shutupandbendover/devansh-swc-wala/Block1/optuna_finetuned/full_pipeline_tune_predict_full_param.py`)
- NIFTY Data Prep → LoRA Fine-tuning: trains on data
- Feature Selection → Market Gating: selects signals
- Kronos Model → Model Layers: uses layers (evidence: `Kronos/model/kronos.py`)
- Kronos Model → LoRA Fine-tuning: adapts backbone (evidence: `Kronos/het/lora_ka_loda.py`)
- LoRA Fine-tuning → Rolling Adaptation: provides adaptation
- Rolling Adaptation → Stock Forecast: generates forecasts
- Market Gating → Cross-Sectional Rank: conditions ranking
- Stock Forecast → Cross-Sectional Rank: ranks stocks (evidence: `Kronos/het/predict_lora_ka_loda.py`)
- Cross-Sectional Rank → Walk-Forward Backtest: evaluates strategy (evidence: `__shutupandbendover/devansh-swc-wala/Block1/my_kronos_project/train_and_predict_walk_forward.py`)
- Walk-Forward Backtest → Forecast Metrics: reports performance
- Stock Forecast → Result Visualization: plots results
