Slick Sim
0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
coinbase_trade_encoder.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
common/market_data.hpp
>
4
#include <
common/messages.hpp
>
5
#include <nlohmann/json.hpp>
6
7
namespace
slick::sim::md_publisher
{
8
9
// Encoders for Coinbase's `market_trades` channel, kept free of the socket layer
10
// so the wire shape can be tested without standing up a WebSocket server.
11
//
12
// Every message carries the same envelope; only `sequence_num` differs per
13
// socket, so the caller stamps that in before sending:
14
//
15
// {"channel":"market_trades","client_id":"","timestamp":"<iso8601>",
16
// "sequence_num":N,
17
// "events":[{"type":"update"|"snapshot","trades":[...]}]}
18
//
19
// Per-trade fields follow the venue: `price`, `size` and `trade_id` are strings,
20
// `side` is the aggressor as "BUY"/"SELL", and `time` is microsecond ISO 8601.
21
23
nlohmann::json
encode_market_trade
(
const
char
* product_id,
const
TradeSummary& summary);
24
28
nlohmann::json
encode_market_trades
(
const
char
* product_id,
const
char
* event_type,
29
const
MDTrade* trades, uint32_t num_trades,
30
bool
newest_first);
31
32
}
// end namespace slick::sim::md_publisher
market_data.hpp
messages.hpp
slick::sim::md_publisher
Definition
market_data_publisher.hpp:8
slick::sim::md_publisher::encode_market_trade
json encode_market_trade(const char *product_id, const TradeSummary &summary)
One executed trade, as a "type":"update" event.
Definition
coinbase_trade_encoder.cpp:45
slick::sim::md_publisher::encode_market_trades
json encode_market_trades(const char *product_id, const char *event_type, const MDTrade *trades, uint32_t num_trades, bool newest_first)
A run of trades as a single event of the given type.
Definition
coinbase_trade_encoder.cpp:53
venues
coinbase
coinbase_trade_encoder.hpp
Generated by
1.15.0