Websocket market data capture utility for coinbase (written in Go)

mdcapture

Websocket market data capture utility for coinbase (written in Go)

Features

  • Live subscription and capture of Coinbase market data
  • Intended for daily recording workflow
  • Supports trade, level2 and match streams
  • Output is normalized CSV files per message type
  • Captures receive timestamp for latency estimation
  • Optionally can capture raw JSON messages instead
  • Auto shutdown at the end of the day

Build

<git clone somewhere>
go mod download github.com/gorilla/websocket
go mod download github.com/jessevdk/go-flags
go get github.com/gorilla/websocket
go get github.com/jessevdk/go-flags
go build

Or run make.

Run

By default mdcapture uses the sandbox websockets endpoint. This allows for easy experimentation without worrying about your IP getting blacklisted.

./mdcapture -p BTC-USD -s quotes_trades -D coinbase.sandbox/20211227 --status

Once comfortable, you can connect to the live endpoint:

./mdcapture -p BTC-USD -p ETH-USD -s quotes_trades -E wss://ws-feed.exchange.coinbase.com -D coinbase/20211227 --status

Data

Robot #1: "Administer the test."
Robot #2: "Which of the following would you most prefer?
A: a puppy,
B: a pretty flower from your sweety, or
C: a large properly formatted data file?"

tabulon -p --tail=10 coinbase/20211227/20211227.ticker.csv
type   |recv_ts                             |time                        |product_id |sequence    |qty        |price    |side |trade_id  |best_bid |best_ask |open_24h |low_24h |high_24h |volume_24h      |volume_30d       |
-------+------------------------------------+----------------------------+-----------+------------+-----------+---------+-----+----------+---------+---------+---------+--------+---------+----------------+-----------------+
ticker |2021-12-27T21:16:36.794742785-05:00 |2021-12-28T02:16:36.783324Z |BTC-USD    |32522639262 |0.0001     |49711.11 |sell |255807331 |49711.11 |49713.43 |50848.38 |49650   |52100    |13583.69858522  |450664.26012436  |
ticker |2021-12-27T21:16:36.925744196-05:00 |2021-12-28T02:16:36.917442Z |ETH-USD    |23894314999 |0.36       |3976.48  |buy  |198380437 |3976.47  |3976.76  |4073.06  |3968.2  |4128.9   |117478.61385221 |5878037.80416139 |
ticker |2021-12-27T21:16:37.033402378-05:00 |2021-12-28T02:16:37.027262Z |ETH-USD    |23894315098 |0.02525817 |3976.55  |sell |198380438 |3976.55  |3976.75  |4073.06  |3968.2  |4128.9   |117478.63911038 |5878037.82941956 |
ticker |2021-12-27T21:16:37.136770805-05:00 |2021-12-28T02:16:37.128556Z |BTC-USD    |32522639436 |0.04804844 |49714.39 |buy  |255807332 |49714.38 |49714.39 |50848.38 |49650   |52100    |13583.74663366  |450664.30817280  |
ticker |2021-12-27T21:16:37.161934162-05:00 |2021-12-28T02:16:37.148106Z |ETH-USD    |23894315125 |0.01840392 |3976.75  |buy  |198380439 |3976.57  |3976.75  |4073.06  |3968.2  |4128.9   |117478.65751430 |5878037.84782348 |
ticker |2021-12-27T21:16:37.320433039-05:00 |2021-12-28T02:16:37.311613Z |ETH-USD    |23894315202 |0.00225278 |3976.75  |buy  |198380440 |3976.60  |3976.75  |4073.06  |3968.2  |4128.9   |117478.65976708 |5878037.85007626 |
ticker |2021-12-27T21:16:37.546501578-05:00 |2021-12-28T02:16:37.539220Z |BTC-USD    |32522639623 |0.00018028 |49714.39 |buy  |255807333 |49714.38 |49714.39 |50848.38 |49650   |52100    |13583.74681394  |450664.30835308  |
ticker |2021-12-27T21:16:37.601654569-05:00 |2021-12-28T02:16:37.594545Z |BTC-USD    |32522639635 |0.00000478 |49714.39 |buy  |255807334 |49714.38 |49716.35 |50848.38 |49650   |52100    |13583.74681872  |450664.30835786  |
ticker |2021-12-27T21:16:37.60186841-05:00  |2021-12-28T02:16:37.594545Z |BTC-USD    |32522639637 |0.00007544 |49716.35 |buy  |255807335 |49714.38 |49716.35 |50848.38 |49650   |52100    |13583.74689416  |450664.30843330  |
ticker |2021-12-27T21:16:38.089480651-05:00 |2021-12-28T02:16:38.083777Z |ETH-USD    |23894315554 |0.29572443 |3976.43  |sell |198380441 |3976.43  |3976.44  |4073.06  |3968.2  |4128.9   |117478.95549151 |5878038.14580069 |
Similar Resources

A fast, well-tested and widely used WebSocket implementation for Go.

Gorilla WebSocket Gorilla WebSocket is a Go implementation of the WebSocket protocol. Documentation API Reference Chat example Command example Client

Jan 2, 2023

Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.

websocketd websocketd is a small command-line tool that will wrap an existing command-line interface program, and allow it to be accessed via a WebSoc

Dec 31, 2022

proxy your traffic through CDN using websocket

go-cdn2proxy proxy your traffic through CDN using websocket what does it do example server client thanks what does it do you can use this as a library

Dec 7, 2022

Chat bots (& more) for Zoom by figuring out their websocket protocol

Chat bots (& more) for Zoom by figuring out their websocket protocol

zoomer - Bot library for Zoom meetings Good bot support is part of what makes Discord so nice to use. Unfortunately, the official Zoom API is basicall

Dec 14, 2022

Tiny WebSocket library for Go.

RFC6455 WebSocket implementation in Go.

Dec 28, 2022

Simple example for using Turbos Streams in Go with the Gorilla WebSocket toolkit.

Go Example for TurboStreams over WebSockets Simple example for using Turbos Streams in Go with the Gorilla WebSocket toolkit.

Dec 22, 2022

Minimal and idiomatic WebSocket library for Go

websocket websocket is a minimal and idiomatic WebSocket library for Go. Install go get nhooyr.io/websocket Highlights Minimal and idiomatic API First

Dec 31, 2022

:notes: Minimalist websocket framework for Go

:notes: Minimalist websocket framework for Go

melody 🎶 Minimalist websocket framework for Go. Melody is websocket framework based on github.com/gorilla/websocket that abstracts away the tedious p

Dec 23, 2022

Terminal on browser via websocket

Terminal on browser via websocket. Supportted OS Linux Mac

Dec 27, 2022
Awesome WebSocket CLient - an interactive command line client for testing websocket servers
Awesome WebSocket CLient - an interactive command line client for testing websocket servers

Awesome WebSocket CLient - an interactive command line client for testing websocket servers

Dec 30, 2022
Encrypted-websocket-chat - Encrypted websocket chat using golang

Encrypted websocket chat First version written in python This version should be

Sep 15, 2022
Websocket-chat - A simple websocket chat application
Websocket-chat - A simple websocket chat application

WebSocket Chat App This is a simple chat app based on websockets. It allows user

Jan 25, 2022
Websocket server. Get data from provider API, clean data and send to websoket, when it's changed.

Описание Сервис получает данные по киберспортивным матчам CS:GO от провайдера, структурирует, очищает от лишнего и отправляет всем активным вебсокет к

Apr 6, 2022
A simple server to convert ATK-IMU901 serial data into websocket stream

A simple server to convert ATK-IMU901 serial data into WebSocket stream.

Jan 31, 2022
WebSocket Command Line Client written in Go

ws-cli WebSocket Command Line Client written in Go Installation go get github.com/kseo/ws-cli Usage $ ws-cli -url ws://echo.websocket.org connected (

Nov 12, 2021
A modern, fast and scalable websocket framework with elegant API written in Go
A modern, fast and scalable websocket framework with elegant API written in Go

About neffos Neffos is a cross-platform real-time framework with expressive, elegant API written in Go. Neffos takes the pain out of development by ea

Dec 29, 2022
A tiny command line websocket client written in Go

wsc A simplistic tool for sending and receiving websocket messages from a command line. Mainly useful to test websocket servers. Getting started: $ go

Jan 12, 2022
A websocket powered discord wrapper for Sugaroid written in golang

sg-discord A thin discord wrapper built on top of Sugaroid Websocket implementation. Build go build . Run export DISCORD_BOT_TOKEN="supersecrettoken"

Dec 30, 2021
A websocket powered telegram wrapper for Sugaroid written in golang

sg-telegram A thin telegram wrapper built on top of Sugaroid Websocket

Nov 4, 2021