Slick Trader 0.11.0
Multi-broker algorithmic trading engine with plugin strategies and a live web dashboard
Loading...
Searching...
No Matches
hyperliquid_md_connector.cpp
Go to the documentation of this file.
10#include <slick/net/http.hpp>
11#include <hyperliquid/info.hpp>
12#include <hyperliquid/utils/constants.hpp>
13#include <hyperliquid/utils/l2_diff.hpp>
14#include <slick/logger.hpp>
15#include <algorithm>
16#include <chrono>
17#include <cmath>
18#include <cstdlib>
19#include <stdexcept>
20#include <cstring>
21
22namespace slick::trader {
23
24static constexpr uint32_t producer_id = static_cast<uint8_t>(BrokerId::HYPERLIQUID) * 2 - 1;
25
27 const json& config,
28 slick::stream_buffer_multiplexer &mux,
29 slick::queue<uint8_t>& control_queue,
30 slick::queue<uint8_t>& request_queue
31)
32 : enabled_(config.empty() ? false : config.value("enabled", true))
33 , shm_name_(config.value("shm_name", ""))
34 , control_queue_(control_queue)
35 , request_queue_(request_queue)
36 , request_cursor_(request_queue.initial_reading_index())
37 , api_url_(config.value("api_url", hyperliquid::MAINNET_API_URL))
38{
40 reg.set_name(BrokerId::HYPERLIQUID, "Hyperliquid");
41 reg.set_md_enabled(BrokerId::HYPERLIQUID, enabled_);
42 if (enabled_) {
43 event_buffer_ = mux.add_producer(
45 config.value("queue_size", 1u << 26),
46 config.value("control_size", 1u << 24),
47 shm_name_.empty() ? nullptr : shm_name_.c_str()
48 );
49 } else {
50 LOG_INFO("Hyperliquid MD connector is disabled");
51 }
52}
53
57
59 if(enabled_) {
60 EventSerializer::publish<RegisterEvent>(control_queue_, [=, this](RegisterEvent& event) {
61 event.broker_id = BrokerId::HYPERLIQUID;
62 event.component_type = ComponentType::MARKET_DATA;
63 event.producer_id = producer_id;
64 std::memcpy(event.shm_name, shm_name_.c_str(), sizeof(event.shm_name));
65 });
66 }
67}
68
70 if (!enabled_) {
71 return false;
72 }
73
74 LOG_INFO("Hyperliquid MD: Connecting to {}", api_url_);
75
76 try {
77 info_ = std::make_unique<hyperliquid::Info>(api_url_, false, true);
78 info_->load_meta();
79 connected_.store(true, std::memory_order_release);
81 LOG_INFO("Hyperliquid MD: Connected");
82 return true;
83 } catch (const std::exception& e) {
84 LOG_ERROR("Hyperliquid MD: connect() failed: {}", e.what());
85 info_.reset();
86 connected_.store(false, std::memory_order_release);
88 return false;
89 }
90}
91
93 if (info_) {
94 LOG_INFO("Hyperliquid MD: Disconnecting");
95 // Unsubscribe all channels before destroying Info
96 for (auto& [sub_json_str, sub_id] : sub_ids_) {
97 try {
98 info_->unsubscribe(nlohmann::json::parse(sub_json_str), sub_id);
99 } catch (...) {}
100 }
101 sub_ids_.clear();
102 info_.reset();
103 connected_.store(false, std::memory_order_release);
105 LOG_INFO("Hyperliquid MD: Disconnected");
106 }
107}
108
110 LOG_INFO("Hyperliquid MD: Subscribing to {} instruments (type: {})",
111 request.num_instruments, static_cast<int>(request.subscription_type));
112
113 // If already connected, subscribe immediately
114 if (info_) {
115 for (auto i = 0u; i < request.num_instruments; ++i) {
116 const auto& instr = request.instruments[i];
117
118 auto iter = info_->name_to_coin.find(instr);
119 if (iter == info_->name_to_coin.end()) {
120 LOG_ERROR("HYPERLIQUID skip subscription of an invalid coin {}", instr);
121 continue;
122 }
123
124 coin_to_name_.emplace(std::make_pair(iter->second, instr));
125
126 nlohmann::json sub;
127 std::string ch_type;
128
129 switch (request.subscription_type) {
131 trade_instruments_.push_back(instr);
132 ch_type = "trades";
133 sub = {{"type", "trades"}, {"coin", instr}};
134 break;
136 quote_instruments_.push_back(instr);
137 ch_type = "bbo";
138 sub = {{"type", "bbo"}, {"coin", instr}};
139 break;
141 level2_instruments_.push_back(instr);
142 level2_depth_ = request.depth;
143 ch_type = "l2";
144 sub = {{"type", "l2"}, {"c", instr}};
145 break;
147 level2_instruments_.push_back(instr);
148 level2_depth_ = request.depth;
149 ch_type = "l2Book";
150 sub = {{"type", "l2Book"}, {"coin", instr}, {"fast", true}};
151 break;
153 LOG_WARN("Hyperliquid MD: no market-by-order feed, MBO subscription of {} ignored", instr);
154 continue;
155 }
156
157 int id = info_->subscribe(sub, [this, ch_type](const nlohmann::json& msg) {
158 if (ch_type == "trades") on_trades(msg);
159 else if (ch_type == "bbo") on_bbo(msg);
160 else if (ch_type == "l2") on_l2(msg);
161 else if (ch_type == "l2Book") on_l2book(msg);
162 else LOG_WARN("Hyperliquid MD: Unknown channel type: {}", ch_type);
163 });
164 sub_ids_.emplace_back(sub.dump(), id);
165 }
166 }
167
168 return true;
169}
170
172 auto remove_from = [&](std::vector<std::string>& list) {
173 for (auto i = 0u; i < request.num_instruments; ++i) {
174 const auto& ins = request.instruments[i];
175 list.erase(std::remove(list.begin(), list.end(), ins), list.end());
176 }
177 };
178
179 switch (request.subscription_type) {
180 case SubscriptionType::TRADE: remove_from(trade_instruments_); break;
181 case SubscriptionType::QUOTE: remove_from(quote_instruments_); break;
183 case SubscriptionType::ORDER_BOOK: remove_from(level2_instruments_); break;
184 case SubscriptionType::MBO: break;
185 }
186
187 return true;
188}
189
191 if (running_.load(std::memory_order_relaxed)) {
192 LOG_WARN("Hyperliquid MD: Already running");
193 return;
194 }
195 running_.store(true, std::memory_order_release);
196 connect();
197 worker_thread_ = std::thread(&HyperliquidMDConnector::run, this);
198}
199
201 if (!running_.load(std::memory_order_acquire)) return;
202
203 running_.store(false, std::memory_order_release);
204 disconnect();
205}
206
207std::vector<MdDefinition> hyperliquid_definitions(const std::unordered_map<std::string, int>& coin_to_asset,
208 const std::unordered_map<int, int>& asset_to_sz_decimals) {
209 constexpr int FIRST_SPOT_ASSET = 10000;
210 std::vector<MdDefinition> definitions;
211 for (const auto& [coin, asset] : coin_to_asset) {
212 if (asset >= FIRST_SPOT_ASSET) {
213 continue;
214 }
215 const auto decimals = asset_to_sz_decimals.find(asset);
216 definitions.push_back(MdDefinition{
217 .symbol = coin,
218 .quantity_increment = decimals != asset_to_sz_decimals.end()
219 ? to_qty_t(std::pow(10.0, -decimals->second))
220 : qty_t(0),
221 .currency = "USDC",
222 });
223 }
224 std::ranges::sort(definitions, {}, &MdDefinition::symbol);
225 return definitions;
226}
227
228void HyperliquidMDConnector::publish_definitions() {
229 const auto definitions = hyperliquid_definitions(info_->coin_to_asset, info_->asset_to_sz_decimals);
230 for (const auto& definition : definitions) {
231 publish_definition(*event_buffer_, BrokerId::HYPERLIQUID, definition);
232 }
233 LOG_INFO("Hyperliquid MD: {} perp(s) defined", definitions.size());
234}
235
236void HyperliquidMDConnector::run() {
237 LOG_INFO("Hyperliquid MD: Worker thread started");
238 connect();
239 // From this thread, the buffer's one writer: the metadata's callbacks publish from it too.
240 if (info_) {
241 publish_definitions();
242 }
243
244 while (running_.load(std::memory_order_acquire)) {
245 if (info_) {
246 info_->dispatch();
247 }
248 process_md_requests();
249 }
250
251 LOG_INFO("Hyperliquid MD: Worker thread stopped");
252}
253
254void HyperliquidMDConnector::process_md_requests() {
255 // Unlike Coinbase's, start() runs this loop when disabled too, so the handlers check.
256 const bool read = process_md_request(
257 request_queue_, request_cursor_, BrokerId::HYPERLIQUID,
258 [this](const MDSubscription& request) {
259 if (enabled_) {
260 subscribe(request);
261 } else {
262 LOG_WARN("Hyperliquid MD skip subscription, not enabled");
263 }
264 },
265 [this](const MDSubscription& request) {
266 if (enabled_) {
267 unsubscribe(request);
268 }
269 });
270 if (!read) {
271 std::this_thread::yield();
272 }
273}
274
275void HyperliquidMDConnector::subscribe_all() {
276 auto subscribe_coin_list = [&](const std::vector<std::string>& coins,
277 const std::string& ch_type) {
278 for (const auto& coin : coins) {
279 nlohmann::json sub = {{"type", ch_type}, {"coin", coin}};
280 int id = info_->subscribe(sub, [this, ch_type](const nlohmann::json& msg) {
281 if (ch_type == "trades") on_trades(msg);
282 else if (ch_type == "bbo") on_bbo(msg);
283 else if (ch_type == "l2") on_l2(msg);
284 else if (ch_type == "l2Book") on_l2book(msg);
285 else LOG_WARN("Hyperliquid MD: Unknown channel type: {}", ch_type);
286 });
287 sub_ids_.emplace_back(sub.dump(), id);
288 }
289 };
290
291 subscribe_coin_list(trade_instruments_, "trades");
292 subscribe_coin_list(quote_instruments_, "bbo");
293 subscribe_coin_list(level2_instruments_, "l2Book");
294}
295
296// ── Private event handlers ────────────────────────────────────────────────────
297
298void HyperliquidMDConnector::on_trades(const nlohmann::json& msg) {
299 const auto data_ptr = msg.find("data");
300 if (data_ptr == msg.end() || !data_ptr->is_array()) return;
301
302 for (const auto& trade : *data_ptr) {
303 try {
304 const std::string coin = trade.at("coin").get<std::string>();
305 const double px = std::stod(trade.at("px").get<std::string>());
306 const double sz = std::stod(trade.at("sz").get<std::string>());
307 const std::string side_str = trade.value("side", "B");
308 const uint64_t tid = trade.value("tid", uint64_t(0));
309 const uint64_t time_ms = trade.value("time", uint64_t(0));
310 std::string instr = coin;
311 auto iter = coin_to_name_.find(coin);
312 if (iter != coin_to_name_.end()) {
313 instr = iter->second;
314 }
315
316 EventSerializer::publish<TradeEvent>(*event_buffer_, [&](TradeEvent& ev) {
317 ev.broker_id = BrokerId::HYPERLIQUID;
318 ev.timestamp_ns = get_timestamp_ns();
319 ev.event_time_ns = time_ms * 1'000'000ULL;
320 ev.set_instrument(instr);
321 ev.price = to_price_t(px);
322 ev.quantity = to_qty_t(sz);
323 // "B" = taker was buyer → buyer is taker → is_buyer_maker = false
324 // "A" = taker was seller → buyer is maker → is_buyer_maker = true
325 ev.is_buyer_maker = (side_str == "A");
326 ev.side = (side_str == "B") ? Side::BUY : Side::SELL;
327 ev.trade_id = tid;
328 });
329 } catch (const std::exception& e) {
330 LOG_ERROR("Hyperliquid MD: Failed to parse trade: {}", e.what());
331 }
332 }
333}
334
335void HyperliquidMDConnector::on_bbo(const nlohmann::json& msg) {
336 const auto data_ptr = msg.find("data");
337 if (data_ptr == msg.end()) return;
338
339 try {
340 const auto& data = *data_ptr;
341 const std::string coin = data.at("coin").get<std::string>();
342 const uint64_t time_ms = data.value("time", uint64_t(0));
343
344 // levels[0] = [[bid_price, bid_size]], levels[1] = [[ask_price, ask_size]]
345 const auto& levels = data.at("levels");
346 if (levels.size() < 2) return;
347
348 const auto& bids = levels[0];
349 const auto& asks = levels[1];
350 if (bids.empty() || asks.empty()) return;
351
352 const double bid_px = std::stod(bids[0][0].get<std::string>());
353 const double bid_sz = std::stod(bids[0][1].get<std::string>());
354 const double ask_px = std::stod(asks[0][0].get<std::string>());
355 const double ask_sz = std::stod(asks[0][1].get<std::string>());
356
357 std::string instr = coin;
358 auto iter = coin_to_name_.find(coin);
359 if (iter != coin_to_name_.end()) {
360 instr = iter->second;
361 }
362
363 EventSerializer::publish<QuoteEvent>(*event_buffer_, [&](QuoteEvent& ev) {
364 ev.broker_id = BrokerId::HYPERLIQUID;
365 ev.timestamp_ns = get_timestamp_ns();
366 ev.event_time_ns = time_ms * 1'000'000ULL;
367 ev.set_instrument(instr);
368 ev.bid_price = to_price_t(bid_px);
369 ev.bid_quantity = to_qty_t(bid_sz);
370 ev.ask_price = to_price_t(ask_px);
371 ev.ask_quantity = to_qty_t(ask_sz);
372 });
373 } catch (const std::exception& e) {
374 LOG_ERROR("Hyperliquid MD: Failed to parse bbo: {}", e.what());
375 }
376}
377
378void HyperliquidMDConnector::on_l2(const nlohmann::json& msg) {
379 const auto data_ptr = msg.find("data");
380 if (data_ptr == msg.end()) return;
381
382 try {
383 const auto& data = *data_ptr;
384 const auto s_ptr = data.find("s");
385 if (s_ptr != data.end() && s_ptr->is_string()) {
386 // This is a snapshot response to a subscription request, not an actual l2 update
387
388 const std::string coin = s_ptr->at("coin").get<std::string>();
389 const uint64_t time_ms = s_ptr->value("t", uint64_t(0));
390
391 std::string instr = coin;
392 auto iter = coin_to_name_.find(coin);
393 if (iter != coin_to_name_.end()) {
394 instr = iter->second;
395 }
396
397 const auto& levels = s_ptr->at("levels");
398 if (levels.size() < 2) return;
399
400 const auto& bids = levels[0];
401 const auto& asks = levels[1];
402 const size_t total_levels = bids.size() + asks.size();
403 if (total_levels == 0) return;
404
405 const uint32_t event_size = static_cast<uint32_t>(
406 sizeof(Level2UpdateEvent) + total_levels * sizeof(PriceLevel));
407
408 EventSerializer::publish<Level2UpdateEvent>(*event_buffer_, event_size, [&](Level2UpdateEvent& ev) {
409 ev.broker_id = BrokerId::HYPERLIQUID;
410 ev.timestamp_ns = get_timestamp_ns();
411 ev.event_time_ns = time_ms * 1'000'000ULL;
412 ev.set_instrument(instr);
413 ev.is_snapshot = true;
414 ev.sequence_num = time_ms;
415 ev.num_levels = static_cast<uint16_t>(total_levels);
416
417 size_t idx = 0;
418 for (const auto& level : bids) {
419 ev.levels[idx].price = to_price_t(std::stod(level["px"].get<std::string>()));
420 ev.levels[idx].quantity = to_qty_t(std::stod(level["sz"].get<std::string>()));
421 ev.levels[idx].side = Side::BUY;
422
423 bid_prices_.insert(ev.levels[idx].price); // Add to bids set
424 ++idx;
425 }
426 for (const auto& level : asks) {
427 ev.levels[idx].price = to_price_t(std::stod(level["px"].get<std::string>()));
428 ev.levels[idx].quantity = to_qty_t(std::stod(level["sz"].get<std::string>()));
429 ev.levels[idx].side = Side::SELL;
430
431 ask_prices_.insert(ev.levels[idx].price); // Add to asks set
432 ++idx;
433 }
434 });
435 return;
436 }
437
438 const auto c_ptr = data.find("c");
439 if (c_ptr == data.end() || !c_ptr->is_string()) return;
440
441 const auto diff = hyperliquid::decode_l2_diff(c_ptr->get<std::string>());
442
443 const std::string coin = diff.at("c").get<std::string>();
444 const uint64_t time_ms = diff.value("t", uint64_t(0));
445
446 std::string instr = coin;
447 auto iter = coin_to_name_.find(coin);
448 if (iter != coin_to_name_.end()) {
449 instr = iter->second;
450 }
451
452 LOG_TRACE("Hyperliquid MD: l2 for {}: {}", instr, c_ptr->get<std::string>());
453 LOG_TRACE("Hyperliquid MD: l2 diff for {}: {}", instr, diff.dump());
454
455 const auto& removed_levels = diff.at("r");
456 if (!removed_levels.empty() && removed_levels.is_array() && removed_levels.size() == 2) {
457 const auto& bids = removed_levels[0];
458 const auto& asks = removed_levels[1];
459 const size_t total_levels = bids.size() + asks.size();
460 if (total_levels) {
461 // LOG_TRACE(diff.at("r").dump());
462
463 const uint32_t event_size = static_cast<uint32_t>(
464 sizeof(Level2UpdateEvent) + total_levels * sizeof(PriceLevel));
465
466 EventSerializer::publish<Level2UpdateEvent>(*event_buffer_, event_size, [&](Level2UpdateEvent& ev) {
467 ev.broker_id = BrokerId::HYPERLIQUID;
468 ev.timestamp_ns = get_timestamp_ns();
469 ev.event_time_ns = time_ms * 1'000'000ULL;
470 ev.set_instrument(instr);
471 ev.is_snapshot = false;
472 ev.sequence_num = time_ms;
473
474 size_t idx = 0;
475 // The bid side index is in descending order, so we can iterate through it directly
476 for (const auto& level_index : bids) {
477 auto index = level_index.get<int>();
478 if (index < 0 || index >= static_cast<int>(bid_prices_.size())) {
479 continue;
480 }
481
482 auto price = *std::next(bid_prices_.begin(), index);
483 // LOG_TRACE("Removing bid level at index {}: price={}", index, price);
484 bid_prices_.erase(price); // Remove the price from the set
485
486 ev.levels[idx].price = price;
487 ev.levels[idx].quantity = 0; // Level removed, quantity is zero
488 ev.levels[idx].side = Side::BUY;
489 ++idx;
490 }
491
492 // Remove levels from the ask side in reverse order to avoid invalidating indices
493 for (auto it = asks.rbegin(); it != asks.rend(); ++it) {
494 auto index = it->get<int>();
495 if (index < 0 || index >= static_cast<int>(ask_prices_.size())) {
496 continue;
497 }
498
499 auto price = *std::next(ask_prices_.begin(), index);
500 // LOG_TRACE("Removing ask level at index {}: price={}", index, price);
501 ask_prices_.erase(price); // Remove the price from the set
502
503 ev.levels[idx].price = price;
504 ev.levels[idx].quantity = 0; // Level removed, quantity is zero
505 ev.levels[idx].side = Side::SELL;
506 ++idx;
507 }
508
509 ev.num_levels = static_cast<uint16_t>(idx);
510 });
511 }
512 }
513
514 const auto& levels = diff.at("l");
515 if (levels.size() < 2) return;
516
517 const auto& bids = levels[0];
518 const auto& asks = levels[1];
519 const size_t total_levels = bids.size() + asks.size();
520 if (total_levels == 0) return;
521
522 const uint32_t event_size = static_cast<uint32_t>(
523 sizeof(Level2UpdateEvent) + total_levels * sizeof(PriceLevel));
524
525 EventSerializer::publish<Level2UpdateEvent>(*event_buffer_, event_size, [&](Level2UpdateEvent& ev) {
526 ev.broker_id = BrokerId::HYPERLIQUID;
527 ev.timestamp_ns = get_timestamp_ns();
528 ev.event_time_ns = time_ms * 1'000'000ULL;
529 ev.set_instrument(instr);
530 ev.is_snapshot = false;
531 ev.sequence_num = time_ms;
532 ev.num_levels = static_cast<uint16_t>(total_levels);
533
534 size_t idx = 0;
535 for (const auto& level : bids) {
536 ev.levels[idx].price = to_price_t(std::stod(level["p"].get<std::string>()));
537 ev.levels[idx].quantity = to_qty_t(std::stod(level["s"].get<std::string>()));
538 ev.levels[idx].side = Side::BUY;
539
540 bid_prices_.insert(ev.levels[idx].price); // Add to bids set
541 ++idx;
542 }
543 for (const auto& level : asks) {
544 ev.levels[idx].price = to_price_t(std::stod(level["p"].get<std::string>()));
545 ev.levels[idx].quantity = to_qty_t(std::stod(level["s"].get<std::string>()));
546 ev.levels[idx].side = Side::SELL;
547
548 ask_prices_.insert(ev.levels[idx].price); // Add to asks set
549 ++idx;
550 }
551 });
552 } catch (const std::exception& e) {
553 LOG_ERROR("Hyperliquid MD: Failed to parse l2 diff: {}", e.what());
554 }
555}
556
557void HyperliquidMDConnector::on_l2book(const nlohmann::json& msg) {
558 const auto data_ptr = msg.find("data");
559 if (data_ptr == msg.end()) return;
560
561 try {
562 const auto& data = *data_ptr;
563 const std::string coin = data.at("coin").get<std::string>();
564 const uint64_t time_ms = data.value("time", uint64_t(0));
565
566 // levels[0] = bids [[price, size], ...], levels[1] = asks
567 const auto& levels = data.at("levels");
568 if (levels.size() < 2) return;
569
570 const auto& bids = levels[0];
571 const auto& asks = levels[1];
572 const size_t total_levels = bids.size() + asks.size();
573
574 if (total_levels == 0) return;
575
576 std::string instr = coin;
577 auto iter = coin_to_name_.find(coin);
578 if (iter != coin_to_name_.end()) {
579 instr = iter->second;
580 }
581
582 const uint32_t event_size = static_cast<uint32_t>(
583 sizeof(Level2UpdateEvent) + total_levels * sizeof(PriceLevel));
584
585 EventSerializer::publish<Level2UpdateEvent>(*event_buffer_, event_size, [&](Level2UpdateEvent& ev) {
586 ev.broker_id = BrokerId::HYPERLIQUID;
587 ev.timestamp_ns = get_timestamp_ns();
588 ev.event_time_ns = time_ms * 1'000'000ULL;
589 ev.set_instrument(instr);
590 ev.is_snapshot = true; // Hyperliquid sends full book on each update
591 ev.sequence_num = time_ms;
592 ev.num_levels = static_cast<uint16_t>(total_levels);
593
594 size_t idx = 0;
595 for (const auto& level : bids) {
596 ev.levels[idx].price = to_price_t(std::stod(level["px"].get<std::string>()));
597 ev.levels[idx].quantity = to_qty_t(std::stod(level["sz"].get<std::string>()));
598 ev.levels[idx].num_orders = level["n"].get<uint32_t>();
599 ev.levels[idx].side = Side::BUY;
600 ++idx;
601 }
602 for (const auto& level : asks) {
603 ev.levels[idx].price = to_price_t(std::stod(level["px"].get<std::string>()));
604 ev.levels[idx].quantity = to_qty_t(std::stod(level["sz"].get<std::string>()));
605 ev.levels[idx].num_orders = level["n"].get<uint32_t>();
606 ev.levels[idx].side = Side::SELL;
607 ++idx;
608 }
609 });
610 } catch (const std::exception& e) {
611 LOG_ERROR("Hyperliquid MD: Failed to parse l2Book: {}", e.what());
612 }
613}
614
615} // namespace slick::trader
void set_md_connected(BrokerId id, bool v)
static BrokerStatusRegistry & instance()
static bool publish(slick::SlickQueue< uint8_t > &queue, uint32_t size, populate_event_fn &&populate_event_func)
HyperliquidMDConnector(const json &config, slick::stream_buffer_multiplexer &mux, slick::queue< uint8_t > &control_queue, slick::queue< uint8_t > &request_queue)
bool unsubscribe(const MDSubscription &request) override
bool subscribe(const MDSubscription &request) override
price_t to_price_t(double value)
Definition types.hpp:24
uint64_t get_timestamp_ns()
Definition time.hpp:7
int64_t qty_t
Definition types.hpp:17
bool process_md_request(slick::queue< uint8_t > &queue, uint64_t &cursor, BrokerId broker, Subscribe &&on_subscribe, Unsubscribe &&on_unsubscribe)
std::vector< MdDefinition > hyperliquid_definitions(const std::unordered_map< std::string, int > &coin_to_asset, const std::unordered_map< int, int > &asset_to_sz_decimals)
bool publish_definition(slick::stream_buffer_multiplexer::producer_buffer &buffer, BrokerId broker, const MdDefinition &d)
nlohmann::json json
static constexpr uint32_t producer_id
qty_t to_qty_t(double value)
Definition types.hpp:32