coinbasevwap

command module
v0.0.0-...-ca4f705 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2022 License: Unlicense Imports: 12 Imported by: 0

README

Coinbase rate VWAP

Build Status Coverage Status Go Report Card

Application that calculates VWAP in a real-time using Coinbase websocket steaming protocol of cryptocurrency transactions updates. Calculated values of VWAP are streamed to os.Stdout for each trading pair. By default, application subscribes for BTC-USD, ETH-USD and ETH-BTC trading pairs.

Synopsis

$ go run main.go -help
INFO[0000] Coinbase rate VWAP.
  -capacity int
        Capacity for storing data for VWAP calculation (default 200)
  -channel string
        Channel to subscribe to (default "matches")
  -feed-url string
        Coinbase feed URL (default "wss://ws-feed.exchange.coinbase.com")
  -help
        Show help
  -log-level string
        Logging level (default "error")
  -products string
        Products to subscribe to (default "BTC-USD,ETH-USD,ETH-BTC")

VWAP

In finance, volume-weighted average price (VWAP) is the ratio of the value of a security or financial asset traded to the total volume of transactions during a trading session.

formula

In this application the VWAP is calculated per trading pair using a sliding window of last 200 data points (Could be configured).

Architecture

Application uses clean architecture. Some of open-source projects was used to build application. Websocket client is a state machine which subscribes and unsubscribes from feeds with trading pair transaction updates. Consumer is subscribed for such updates from Websocket client and supplies data to use-case which calculates the VWAP of offered trading pair and stores it in a repository. Storage is like a cyclic buffer and stores last 200 data points.

Developer instructions

Building

To build application run:

make

or

make BINARY_NAME=vwap build
Testing

To start unit-tests:

make test
Run

To start application with default arguments:

make run
Run with verbose logging

To start application with error level set to Debug:

make debug

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL