Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
slick::sim Namespace Reference

Namespaces

namespace  cli
 The CLI commands that switch a gateway's business rejects per ID: REJECT_LOGON, REJECT_NEW_ORDERS and LIST_REJECTS.
namespace  detail
namespace  exch
 Helpers for a venue whose one config entry describes several independent exchange instances, such as CME's market segments or ICE's silos.
namespace  md_publisher
namespace  engine
namespace  md_feed
namespace  order_gateway
namespace  utils
 Conversions between wire decimals with a constant exponent of -9 (CME PRICE9, ICE Decimal9) and the simulator's 1e-8 fixed point.

Classes

struct  ControlHeader
 Every control message starts with this. More...
struct  FeedStatusMessage
 The replay feed's state. More...
struct  StartMessage
 Starts the replay of every loaded instrument. More...
struct  CliRequestMessage
 One command to the simulator, on the CLI port. More...
struct  CliReplyMessage
 The answer to a CliRequestMessage. More...
class  ControlStreams
 Cuts each connection's control-port byte stream into whole messages, keeping the part of a message that has arrived until the rest does. More...
struct  MDLevel
struct  MDBookUpdate
struct  MDLevelUpdate
struct  MDOrder
struct  MDOrderUpdate
 Every order-book change one request (or feed event) produced, in book order. More...
struct  MarketDataUpdate
struct  MDSubscriptionResponse
struct  BookSnapshot
struct  MDTrade
struct  MDTradeUpdate
struct  MDTradeSnapshotResponse
 Payload of a SUB_RESPONSE for a venue's trade channel. More...
struct  AddOrderMessage
struct  ModifyOrderMessage
struct  CancelOrderMessage
struct  MDSubscriptionMessage
struct  Request
struct  OrderResponse
struct  Trade
struct  TradeSummary
struct  TradeSummaryInfo
struct  OrderIdentity
 The four identity fields, stored inline in the order and width used by OrderResponse. More...
struct  Order
struct  Fill
struct  SymbolKey
 An instrument is identified by both venue and name. More...
struct  SymbolKeyHash
class  SymbolManager
class  OrderBook
struct  Empty
class  OrderBookImpl
struct  ProxiedHttpResponse

Typedefs

using symbol_name_t = utils::fixed_string<sizeof(MarketDataUpdate::symbol)>
 An instrument name at its wire width.
using price_t = int_fast64_t
using qty_t = int_fast64_t
using time_t = uint_fast64_t
using symid_t = uint16_t
using cum_value_t = boost::multiprecision::uint128_t
using OrderBookL3 = slick::orderbook::OrderBookL3
using IOrderBookObserver = slick::orderbook::IOrderBookObserver
using PriceLevelUpdate = slick::orderbook::PriceLevelUpdate
using OrderUpdate = slick::orderbook::OrderUpdate
using TopOfBook = slick::orderbook::TopOfBook
using SymbolId = slick::orderbook::SymbolId
using Timestamp = slick::orderbook::Timestamp

Enumerations

enum class  FeedState : uint8_t {
  IDLE = 0 , LOADING = 1 , SYNCING = 2 , READY = 3 ,
  REPLAYING = 4 , FINISHED = 5 , ERROR = 6
}
 Where a pcap replay feed is. The values are on the wire: append, never renumber. More...
enum class  ControlMessageType : uint8_t { FEED_STATUS = 1 , START = 2 , CLI_REQUEST = 3 , CLI_REPLY = 4 }
enum class  CliCommandType : uint8_t {
  LIST_TARGETS = 1 , SET_LOG_LEVEL = 2 , SHUTDOWN = 3 , REJECT_LOGON = 4 ,
  REJECT_NEW_ORDERS = 5 , LIST_REJECTS = 6 , START_REPLAY = 7 , PCAP_STATUS = 8 ,
  LIST_FEEDS = 9 , GET_VERSION = 10
}
 What a CLI request asks for. The values are on the wire: append, never renumber. More...
enum class  CliStatus : uint8_t { OK = 0 , FAILED = 1 }
enum  MDUpdateType : uint8_t {
  BOOK , LEVEL , ORDER , TRADE_SUMMARY ,
  TRADE , BOOK_SNAPSHOT , ORDER_SNAPSHOT , SUB_RESPONSE
}
enum  UpdateFlags : uint8_t { F_NONE = 0 , F_IS_SNAPSHOT = 1 , F_END_EVENT = 1 << 1 , F_NOT_IN_BOOK = 1 << 2 }
enum  MDUpdateAction : uint8_t { ACTION_NEW , ACTION_CHANGE , ACTION_DELETE }
enum  MDSubscriptionRejectReason : uint8_t { NONE , UNKNOWN_CONTRACT , MARKET_CLOSED }
enum class  ExecutionMessageType : uint16_t {
  UNKNOWN = 0 , LOGON_REQUEST , TRADER_LOGON_REQUEST , LOGON_REPLY ,
  LOGON_REJECT , TRADER_LOGON_REPLY , SESSION_REJECT , NEW_ORDER_REQUEST ,
  ORDER_CANCEL_REPLACE_REQUEST , ORDER_CANCEL_REQUEST , ORDER_MASS_STATUS_REQUEST , BUSINESS_REJECT ,
  EXECUTION_REPORT , ORDER_CANCEL_REJECT , ORDER_CANCEL_REPLACE_REJECT , HEARTBEAT ,
  NEWS , RETRANSMIT_REQUEST , RETRANSMIT_RESPONSE
}
enum class  BusinessRejectReason : uint16_t { UNKNOWN = 0 , UNKNOWN_SECURITY_ID , DUPLICATE_REQUEST_ID }
enum class  SessionRejectReason : uint16_t {
  NONE , ALREADY_LOGGED_IN , NOT_LOGGED_IN , INVALID_SESSION_ID ,
  UNKNOWN
}
enum class  OrdRejectReason : uint16_t {
  NONE , UNKNOWN , UNKNOWN_CONTRACT , UNKNOWN_ORDER ,
  MARKET_CLOSED , MARKET_HALTED , SMP , INVALID_DISPLAY_QTY ,
  FAK_MUST_BE_LIMIT , ICEBERG_MUST_BE_LIMIT , ICEBERG_MUST_BE_DAY_OR_GTC , PRICE_CANT_BE_BELOW_STOP_PRICE ,
  PRICE_CANT_BE_ABOVE_STOP_PRICE , STOP_PRICE_MUST_BE_BELOW_LAST_TRADE_PRICE , STOP_PRICE_MUST_BE_ABOVE_LAST_TRADE_PRICE , TIME_IN_FORCE_NOT_ALLOWED_IN_CURRENT_MARKET_STATE ,
  ORDER_TYPE_NOT_ALLOWED_IN_CURRENT_MARKET_STATE , INVALID_TICK_SIZE , INVALID_QTY , INVALID_MIN_QTY ,
  CLIENT_ORDER_ID_ALREADY_EXISTS , FOK_CANNOT_FILL , LICENSE_REQUIRED
}
enum class  CxlRejectReason : uint16_t {
  NONE , UNKNOWN , MARKET_CLOSED , MARKET_HALTED ,
  PREOPEN , ORDER_NOT_FOUND , INVALID_DISPLAY_QTY , ICEBERG_REQUEST_ON_NON_ICEBERG ,
  NON_ICEBERG_REQUEST_ON_ICEBERG , ORDER_TYPE_MISMATCH , TIME_IN_FORCE_MISMATCH , PRICE_CANT_BE_BELOW_STOP_PRICE ,
  PRICE_CANT_BE_ABOVE_STOP_PRICE , STOP_PRICE_MUST_BE_BELOW_LAST_TRADE_PRICE , STOP_PRICE_MUST_BE_ABOVE_LAST_TRADE_PRICE , INVALID_TICK_SIZE ,
  INVALID_QTY , INVALID_MIN_QTY , INTERCEPTED
}
enum class  MessageType : uint8_t {
  UNKNOWN = 0 , NEW_ORDER_SINGLE = 1 , ORDER_CANCEL_REQUEST = 2 , ORDER_REPLACE_REQUEST = 3 ,
  EXECUTION_REPORT = 4 , ORDER_CANCEL_REJECT = 5 , HEARTBEAT = 6 , TEST_REQUEST = 7 ,
  RE_SEND_REQUEST = 8 , REJECT = 9 , MD_SUBSCRIPTION = 10 , MD_UNSUBSCRIPTION = 11
}
enum  Side : uint8_t { BUY , SELL , UNKNOWN_SIDE }
enum class  OrderType : char {
  UNKNOWN = '0' , MARKET = '1' , LIMIT = '2' , STOP = '3' ,
  STOP_LIMIT = '4' , BRACKET = '5' , TWAP = '6' , ROLL_OPEN = '7' ,
  ROLL_CLOSE = '8' , LIQUIDATION = '9' , SCALED = 'A'
}
enum class  ExecType : char {
  NEW = '0' , CANCELED = '4' , REPLACED = '5' , PENDING_CANCEL = '6' ,
  REJECTED = '8' , EXPIRED = 'C' , PENDING_REPLACE = 'E' , TRADE = 'F' ,
  TRADE_CORRECT = 'G' , TRADE_CANCEL = 'H' , ORDER_STATUS = 'I' , RESTATED = 'D'
}
enum class  OrderStatus : char {
  NEW = '0' , PARTIALLY_FILLED = '1' , FILLED = '2' , DONE_FOR_DAY = '3' ,
  CANCELED = '4' , REPLACED = '5' , PENDING_CANCEL = '6' , STOPPED = '7' ,
  REJECTED = '8' , SUSPENDED = '9' , PENDING_NEW = 'A' , CALCULATED = 'B' ,
  EXPIRED = 'C' , ACCEPTED_FOR_BIDDING = 'D' , PENDING_REPLACE = 'E'
}
enum class  TimeInForce : char {
  DAY = '0' , GOOD_TILL_CANCEL = '1' , AT_THE_OPENING = '2' , IMMEDIATE_OR_CANCEL = '3' ,
  FILL_OR_KILL = '4' , GOOD_TILL_CROSSING = '5' , GOOD_TILL_DATE = '6'
}
enum class  SelfMatchPreventionMode : uint8_t { NONE = 0 , CANCEL_RESTING = 1 , CANCEL_NEWEST = 2 }
enum class  ProductType : uint8_t { UNKNOWN , SPOT , FUTURE }
enum  Venue : uint8_t {
  UNKNOWN_VENUE , CME , ICE , COINBASE ,
  HYPERLIQUID , STOCK , __COUNT__
}
enum class  OrderBookType { L2 , L3 }

Functions

constexpr const char * to_string (FeedState state) noexcept
constexpr const char * to_string (CliCommandType command) noexcept
 The command's name, as the CLI client spells it.
constexpr std::string_view to_string (MDSubscriptionRejectReason reason)
std::string to_string (BusinessRejectReason reject)
std::string to_string (SessionRejectReason reject)
std::string to_string (OrdRejectReason reject)
std::string to_string (CxlRejectReason reject)
void setOrderIdentity (OrderResponse &response, const Order &order) noexcept
 Fills a response's identity from an order: the symbol/user_id/client_order_id/ order_id header in one fixed-size copy, plus the numeric id and correlation tag.
constexpr Side opposite_side (Side side)
template<Side S>
constexpr Side opposite_side ()
constexpr std::string_view to_string (Side side)
constexpr std::string_view to_string (OrderType type)
constexpr std::string_view to_string (ExecType exec_type)
constexpr std::string_view to_string (OrderStatus status)
std::string_view to_string (TimeInForce tif)
constexpr std::string_view to_string (SelfMatchPreventionMode mode)
constexpr SelfMatchPreventionMode to_smp_mode (std::string_view name)
 Parses the self_match_prevention configuration value.
constexpr std::string_view to_string (ProductType type)
constexpr price_t to_price_t (double price)
 Scales a decimal into the fixed-point representation, rounding to the nearest tick rather than truncating.
constexpr double to_price_double (price_t price)
constexpr qty_t to_qty_t (double qty)
constexpr double to_qty_double (qty_t qty)
std::string to_fixed_string (int_fast64_t value, unsigned min_frac_digits=0)
 Renders a fixed-point value as an exact decimal string.
std::string to_price_string (price_t price)
std::string to_qty_string (qty_t qty)
const char * to_string (Venue venue)
Venue to_venue (std::string_view exch)
 Matches venue names case-insensitively, including mixed-case names such as "Coinbase".
orderbook::Side to_book_side (Side side)
ProxiedHttpResponse build_proxied_response (const slick::net::Http::Response &rsp)
void proxy_hyperliquid_info_request (uWS::HttpResponse< false > *res, const std::string &upstream_base_url)

Variables

constexpr symid_t INVALID_SYMBOL_ID = std::numeric_limits<symid_t>::max()
constexpr price_t NULL_PRICE = std::numeric_limits<price_t>::max()
constexpr int32_t DOUBLE_MULTIPLIER = static_cast<int32_t>(1e8)
constexpr double EPSILON = 1e-8

Typedef Documentation

◆ cum_value_t

using slick::sim::cum_value_t = boost::multiprecision::uint128_t

Definition at line 25 of file types.hpp.

◆ IOrderBookObserver

using slick::sim::IOrderBookObserver = slick::orderbook::IOrderBookObserver

Definition at line 30 of file order_book.hpp.

◆ OrderBookL3

using slick::sim::OrderBookL3 = slick::orderbook::OrderBookL3

Definition at line 29 of file order_book.hpp.

◆ OrderUpdate

using slick::sim::OrderUpdate = slick::orderbook::OrderUpdate

Definition at line 32 of file order_book.hpp.

◆ price_t

using slick::sim::price_t = int_fast64_t

Definition at line 21 of file types.hpp.

◆ PriceLevelUpdate

using slick::sim::PriceLevelUpdate = slick::orderbook::PriceLevelUpdate

Definition at line 31 of file order_book.hpp.

◆ qty_t

using slick::sim::qty_t = int_fast64_t

Definition at line 22 of file types.hpp.

◆ symbol_name_t

An instrument name at its wire width.

Symbol and OrderBook hold their name in this type, so publishing one is a fixed-size copy of the whole field rather than memcpy(update->symbol, name.c_str(), sizeof(update->symbol)), which reads past the end of any name shorter than the field - which is all of them.

Deliberately derived from the wire field rather than spelled out: widening MarketDataUpdate::symbol widens the storage with it, instead of silently reintroducing the over-read at every publish site.

Definition at line 122 of file market_data.hpp.

◆ SymbolId

using slick::sim::SymbolId = slick::orderbook::SymbolId

Definition at line 34 of file order_book.hpp.

◆ symid_t

using slick::sim::symid_t = uint16_t

Definition at line 24 of file types.hpp.

◆ time_t

using slick::sim::time_t = uint_fast64_t

Definition at line 23 of file types.hpp.

◆ Timestamp

using slick::sim::Timestamp = slick::orderbook::Timestamp

Definition at line 35 of file order_book.hpp.

◆ TopOfBook

using slick::sim::TopOfBook = slick::orderbook::TopOfBook

Definition at line 33 of file order_book.hpp.

Enumeration Type Documentation

◆ BusinessRejectReason

enum class slick::sim::BusinessRejectReason : uint16_t
strong
Enumerator
UNKNOWN 
UNKNOWN_SECURITY_ID 
DUPLICATE_REQUEST_ID 

Definition at line 34 of file messages.hpp.

◆ CliCommandType

enum class slick::sim::CliCommandType : uint8_t
strong

What a CLI request asks for. The values are on the wire: append, never renumber.

Enumerator
LIST_TARGETS 

Any target. The CLI server answers with every target it routes to.

SET_LOG_LEVEL 

sim. arg is the level; empty reports the current one.

SHUTDOWN 

sim. Stops the simulator.

REJECT_LOGON 

A venue. flag 1 refuses the logons of ID arg from now on, 0 stops.

REJECT_NEW_ORDERS 

A venue. flag 1 rejects every new order of ID arg, 0 stops.

LIST_REJECTS 

A venue. The IDs both of the above apply to.

START_REPLAY 

pcap. Starts each feed's replay, as a control-channel START does.

PCAP_STATUS 

pcap. Each feed's state, progress and window.

LIST_FEEDS 

Any target. The CLI server answers with every enabled market-data feed.

GET_VERSION 

Any target. The CLI server answers with slick-sim's version.

Definition at line 45 of file control_messages.hpp.

◆ CliStatus

enum class slick::sim::CliStatus : uint8_t
strong
Enumerator
OK 
FAILED 

Definition at line 75 of file control_messages.hpp.

◆ ControlMessageType

enum class slick::sim::ControlMessageType : uint8_t
strong
Enumerator
FEED_STATUS 

Sim to client.

START 

Client to sim: start the replay.

CLI_REQUEST 

Client to sim, on the CLI port: CliRequestMessage.

CLI_REPLY 

Sim to client, on the CLI port: CliReplyMessage.

Definition at line 37 of file control_messages.hpp.

◆ CxlRejectReason

enum class slick::sim::CxlRejectReason : uint16_t
strong
Enumerator
NONE 
UNKNOWN 
MARKET_CLOSED 
MARKET_HALTED 
PREOPEN 
ORDER_NOT_FOUND 
INVALID_DISPLAY_QTY 
ICEBERG_REQUEST_ON_NON_ICEBERG 
NON_ICEBERG_REQUEST_ON_ICEBERG 
ORDER_TYPE_MISMATCH 
TIME_IN_FORCE_MISMATCH 
PRICE_CANT_BE_BELOW_STOP_PRICE 
PRICE_CANT_BE_ABOVE_STOP_PRICE 
STOP_PRICE_MUST_BE_BELOW_LAST_TRADE_PRICE 
STOP_PRICE_MUST_BE_ABOVE_LAST_TRADE_PRICE 
INVALID_TICK_SIZE 
INVALID_QTY 
INVALID_MIN_QTY 
INTERCEPTED 

Definition at line 155 of file messages.hpp.

◆ ExecType

enum class slick::sim::ExecType : char
strong
Enumerator
NEW 
CANCELED 
REPLACED 
PENDING_CANCEL 
REJECTED 
EXPIRED 
PENDING_REPLACE 
TRADE 
TRADE_CORRECT 
TRADE_CANCEL 
ORDER_STATUS 
RESTATED 

Definition at line 104 of file order.hpp.

◆ ExecutionMessageType

enum class slick::sim::ExecutionMessageType : uint16_t
strong
Enumerator
UNKNOWN 
LOGON_REQUEST 
TRADER_LOGON_REQUEST 
LOGON_REPLY 
LOGON_REJECT 
TRADER_LOGON_REPLY 
SESSION_REJECT 
NEW_ORDER_REQUEST 
ORDER_CANCEL_REPLACE_REQUEST 
ORDER_CANCEL_REQUEST 
ORDER_MASS_STATUS_REQUEST 
BUSINESS_REJECT 
EXECUTION_REPORT 
ORDER_CANCEL_REJECT 
ORDER_CANCEL_REPLACE_REJECT 
HEARTBEAT 
NEWS 
RETRANSMIT_REQUEST 
RETRANSMIT_RESPONSE 

Definition at line 12 of file messages.hpp.

◆ FeedState

enum class slick::sim::FeedState : uint8_t
strong

Where a pcap replay feed is. The values are on the wire: append, never renumber.

Enumerator
IDLE 

Not started.

LOADING 

Opening the capture files and reading up to the window's begin.

SYNCING 

Building the book from the snapshot and incremental captures. Nothing is published.

READY 

The book is built and held. Replay starts when a client sends START.

REPLAYING 

Publishing the capture.

FINISHED 

The window is replayed out.

ERROR 

The feed failed; message says why.

Definition at line 14 of file control_messages.hpp.

◆ MDSubscriptionRejectReason

Enumerator
NONE 
UNKNOWN_CONTRACT 
MARKET_CLOSED 

Definition at line 127 of file market_data.hpp.

◆ MDUpdateAction

Enumerator
ACTION_NEW 
ACTION_CHANGE 
ACTION_DELETE 

Definition at line 47 of file market_data.hpp.

◆ MDUpdateType

enum slick::sim::MDUpdateType : uint8_t
Enumerator
BOOK 
LEVEL 
ORDER 
TRADE_SUMMARY 

One executed trade.

The only source of the public trade tape: a venue's own trade print is replayed through the matching engine as an aggressor order, and the resulting fills are published as these.

TRADE 

Reserved.

Held so the following values keep their numbering - nothing produces or consumes it since venue prints stopped being relayed raw.

BOOK_SNAPSHOT 
ORDER_SNAPSHOT 
SUB_RESPONSE 

Definition at line 20 of file market_data.hpp.

◆ MessageType

enum class slick::sim::MessageType : uint8_t
strong
Enumerator
UNKNOWN 
NEW_ORDER_SINGLE 
ORDER_CANCEL_REQUEST 
ORDER_REPLACE_REQUEST 
EXECUTION_REPORT 
ORDER_CANCEL_REJECT 
HEARTBEAT 
TEST_REQUEST 
RE_SEND_REQUEST 
REJECT 
MD_SUBSCRIPTION 
MD_UNSUBSCRIPTION 

Definition at line 224 of file messages.hpp.

◆ OrderBookType

enum class slick::sim::OrderBookType
strong
Enumerator
L2 
L3 

Definition at line 270 of file order_book.hpp.

◆ OrderStatus

enum class slick::sim::OrderStatus : char
strong
Enumerator
NEW 
PARTIALLY_FILLED 
FILLED 
DONE_FOR_DAY 
CANCELED 
REPLACED 
PENDING_CANCEL 
STOPPED 
REJECTED 
SUSPENDED 
PENDING_NEW 
CALCULATED 
EXPIRED 
ACCEPTED_FOR_BIDDING 
PENDING_REPLACE 

Definition at line 149 of file order.hpp.

◆ OrderType

enum class slick::sim::OrderType : char
strong
Enumerator
UNKNOWN 
MARKET 
LIMIT 
STOP 
STOP_LIMIT 
BRACKET 
TWAP 
ROLL_OPEN 
ROLL_CLOSE 
LIQUIDATION 
SCALED 

Definition at line 62 of file order.hpp.

◆ OrdRejectReason

enum class slick::sim::OrdRejectReason : uint16_t
strong
Enumerator
NONE 
UNKNOWN 
UNKNOWN_CONTRACT 
UNKNOWN_ORDER 
MARKET_CLOSED 
MARKET_HALTED 
SMP 
INVALID_DISPLAY_QTY 
FAK_MUST_BE_LIMIT 
ICEBERG_MUST_BE_LIMIT 
ICEBERG_MUST_BE_DAY_OR_GTC 
PRICE_CANT_BE_BELOW_STOP_PRICE 
PRICE_CANT_BE_ABOVE_STOP_PRICE 
STOP_PRICE_MUST_BE_BELOW_LAST_TRADE_PRICE 
STOP_PRICE_MUST_BE_ABOVE_LAST_TRADE_PRICE 
TIME_IN_FORCE_NOT_ALLOWED_IN_CURRENT_MARKET_STATE 
ORDER_TYPE_NOT_ALLOWED_IN_CURRENT_MARKET_STATE 
INVALID_TICK_SIZE 
INVALID_QTY 
INVALID_MIN_QTY 
CLIENT_ORDER_ID_ALREADY_EXISTS 
FOK_CANNOT_FILL 
LICENSE_REQUIRED 

Definition at line 76 of file messages.hpp.

◆ ProductType

enum class slick::sim::ProductType : uint8_t
strong
Enumerator
UNKNOWN 
SPOT 
FUTURE 

Definition at line 263 of file order.hpp.

◆ SelfMatchPreventionMode

enum class slick::sim::SelfMatchPreventionMode : uint8_t
strong
Enumerator
NONE 
CANCEL_RESTING 
CANCEL_NEWEST 

Definition at line 233 of file order.hpp.

◆ SessionRejectReason

enum class slick::sim::SessionRejectReason : uint16_t
strong
Enumerator
NONE 
ALREADY_LOGGED_IN 
NOT_LOGGED_IN 
INVALID_SESSION_ID 
UNKNOWN 

Definition at line 52 of file messages.hpp.

◆ Side

enum slick::sim::Side : uint8_t
Enumerator
BUY 
SELL 
UNKNOWN_SIDE 

Definition at line 20 of file order.hpp.

◆ TimeInForce

enum class slick::sim::TimeInForce : char
strong
Enumerator
DAY 
GOOD_TILL_CANCEL 
AT_THE_OPENING 
IMMEDIATE_OR_CANCEL 
FILL_OR_KILL 
GOOD_TILL_CROSSING 
GOOD_TILL_DATE 

Definition at line 203 of file order.hpp.

◆ UpdateFlags

enum slick::sim::UpdateFlags : uint8_t
Enumerator
F_NONE 
F_IS_SNAPSHOT 
F_END_EVENT 
F_NOT_IN_BOOK 

On an MDTrade: this print was never applied to the order book.

Set only for prints seeded from a venue's own trade snapshot, which happened before the simulator was listening. Every trade the matching engine produced is in the book by construction, whatever its timestamp.

Definition at line 36 of file market_data.hpp.

◆ Venue

enum slick::sim::Venue : uint8_t
Enumerator
UNKNOWN_VENUE 
CME 
ICE 
COINBASE 
HYPERLIQUID 
STOCK 
__COUNT__ 

Definition at line 155 of file types.hpp.

Function Documentation

◆ build_proxied_response()

ProxiedHttpResponse slick::sim::build_proxied_response ( const slick::net::Http::Response & rsp)
inline

Definition at line 28 of file hyperliquid_info_proxy.hpp.

Referenced by proxy_hyperliquid_info_request().

◆ opposite_side() [1/2]

template<Side S>
Side slick::sim::opposite_side ( )
inlineconstexpr

Definition at line 39 of file order.hpp.

References BUY, SELL, and UNKNOWN_SIDE.

Referenced by slick::sim::engine::detail::recordTrade().

◆ opposite_side() [2/2]

Side slick::sim::opposite_side ( Side side)
inlineconstexpr

Definition at line 26 of file order.hpp.

References BUY, SELL, and UNKNOWN_SIDE.

◆ proxy_hyperliquid_info_request()

void slick::sim::proxy_hyperliquid_info_request ( uWS::HttpResponse< false > * res,
const std::string & upstream_base_url )
inline

Definition at line 50 of file hyperliquid_info_proxy.hpp.

References build_proxied_response().

◆ setOrderIdentity()

void slick::sim::setOrderIdentity ( OrderResponse & response,
const Order & order )
inlinenoexcept

Fills a response's identity from an order: the symbol/user_id/client_order_id/ order_id header in one fixed-size copy, plus the numeric id and correlation tag.

Every response built from an order goes through here, so neither of those two can be left holding a recycled slot's previous value.

Definition at line 368 of file messages.hpp.

Referenced by slick::sim::engine::MatchingEngine::publishOrderAck(), slick::sim::engine::MatchingEngine::publishOrderCancel(), slick::sim::engine::MatchingEngine::publishOrderExecution(), slick::sim::engine::MatchingEngine::publishOrderModify(), slick::sim::exch::Exchange::sendOrderCancelPending(), slick::sim::exch::Exchange::sendOrderNewPending(), and slick::sim::exch::Exchange::sendOrderReplacePending().

◆ to_book_side()

◆ to_fixed_string()

std::string slick::sim::to_fixed_string ( int_fast64_t value,
unsigned min_frac_digits = 0 )
inline

Renders a fixed-point value as an exact decimal string.

Formats straight from the integer, never through double. std::to_string(double) formats with f, which emits exactly six fractional digits, but the scale here carries eight: a size of 0.00011628 went onto the wire as "0.000116", and one tick, 0.00000001, as "0.000000" - a value the receiver reads as zero.

Trailing fractional zeros are trimmed, and the point is omitted entirely for a whole number, so 8.2 renders as "8.2" rather than "8.20000000".

min_frac_digits sets a floor on how far that trimming goes, for a venue whose own serialiser always leaves a fractional digit behind: at 1, a whole 77052 renders as "77052.0" instead of "77052". It never pads past the scale's eight digits, and 0 - the default - is the trim-everything behaviour above.

Definition at line 72 of file types.hpp.

References DOUBLE_MULTIPLIER.

Referenced by slick::sim::md_publisher::to_hyperliquid_number(), to_price_string(), and to_qty_string().

◆ to_price_double()

◆ to_price_string()

std::string slick::sim::to_price_string ( price_t price)
inline

Definition at line 107 of file types.hpp.

References to_fixed_string().

Referenced by slick::sim::order_gateway::coinbase::to_json().

◆ to_price_t()

price_t slick::sim::to_price_t ( double price)
inlineconstexpr

Scales a decimal into the fixed-point representation, rounding to the nearest tick rather than truncating.

price * 1e8 is a binary floating-point multiply, and most decimal fractions have no exact binary form, so the product lands just under the intended integer: 8.2 * 1e8 is 819999999.99999988, and a plain cast to an integer throws the fraction away, yielding 819999999 - a price of 8.19999999. The same happens to 0.29 and 4.35, and to quantities. Adding half a tick before truncating rounds to nearest instead, which lands on the intended value for every decimal that fits in the scale.

Definition at line 42 of file types.hpp.

References DOUBLE_MULTIPLIER.

Referenced by slick::sim::exch::CoinbaseExchange::onLevel2Snapshot(), slick::sim::exch::CoinbaseExchange::onLevel2Updates(), slick::sim::exch::CoinbaseExchange::onMarketTrades(), and slick::sim::exch::CoinbaseExchange::onMarketTradesSnapshot().

◆ to_qty_double()

◆ to_qty_string()

std::string slick::sim::to_qty_string ( qty_t qty)
inline

Definition at line 108 of file types.hpp.

References to_fixed_string().

Referenced by slick::sim::order_gateway::coinbase::to_json().

◆ to_qty_t()

◆ to_smp_mode()

SelfMatchPreventionMode slick::sim::to_smp_mode ( std::string_view name)
inlineconstexpr

Parses the self_match_prevention configuration value.

Returns NONE for an unrecognised name, so a typo disables SMP rather than aborting startup.

Definition at line 253 of file order.hpp.

References CANCEL_NEWEST, CANCEL_RESTING, and NONE.

◆ to_string() [1/15]

std::string slick::sim::to_string ( BusinessRejectReason reject)
inline

Definition at line 40 of file messages.hpp.

References DUPLICATE_REQUEST_ID, UNKNOWN, and UNKNOWN_SECURITY_ID.

◆ to_string() [2/15]

const char * slick::sim::to_string ( CliCommandType command)
nodiscardconstexprnoexcept

The command's name, as the CLI client spells it.

Definition at line 59 of file control_messages.hpp.

References GET_VERSION, LIST_FEEDS, LIST_REJECTS, LIST_TARGETS, PCAP_STATUS, REJECT_LOGON, REJECT_NEW_ORDERS, SET_LOG_LEVEL, SHUTDOWN, and START_REPLAY.

◆ to_string() [3/15]

◆ to_string() [4/15]

std::string_view slick::sim::to_string ( ExecType exec_type)
inlineconstexpr

◆ to_string() [5/15]

◆ to_string() [6/15]

std::string_view slick::sim::to_string ( MDSubscriptionRejectReason reason)
inlineconstexpr

Definition at line 133 of file market_data.hpp.

References MARKET_CLOSED, NONE, and UNKNOWN_CONTRACT.

◆ to_string() [7/15]

std::string_view slick::sim::to_string ( OrderStatus status)
inlineconstexpr

◆ to_string() [8/15]

std::string_view slick::sim::to_string ( OrderType type)
inlineconstexpr

Definition at line 76 of file order.hpp.

References BRACKET, LIMIT, LIQUIDATION, MARKET, ROLL_CLOSE, ROLL_OPEN, SCALED, STOP, STOP_LIMIT, TWAP, and UNKNOWN.

◆ to_string() [9/15]

◆ to_string() [10/15]

std::string_view slick::sim::to_string ( ProductType type)
inlineconstexpr

Definition at line 269 of file order.hpp.

References FUTURE, SPOT, and UNKNOWN.

◆ to_string() [11/15]

std::string_view slick::sim::to_string ( SelfMatchPreventionMode mode)
inlineconstexpr

Definition at line 239 of file order.hpp.

References CANCEL_NEWEST, CANCEL_RESTING, and NONE.

◆ to_string() [12/15]

std::string slick::sim::to_string ( SessionRejectReason reject)
inline

Definition at line 60 of file messages.hpp.

References ALREADY_LOGGED_IN, INVALID_SESSION_ID, NONE, NOT_LOGGED_IN, and UNKNOWN.

◆ to_string() [13/15]

std::string_view slick::sim::to_string ( Side side)
inlineconstexpr

Definition at line 49 of file order.hpp.

References BUY, SELL, and UNKNOWN_SIDE.

◆ to_string() [14/15]

std::string_view slick::sim::to_string ( TimeInForce tif)
inline

◆ to_string() [15/15]

const char * slick::sim::to_string ( Venue venue)
inline

Definition at line 163 of file types.hpp.

References __COUNT__, SLICK_SIM_VENUE_CASE, SLICK_SIM_VENUE_LIST, and UNKNOWN_VENUE.

◆ to_venue()

Venue slick::sim::to_venue ( std::string_view exch)
inline

Matches venue names case-insensitively, including mixed-case names such as "Coinbase".

ExchangeRegistry uses the same iequals comparison for config keys.

Definition at line 177 of file types.hpp.

References SLICK_SIM_VENUE_LIST, SLICK_SIM_VENUE_MATCH, and UNKNOWN_VENUE.

Variable Documentation

◆ DOUBLE_MULTIPLIER

int32_t slick::sim::DOUBLE_MULTIPLIER = static_cast<int32_t>(1e8)
constexpr

Definition at line 29 of file types.hpp.

Referenced by to_fixed_string(), to_price_double(), to_price_t(), to_qty_double(), and to_qty_t().

◆ EPSILON

double slick::sim::EPSILON = 1e-8
constexpr

Definition at line 30 of file types.hpp.

◆ INVALID_SYMBOL_ID

symid_t slick::sim::INVALID_SYMBOL_ID = std::numeric_limits<symid_t>::max()
constexpr

Definition at line 27 of file types.hpp.

◆ NULL_PRICE