Skip to content

pateldhruvil5467-ctrl/ParallelFinancialAnalytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallel Financial Analytics System

Overview

The Parallel Financial Analytics System is a C++ application developed as part of the Multicore Programming course. The project demonstrates the practical application of multicore programming by comparing Sequential Merge Sort and Parallel Merge Sort implemented using C++ std::thread.

Unlike traditional algorithm demonstrations using randomly generated numbers, this project utilizes real Tesla historical stock market data to perform financial analysis and evaluate the performance of parallel computing.

The application measures execution time, validates correctness, generates benchmark reports, and visualizes performance through graphs.


Project Information

Course: Multicore Programming

Language: C++17

Compiler: g++ (MinGW)

Operating System: Windows 11

Concurrency Library: std::thread

Dataset: Tesla Historical Stock Dataset


Objectives

  • Implement Sequential Merge Sort
  • Implement Parallel Merge Sort using C++ std::thread
  • Process real Tesla historical stock market data
  • Perform financial analytics
  • Benchmark sequential and parallel execution
  • Validate correctness of the parallel implementation
  • Demonstrate multicore programming concepts using real-world data

Features

  • Real Tesla historical stock dataset
  • CSV file parsing and preprocessing
  • Sequential Merge Sort
  • Parallel Merge Sort using std::thread
  • Financial analytics module
  • Performance benchmarking
  • Automatic correctness validation
  • Benchmark CSV export
  • Performance graph generation
  • Modular software architecture

Technologies Used

  • C++17
  • Standard Template Library (STL)
  • std::thread
  • Chrono Library
  • Python 3
  • Pandas
  • Matplotlib

Project Structure

ParallelFinancialAnalytics/

│── data/
│   └── Tesla.csv

│── include/
│   ├── Benchmark.h
│   ├── CSVReader.h
│   ├── FinancialAnalyzer.h
│   ├── StockMergeSort.h
│   ├── StockParallelMergeSort.h
│   └── StockRecord.h

│── src/
│   ├── Benchmark.cpp
│   ├── CSVReader.cpp
│   ├── FinancialAnalyzer.cpp
│   ├── StockMergeSort.cpp
│   ├── StockParallelMergeSort.cpp
│   └── main.cpp

│── results/
│   ├── benchmark_results.csv
│   └── performance_graph.png

│── graph.py
│── README.md

System Architecture

Tesla.csv
      │
      ▼
 CSV Reader & Preprocessing
      │
      ▼
Vector<StockRecord>
      │
 ┌────┴───────────────┐
 ▼                    ▼
Sequential       Parallel
Merge Sort       Merge Sort
(1 Thread)      (std::thread)
      │               │
      └──────┬────────┘
             ▼
 Financial Analytics
             ▼
 Benchmark Module
             ▼
 CSV Results + Graph

Workflow

  1. Load Tesla historical stock data.
  2. Parse and preprocess the CSV file.
  3. Store records as StockRecord objects.
  4. Execute Sequential Merge Sort.
  5. Execute Parallel Merge Sort using multiple threads.
  6. Perform financial analytics.
  7. Benchmark execution time.
  8. Validate correctness.
  9. Export benchmark results.
  10. Generate performance graph.

Financial Analytics

The application computes:

  • Highest Closing Price
  • Lowest Closing Price
  • Average Closing Price
  • Highest Trading Volume
  • Lowest Trading Volume
  • Average Trading Volume

Benchmark Module

The benchmark measures:

  • Sequential execution time
  • Parallel execution time
  • Speedup
  • Correctness validation
  • Performance comparison across different dataset sizes

Results are automatically saved to:

results/benchmark_results.csv

Experimental Results

The experimental evaluation demonstrates:

  • Sequential Merge Sort performs better for small datasets due to lower thread management overhead.
  • Parallel Merge Sort becomes increasingly efficient as dataset size grows.
  • Performance improvement is achieved by utilizing multiple CPU threads.
  • Both implementations produce identical sorted outputs.
  • Benchmark results are validated after every execution.

Prerequisites

Before building the project, ensure the following are installed:

  • g++ (C++17 compatible compiler)
  • Python 3.x
  • Pandas
  • Matplotlib

Build Instructions

Clone the repository:

git clone https://github.com/pateldhruvil5467-ctrl/ParallelFinancialAnalytics.git
cd ParallelFinancialAnalytics

Compile the project:

g++ src/main.cpp src/CSVReader.cpp src/StockMergeSort.cpp src/StockParallelMergeSort.cpp src/FinancialAnalyzer.cpp src/Benchmark.cpp -Iinclude -o financial

Run the Application

Execute:

./financial

The application will automatically:

  • Load Tesla.csv
  • Parse the dataset
  • Execute Sequential Merge Sort
  • Execute Parallel Merge Sort
  • Perform Financial Analytics
  • Run Benchmark
  • Validate Results
  • Save benchmark_results.csv

Generate Performance Graph

After running the benchmark:

python graph.py

The graph will be generated inside:

results/performance_graph.png

Reproducing Results

To reproduce the benchmark presented in the report:

  1. Build the project.
  2. Run the executable.
  3. Verify that benchmark_results.csv is generated.
  4. Execute:
python graph.py
  1. Compare the generated graph with the report and presentation.

Validation

Correctness is verified by comparing the outputs of the Sequential Merge Sort and Parallel Merge Sort after every benchmark execution.

The benchmark reports:

PASS

only when both implementations produce identical sorted results.


Future Improvements

  • OpenMP implementation
  • MPI implementation
  • CUDA / GPU acceleration
  • Live financial APIs
  • Interactive dashboard
  • Additional financial indicators
  • Dynamic thread allocation based on hardware

Authors

Dhruvil Patel

  • Sequential Merge Sort
  • CSV Processing
  • Financial Analytics
  • Benchmark Integration
  • Testing and Validation

Shehleen Kaur

  • Parallel Merge Sort
  • Documentation
  • Presentation
  • Performance Evaluation

AI Assistance

AI-assisted tools (ChatGPT) were used to support debugging, code explanation, documentation refinement, and report writing.

All implementation decisions, testing, benchmarking, validation, and final verification were performed by the project members.


License

This project was developed for academic purposes as part of the Multicore Programming course.

About

Parallel Financial Analytics System using Multithreaded Merge Sort in C++ for real-time financial data analysis and benchmarking.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages