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.

screenshot

Design

The service in ./internal/service.go is composed of two main components:

  • A websocket client that pulls data off an exchange.
    • The default choice is coinbase.
    • Any exchange can be used as long as it implements the client interface defined in the websocket package.
  • A list of data points defined in the VWAP package.
    • The VWAP calculation is performed each time a data point is pushed to the list and saved in a hash map for each trading pairs.
    • We don't loop over the datapoints so the VWAP calculation is done in constant time, O(1).

Configuration

The following flags are available while running the project through CLI using the binary.

  • trading-pairs: a comma separated strings of crypto currencies pairs, default is set to BTC-USD,ETH-USD,ETH-BTC
  • ws-url: the URL of the websocket server to use, default is coinbase websocket URL.
  • window-size: the sliding window used for the VWAP calculation, default is set to 200.

Decimal

For precision sake we used https://github.com/shopspring/decimal for all calculation.

Run it

First, make sure that you have go version 0.17 installed on your machine. Then ...

make run

or

make build

then ...

./vwap -ws-url "<coinbase_valid_ws_url>" -trading-pairs "<trading_pairs>" -window-size <window_size>

Tests

  • Runs all the tests.
make test
  • Runs the unit tests.
make test-unit
  • Runs the integration test.
make test-intergration
Owner
Tsilavina Razafinirina
Fulltime on Go
Tsilavina Razafinirina
Similar Resources

InductiveDifferentiation - A Trading Experiment With The Crypto Market

A Trading Experiment With The Crypto Market The program was proposed and owned b

Apr 10, 2022

Easy to use crypto library with multiple algorithms

crypka Crypka is library, which abstracts away crypto, so one can easily do: Swap cryptosystems by swapping algorithm object in one place Easily and s

Mar 6, 2022

Coinbase - You can use this to retrieve the current price for an crypto currency

whats-this You can use this to retrieve the current price for an crypto currency

Sep 29, 2022

Crypto-project - Personal project for learning TLS

crypto-project My personal attempt to implement this cipher suite using the Go l

Feb 14, 2022

Blockcain - Trust Wallet token repository - A comprehensive, up-to-date collection of information about several thousands (!) of crypto tokens

Blockcain - Trust Wallet token repository - A comprehensive, up-to-date collection of information about several thousands (!) of crypto tokens

Trust Wallet Assets Info Overview Trust Wallet token repository is a comprehensi

Feb 14, 2022

🔐 Share end-to-end encrypted secrets with others via a one-time URL

🔐 Share end-to-end encrypted secrets with others via a one-time URL

If you use this repo, star it ✨ 🔐 Share end-to-end encrypted secrets with others via a one-time URL Use to securely share API Keys, Signing secrets,

Dec 26, 2022

🔐 Share end-to-end encrypted secrets with others via a one-time URL

🔐 Share end-to-end encrypted secrets with others via a one-time URL

If you use this repo, star it ✨ 🔐 Share end-to-end encrypted secrets with others via a one-time URL Use to securely share API Keys, Signing secrets,

Dec 26, 2022

A binary that continuously displays Ethiopian date and time (Amharic). best used in i3-status.

i3-eth-time Display ethiopian calendar date/time in i3-wm! Intended for use in i3-status. How to use Clone/Download repo and compile Open up your i3co

Jan 4, 2022
Related tags
Quoter - Get real-time Cryptocurrency quotes via CoinMarketCap

quoter Get real-time Cryptocurrency quotes via CoinMarketCap. Get it go get -u g

May 12, 2022
Simple Crypto API for Go

cryptogo Simple cryptography API in Go Hashes: hash.MD5Bytes, hash.MD5Base64, hash.MD5Hex calculates an MD5 chechsum of the input byte array as a byte

Nov 10, 2021
A command line Crypto-currency ticker made using golang and WazirX Api
A command line Crypto-currency ticker made using golang and WazirX Api

░█████╗░██████╗░██╗░░░██╗██████╗░████████╗███████╗██╗░░██╗ ██╔══██╗██╔══██╗╚██╗░██╔╝██╔══██╗╚══██╔══╝██╔════╝╚██╗██╔╝ ██║░░╚═╝██████╔╝░╚████╔╝░██████╔

Feb 6, 2022
a modern crypto messaging format

saltpack a modern crypto messaging format https://saltpack.org/ saltpack is a streamlined, modern solution, designed with simplicity in mind. It is ea

Dec 22, 2022
An easy to setup local crypto wallet based on Geth

CryptoWallet An easy to setup local crypto wallet based on Geth To run. go run CrytoWallet This will expose a set a api's. To Create new Wallet curl

Oct 15, 2021
A terminal application to watch crypto prices!
A terminal application to watch crypto prices!

cryptgo Latest Stable Version: Crytpgo is a TUI based application written purely in Go to monitor and observe cryptocurrency prices in real time! Inst

Dec 21, 2022
ECIES implementation forked of the `crypto/ecies` package from Ethereum

# NOTE This implementation is direct fork of Kylom's implementation. I claim no authorship over this code apart from some minor modifications. Please

Dec 7, 2021
A tiny Crypto Project with REST API

Goal ⚽ Golang으로 아무 쓸모 없는 블록체인을 한땀 한땀 만들어보면서 BTC나 ETH에 적용된 블록체인 기법 이해해보기! Special Thanks to Nico! Current... ??️ Work ?? 자세한 내용은 issue와 PR을 확인하세요. Now

Dec 30, 2021
Xk6-crypto-x509 - A k6 extension to encrypt data with a PEM Public Key

xk6-crypto-x509 A k6 extension to encrypt data with a PEM Public Key This is a k

Jan 5, 2022