ohmpatel1997 / vwap

This project calculate the volume-weighted average price of various trading crypto pairs in real time. For now its uses the coinbase websocket for the live transaction data. For now this project only calculates the vwap for BTC-USD, ETH-USD and ETH-BTC trading pairs for 200 data pairs at max.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vwap

This project calculate the volume-weighted average price of various trading crypto pairs in real time. For now its uses the coinbase websocket for the live transaction data. For now this project only calculates the vwap for BTC-USD, ETH-USD and ETH-BTC trading pairs for 200 data pairs at max.

How To Run

  • To run the application with default configuration, run make run
  • To run the application in debug mode, run make debug

Architecture

![](../Desktop/vwap arch.png)

There are mainly 3 parts of the system executing concurrently:

  1. Writer:

    • Writer writes the initialization and termination message to the coinbase websocket. It consumes the message from output queue and send it to coinbase.
  2. Reader:

    • Reader reads the data from the coinbase websocket continuously, parses it, and pushes it to the vwap calculation engine where it calculates the vwap of the consumed pair
  3. Driver Program:

    • Driver program spawns and monitors the overall execution of readers, writers, establishing connection etc.

VWAP Calculation Engine:

This is the heart of the project where all the calculation happens. It keeps track of the volumes and weighted price of all trades. We are using the circular buffer to efficiently use the memory buffer and replace the existing memory when we reach the overflow. It reduces the memory footprint of algorithm. The time complexity of the algoirthm is contant, i.e O(1) and memory complexity is O(capacity), i.e constant 200 for the given program.

External Dependencies:

About

This project calculate the volume-weighted average price of various trading crypto pairs in real time. For now its uses the coinbase websocket for the live transaction data. For now this project only calculates the vwap for BTC-USD, ETH-USD and ETH-BTC trading pairs for 200 data pairs at max.


Languages

Language:Go 98.9%Language:Makefile 1.1%