|
Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
|
Classes | |
| class | MarketDataPublisher |
| class | SequencedMessage |
| One fan-out payload, serialised once and stamped per subscriber. More... | |
| class | WebsocketMarketDataPublisher |
| struct | PerSocketData |
| class | CoinbasePublisher |
| struct | L2Diff |
| struct | HyperliquidPerSocketData |
| class | HyperliquidPublisher |
Typedefs | |
| using | json = nlohmann::json |
| using | L2Levels = std::vector<std::pair<price_t, qty_t>> |
| using | HyperliquidChannel = slick::sim::exch::HyperliquidChannel |
Functions | |
| json | encode_market_trade (const char *product_id, const TradeSummary &summary) |
| One executed trade, as a "type":"update" event. | |
| 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. | |
| void | split_book_snapshot (const MDLevel *levels, uint32_t num_bid, uint32_t num_ask, nlohmann::json::array_t &bids, nlohmann::json::array_t &asks, L2Levels &curr_bid, L2Levels &curr_ask) |
| L2Diff | compute_l2_diff (const L2Levels &prev_bid, const L2Levels &prev_ask, const L2Levels &curr_bid, const L2Levels &curr_ask) |
| std::string | encode_l2_diff (const nlohmann::json &payload) |
| json | encode_trade_message (const char *coin, const TradeSummary &summary) |
| One executed trade. | |
| json | encode_trade_message (const char *coin, const MDTrade *trades, uint32_t num_trades) |
| A run of trades in the order given. | |
| std::string | to_hyperliquid_number (int_fast64_t value) |
| Formats a fixed-point price or size as Hyperliquid does on the wire. | |
Variables | |
| constexpr uint32_t | L2_PUBLISH_DEPTH = 20 |
Definition at line 23 of file hyperliquid_publisher.hpp.
| using slick::sim::md_publisher::json = nlohmann::json |
Definition at line 20 of file coinbase_publisher.hpp.
| using slick::sim::md_publisher::L2Levels = std::vector<std::pair<price_t, qty_t>> |
Definition at line 14 of file hyperliquid_l2_diff.hpp.
| L2Diff slick::sim::md_publisher::compute_l2_diff | ( | const L2Levels & | prev_bid, |
| const L2Levels & | prev_ask, | ||
| const L2Levels & | curr_bid, | ||
| const L2Levels & | curr_ask ) |
Definition at line 126 of file hyperliquid_l2_diff.cpp.
References slick::sim::md_publisher::L2Diff::l, and slick::sim::md_publisher::L2Diff::r.
| std::string slick::sim::md_publisher::encode_l2_diff | ( | const nlohmann::json & | payload | ) |
Definition at line 138 of file hyperliquid_l2_diff.cpp.
| nlohmann::json slick::sim::md_publisher::encode_market_trade | ( | const char * | product_id, |
| const TradeSummary & | summary ) |
One executed trade, as a "type":"update" event.
Definition at line 45 of file coinbase_trade_encoder.cpp.
References slick::sim::TradeSummary::aggressor_side, slick::sim::TradeSummary::price, slick::sim::TradeSummary::qty, slick::sim::TradeSummary::timestamp, and slick::sim::TradeSummary::trade_id.
| nlohmann::json slick::sim::md_publisher::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.
newest_first reverses the iteration: the venue orders snapshot trades newest first, while updates stay chronological. Emits an empty trades array when num_trades is zero.
Definition at line 53 of file coinbase_trade_encoder.cpp.
| nlohmann::json slick::sim::md_publisher::encode_trade_message | ( | const char * | coin, |
| const MDTrade * | trades, | ||
| uint32_t | num_trades ) |
A run of trades in the order given.
Emits an empty data array when num_trades is zero.
Definition at line 42 of file hyperliquid_trade_encoder.cpp.
| nlohmann::json slick::sim::md_publisher::encode_trade_message | ( | const char * | coin, |
| const TradeSummary & | summary ) |
One executed trade.
Definition at line 34 of file hyperliquid_trade_encoder.cpp.
References slick::sim::TradeSummary::aggressor_side, slick::sim::TradeSummary::price, slick::sim::TradeSummary::qty, slick::sim::TradeSummary::timestamp, and slick::sim::TradeSummary::trade_id.
| void slick::sim::md_publisher::split_book_snapshot | ( | const MDLevel * | levels, |
| uint32_t | num_bid, | ||
| uint32_t | num_ask, | ||
| nlohmann::json::array_t & | bids, | ||
| nlohmann::json::array_t & | asks, | ||
| L2Levels & | curr_bid, | ||
| L2Levels & | curr_ask ) |
Definition at line 84 of file hyperliquid_l2_diff.cpp.
References L2_PUBLISH_DEPTH, slick::sim::MDLevel::num_orders, slick::sim::MDLevel::price, and slick::sim::MDLevel::qty.
|
inline |
Formats a fixed-point price or size as Hyperliquid does on the wire.
The venue uses shortest-round-trip floats with at least one fractional digit: 77052 becomes "77052.0", while 0.73245 and 1.915 keep their existing digits. Use to_fixed_string with a one-digit minimum. In a session capture, all 201 distinct prices ended in ".0" and none of the 8807 distinct sizes had a trailing zero.
This matters for clients that key levels by the received price string. Coinbase uses to_price_string/to_qty_string instead and renders whole values without the fractional digit, such as "99".
Definition at line 19 of file hyperliquid_wire_format.hpp.
References slick::sim::to_fixed_string().
|
inlineconstexpr |
Definition at line 20 of file hyperliquid_l2_diff.hpp.
Referenced by split_book_snapshot().