A real-time `VWAP` (volume-weighted average price) calculation engine

VWAP

technology Go

Overview

The goal of this project is to create a real-time VWAP (volume-weighted average price) calculation engine. For this was used the coinbase websocket feed to stream in trade executions and update the VWAP for each trading pair as updates become available.

Default parameters:

  • Trading pairs: BTC-USD, ETH-USD, ETH-BTC .
  • Sliding window: 200 .
  • Coinbase URL: wss://ws-feed.exchange.coinbase.com .

Program structure

The service is composed of two main components:

  • A websocket client that pulls data off on trade executions. By default is used coinbase websocket feed.
  • A vwapcalculator to calculate the VWAP. Use a list to push the data points and a map to save the calculated trading pairs.

Performance

  • Having a list of datapoints with a hash map to store the cumulative values for each trading pair favors efficiency, since this avoids having to loop over all the data points to calculate the vwap. So this strategy reduces the complexity from O(N) to O(1).

  • Precision calculation: Decimal library for arbitrary precision decimal type on representing money.This is used because it's better for precise calculations on currency. For more information check the library repository.

How To Run This Project

  • Clone this repo to your workspace.
  • Type make run .

Tests

  • Unit Test: make test-unit

  • Integration Test: make test-intergration

Improvements

It is necessary to improve the test cases to cover all border cases.

More information

Owner
Sayi Polia
Backend Software Engineer
Sayi Polia
Similar Resources

Mathematical expression parsing and calculation engine library. 数学表达式解析计算引擎库

Math-Engine 使用 Go 实现的数学表达式解析计算引擎库,它小巧,无任何依赖,具有扩展性(比如可以注册自己的函数到引擎中),比较完整的完成了数学表达式解析执行,包括词法分析、语法分析、构建AST、运行。 go get -u github.com/dengsgo/math-engine 能够

Jan 3, 2023

Weighted PageRank implementation in Go

pagerank Weighted PageRank implementation in Go Usage package main import ( "fmt" "github.com/alixaxel/pagerank" ) func main() { graph := pagera

Dec 21, 2022

A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

LWN Simulator A LoRaWAN nodes' simulator to simulate a LoRaWAN Network. Table of Contents General Info Requirements Installation General Info LWN Simu

Nov 20, 2022

Implementing SPEEDEX price computation engine in Golang as a standalone binary that exchanges can call

speedex-standalone Implementing SPEEDEX price computation engine in Golang as a standalone binary that exchanges can call. Notes from Geoff About Tato

Dec 1, 2021

Tool for collect statistics from AMQP (RabbitMQ) broker. Good for cloud native service calculation.

amqp-statisticator Tool for collect statistics around your AMQP broker. For example RabbitMQ expose a lot information trought the management API, but

Dec 13, 2021

Suan - Mathematical expression calculation tool

suan Suan( 算 ) is a CLI tool to calculate given mathematical expression. Current

Feb 14, 2022

Fast specialized time-series database for IoT, real-time internet connected devices and AI analytics.

Fast specialized time-series database for IoT, real-time internet connected devices and AI analytics.

unitdb Unitdb is blazing fast specialized time-series database for microservices, IoT, and realtime internet connected devices. As Unitdb satisfy the

Jan 1, 2023

A GPU-powered real-time analytics storage and query engine.

A GPU-powered real-time analytics storage and query engine.

AresDB AresDB is a GPU-powered real-time analytics storage and query engine. It features low query latency, high data freshness and highly efficient i

Jan 7, 2023

Weaviate is a cloud-native, modular, real-time vector search engine

Weaviate is a cloud-native, modular, real-time vector search engine

Weaviate is a cloud-native, real-time vector search engine (aka neural search engine or deep search engine). There are modules for specific use cases such as semantic search, plugins to integrate Weaviate in any application of your choice, and a console to visualize your data.

Dec 30, 2022

Weaviate is a cloud-native, modular, real-time vector search engine

Weaviate is a cloud-native, modular, real-time vector search engine

Weaviate is a cloud-native, real-time vector search engine (aka neural search engine or deep search engine). There are modules for specific use cases such as semantic search, plugins to integrate Weaviate in any application of your choice, and a console to visualize your data.

Jan 5, 2023

An application that uses gRPC Client Streaming framework to computes average.

compute-average An API that uses Client Streaming gRPC framework to capture all integer numbers on Requests that the client sent and returns just the

Dec 26, 2021

Check-load - Simple cross-platform load average check

Sensu load average check Table of Contents Overview Usage examples Configuration

Jun 16, 2022

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Grafana Tempo is an open source, easy-to-use and high-scale distributed tracing backend. Tempo is cost-efficient, requiring only object storage to ope

Jan 8, 2023

RESTful based volume management framework for GlusterFS

Heketi Heketi provides a RESTful management interface which can be used to manage the life cycle of GlusterFS volumes. With Heketi, cloud services lik

Nov 18, 2020

An example microservice demo using kubernetes concepts like deployment, services, persistent volume and claims, secrets and helm chart

Docker vs Kubernetes Docker Kubernetes container tech, isolated env for apps infra management, multiple containers automated builds and deploy apps -

Dec 13, 2021

Sync local file/directory to pod volume

Sync local file/directory to pod volume

Mar 19, 2022

A command line tool for simplified docker volume command built with go

dockervol A command line tool for simplified docker volume command built with go. Features: Remove anonymous volume (beta) Remove volume by matching n

Dec 18, 2021

K8s-cinder-csi-plugin - K8s Pod Use Openstack Cinder Volume

k8s-cinder-csi-plugin K8s Pod Use Openstack Cinder Volume openstack volume list

Jul 18, 2022
Related tags
Price Oscilation Bot

Price Oscilation Bot Hi there ?? Connect to Uphold public ticker and retrieve the Currency Pair rate every fetch interval that the user whants. Each t

Apr 21, 2022
The real 0xSniper. Open your nitro sniping service easy just need to patch the code.

# ss-sniper Hi my homies, Here was the ss-sniper, the "best" nitro sniper. Average delay -> 100~120ms. The sniper include invite checker (minimal o

Nov 1, 2022
🕌 Iftar Bot, Plays Ezan sound on iftar time (Ramadan special ✨)

?? Iftar Bot Plays Ezan sound on iftar time (Ramadan special ✨ ) ?? Running Download go Clone repo copy .env.example as .env and fill required blanks

Jul 22, 2022
Auto send check-in message to Slack channel at a specific time.
Auto send check-in message to Slack channel at a specific time.

Auto Slack Check-in auto-slack-checkin is a command line interface (CLI) that sends check-in or check-out message for you while you are sleeping ??.

Feb 15, 2022
A fast responsive, machine learning, conversational dialog engine for creating chat bots, written in Go.

chatbot English | 简体中文 项目说明 chatbot 是一个通过已知对话数据集快速生成回答的 Go 问答引擎。比 ChatterBot 快非常多,我们在1.2亿对话上的对比结果是:ChatterBot 回答需要21秒,chatbot 只需要18毫秒。 bot 问答引擎 cli tr

Jan 6, 2023
Gofra - Gofra, an XMPP bot engine written in Go

Gofra, an XMPP bot engine Gofra is a tiny XMPP bot engine written in Go. As of n

Dec 3, 2022
Exponentially Weighted Moving Average algorithms for Go.
Exponentially Weighted Moving Average algorithms for Go.

EWMA This repo provides Exponentially Weighted Moving Average algorithms, or EWMAs for short, based on our Quantifying Abnormal Behavior talk. Exponen

Dec 28, 2022
Real time crypto VWAP calculator
Real time crypto VWAP calculator

VWAP calculator A realtime VWAP calculator of crypto currencies. It uses coinbase as its default provider for real time data over websocket. Design Th

Oct 31, 2022
Injective-price-oracle-ext - Injective's Oracle with dynamic price feeds (for External Integrations)

injective-price-oracle Injective's Oracle with dynamic price feeds. Allows anyon

Aug 29, 2022
Real-time Map displays real-time positions of public transport vehicles in Helsinki
Real-time Map displays real-time positions of public transport vehicles in Helsinki

Real-time Map Real-time Map displays real-time positions of public transport vehicles in Helsinki. It's a showcase for Proto.Actor - an ultra-fast dis

Nov 30, 2022