This repository contains code for constructing and evaluating a market report generation dataset. The pipeline processes financial market data from various sources and pairs it with market reports to create training datasets for language models.
All OHLCV market data is bundled in data/source_data_long.csv (long format:
Date, Symbol, Open, High, Low, Close, Volume), so no live downloads or manual
collection are required. The pipeline consists of three scripts run sequentially.
python data/build_report_data.py --period "1 month"Objectives:
- Read
source_data_long.csvand map its symbols onto the project's reference instruments (data/references/financial_instrument_reference.json,futures_symbol.csv) - For each market report, extract the OHLCV window covering the
--periodlookback ending on the report date (futures use the active front/second/third month contracts) - Organize the output by historical time span, split, market, and data source
Arguments:
--period— lookback window per report:1 day,2 weeks,1 month,3 months,1 year, or compact forms like1week/3months(default1week)--save-intermediate— also write the combinedprocessed_dataCSV used internally--source-data,--reports,--reference,--futures,--split-ref,--output-base— override default input/output paths
Output Structure:
data/
└── table_data/
└── report_table_data/
└── <historical_time_span>/
└── <split>/
└── <market-report_data_source>/
└── <report_date>.csv
python construct_dataset.pyObjectives:
- Combine table data with corresponding market reports
- Format prompts for model training
- Include relevant metadata
Output Structure:
data/
└── processed_dataset/
└── <historical_time_span>/
└── <split>.json # Contains tables, prompts, reports, and metadata
python tokenize_dataset.pyObjectives:
- Convert processed dataset into tokenized format
- Prepare data for training open-source language models
- Support multiple tokenizer options
Output Structure:
data/
└── tokenized_dataset/
└── <historical_time_span>/
└── <tokenizer>/
└── <split>/ # Tokenized data ready for training