Code Monkey home page Code Monkey logo

vwap-from-itch5's Introduction

ITCH 5.0 Data Processor for VWAP Calculation

Tairan Gao

Overview

This project provides a C++ application designed to read ITCH 5.0 format stock market data, process the trades, and calculate the Volume Weighted Average Price (VWAP) for each stock listed on an exchange for every hour of trading. The program outputs the VWAP calculations to a CSV file for further analysis or review.

  • Raw ITCH 5.0 data downloaded from here
  • Format is defined by this document

Dependencies

  • C++20 or later
  • POSIX compliant system (for memory-mapped files and threading support)

Compile the Project

g++ -std=c++2a -o3 -o ItchVwapProcessor main.cpp -lpthread

Run Program

After compiling the project, it can be ran via

./ItchVwapProcessor path/to/your/itchDatafile

If the itchDatafile path is not provided, the program will look for the file under the current folder.

Result

  • In file output.csv

VWAP Assumptions

  • Cross Trade Messages are included when calculating VWAP
  • Non-Printable Messages are Not included when calculating VWAP

Design Notes

  • MemoryMappedFileReader: Handles the reading of large data files efficiently by mapping files into memory, reducing the overhead of I/O operations.
  • Producer-Consumer Model: The architecture is built around the producer-consumer model, with:
    • a producer thread dedicated to reading data from memory-mapped files and consumer threads focused on processing this data
    • a consumer threads focused on processing this data and output vwap results
  • ThreadSafeQueue: as a buffer and synchronization mechanism between producer and consumer
  • Message Parsing: Implements a factory pattern to dynamically create message objects based on the ITCH message types

Future Improvements

The current implementation relies on a single-threaded approach for both reading and processing data, adhering to the sequential order mandated by the ITCH5 data format. Future enhancements can introduce a multi-threaded architecture for both reading and processing the data.

vwap-from-itch5's People

Contributors

gug-shadamu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.