[
  {
    "path": ".clang-format",
    "content": "---\nBasedOnStyle: Google\nAlignAfterOpenBracket: AlwaysBreak\nAllowAllParametersOfDeclarationOnNextLine: true\nAllowShortCaseLabelsOnASingleLine: false\nAllowShortFunctionsOnASingleLine: InlineOnly\nAllowShortIfStatementsOnASingleLine: Never\nAllowShortLoopsOnASingleLine: false\nBinPackArguments: false\nBinPackParameters: false\nBreakBeforeBraces: Attach\nBreakConstructorInitializers: BeforeColon\nBreakInheritanceList: BeforeColon\nColumnLimit: 160\nConstructorInitializerAllOnOneLineOrOnePerLine: false\nDerivePointerAlignment: false\nExperimentalAutoDetectBinPacking: false\nIncludeBlocks: Preserve\nIndentCaseLabels: true\nInsertBraces: true\nPointerAlignment: Right\nQualifierAlignment: Right\nStandard: c++20  # note! clang20 does not support c++23\n"
  },
  {
    "path": ".clang-tidy",
    "content": "---\nChecks: bugprone-*, modernize-*, performance-*, readability-*, -bugprone-branch-clone,\n  -bugprone-easily-swappable-parameters, -bugprone-inc-dec-in-conditions, -bugprone-macro-parentheses,\n  -bugprone-switch-missing-default-case, -clang-analyzer-optin.performance.Padding,\n  -clang-diagnostic-unused-command-line-argument, -modernize-concat-nested-namespaces,\n  -modernize-use-nodiscard, -modernize-use-trailing-return-type, -performance-enum-size,\n  -performance-move-const-arg, -readability-duplicate-include, -readability-convert-member-functions-to-static,\n  -readability-enum-initial-value, -readability-isolate-declaration, -readability-named-parameter,\n  -readability-qualified-auto, -readability-redundant-member-init, -readability-uppercase-literal-suffix,\nCheckOptions:\n  - key: readability-magic-numbers.IgnoredIntegerValues\n    value: 1;2;3;4;5;10;100;1000;10000;100000;1000000\n  - key: readability-magic-numbers.IgnorePowersOf2IntegerValues\n    value: 'true'\n  - key: readability-magic-numbers.IgnoreAllFloatingPointValues\n    value: 'true'\n  - key: cppcoreguidelines-avoid-magic-numbers.IgnoredIntegerValues\n    value: 1;2;3;4;5;10;100;1000;10000;100000;1000000\n  - key: cppcoreguidelines-avoid-magic-numbers.IgnorePowersOf2IntegerValues\n    value: 'true'\n  - key: cppcoreguidelines-avoid-magic-numbers.IgnoreAllFloatingPointValues\n    value: 'true'\n  - key: readability-identifier-length.IgnoredVariableNames\n    value: e|i|j|k|m|n|fd|id|io|ok|wd|_\n  - key: readability-identifier-length.IgnoredParameterNames\n    value: fd|id|wd\n  - key: readability-function-cognitive-complexity.IgnoreMacros\n    value: 'true'\nWarningsAsErrors: ''\nHeaderFilterRegex: ''\nFormatStyle: none\n"
  },
  {
    "path": ".cmake-format.yaml",
    "content": "---\nformat:\n  line_width: 160\n  tab_size: 2\n"
  },
  {
    "path": ".gitattributes",
    "content": "cmake/* linguist-vendored\ndoxygen/Doxyfile.in linguist-vendored\n*.hpp.in linguist-language=C++\n"
  },
  {
    "path": ".gitignore",
    "content": "# vim\n*.sw[po]\n\n# cmake\n*.[ao]\n*.cmake\n*.so\n*.dylib\nCMake*.in\nCMakeCache.txt\nCMakeFiles/\nDartConfiguration.tcl\nMakefile\nTesting/\nbuild/\ncompile_commands.json*\ninstall_manifest.txt\nlib/\nexternal/\nexternal-prefix/\n\n# cpack\n_CPack_Packages/\n\n# debian\n*.deb\n\n# conda\nopt/\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"roq-cmake\"]\n\tpath = cmake\n\turl = https://github.com/roq-trading/roq-cmake.git\n\tignore = dirty\n[submodule \"roq-scripts\"]\n\tpath = scripts\n\turl = https://github.com/roq-trading/roq-scripts.git\n\tignore = dirty\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes will be documented in this file.\n\n## Head\n\n## 1.1.3 &ndash; 2026-03-12\n\n### Changed\n\n* Add `FundsUpdate.unrealized_pnl` (#571)\n\n## 1.1.2 &ndash; 2026-02-08\n\n## 1.1.1 &ndash; 2025-12-14\n\n## 1.1.0 &ndash; 2025-11-22\n\n### Changed\n\n* Support leverage (CreateOrder, OrderAck, OrderUpdate) (#529)\n\n## 1.0.9 &ndash; 2025-09-26\n\n### Changed\n\n* Workaround for fmt 11.2 and clang 21.x (#521)\n\n## 1.0.8 &ndash; 2025-08-16\n\n### Changed\n\n* Increase max-length of `symbol` to 64 (#516)\n* Auto-generate time-series from history of event-logs and live data (#515)\n* Better support for estimating P&L and funds (#514)\n\n## 1.0.7 &ndash; 2025-07-02\n\n### Changed\n\n* Extend FundsUpdate with borrowed amount (#502)\n\n## 1.0.6 &ndash; 2025-05-16\n\n## 1.0.5 &ndash; 2025-03-26\n\n### Changed\n\n* Upgrade the `format_str` helper class to work with `fmt 11.1` (#488)\n\n### Added\n\n* Control enabled/disabled state (#484)\n* Support MassQuote (#483)\n\n## 1.0.4 &ndash; 2024-12-30\n\n## 1.0.3 &ndash; 2024-11-26\n\n### Changed\n\n* Add quantity type to order management (#469)\n* Add settlement currency to reference data (#468)\n\n## 1.0.2 &ndash; 2024-07-14\n\n### Changed\n\n* `cache::MarketByPrice::impact_price` to accept an optional number of orders (#462)\n* `Fill` to support quote quantity and commission (#458)\n\n## 1.0.1 &ndash; 2024-04-14\n\n### Changed\n\n* Issues with create limited depth updates (#453)\n\n## 1.0.0 &ndash; 2024-03-16\n\n### Fixed\n\n* `utils::compare<double>` could incorrectly compare values in the [0;1] range (#446)\n\n### Added\n\n* `RateLimitsUpdate` to support exchange rate-limit updates\n\n### Changed\n\n* Renamed `{price|quantity}_precision` (from `{price_quantity}_decimals`\n* Moved several header files to the roq-server library (from the roq::oms namespace here)\n* UUID now using C++23 features\n* Moved several header files to the roq-cache library (from the roq::cache namespace here)\n* Moved several header files to the roq-utils library (from the roq::utils namespace here)\n* Promote Decimal to API (from utils::Number) and rename Precision (from Decimals) (#439)\n\n## 0.9.9 &ndash; 2024-01-28\n\n### Added\n\n* Adding exchange time, exchange sequence and sending time to ReferenceData and MarketStatus\n\n### Changed\n\n* Adding `PositionEffect` to `OrderAck`\n* Adding `MarginMode` to `CreateOrder`, `OrderAck`, `OrderUpdate`, `TradeUpdate`\n* OMS validate quantity and price against reference data (#432)\n* Added `MarginMode` to `FundsUpdate` and `PositionUpdate` (#430)\n\n## 0.9.8 &ndash; 2023-11-20\n\n### Fixed\n\n* The position cache would treat zero as a missing value and therefore not update (#419)\n\n### Changed\n\n* `exchange_sequence` is now `uint64_t` (was `int64_t`)\n* `RoutingId` now 64 bytes\n* `GatewaySettings.oms_cancel_all_orders` has been added (#414)\n* `CancelAllOrders` now includes some filters (#414)\n* `oms::OrderUpdate` now includes the max request/response/accepted versions\n\n### Added\n\n* `Fill.exchange_time_utc`\n* `CancelAllOrdersAck` (#414)\n* EXPERIMENTAL: messages for managing dynamic routes\n\n### Removed\n\n* The FlatBuffers schema and auto-generated is no longer needed (replaced by the roq-codec library)\n\n## 0.9.7 &ndash; 2023-09-18\n\n### Added\n\n* `oms::OrderUpdate::routing_id` to support FIX\n\n### Changed\n\n* `order_id` must be `uint64_t` (#377)\n\n### Added\n\n* `OrderAck.client_order_id` and `TradeUpdate.client_order_id` (#389)\n* `CancelAllOrders.strategy_id`\n* `CreateOrder.strategy_id`, `OrderAck.strategy_id`, `OrderUpdate.strategy_id`, `TradeUpdate.strategy_id` (#375)\n* `OrderAck.user` to support drop-copy and risk management\n\n## 0.9.6 &ndash; 2023-07-22\n\n### Changed\n\n* Using `std::source_location` (clang16)\n* Using fmt10\n\n### Added\n\n* `Error.RISK_LIMIT_REACHED`\n* New `Ready` event to indicate the completion of the intial download phase\n* Risk exposure and change added to `OrderAck` and `OrderUpdate` (EXPERIMENTAL)\n* `cache::MarketByPrice::impact_price()` (#372)\n* `RiskLimits` and `RiskLimitsUpdate` (EXPERIMENTAL)\n* `client::Dispatcher.broadcast(CancelAllOrders)`\n\n## 0.9.5 &ndash; 2023-06-12\n\n### Changed\n\n* The `Mask<E>` template had to be changed to work with magic_enum 0.9.0\n\n### Added\n\n* `OrderUpdate.client_order_id` (#366)\n* `OrderAck.traded_quantity` (#359)\n\n### Removed\n\n* `oms::TradeUpdate` was unnecessary (`TradeUpdate` is sufficient for the gateways)\n\n## 0.9.4 &ndash; 2023-05-04\n\n### Changed\n\n* Review `PositionUpdate` and `FundsUpdate` to better correlate with `OrderUpdate` and `TradeUpdate` (#340)\n* `cache::MarketByOrder::OrderUpdate` now includes the final update action\n* `StreamStatus` should include connection details (#337)\n* [BREAKING CHANGE] `CreateOrder::request_template` (renamed from `order_template`)\n* All order requests must support `request_template` (#329)\n\n### Removed\n\n* Drop `OrderUpdate.order_template` (#330)\n\n### Added\n\n* `CustomMatrix` (#344)\n* `PortfolioUpdate` and `Position` to support a position manager (#343)\n\n## 0.9.3 &ndash; 2023-03-20\n\n### Added\n\n* `sending_time_utc` to market data messages (#326)\n* `oms::TradeUpdate` (#254)\n* `client::Settings.drop_copy` (#254)\n\n### Changed\n\n* [BREAKING CHANGE] `MarketByOrderUpdate` and `MBOUpdate` has been changed to support CME's TradeSummary (#322)\n\n### Fixed\n\n* utils::invert(side)` didn't work for `side == UNDEFINED` (#325)\n\n## 0.9.2 &ndash; 2023-02-22\n\n### Added\n\n* `MBOUpdate.reason` + `UpdateReason`\n* `cache::MarketByOrder`\n\n### Changed\n\n* `fbs::MarketByOrderUpdate.max_depth` was inserted (should not be an issue since it was never used before)\n* `MBOUpdate`: `priority` now `uint64_t`, `order_id` length 36 (UUID), re-ordering\n\n## 0.9.1 &ndash; 2023-01-12\n\n## 0.9.0 &ndash; 2022-12-22\n\n### Changed\n\n* New `Protocol` and `Encoding` to support Roq's UDP transport (#307)\n\n## 0.8.9 &ndash; 2022-11-14\n\n### Added\n\n* Move `Category` (from the core and adapter libraries) (#297)\n\n### Changed\n\n* `Parameter` now includes the `account`, `exchange`, `symbol` tuple\n* `ParametersUpdate` was renamed (from `ParameterUpdate`)\n* `TraceInfo` now default initializing to current time\n* `clock` promoted (from core library)\n\n## 0.8.8 &ndash; 2022-10-04\n\n### Added\n\n* `RequestStatus.ERROR` (#292)\n* `TradeSummary` to include exchange sequence and taker/maker order id's (#279)\n* `CustomMetrics.update_type` and `CustomMetricsUpdate.update_type`\n* `GatewaySettings.mbp_checksum`\n\n### Changed\n\n* Preparing to drop C++17 compatibility\n* `cache::MarketByPrice::max_depth` now returns `uint16_t`\n\n### Removed\n\n* `MarketByPriceUpdate.checksum` from the FlatBuffers schema\n* Optimize the `cache::MarketByPrice` interface (#267)\n\n## 0.8.7 &ndash; 2022-08-22\n\n### Added\n\n* `client::EventLogMultiplexer` (#266)\n* Cache objects for Create/Modify/CancelOrder (#26)\n* `ParameterUpdate` (#258)\n\n### Changed\n\n* Optimize the `cache::MarketByPrice` interface (#267)\n* An optional `is_last` field has been added to `client::Dispatcher::send` (#26)\n* Move `RateLimiter` (from roq-server) (#259)\n* API changes needed to support drop-copy (#254)\n* Add notional fields to `ReferenceData` (#252)\n* Add new fields to `RateLimitTrigger` (#251)\n\n### Removed\n\n* `OrderUpdateAction` (replaced with `UpdateAction`)\n\n### Fixed\n\n* `utils::safe_cast` now using `std::numeric_limist::lowest()` (instead of `min()`)\n\n## 0.8.6 &ndash; 2022-07-18\n\n### Fixed\n\n* fmt v9 requires custom formatters to be const\n\n### Changed\n\n* Prevent copy/move of `Event<>` and `Trace<>` (#247)\n* return `span<MBPUpdate>` from `cache::MarketByPrice` (#241)\n* Flatbuffers auto-generated code now using C++17\n* `client::EventLogReader` now expose more metadata\n* `MBPUpdate` now supports `UpdateAction` (#236)\n\n## 0.8.5 &ndash; 2022-06-06\n\n### Added\n\n* `cache::Manager::get_market_with_id` and `cache::Manager::get_market_id`\n* `ReferenceData::discard` (#225)\n\n### Changed\n\n* Promote `utils::DateTime_iso8601` formatter to API (from core)\n* Make `cache::Manager` a non-template (#230)\n* `cache::MarketByPrice::stream_id()`\n\n## 0.8.4 &ndash; 2022-05-14\n\n### Added\n\n* `cache::MarketByPrice::find_index`\n* `cache::MarketByPrice::compute_vwap`\n* RequestIdType added to GatewaySettings (from server)\n\n### Changed\n\n* Increase `Symbol` fixed-length size to 48 (#214)\n* `Event<>` and `Trace<>` formatting has move the value to the front\n* C++17 compatibility (std::span and \"using enum\" workarounds)\n* `Trace` now supports non-const (and retains const-safety when const)\n* `TopOfBook` now includes an exhange sequence number (to correlate with MbP updates)\n* `StreamStatus` now provides more detailed information\n* Promote `debug::hex::Message` and `debug::fix::Message` (from core library)\n* Comparisons now use (or return) `std::strong_ordering` (instead of `int`)\n* Simplify enums (#199)\n* Proper bit-mask support (#198)\n* Promote Trace and TraceInfo to API (from server)\n\n## 0.8.3 &ndash; 2022-03-22\n\n### Changed\n\n* Enforce fixed-length strings for standard use-cases (account, exchange, symbol, ...)\n* Rename `string` (from `string_buffer`)\n* Promote Mask to API (from utils)\n* Rename headers to .hpp (#195)\n* Conda packaging should pin versions to match x.x.x (#189)\n* Added `update_type` to `OrderUpdate` and `TradeUpdate` (#39)\n\n## 0.8.2 &ndash; 2022-02-18\n\n### Changed\n\n* Added account to ExternalLatency (#170)\n* Source file name are now evaluated and stored at compile time (#160)\n\n## 0.8.1 &ndash; 2022-01-16\n\n### Changed                                                                                                                \n                                                                                                                           \n* Upgrade to C++20 (#158)\n\n## 0.8.0 &ndash; 2022-01-12\n\n### Added\n\n* `cache::MarketByPrice::exists` (#153)\n* `SecurityType::SWAP`\n* Capture `origin_create_time` for externally triggered events (#140)\n\n### Changed\n\n* Increase `MAX_LENGTH_CURRENCY`\n* `ReferenceData::margin_currency` (#150)\n* Support macOS/ARM64 (#149)\n\n### Removed\n\n* `client::DepthBuilder` (#152)\n\n## 0.7.9 &ndash; 2021-12-08\n\n### Changed\n\n* Align oms with new use of Decimals enum\n* `MarketByPriceUpdate` now include max-depth (#123)\n* `MarketByPriceUpdate` and `MarketByOrderUpdate` now include checksum (#74)\n* `MarketByPriceUpdate` and `MarketByOrderUpdate` now include price/quantity decimals (#119)\n\n### Added\n\n* Capture request round-trip latency (#130)\n* Starting to move object cache logic into API (#128)\n\n## 0.7.8 &ndash; 2021-11-02\n\n### Added\n\n* Move cache utilities to API (#111)\n* Promoted `server::TraceInfo` to API\n* Add exchange sequence number to `MarketByPrice` and `MarketByOrder` (#101)\n* Add `max_trade_vol` and `trade_vol_step_size` to ReferenceData (#100)\n* New method to update `market::MarketByPrice` (#17)\n* Price/quantity decimal digits added to `oms::Order` (#46)\n* Conversion to/from internal price used by `market::MarketByPrice` (#21)\n* Interface to extract bid/ask `MBPUpdate` from `market::MarketByPrice`\n* New `UpdateType` (will eventually be used with `MarketByPriceUpdate`) (#93)\n* Add `StatisticsType::TRADE_VOLUME` (#88)\n\n### Changed\n\n* Remove custom literals (#110)\n* ReferenceData currencies should follow FX conventions (#99)\n* Replace `snapshot` (bool) with `update_type` (UpdateType) (#97)\n* Align type used to represent decimal digits (#46)\n* Adding more `MAX_LENGTH` constants (#91)\n* Align `PositionUpdate` with the FIX protocol (#89)\n\n### Fixed\n\n* Utility functions did not correctly handle `RequestStatus::FAILED` (#82)\n\n## 0.7.7 &ndash; 2021-09-20\n\n### Added\n\n* New `market::MarketByPrice` interface (#56)\n\n### Changed\n\n* `RequestStatus::TIMEOUT` should not be a final order request state (#59)\n* `GatewaySettings` has changed structure and new fields (#56)\n* `client::DepthBuilder` now derives from `market::MarketByPrice` (#56)\n* `string_buffer` did not have O(1) `length()` (#53)\n* Move OMS interfaces to API (#51)\n* `RateLimitTrigger` must support const members (#34)\n\n### Fixed\n\n* API exceptions should compile with C++14 (#69)\n\n## 0.7.6 &ndash; 2021-09-02\n\n### Added\n\n* `Error::INSUFFICIENT_FUNDS` (#32)\n* `RateLimitTrigger` replaces `RateLimitUsage` (#34)\n* Promoting `RateLimitType` to API (#34)\n* `NotSupported` exception (clean-up)\n* `CustomMetrics` (publish) and `CustomMetricsUpdate` (receive) (#8)\n* `NotImplemented` exception (clean-up)\n* `Error::CONDITIONAL_REQUEST_HAS_FAILED` and `Error::UNKNOWN_ORDER_ID` (#25)\n* `utils::was_order_received` and `utils::to_request_status` (#25)\n* `OrderAck::side` (#11)\n* `client::EventLogReader` interface (#10)\n\n### Changed\n\n* The various interfaces used for simulation has been updated (#7)\n\n### Removed\n\n* `Subscribe` has been removed from API (#14)\n\n## 0.7.5 &ndash; 2021-08-08\n\n### Changes\n\n* `Error` has been extended to communicate certain exchange errors\n* `RequestStatus` now includes `DISCONNECTED`, `TIMEOUT`, and `FAILED`\n* `OrderAck` now includes `exchange` and `symbol`\n* `CustomMessage` now uses `span` to represent the message\n\n### Fixed\n\n* `DepthBuilder` was unsafe because the constructor cached a pointer to a span\n  of `Layer`s, aka. the depth.\n  This has been changed and applying a `MarketByPriceUpdate` will now require\n  you to also pass a reference to the depth.\n\n### Added\n\n* `Error::REQUEST_RATE_LIMIT_REACHED`\n* `StatisticsType::FUNDING_RATE_PREDICTION`\n\n### Removed\n\n* Dropped all wrappers for fmt. (Reason: `fmt::format_string` is now a template\n  solution -- previously it was a macro).\n\n## 0.7.4 &ndash; 2021-07-20\n\n### Changed\n\n* The exception hierarchy no longer tries to mirror `std`.\n\n## 0.7.3 &ndash; 2021-07-06\n\n### Added\n\n* `OrderManagement` used to instruct a gateway of the order management style\n* `MAX_ORDER_ID` and `MAX_REQUEST_VERSION` to reflect 24 bit limits\n\n### Changed\n\n* `OrderAck`, `OrderUpdate`, `ModifyOrder` and `CancelOrder`\n   now use `uint32_t` for all version fields\n* The format functions no longer require use of the `_fmt` literal\n* Reduced `MAX_LENGTH_ROUTING_ID` to 16\n* `GatewaySettings` now includes `oms_download_has_state` and\n  `oms_download_has_routing_id`\n\n### Removed\n\n* The `_fmt` literal\n* The `format_str` wrapper class has been moved to the roq-logging library\n\n\n## 0.7.2 &ndash; 2021-06-20\n\n### Changed\n\n* `Error` has been updated\n* `OrderAck` has been updated and extended with `version`\n* `OrderUpdate` has been updated and extended with `max_request_version`,\n  `max_response_version` and `max_accepted_version`\n* `ModifyOrder` and `CancelOrder` has been updated with `version` and\n  `conditional_on_version`\n* `CreateOrder` and `OrderUpdate` has changed field ordering to better group\n  constant vs. possibly changing fields\n* `TradeUpdate` and `Fill` has changed field ordering and `Fill` has dropped\n  artificially generated `trade_id`'s\n* `MBPUpdate` has been updated with `implied_quantity`, `price_level` and\n  `number_of_orders`\n\n## 0.7.1 &ndash; 2021-05-30\n\n### Added\n\n* `RateLimitUsage` to allow strategy to back off when it high-water mark on\n   rate-limiting has been detected\n* `CancelAllOrders` when all orders must be cancelled immediately\n* `GatewaySettings.mbp_allow_remove_non_existing` to indicate if an exchange\n   could possibly send updates to unknown price levels\n* `StatisticsType::FUNDING_RATE` and `StatisticsType::DAILY_FUNDING_RATE`\n* `routing_id` to `ModifyOrder` and `CancelOrder`\n* `SupportType.ORDER_STATE` to indicate if gateway supports FIX 4.4 style\n   order state management (through ClOrdId/OrigClOrdId transitions)\n* `GatewaySettings.supports` to allow users to detect what is supported\n* Added `Liquidity` to indicate if last fill was as maker or taker\n* Extend `OrderUpdate` with more fields (required for FIX bridge and download)\n* `TradingStatus` has been completely reviewed to match the trading session state\n  changes which can occur on most exchanges\n* `ExecutionInstruction` will now support bit-masks (future change)\n* The layout of many structs have changed\n\n### Changed\n\n* `client::Config::Handler` now includes a method to configur\n* `client::Settings`. This makes it possible to override `cancel_policy` (on\n   disconnect)\n* `Disconnected` now adds a flag useful to detect if disconnect could trigger an\n   order cancellation request\n* `OrderStatus` better aligned with FIX enum, but excluding state transitions\n* `TimeInForce` better aligned with FIX enum\n\n\n## 0.7.0 &ndash; 2021-04-15\n\n### Added\n\n* Promoted a number of generic utilities to the `roq::utils` namespace.\n  Although these are useful, they should not be considered \"API\".\n* The `routing_id` field has been added to the relevant order management\n  structures.\n\n\n### Changed\n\n* All server (gateway) originated structs now include `stream_id` to indicate\n  the origin of a message.\n  `MarketDataStatus` and `OrderManagerStatus` have been replaced with\n  `StreamUpdate`.\n  Clients must use the `supports` bit-mask from `StreamUpdate` to maintain\n  availability of cached objects.\n  This change was done to allow gateways to manage load balance e.g. by\n  maintaining multiple connections.\n* Replaced `Connection` with `Connected` and `Disconnected`\n* Renamed `GatewayStatus` to `ConnectionStatus`\n\n### Removed\n\n* Python API (this is not the right place)\n* Removed `name` from `ExternalLatency`\n* Removed `MarketDataStatus` and `OrderManagerStatus`\n\n## 0.6.1 &ndash; 2021-02-19\n\n### Added\n\n* Convenience functions making it easy to encode Flatbuffers objects\n\n### Changed\n\n* Consistent use string literals\n* Enforce usage of the `_fmt` literal when formatting\n\n### Removed\n\n* Enumerations no longer include `MAX`\n\n\n## 0.6.0 &ndash; 2021-02-02\n\n### Changed\n\n* Repo now includes the auto-generated header files (for better discoverability)\n\n* Miniforge (instead of Miniconda)\n\n* `MessageInfo.source_session_id` now using a more efficient UUID representation\n\n* Now using span-lite (instead of own implementation, C++20 preparation)\n\n### Added\n\n* `Settings`\n* `ExternalLatency`\n\n### Removed\n\n* `User` and `Account` removed (not public interfaces)\n\n## 0.5.0 &ndash; 2020-12-04\n\n### Changed\n\n* Time management has been changed\n\n  * `std::chrono::nanoseconds` used for all precision timestamps\n  * `std::chrono::seconds` used for all date-times\n  * `std::chrono::days` (using `roq::chrono::days` until C++20 is supported)\n    used for all dates\n\n### Added\n\n* `ReferenceData`\n\n   * `description`, `underlying`,\n     `time_zone`, `issue_date`, `settlement_date`,\n     `expiry_datetime`, `expiry_datetime_utc\n\n### Removed\n\n* `ReferenceData::limit_{up|down}`\n\n   * Upper and lower trading limits belongs to daily session statistics,\n     not reference data.\n     These fields were anyway already managed by `StatisticsUpdate`.\n\n## 0.4.5 &ndash; 2020-11-09\n\n## 0.4.4 &ndash; 2020-09-20\n\n## 0.4.3 &ndash; 2020-09-02\n\n### Changed\n\n* `client::Collector` interface now implements default handlers instead of\n   having pure virtual functions.\n* `is_{order|request}_completed` replacing `is_completed`.\n\n### Removed\n\n* `client::Collector::{extract|write}` were too specific.\n\n## 0.4.2 &ndash; 2020-07-27\n\n### Removed\n\n* Automake support\n\n## 0.4.1 &ndash; 2020-07-17\n\n**Note!**\n*CMake is now the default build system for all Roq solutions.\nThis makes it significantly easier to integrate with other CMake based\nsolutions*.\n\n### Changed\n\n* CMake is now the default build system for all Roq solutions\n* Replace ROQ\\_PREDICT\\_{TRUE,FALSE} with ROQ\\_LIKELY and\n  ROQ\\_UNLIKLEY to better match c++20 naming\n* Removed (again) the use of FMT\\_STRING since it will not be\n  compatible with c++20\n\n### Removed\n\n* `roq/format.h`\n\n## 0.4.0 &ndash; 2020-06-30\n\n**Note!**\n*FlatBuffers has been introduced to compliment the C++ interface for\nnon-latency sensitive use-cases.\nEvent-logs are now using FlatBuffers for all encoding.\nThis allows for backwards compatibility and thereby dropping the\nrequirement for decoding to be binary compatible with encoding.\nAn upcoming release will introduce a FlatBuffers interface into\nthe gateways thereby allowing other languages than C++ languages\nto communicate with the gateway*.\n\n### Added\n\n* FlatBuffers schema (experimental!)\n* `StatisticsUpdate` (to replace `DailyStatistics` and `SessionStatistics`)\n\n### Changed\n\n* Events are now wrapped with the `Event` template\n* Replaced `MarketByPrice` and `MarketByOrder` with `MarketByPriceUpdate` and\n  `MarketByOrderUpdate` to more clearly reflect changes being communicated\n\n## 0.3.9 &ndash; 2020-06-09\n\n### Fixed\n\n* `roq::event_value<ConnectionStatusEvent>` was broken in release 0.3.8\n\n### Changed\n\n* Metrics interfaces and utilities have been moved into the\n  `roq::metrics` namespace\n* Metric collectors now using std::atomic variables\n\n### Removed\n\n* Logging has been moved into a separate library `roq-logging`\n\n## 0.3.8 &ndash; 2020-06-06\n\n### Changed\n\n* Auto-generate enums, structs, classes, formatting, etc.\n* Major parts of the client API have been moved here\n\n## 0.3.7 &ndash; 2020-05-27\n\n### Added\n\n* Dependency on FlatBuffers\n* `SessionsStatistics::index_value` and\n  `SessionsStatistics::margin_rate`\n\n### Changed\n\n* Inherit all network-related exceptions from `NetworkError`\n\n## 0.3.6 &ndash; 2020-05-02\n\n### Added\n\n* `TimedOut` (exception)\n\n## 0.3.5 &ndash; 2020-04-22\n\n## 0.3.4 &ndash; 2020-04-08\n\n### Added\n\n* `ExecutionInstruction` (enum) similar to FIX `ExecInst`\n* `Error::EXECUTION_INSTRUCTION_NOT_SUPPORTED`\n* `Account::user`\n* `OrderUpdate::execution_instruction`, `OrderUpdate::stop_price` and\n  `OrderUpdate::max_show_quantity`\n* Ensure all enums have an `UNDEFINED`\n\n### Removed\n\n* `OrderUpdate::commissions`\n\n### Changed\n\n* Log non-zero application exit codes as warning\n* Prefer C++ raw strings\n\n## 0.3.3 &ndash; 2020-03-04\n\n### Added\n\n* `Fill` (struct)\n* `TopOfBook` (struct)\n* `price_from_side` (function)\n* `span` (struct)\n\n### Removed\n\n* `MBOUpdate::side`\n\n### Changed\n\n* `TradeUpdate` (struct) now containing an array of `Fill`'s (struct)\n* Logging now requires `FMT_STRING` to better formatting errors at\n  compile time\n* `MarketByPrice` (struct) now maintaining `bids` and `asks` separately\n* `MBOUpdate::order_id` (string) replaces `order_id_ext` (integer)\n* Use `roq::span` everywhere\n"
  },
  {
    "path": "CMakeLists.txt",
    "content": "cmake_minimum_required(VERSION 4.0)\n\nset(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})\n\n# config\n\ninclude(RoqConfig)\n\n# version (using git tag)\n\ninclude(GetGitRepoVersion)\n\nmessage(\"Using GIT_REPO_VERSION=${GIT_REPO_VERSION}\")\n\n# project\n\nproject(roq-api VERSION ${GIT_REPO_VERSION})\n\n# language\n\nenable_language(CXX)\n\n# filesystem\n\ninclude(GNUInstallDirs)\n\n# dependencies\n\nfind_package(fmt REQUIRED)\nfind_package(magic_enum REQUIRED)\nfind_package(nameof REQUIRED)\n\nif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)\n  include(CTest)\nendif()\n\nif(BUILD_TESTING)\n  find_package(Catch2 REQUIRED)\nendif()\n\n# autogen\n\nfind_program(ROQ_AUTOGEN roq-autogen REQUIRED)\n\nset(TEMPLATE_DIR ${CMAKE_SOURCE_DIR}/scripts/templates)\nset(SCHEMA_LINK_DIR ${CMAKE_SOURCE_DIR}/schema)\n\n# clang-format\n\nfind_program(CLANG_FORMAT clang-format REQUIRED)\n\n# includes\n\ninclude_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR})\n\n# sub-projects\n\nadd_subdirectory(${CMAKE_SOURCE_DIR}/schema/roq)\nadd_subdirectory(${CMAKE_SOURCE_DIR}/include/roq)\n\nif(BUILD_TESTING)\n  add_subdirectory(${CMAKE_SOURCE_DIR}/test)\nendif()\n\n# project\n\nadd_library(${PROJECT_NAME} INTERFACE)\n\nadd_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-include-cpp)\n\n# install (public headers)\n\ninstall(\n  DIRECTORY ${CMAKE_SOURCE_DIR}/include/roq/\n  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/roq\n  FILES_MATCHING\n  PATTERN \"*.h*\"\n  PATTERN \"CMakeFiles\" EXCLUDE)\n\n# doxygen\n\noption(BUILD_DOCS \"Enable doxygen\" OFF)\n\nif(BUILD_DOCS)\n  find_package(Doxygen)\n  add_subdirectory(${CMAKE_SOURCE_DIR}/doxygen)\n  add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-doxygen)\n  add_dependencies(${PROJECT_NAME}-doxygen ${PROJECT_NAME}-include-cpp)\nendif()\n\n# install (cmake)\n\ninstall(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-config)\n\ninstall(FILES ${CMAKE_SOURCE_DIR}/CHANGELOG.md DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${PROJECT_NAME})\n\nset(CMAKE_LIB_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})\n\nexport(\n  TARGETS ${PROJECT_NAME}\n  NAMESPACE ${PROJECT_NAME}::\n  FILE ${CMAKE_LIB_DIR}/${PROJECT_NAME}-config.cmake)\n\ninstall(\n  EXPORT ${PROJECT_NAME}-config\n  NAMESPACE ${PROJECT_NAME}::\n  DESTINATION ${CMAKE_LIB_DIR})\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017-2026, Hans Erik Thrane\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# roq-api\n\nAPI for algorithmic and high-frequency trading (HFT).\n\n> This project does **not** contain the closed source implementation of the\n> C++ interfaces.\n\n\n## Links\n\n* [Roq GmbH (website)](https://roq-trading.com/)\n* [Contact (email)](mailto:info@roq-trading.com)\n* [Documentation](https://roq-trading.com/docs/)\n* [Releases](https://roq-trading.com/docs/releases/)\n* [Gateways](https://roq-trading.com/docs/introduction/gateways/)\n* [Samples](https://github.com/roq-trading/roq-cpp-samples/)\n* [Roadmap](https://roq-trading.com/docs/introduction/roadmap/)\n* [Pricing](https://roq-trading.com/#pricing)\n* [LinkedIn](https://www.linkedin.com/company/35447832/)\n* [Telegram](https://t.me/roq_trading/)\n\n\n## Design\n\n* Modular.\n* Predictable low latency.\n* Support all aspects required by a production environment.\n* Aim to reduce \"glue\" code and offer standard solutions for data capture,\n  monitoring, bridge solutions, etc.\n\n![Design](/static/images/architecture_reference.svg)\n\n* The **C++ API** enables clients (e.g. trading strategies) to\n  * communicate with gateways using a unified interface, or\n  * replay event-logs (exactly, for simulation and back-testing purposes).\n* The **FIX bridge** supports third-party solutions.\n* The **adapters** support third-party database solutions, e.g. ClickHouse.\n* The **metrics** interface supports third-party monitoring solutions, e.g. Prometheus,\n  Alertmanager and Grafana.\n\n\n## Features\n\n* Open source interface (no need to sign an NDA to access or use).\n* Permissive license (anyone is free to copy and use for whatever purpose).\n* Free to download and try (no need to contact or register).\n* Unified client interface to access any market.\n* Design is strongly inspired by standards and specific implementations used\n  by major exchanges.\n* Strong preference for allocation-free message encoding/decoding.\n* Extensive use of auto-generated code based on schemas.\n* Strongly typed messages (events).\n* Asynchronous interfaces and implementations.\n* C++ and shared memory for low latency.\n* Automatic capture of all events.\n* Free to download tools and database adapters.\n\n\n## Support and Maintenance\n\nA SLA is required for production support.\nMore information can be found [here](https://roq-trading.com/#pricing).\n\nFeel free to [contact us](mailto:info@roq-trading.com) with any questions\nyou may have.\n\n\n## Gateways\n\nCurrently supported traditional exchanges include\n\n* CME\n\nCurrently supported Cryptocurrency exchanges include\n\n* Binance\n* BitMEX\n* Bitstamp\n* Bybit\n* Coinbase PRO\n* Deribit\n* Gate\n* Gemini\n* HitBTC\n* Huobi\n* Kraken\n* KuCoin\n* OKX\n\nThe full list can be found [here](https://roq-trading.com/docs/introduction/gateways/).\n\n> Instructions on how to install, configure and use the gateways can either\n> be found in the [samples](https://github.com/roq-trading/roq-cpp-samples) or\n> by consulting the [documentation](https://roq-trading.com/docs/tutorials/gateways/).\n\n\n## Operating Systems\n\n* Linux (x86-64, AArch64)\n* macOS (x86-64, Arm64)\n\n> All listed combinations are regularly compiled but only Linux/x86-64 is continuously being tested.\n> If you require a specific combination, please [contact us](mailto:info@roq-trading.com) before using.\n\n> We plan to drop support for macOS/x86-64.\n\n\n## Library/Package Dependencies\n\n* [fmt](https://github.com/fmtlib/fmt) (MIT License)\n* [magic_enum](https://github.com/Neargye/magic_enum) (MIT License)\n* [jinja2](https://github.com/pallets/jinja) (BSD 3-Clause License)\n\nOptional\n\n* [Catch2](https://github.com/catchorg/Catch2) (Boost Software License 1.0 License)\n\n\n## Prerequisites\n\n> It is not very interesting to follow the instructions shown here due to this\n> project only containing interfaces.\n> The actual client implementation is closed source as mentioned elsewhere in\n> this document.\n\nThe project is primarily designed to be compatible with the conda package manager.\n\n> Use `stable` for (the approx. monthly) release build.\n> Use `unstable` for the more regularly updated development builds.\n\n### Initialize sub-modules\n\n```bash\ngit submodule update --init --recursive\n```\n\n### Create development environment\n\n```bash\nscripts/create_conda_env unstable debug\n```\n\n### Activate environment\n\n```bash\nsource opt/conda/bin/activate dev\n```\n\n## Build the project\n\n> Sometimes you may have to delete CMakeCache.txt if CMake has already cached an incorrect configuration.\n\n```bash\ncmake . && make -j4\n```\n\n### Using\n\nYou can download the closed source client implementation like this\n\n```bash\nconda install -y --channel https://roq-trading.com/conda/stable \\\n    roq-client\n```\n\nSamples can be found [here](https://github.com/roq-trading/roq-cpp-samples).\n\n\n## License\n\nThe project is released under the terms of the MIT license.\n"
  },
  {
    "path": "conda/bld.bat",
    "content": "#xyz\n"
  },
  {
    "path": "conda/meta.yaml",
    "content": "package:\n  name: roq-api\n  version: {{ GIT_DESCRIBE_TAG }}\n\nsource:\n  git_url: ..\n\nbuild:\n  skip: true  # [not unix]\n  number: {{ ROQ_BUILD_NUMBER if ROQ_BUILD_NUMBER is defined else GIT_DESCRIBE_NUMBER }}\n\nrequirements:\n  build:\n    - {{ compiler('cxx') }}\n    - clang-format\n    - cmake\n    - coreutils\n    - doxygen\n    - git\n    - make\n    - roq-autogen\n  host:\n    - catch2\n    - fmt\n    - magic_enum\n    - roq-oss-nameof\n\nabout:\n  home: https://roq-trading.com\n  doc_url: https://roq-trading.com/docs\n  dev_url: https://github.com/roq-trading\n  license: MIT\n  license_family: MIT\n  license_file: LICENSE\n  summary: Roq API\n"
  },
  {
    "path": "doxygen/.gitignore",
    "content": "Doxyfile\ndoxygen-build.stamp\nhtml\nxml\n"
  },
  {
    "path": "doxygen/CMakeLists.txt",
    "content": "set(TARGET_NAME ${PROJECT_NAME}-doxygen)\n\nset(TARGET_DIR ${CMAKE_INSTALL_DATADIR}/doc/${PROJECT_NAME})\n\n# doxyfile\n\nset(DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)\n\nconfigure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${DOXYFILE} @ONLY)\n\n# target\n\nset(INDEX_HTML ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)\n\nadd_custom_command(\n  OUTPUT ${INDEX_HTML}\n  COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE}\n  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}\n  VERBATIM\n  DEPENDS ${DOXYGEN_EXECUTABLE} ${DOXYFILE})\n\nadd_custom_target(${TARGET_NAME} ALL DEPENDS ${INDEX_HTML})\n\n# install\n\ninstall(\n  DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/xml/\n  DESTINATION ${TARGET_DIR}/xml\n  FILES_MATCHING\n  PATTERN \"*.xml\")\n\ninstall(\n  DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/\n  DESTINATION ${TARGET_DIR}/html\n  FILES_MATCHING\n  PATTERN \"*.html\")\n"
  },
  {
    "path": "doxygen/Doxyfile.in",
    "content": "PROJECT_NAME           = \"roq-api\"\nPROJECT_NUMBER         = \"@ROQ_VERSION@\"\nEXTRACT_ALL            = YES\nEXTRACT_PRIVATE        = YES\nEXTRACT_STATIC         = YES\nCASE_SENSE_NAMES       = NO\nINPUT                  = @CMAKE_SOURCE_DIR@/include \\\n                         @CMAKE_BINARY_DIR@/@CMAKE_INSTALL_INCLUDEDIR@\nRECURSIVE              = YES\nEXCLUDE                = @CMAKE_SOURCE_DIR@/include/roq/fbs\nGENERATE_LATEX         = NO\nGENERATE_XML           = YES\nHIDE_UNDOC_RELATIONS   = NO\nHAVE_DOT               = NO\nCOLLABORATION_GRAPH    = NO\nGROUP_GRAPHS           = NO\nGRAPHICAL_HIERARCHY    = NO\n"
  },
  {
    "path": "include/roq/CMakeLists.txt",
    "content": "set(TARGET_NAME ${PROJECT_NAME}-include-cpp)\n\ninclude(RoqAutogen)\n\nset(TARGET_DIR ${CMAKE_INSTALL_INCLUDEDIR}/roq)\n\n# schema\n\nset(SCHEMA_ROQ\n    action.json\n    add_market.json\n    add_routes.json\n    bar.json\n    batch_begin.json\n    batch_end.json\n    buffer_capacity.json\n    cancel_all_orders_ack.json\n    cancel_all_orders.json\n    cancel_order.json\n    cancel_quotes_ack.json\n    cancel_quotes.json\n    category.json\n    connected.json\n    connection_status.json\n    control_ack.json\n    control.json\n    create_order.json\n    custom_matrix.json\n    custom_matrix_update.json\n    custom_metrics.json\n    custom_metrics_update.json\n    data_source.json\n    disconnected.json\n    download_begin.json\n    download_end.json\n    encoding.json\n    error.json\n    execution_instruction.json\n    external_latency.json\n    fill.json\n    filter.json\n    funds_update.json\n    gateway_settings.json\n    gateway_status.json\n    interval.json\n    layer.json\n    leg.json\n    legs_update.json\n    liquidity.json\n    margin_mode.json\n    market_by_order_update.json\n    market_by_price_update.json\n    market_status.json\n    mass_quote_ack.json\n    mass_quote.json\n    mbo_update.json\n    mbp_update.json\n    measurement.json\n    message_info.json\n    modify_order.json\n    option_type.json\n    order_ack.json\n    order_cancel_policy.json\n    order_management.json\n    order_status.json\n    order_type.json\n    order_update.json\n    origin.json\n    parameter.json\n    parameters_update.json\n    portfolio.json\n    portfolio_update.json\n    position_effect.json\n    position.json\n    position_update.json\n    precision.json\n    priority.json\n    protocol.json\n    quality_of_service.json\n    quantity_type.json\n    quote.json\n    rate_limit.json\n    rate_limits_update.json\n    rate_limit_trigger.json\n    rate_limit_type.json\n    ready.json\n    reference_data.json\n    remove_routes.json\n    request_id_type.json\n    request_status.json\n    request_type.json\n    risk_limit.json\n    risk_limits.json\n    risk_limits_update.json\n    route_ack.json\n    route.json\n    route_request_status.json\n    routing.json\n    security_type.json\n    service_update.json\n    side.json\n    start.json\n    state.json\n    statistics.json\n    statistics_type.json\n    statistics_update.json\n    stop.json\n    strategy_update.json\n    stream_status.json\n    subscribe.json\n    support_type.json\n    tick_size_step.json\n    time_in_force.json\n    timer.json\n    time_series_update.json\n    top_of_book.json\n    trade.json\n    trade_summary.json\n    trade_update.json\n    trading_status.json\n    transport.json\n    update_action.json\n    update_reason.json\n    update_type.json\n    variant_type.json)\n\nset(SOURCES ${SCHEMA_ROQ})\n\n# configure\n\nset(API_HPP ${CMAKE_BINARY_DIR}/${TARGET_DIR}/api.hpp)\n\nconfigure_file(\"api.hpp.in\" ${API_HPP} @ONLY)\n\n# auto-generate\n\nroq_autogen_hpp(\n  OUTPUT\n  AUTOGEN_HEADERS\n  SOURCES\n  ${SOURCES}\n  NAMESPACE\n  \"roq\"\n  SCHEMA_LINK_DIR\n  ${SCHEMA_LINK_DIR}\n  TEMPLATE_DIR\n  ${TEMPLATE_DIR}\n  TEMPLATE_TYPE\n  \"api\")\n\n# target\n\nadd_custom_target(${TARGET_NAME} ALL DEPENDS ${AUTOGEN_HEADERS} ${GITIGNORE})\n\n# install\n\ninstall(FILES ${AUTOGEN_HEADERS} ${API_HPP} DESTINATION ${TARGET_DIR})\n"
  },
  {
    "path": "include/roq/action.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of control action\nenum class Action : uint8_t {\n  UNDEFINED = 0,\n  ENABLE,   //!< Enable\n  DISABLE,  //!< Disable\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/add_market.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Emitted when a new market is being created by the framework\nstruct ROQ_PUBLIC AddMarket final {\n  std::string_view exchange;  //!< Exchange\n  std::string_view symbol;    //!< Symbol\n};\n\ntemplate <>\nconstexpr std::string_view get_name<AddMarket>() {\n  using namespace std::literals;\n  return \"add_market\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::AddMarket> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::AddMarket const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\")\"\n        R\"(}})\"sv,\n        value.exchange,\n        value.symbol);\n  }\n};"
  },
  {
    "path": "include/roq/add_routes.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Add route(s)\nstruct ROQ_PUBLIC AddRoutes final {\n  std::span<uint32_t const> strategy_ids;  //!< List of strategy_id's to add\n};\n\ntemplate <>\nconstexpr std::string_view get_name<AddRoutes>() {\n  using namespace std::literals;\n  return \"add_routes\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::AddRoutes> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::AddRoutes const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(strategy_ids=[{}])\"\n        R\"(}})\"sv,\n        fmt::join(value.strategy_ids, \", \"sv));\n  }\n};"
  },
  {
    "path": "include/roq/api.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n// convenience\n\n#include \"roq/limits.hpp\"\n\n// enums\n\n#include \"roq/action.hpp\"\n#include \"roq/buffer_capacity.hpp\"\n#include \"roq/category.hpp\"\n#include \"roq/connection_status.hpp\"\n#include \"roq/data_source.hpp\"\n#include \"roq/encoding.hpp\"\n#include \"roq/error.hpp\"\n#include \"roq/execution_instruction.hpp\"\n#include \"roq/filter.hpp\"\n#include \"roq/interval.hpp\"\n#include \"roq/liquidity.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/option_type.hpp\"\n#include \"roq/order_cancel_policy.hpp\"\n#include \"roq/order_management.hpp\"\n#include \"roq/order_status.hpp\"\n#include \"roq/order_type.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/position_effect.hpp\"\n#include \"roq/precision.hpp\"\n#include \"roq/priority.hpp\"\n#include \"roq/protocol.hpp\"\n#include \"roq/quantity_type.hpp\"\n#include \"roq/rate_limit_type.hpp\"\n#include \"roq/request_id_type.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/request_type.hpp\"\n#include \"roq/route_request_status.hpp\"\n#include \"roq/security_type.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/state.hpp\"\n#include \"roq/statistics_type.hpp\"\n#include \"roq/support_type.hpp\"\n#include \"roq/time_in_force.hpp\"\n#include \"roq/trading_status.hpp\"\n#include \"roq/transport.hpp\"\n#include \"roq/update_action.hpp\"\n#include \"roq/update_reason.hpp\"\n#include \"roq/update_type.hpp\"\n\n// helpers\n\n#include \"roq/bar.hpp\"\n#include \"roq/fill.hpp\"\n#include \"roq/layer.hpp\"\n#include \"roq/leg.hpp\"\n#include \"roq/mbo_update.hpp\"\n#include \"roq/mbp_update.hpp\"\n#include \"roq/measurement.hpp\"\n#include \"roq/parameter.hpp\"\n#include \"roq/position.hpp\"\n#include \"roq/quote.hpp\"\n#include \"roq/rate_limit.hpp\"\n#include \"roq/risk_limit.hpp\"\n#include \"roq/route.hpp\"\n#include \"roq/statistics.hpp\"\n#include \"roq/tick_size_step.hpp\"\n#include \"roq/trade.hpp\"\n\n// transport\n\n#include \"roq/message_info.hpp\"\n\n// control (autogen)\n\n#include \"roq/connected.hpp\"\n#include \"roq/control.hpp\"\n#include \"roq/control_ack.hpp\"\n#include \"roq/disconnected.hpp\"\n#include \"roq/legs_update.hpp\"\n#include \"roq/service_update.hpp\"\n#include \"roq/start.hpp\"\n#include \"roq/stop.hpp\"\n#include \"roq/strategy_update.hpp\"\n#include \"roq/timer.hpp\"\n\n// messages (autogen)\n\n#include \"roq/add_market.hpp\"\n#include \"roq/add_routes.hpp\"\n#include \"roq/batch_begin.hpp\"\n#include \"roq/batch_end.hpp\"\n#include \"roq/cancel_all_orders.hpp\"\n#include \"roq/cancel_all_orders_ack.hpp\"\n#include \"roq/cancel_order.hpp\"\n#include \"roq/cancel_quotes.hpp\"\n#include \"roq/cancel_quotes_ack.hpp\"\n#include \"roq/create_order.hpp\"\n#include \"roq/custom_matrix.hpp\"\n#include \"roq/custom_matrix_update.hpp\"\n#include \"roq/custom_metrics.hpp\"\n#include \"roq/custom_metrics_update.hpp\"\n#include \"roq/download_begin.hpp\"\n#include \"roq/download_end.hpp\"\n#include \"roq/external_latency.hpp\"\n#include \"roq/funds_update.hpp\"\n#include \"roq/gateway_settings.hpp\"\n#include \"roq/gateway_status.hpp\"\n#include \"roq/market_by_order_update.hpp\"\n#include \"roq/market_by_price_update.hpp\"\n#include \"roq/market_status.hpp\"\n#include \"roq/mass_quote.hpp\"\n#include \"roq/mass_quote_ack.hpp\"\n#include \"roq/modify_order.hpp\"\n#include \"roq/order_ack.hpp\"\n#include \"roq/order_update.hpp\"\n#include \"roq/parameters_update.hpp\"\n#include \"roq/portfolio.hpp\"\n#include \"roq/portfolio_update.hpp\"\n#include \"roq/position_update.hpp\"\n#include \"roq/rate_limit_trigger.hpp\"\n#include \"roq/rate_limits_update.hpp\"\n#include \"roq/ready.hpp\"\n#include \"roq/reference_data.hpp\"\n#include \"roq/remove_routes.hpp\"\n#include \"roq/risk_limits.hpp\"\n#include \"roq/risk_limits_update.hpp\"\n#include \"roq/route_ack.hpp\"\n#include \"roq/statistics_update.hpp\"\n#include \"roq/stream_status.hpp\"\n#include \"roq/subscribe.hpp\"\n#include \"roq/time_series_update.hpp\"\n#include \"roq/top_of_book.hpp\"\n#include \"roq/trade_summary.hpp\"\n#include \"roq/trade_update.hpp\"\n\n// misc\n\n#include \"roq/exceptions.hpp\"\n\n// version\n\n#define ROQ_VERSION \"1.1.3\"\n\nnamespace roq {\n\n// NOLINTBEGIN(readability-magic-numbers)\n\n// user id (8 bits)\n\nstatic constexpr uint8_t const SOURCE_MIN = 0;\nstatic constexpr uint8_t const SOURCE_MAX = 255;\n\nstatic constexpr auto const SOURCE_NONE = SOURCE_MIN;\nstatic constexpr auto const SOURCE_SELF = SOURCE_MAX;\n\n// stream id (16 bits)\n\nstatic constexpr uint16_t const STREAM_ID_MIN = 0;\nstatic constexpr uint16_t const STREAM_ID_MAX = 65535;\n\nstatic constexpr auto const STREAM_ID_NONE = STREAM_ID_MIN;\n\n// order id (48 bits)\n\nstatic constexpr uint64_t const ORDER_ID_MIN = 0;\nstatic constexpr uint64_t const ORDER_ID_MAX = (uint64_t{1} << 48) - 1;\n\nstatic constexpr auto const ORDER_ID_NONE = ORDER_ID_MIN;\n\n// request version (24 bits)\n\nstatic constexpr uint32_t const REQUEST_VERSION_MIN = 0;\nstatic constexpr uint32_t const REQUEST_VERSION_MAX = (uint32_t{1} << 24) - 1;\n\nstatic constexpr auto const REQUEST_VERSION_NONE = REQUEST_VERSION_MIN;\n\n// strategy id (24 bits)\n\nstatic constexpr uint32_t const STRATEGY_ID_MIN = 0;\nstatic constexpr uint32_t const STRATEGY_ID_MAX = (uint32_t{1} << 24) - 1;\n\nstatic constexpr auto const STRATEGY_ID_NONE = STRATEGY_ID_MIN;\n\n// account id (8 bits)\n\nstatic constexpr uint8_t const ACCOUNT_MIN = 0;\nstatic constexpr uint8_t const ACCOUNT_MAX = 255;\n\nstatic constexpr auto const ACCOUNT_NONE = ACCOUNT_MIN;\n\n// symbol id (24 bits)\n\nstatic constexpr uint32_t const SYMBOL_ID_MIN = 0;\nstatic constexpr uint32_t const SYMBOL_ID_MAX = (uint32_t{1} << 24) - 1;\n\nstatic constexpr auto const SYMBOL_ID_NONE = SYMBOL_ID_MIN;\n\n// instance id (4 bits)\n\nstatic constexpr uint8_t const INSTANCE_MIN = 0;\nstatic constexpr uint8_t const INSTANCE_MAX = (uint8_t{1} << 4) - 1;\n\nstatic constexpr auto const INSTANCE_NONE = INSTANCE_MIN;\n\n// validate auto-generated code\n\nstatic_assert(sizeof(decltype(RateLimitTrigger::users)::value_type) == sizeof(User));\nstatic_assert(sizeof(decltype(RateLimitTrigger::accounts)::value_type) == sizeof(Account));\n\nstatic_assert(sizeof(decltype(Measurement::name)) == sizeof(MeasurementKey));\n\n// check size of certain array items\n// - frequent -- should be (reasonably) cache aligned\nstatic_assert(sizeof(Layer) == 32);\nstatic_assert(sizeof(MBPUpdate) == 32);\nstatic_assert(sizeof(MBOUpdate) == 64);\nstatic_assert(sizeof(Trade) == 192);\nstatic_assert(sizeof(Statistics) == 32);\nstatic_assert(sizeof(Measurement) == 16);\nstatic_assert(sizeof(Route) == 8);\nstatic_assert(sizeof(TickSizeStep) == 16);\n// - not frequent -- not so important\nstatic_assert(sizeof(Fill) == 136);\nstatic_assert(sizeof(Parameter) == 196);\nstatic_assert(sizeof(Position) == 144);\nstatic_assert(sizeof(RiskLimit) == 152);\n\n// NOLINTEND(readability-magic-numbers)\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/api.hpp.in",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n// convenience\n\n#include \"roq/limits.hpp\"\n\n// enums\n\n#include \"roq/action.hpp\"\n#include \"roq/buffer_capacity.hpp\"\n#include \"roq/category.hpp\"\n#include \"roq/connection_status.hpp\"\n#include \"roq/data_source.hpp\"\n#include \"roq/encoding.hpp\"\n#include \"roq/error.hpp\"\n#include \"roq/execution_instruction.hpp\"\n#include \"roq/filter.hpp\"\n#include \"roq/interval.hpp\"\n#include \"roq/liquidity.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/option_type.hpp\"\n#include \"roq/order_cancel_policy.hpp\"\n#include \"roq/order_management.hpp\"\n#include \"roq/order_status.hpp\"\n#include \"roq/order_type.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/position_effect.hpp\"\n#include \"roq/precision.hpp\"\n#include \"roq/priority.hpp\"\n#include \"roq/protocol.hpp\"\n#include \"roq/quantity_type.hpp\"\n#include \"roq/rate_limit_type.hpp\"\n#include \"roq/request_id_type.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/request_type.hpp\"\n#include \"roq/route_request_status.hpp\"\n#include \"roq/security_type.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/state.hpp\"\n#include \"roq/statistics_type.hpp\"\n#include \"roq/support_type.hpp\"\n#include \"roq/time_in_force.hpp\"\n#include \"roq/trading_status.hpp\"\n#include \"roq/transport.hpp\"\n#include \"roq/update_action.hpp\"\n#include \"roq/update_reason.hpp\"\n#include \"roq/update_type.hpp\"\n\n// helpers\n\n#include \"roq/bar.hpp\"\n#include \"roq/fill.hpp\"\n#include \"roq/layer.hpp\"\n#include \"roq/leg.hpp\"\n#include \"roq/mbo_update.hpp\"\n#include \"roq/mbp_update.hpp\"\n#include \"roq/measurement.hpp\"\n#include \"roq/parameter.hpp\"\n#include \"roq/position.hpp\"\n#include \"roq/quote.hpp\"\n#include \"roq/rate_limit.hpp\"\n#include \"roq/risk_limit.hpp\"\n#include \"roq/route.hpp\"\n#include \"roq/statistics.hpp\"\n#include \"roq/tick_size_step.hpp\"\n#include \"roq/trade.hpp\"\n\n// transport\n\n#include \"roq/message_info.hpp\"\n\n// control (autogen)\n\n#include \"roq/connected.hpp\"\n#include \"roq/control.hpp\"\n#include \"roq/control_ack.hpp\"\n#include \"roq/disconnected.hpp\"\n#include \"roq/legs_update.hpp\"\n#include \"roq/service_update.hpp\"\n#include \"roq/start.hpp\"\n#include \"roq/stop.hpp\"\n#include \"roq/strategy_update.hpp\"\n#include \"roq/timer.hpp\"\n\n// messages (autogen)\n\n#include \"roq/add_market.hpp\"\n#include \"roq/add_routes.hpp\"\n#include \"roq/batch_begin.hpp\"\n#include \"roq/batch_end.hpp\"\n#include \"roq/cancel_all_orders.hpp\"\n#include \"roq/cancel_all_orders_ack.hpp\"\n#include \"roq/cancel_order.hpp\"\n#include \"roq/cancel_quotes.hpp\"\n#include \"roq/cancel_quotes_ack.hpp\"\n#include \"roq/create_order.hpp\"\n#include \"roq/custom_matrix.hpp\"\n#include \"roq/custom_matrix_update.hpp\"\n#include \"roq/custom_metrics.hpp\"\n#include \"roq/custom_metrics_update.hpp\"\n#include \"roq/download_begin.hpp\"\n#include \"roq/download_end.hpp\"\n#include \"roq/external_latency.hpp\"\n#include \"roq/funds_update.hpp\"\n#include \"roq/gateway_settings.hpp\"\n#include \"roq/gateway_status.hpp\"\n#include \"roq/market_by_order_update.hpp\"\n#include \"roq/market_by_price_update.hpp\"\n#include \"roq/market_status.hpp\"\n#include \"roq/mass_quote.hpp\"\n#include \"roq/mass_quote_ack.hpp\"\n#include \"roq/modify_order.hpp\"\n#include \"roq/order_ack.hpp\"\n#include \"roq/order_update.hpp\"\n#include \"roq/parameters_update.hpp\"\n#include \"roq/portfolio.hpp\"\n#include \"roq/portfolio_update.hpp\"\n#include \"roq/position_update.hpp\"\n#include \"roq/rate_limit_trigger.hpp\"\n#include \"roq/rate_limits_update.hpp\"\n#include \"roq/ready.hpp\"\n#include \"roq/reference_data.hpp\"\n#include \"roq/remove_routes.hpp\"\n#include \"roq/risk_limits.hpp\"\n#include \"roq/risk_limits_update.hpp\"\n#include \"roq/route_ack.hpp\"\n#include \"roq/statistics_update.hpp\"\n#include \"roq/stream_status.hpp\"\n#include \"roq/subscribe.hpp\"\n#include \"roq/time_series_update.hpp\"\n#include \"roq/top_of_book.hpp\"\n#include \"roq/trade_summary.hpp\"\n#include \"roq/trade_update.hpp\"\n\n// misc\n\n#include \"roq/exceptions.hpp\"\n\n// version\n\n#define ROQ_VERSION \"@ROQ_VERSION_MAJOR@.@ROQ_VERSION_MINOR@.@ROQ_VERSION_PATCH@\"\n\nnamespace roq {\n\n// NOLINTBEGIN(readability-magic-numbers)\n\n// user id (8 bits)\n\nstatic constexpr uint8_t const SOURCE_MIN = 0;\nstatic constexpr uint8_t const SOURCE_MAX = 255;\n\nstatic constexpr auto const SOURCE_NONE = SOURCE_MIN;\nstatic constexpr auto const SOURCE_SELF = SOURCE_MAX;\n\n// stream id (16 bits)\n\nstatic constexpr uint16_t const STREAM_ID_MIN = 0;\nstatic constexpr uint16_t const STREAM_ID_MAX = 65535;\n\nstatic constexpr auto const STREAM_ID_NONE = STREAM_ID_MIN;\n\n// order id (48 bits)\n\nstatic constexpr uint64_t const ORDER_ID_MIN = 0;\nstatic constexpr uint64_t const ORDER_ID_MAX = (uint64_t{1} << 48) - 1;\n\nstatic constexpr auto const ORDER_ID_NONE = ORDER_ID_MIN;\n\n// request version (24 bits)\n\nstatic constexpr uint32_t const REQUEST_VERSION_MIN = 0;\nstatic constexpr uint32_t const REQUEST_VERSION_MAX = (uint32_t{1} << 24) - 1;\n\nstatic constexpr auto const REQUEST_VERSION_NONE = REQUEST_VERSION_MIN;\n\n// strategy id (24 bits)\n\nstatic constexpr uint32_t const STRATEGY_ID_MIN = 0;\nstatic constexpr uint32_t const STRATEGY_ID_MAX = (uint32_t{1} << 24) - 1;\n\nstatic constexpr auto const STRATEGY_ID_NONE = STRATEGY_ID_MIN;\n\n// account id (8 bits)\n\nstatic constexpr uint8_t const ACCOUNT_MIN = 0;\nstatic constexpr uint8_t const ACCOUNT_MAX = 255;\n\nstatic constexpr auto const ACCOUNT_NONE = ACCOUNT_MIN;\n\n// symbol id (24 bits)\n\nstatic constexpr uint32_t const SYMBOL_ID_MIN = 0;\nstatic constexpr uint32_t const SYMBOL_ID_MAX = (uint32_t{1} << 24) - 1;\n\nstatic constexpr auto const SYMBOL_ID_NONE = SYMBOL_ID_MIN;\n\n// instance id (4 bits)\n\nstatic constexpr uint8_t const INSTANCE_MIN = 0;\nstatic constexpr uint8_t const INSTANCE_MAX = (uint8_t{1} << 4) - 1;\n\nstatic constexpr auto const INSTANCE_NONE = INSTANCE_MIN;\n\n// validate auto-generated code\n\nstatic_assert(sizeof(decltype(RateLimitTrigger::users)::value_type) == sizeof(User));\nstatic_assert(sizeof(decltype(RateLimitTrigger::accounts)::value_type) == sizeof(Account));\n\nstatic_assert(sizeof(decltype(Measurement::name)) == sizeof(MeasurementKey));\n\n// check size of certain array items\n// - frequent -- should be (reasonably) cache aligned\nstatic_assert(sizeof(Layer) == 32);\nstatic_assert(sizeof(MBPUpdate) == 32);\nstatic_assert(sizeof(MBOUpdate) == 64);\nstatic_assert(sizeof(Trade) == 192);\nstatic_assert(sizeof(Statistics) == 32);\nstatic_assert(sizeof(Measurement) == 16);\nstatic_assert(sizeof(Route) == 8);\nstatic_assert(sizeof(TickSizeStep) == 16);\n// - not frequent -- not so important\nstatic_assert(sizeof(Fill) == 136);\nstatic_assert(sizeof(Parameter) == 196);\nstatic_assert(sizeof(Position) == 144);\nstatic_assert(sizeof(RiskLimit) == 152);\n\n// NOLINTEND(readability-magic-numbers)\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/args/parser.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <span>\n#include <string_view>\n\nnamespace roq {\nnamespace args {\n\nstruct ROQ_PUBLIC Parser {\n  virtual ~Parser() = default;\n\n  // note! c-style with first element being the program name\n  virtual operator std::span<std::string_view const>() const = 0;\n\n  auto program_name() const { return static_cast<std::span<std::string_view const>>(*this)[0]; }\n  auto params() const { return static_cast<std::span<std::string_view const>>(*this).subspan(1); }\n};\n\n}  // namespace args\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/bar.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n\n#include \"roq/limits.hpp\"\n\nnamespace roq {\n\n//! Represents a single bar of a time-series\nstruct ROQ_PUBLIC Bar final {\n  std::chrono::seconds begin_time_utc = {};  //!< Begin-of-period time-stamp (UTC)\n  bool confirmed = false;                    //!< Confirmed?\n  double open_price = roq::NaN;              //!< Open price\n  double high_price = roq::NaN;              //!< High price\n  double low_price = roq::NaN;               //!< Low price\n  double close_price = roq::NaN;             //!< Close price\n  double quantity = roq::NaN;                //!< Total quantity (contracts or base currency)\n  double base_amount = roq::NaN;             //!< Total amount (base currency)\n  double quote_amount = roq::NaN;            //!< Total amount (quote currency)\n  uint32_t number_of_trades = {};            //!< Number of trades (count)\n  double vwap = roq::NaN;                    //!< VWAP\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Bar> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Bar const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(begin_time_utc={}, )\"\n        R\"(confirmed={}, )\"\n        R\"(open_price={}, )\"\n        R\"(high_price={}, )\"\n        R\"(low_price={}, )\"\n        R\"(close_price={}, )\"\n        R\"(quantity={}, )\"\n        R\"(base_amount={}, )\"\n        R\"(quote_amount={}, )\"\n        R\"(number_of_trades={}, )\"\n        R\"(vwap={})\"\n        R\"(}})\"sv,\n        value.begin_time_utc,\n        value.confirmed,\n        value.open_price,\n        value.high_price,\n        value.low_price,\n        value.close_price,\n        value.quantity,\n        value.base_amount,\n        value.quote_amount,\n        value.number_of_trades,\n        value.vwap);\n  }\n};"
  },
  {
    "path": "include/roq/batch_begin.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Identifies the beginning of a sequence of related messages\nstruct ROQ_PUBLIC BatchBegin final {};\n\ntemplate <>\nconstexpr std::string_view get_name<BatchBegin>() {\n  using namespace std::literals;\n  return \"batch_begin\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::BatchBegin> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::BatchBegin const &, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), R\"({{}})\"sv);\n  }\n};"
  },
  {
    "path": "include/roq/batch_end.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Identifies the end of a sequence of related messages\nstruct ROQ_PUBLIC BatchEnd final {};\n\ntemplate <>\nconstexpr std::string_view get_name<BatchEnd>() {\n  using namespace std::literals;\n  return \"batch_end\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::BatchEnd> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::BatchEnd const &, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), R\"({{}})\"sv);\n  }\n};"
  },
  {
    "path": "include/roq/buffer_capacity.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Buffer capacity\nenum class BufferCapacity : uint8_t {\n  UNDEFINED = 0,\n  EMPTY,            //!< Buffer is empty\n  LOW_WATER_MARK,   //!< Buffer has reached the low water mark (from above)\n  HIGH_WATER_MARK,  //!< Buffer has reached the high water mark (from below)\n  FULL,             //!< Buffer is full\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/cancel_all_orders.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Cancel all orders (best effort)\nstruct ROQ_PUBLIC CancelAllOrders final {\n  std::string_view account;   //!< Account name\n  uint64_t order_id = {};     //!< Order identifier\n  std::string_view exchange;  //!< Exchange\n  std::string_view symbol;    //!< Symbol\n  uint32_t strategy_id = {};  //!< Strategy identifier (optional)\n  roq::Side side = {};        //!< Side\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CancelAllOrders>() {\n  using namespace std::literals;\n  return \"cancel_all_orders\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CancelAllOrders> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CancelAllOrders const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(side={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.order_id,\n        value.exchange,\n        value.symbol,\n        value.strategy_id,\n        value.side);\n  }\n};"
  },
  {
    "path": "include/roq/cancel_all_orders_ack.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/error.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Acknowledgement that a cancel all orders request has been seen by gateway/exchange\nstruct ROQ_PUBLIC CancelAllOrdersAck final {\n  uint16_t stream_id = {};                           //!< Stream identifier\n  std::string_view account;                          //!< Account name\n  uint64_t order_id = {};                            //!< Order identifier\n  std::string_view exchange;                         //!< Exchange\n  std::string_view symbol;                           //!< Symbol\n  roq::Side side = {};                               //!< Side\n  roq::Origin origin = {};                           //!< Origin of ack\n  roq::RequestStatus request_status = {};            //!< Request status\n  roq::Error error = {};                             //!< Error code\n  std::string_view text;                             //!< Descriptive text\n  std::string_view request_id;                       //!< Request identifier\n  std::string_view external_account;                 //!< External account name\n  uint32_t number_of_affected_orders = {};           //!< Number of affected orders (optional, indicative)\n  std::chrono::nanoseconds round_trip_latency = {};  //!< Round-trip latency between gateway and exchange\n  std::string_view user;                             //!< User name (optional, only relevant for drop-copy)\n  uint32_t strategy_id = {};                         //!< Strategy identifier (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CancelAllOrdersAck>() {\n  using namespace std::literals;\n  return \"cancel_all_orders_ack\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CancelAllOrdersAck> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CancelAllOrdersAck const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(side={}, )\"\n        R\"(origin={}, )\"\n        R\"(request_status={}, )\"\n        R\"(error={}, )\"\n        R\"(text=\"{}\", )\"\n        R\"(request_id=\"{}\", )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(number_of_affected_orders={}, )\"\n        R\"(round_trip_latency={}, )\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.order_id,\n        value.exchange,\n        value.symbol,\n        value.side,\n        value.origin,\n        value.request_status,\n        value.error,\n        value.text,\n        value.request_id,\n        value.external_account,\n        value.number_of_affected_orders,\n        value.round_trip_latency,\n        value.user,\n        value.strategy_id);\n  }\n};"
  },
  {
    "path": "include/roq/cancel_order.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Fields required to cancel an existing order\nstruct ROQ_PUBLIC CancelOrder final {\n  std::string_view account;                        //!< Account name\n  uint64_t order_id = {};                          //!< Order identifier\n  std::string_view request_template;               //!< Request template (gateway configured)\n  std::string_view routing_id;                     //!< Routing identifier\n  uint32_t version = {};                           //!< Version number (strictly increasing, optional)\n  uint32_t conditional_on_version = {};            //!< Auto-reject if this version has positively failed (optional)\n  std::chrono::nanoseconds release_time_utc = {};  //!< Request release time (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CancelOrder>() {\n  using namespace std::literals;\n  return \"cancel_order\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CancelOrder> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CancelOrder const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(request_template=\"{}\", )\"\n        R\"(routing_id=\"{}\", )\"\n        R\"(version={}, )\"\n        R\"(conditional_on_version={}, )\"\n        R\"(release_time_utc={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.order_id,\n        value.request_template,\n        value.routing_id,\n        value.version,\n        value.conditional_on_version,\n        value.release_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/cancel_quotes.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Cancel quotes\nstruct ROQ_PUBLIC CancelQuotes final {\n  std::string_view account;    //!< Account name\n  uint16_t quote_set_id = {};  //!< Quote Request ID\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CancelQuotes>() {\n  using namespace std::literals;\n  return \"cancel_quotes\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CancelQuotes> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CancelQuotes const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(quote_set_id={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.quote_set_id);\n  }\n};"
  },
  {
    "path": "include/roq/cancel_quotes_ack.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/error.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Acknowledgement that a cancel quotes request has been seen by gateway/exchange\nstruct ROQ_PUBLIC CancelQuotesAck final {\n  uint16_t stream_id = {};                  //!< Stream identifier\n  std::string_view account;                 //!< Account name\n  roq::Origin origin = {};                  //!< Origin of ack\n  roq::RequestStatus request_status = {};   //!< Request status\n  roq::Error error = {};                    //!< Error code\n  std::string_view text;                    //!< Descriptive text\n  std::string_view request_id;              //!< Request identifier\n  std::string_view external_account;        //!< External account name\n  uint32_t number_of_affected_quotes = {};  //!< Number of affected quotes (optional, indicative)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CancelQuotesAck>() {\n  using namespace std::literals;\n  return \"cancel_quotes_ack\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CancelQuotesAck> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CancelQuotesAck const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(origin={}, )\"\n        R\"(request_status={}, )\"\n        R\"(error={}, )\"\n        R\"(text=\"{}\", )\"\n        R\"(request_id=\"{}\", )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(number_of_affected_quotes={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.origin,\n        value.request_status,\n        value.error,\n        value.text,\n        value.request_id,\n        value.external_account,\n        value.number_of_affected_quotes);\n  }\n};"
  },
  {
    "path": "include/roq/category.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Category (of data)\nenum class Category : uint8_t {\n  UNDEFINED = 0,\n  PUBLIC,   //!< Public data\n  PRIVATE,  //!< Private data\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/client/custom_message.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <span>\n\n#include \"roq/event.hpp\"\n\nnamespace roq {\nnamespace client {\n\nstruct ROQ_PUBLIC CustomMessage final {\n  std::span<std::byte const> message;\n};\n\n}  // namespace client\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::client::CustomMessage> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::client::CustomMessage const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(length={})\"\n        R\"(}})\"sv,\n        std::size(value.message));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Event<roq::client::CustomMessage>> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Event<roq::client::CustomMessage> const &event, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(message_info={}, )\"\n        R\"(custom_message={})\"\n        R\"(}})\"sv,\n        event.message_info,\n        event.value);\n  }\n};\n"
  },
  {
    "path": "include/roq/clock.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <chrono>\n#include <cstdint>\n#include <ctime>\n\n#include \"roq/exceptions.hpp\"\n\nnamespace roq {\n\nnamespace detail {\ntemplate <clockid_t clock>\ninline auto get_time_helper() {\n  struct timespec time;\n  auto res = ::clock_gettime(clock, &time);\n  if (res != 0) [[unlikely]] {\n    using namespace std::literals;\n    throw SystemError{std::error_code{errno, std::system_category()}, \"clock_gettime\"sv};\n  }\n  return std::chrono::nanoseconds{(static_cast<int64_t>(time.tv_sec) * INT64_C(1000000000)) + static_cast<int64_t>(time.tv_nsec)};\n}\n}  // namespace detail\n\nnamespace clock {\ntemplate <typename T = std::chrono::nanoseconds>\ninline T get_system() {\n  return std::chrono::duration_cast<T>(detail::get_time_helper<CLOCK_MONOTONIC>());\n}\n\ntemplate <typename T = std::chrono::nanoseconds>\ninline T get_realtime() {\n  return std::chrono::duration_cast<T>(detail::get_time_helper<CLOCK_REALTIME>());\n}\n}  // namespace clock\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/compat.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <cstddef>\n\n#if defined(__GNUC__)\n#define ROQ_PUBLIC __attribute__((visibility(\"default\")))\n#define ROQ_HOT __attribute__((hot))\n#define ROQ_PACKED __attribute__((packed))\n#else  // not gnuc\n#if defined(__clang__)\n#error \"expected __clang__ to also define __GNUC__\"\n#endif\n#error \"unsupported compiler\"\n#endif\n\n#if defined(__APPLE__)\n// sysctl -a | grep -e vm.pagesize -e hw.cachelinesize\n#if defined(__arm64__)\nstatic constexpr size_t const ROQ_CACHELINE_SIZE = 128;\nstatic constexpr size_t const ROQ_PAGE_SIZE = 16384;\n#else  // not __arm64__\nstatic constexpr size_t const ROQ_CACHELINE_SIZE = 64;\nstatic constexpr size_t const ROQ_PAGE_SIZE = 4096;\n#endif\n#else  // not __APPLE__\n// getconf -a | grep -e PAGE_SIZE -e LEVEL1_DCACHE_LINESIZE\nstatic constexpr size_t const ROQ_CACHELINE_SIZE = 64;\nstatic constexpr size_t const ROQ_PAGE_SIZE = 4096;\n#endif\n"
  },
  {
    "path": "include/roq/connected.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Connected to gateway\nstruct ROQ_PUBLIC Connected final {};\n\ntemplate <>\nconstexpr std::string_view get_name<Connected>() {\n  using namespace std::literals;\n  return \"connected\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Connected> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Connected const &, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), R\"({{}})\"sv);\n  }\n};"
  },
  {
    "path": "include/roq/connection_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of exchange connectivity status as seen from a gateway\nenum class ConnectionStatus : uint8_t {\n  UNDEFINED = 0,\n  DISCONNECTED,  //!< Disconnected\n  CONNECTING,    //!< Connecting\n  LOGIN_SENT,    //!< Login sent\n  DOWNLOADING,   //!< Downloading\n  READY,         //!< Ready\n  LOGGED_OUT,    //!< Logged out\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/control.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/action.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Service control\nstruct ROQ_PUBLIC Control final {\n  std::string_view request_id;  //!< Request identifier\n  std::string_view user;        //!< User name (client routing, optional)\n  roq::Action action = {};      //!< Action\n  uint32_t strategy_id = {};    //!< Strategy filter (optional)\n  uint16_t leg_id = {};         //!< Leg index filter (optional)\n  std::string_view account;     //!< Account filter (optional)\n  std::string_view exchange;    //!< Exchange filter (optional)\n  std::string_view symbol;      //!< Symbol filter (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<Control>() {\n  using namespace std::literals;\n  return \"control\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Control> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Control const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(request_id=\"{}\", )\"\n        R\"(user=\"{}\", )\"\n        R\"(action={}, )\"\n        R\"(strategy_id={}, )\"\n        R\"(leg_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\")\"\n        R\"(}})\"sv,\n        value.request_id,\n        value.user,\n        value.action,\n        value.strategy_id,\n        value.leg_id,\n        value.account,\n        value.exchange,\n        value.symbol);\n  }\n};"
  },
  {
    "path": "include/roq/control_ack.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/error.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Control ack\nstruct ROQ_PUBLIC ControlAck final {\n  std::string_view request_id;             //!< Request identifier\n  std::string_view user;                   //!< User name (client routing, optional)\n  roq::Origin origin = {};                 //!< Origin of ack\n  roq::RequestStatus request_status = {};  //!< Request status\n  roq::Error error = {};                   //!< Error code\n  std::string_view text;                   //!< Descriptive text\n};\n\ntemplate <>\nconstexpr std::string_view get_name<ControlAck>() {\n  using namespace std::literals;\n  return \"control_ack\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ControlAck> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ControlAck const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(request_id=\"{}\", )\"\n        R\"(user=\"{}\", )\"\n        R\"(origin={}, )\"\n        R\"(request_status={}, )\"\n        R\"(error={}, )\"\n        R\"(text=\"{}\")\"\n        R\"(}})\"sv,\n        value.request_id,\n        value.user,\n        value.origin,\n        value.request_status,\n        value.error,\n        value.text);\n  }\n};"
  },
  {
    "path": "include/roq/create_order.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/execution_instruction.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/mask.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/order_type.hpp\"\n#include \"roq/position_effect.hpp\"\n#include \"roq/quantity_type.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/time_in_force.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Fields required to create an order\nstruct ROQ_PUBLIC CreateOrder final {\n  std::string_view account;                                     //!< Account name\n  uint64_t order_id = {};                                       //!< Order identifier\n  std::string_view exchange;                                    //!< Exchange\n  std::string_view symbol;                                      //!< Symbol\n  roq::Side side = {};                                          //!< Order side\n  roq::PositionEffect position_effect = {};                     //!< Position effect\n  roq::MarginMode margin_mode = {};                             //!< Margin mode\n  roq::QuantityType quantity_type = {};                         //!< Type of quantity (requires ecxhange support)\n  double max_show_quantity = roq::NaN;                          //!< Quantity visible to market (requires exchange support)\n  roq::OrderType order_type = {};                               //!< Order type\n  roq::TimeInForce time_in_force = {};                          //!< Time in force\n  roq::Mask<roq::ExecutionInstruction> execution_instructions;  //!< Execution instructions\n  std::string_view request_template;                            //!< Request template (gateway configured)\n  double quantity = roq::NaN;                                   //!< Order quantity\n  double price = roq::NaN;                                      //!< Limit price (depends on order_type)\n  double stop_price = roq::NaN;                                 //!< Stop price (depends on order_type and time_in_force)\n  double leverage = roq::NaN;                                   //!< Leverage (requires exchange support)\n  std::string_view routing_id;                                  //!< Routing identifier\n  uint32_t strategy_id = {};                                    //!< Strategy identifier (optional)\n  std::chrono::nanoseconds release_time_utc = {};               //!< Request release time (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CreateOrder>() {\n  using namespace std::literals;\n  return \"create_order\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CreateOrder> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CreateOrder const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(side={}, )\"\n        R\"(position_effect={}, )\"\n        R\"(margin_mode={}, )\"\n        R\"(quantity_type={}, )\"\n        R\"(max_show_quantity={}, )\"\n        R\"(order_type={}, )\"\n        R\"(time_in_force={}, )\"\n        R\"(execution_instructions={}, )\"\n        R\"(request_template=\"{}\", )\"\n        R\"(quantity={}, )\"\n        R\"(price={}, )\"\n        R\"(stop_price={}, )\"\n        R\"(leverage={}, )\"\n        R\"(routing_id=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(release_time_utc={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.order_id,\n        value.exchange,\n        value.symbol,\n        value.side,\n        value.position_effect,\n        value.margin_mode,\n        value.quantity_type,\n        value.max_show_quantity,\n        value.order_type,\n        value.time_in_force,\n        value.execution_instructions,\n        value.request_template,\n        value.quantity,\n        value.price,\n        value.stop_price,\n        value.leverage,\n        value.routing_id,\n        value.strategy_id,\n        value.release_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/custom_matrix.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/string_types.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Custom matrix (publish)\nstruct ROQ_PUBLIC CustomMatrix final {\n  std::string_view label;                   //!< Label\n  std::string_view account;                 //!< Account name\n  std::string_view exchange;                //!< Exchange\n  std::string_view symbol;                  //!< Symbol\n  std::span<roq::MatrixKey const> rows;     //!< row labels\n  std::span<roq::MatrixKey const> columns;  //!< column labels\n  std::span<double const> data;             //!< matrix\n  roq::UpdateType update_type = {};         //!< Update type\n  uint32_t version = {};                    //!< Version number (does not have to be sequential)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CustomMatrix>() {\n  using namespace std::literals;\n  return \"custom_matrix\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CustomMatrix> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CustomMatrix const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(label=\"{}\", )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(rows=[{}], )\"\n        R\"(columns=[{}], )\"\n        R\"(data=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(version={})\"\n        R\"(}})\"sv,\n        value.label,\n        value.account,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.rows, \", \"sv),\n        fmt::join(value.columns, \", \"sv),\n        fmt::join(value.data, \", \"sv),\n        value.update_type,\n        value.version);\n  }\n};"
  },
  {
    "path": "include/roq/custom_matrix_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/string_types.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Custom matrix (receive)\nstruct ROQ_PUBLIC CustomMatrixUpdate final {\n  std::string_view label;                          //!< Label\n  std::string_view account;                        //!< Account name\n  std::string_view exchange;                       //!< Exchange\n  std::string_view symbol;                         //!< Symbol\n  std::span<roq::MatrixKey const> rows;            //!< row labels\n  std::span<roq::MatrixKey const> columns;         //!< column labels\n  std::span<double const> data;                    //!< matrix\n  roq::UpdateType update_type = {};                //!< Update type\n  uint32_t version = {};                           //!< Version number (does not have to be sequential)\n  std::chrono::nanoseconds sending_time_utc = {};  //!< Exchange sending timestamp (UTC)\n  std::string_view user;                           //!< User name (origin)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CustomMatrixUpdate>() {\n  using namespace std::literals;\n  return \"custom_matrix_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CustomMatrixUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CustomMatrixUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(label=\"{}\", )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(rows=[{}], )\"\n        R\"(columns=[{}], )\"\n        R\"(data=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(version={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(user=\"{}\")\"\n        R\"(}})\"sv,\n        value.label,\n        value.account,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.rows, \", \"sv),\n        fmt::join(value.columns, \", \"sv),\n        fmt::join(value.data, \", \"sv),\n        value.update_type,\n        value.version,\n        value.sending_time_utc,\n        value.user);\n  }\n};"
  },
  {
    "path": "include/roq/custom_metrics.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/measurement.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Custom metrics (publish)\nstruct ROQ_PUBLIC CustomMetrics final {\n  std::string_view label;                          //!< Label\n  std::string_view account;                        //!< Account name\n  std::string_view exchange;                       //!< Exchange\n  std::string_view symbol;                         //!< Symbol\n  std::span<roq::Measurement const> measurements;  //!< List of measurements\n  roq::UpdateType update_type = {};                //!< Update type\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CustomMetrics>() {\n  using namespace std::literals;\n  return \"custom_metrics\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CustomMetrics> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CustomMetrics const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(label=\"{}\", )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(measurements=[{}], )\"\n        R\"(update_type={})\"\n        R\"(}})\"sv,\n        value.label,\n        value.account,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.measurements, \", \"sv),\n        value.update_type);\n  }\n};"
  },
  {
    "path": "include/roq/custom_metrics_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/measurement.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Custom metrics (receive)\nstruct ROQ_PUBLIC CustomMetricsUpdate final {\n  std::string_view label;                          //!< Label\n  std::string_view account;                        //!< Account name\n  std::string_view exchange;                       //!< Exchange\n  std::string_view symbol;                         //!< Symbol\n  std::span<roq::Measurement const> measurements;  //!< List of measurements\n  roq::UpdateType update_type = {};                //!< Update type\n  std::chrono::nanoseconds sending_time_utc = {};  //!< Exchange sending timestamp (UTC)\n  std::string_view user;                           //!< User name (origin)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<CustomMetricsUpdate>() {\n  using namespace std::literals;\n  return \"custom_metrics_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::CustomMetricsUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CustomMetricsUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(label=\"{}\", )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(measurements=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(user=\"{}\")\"\n        R\"(}})\"sv,\n        value.label,\n        value.account,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.measurements, \", \"sv),\n        value.update_type,\n        value.sending_time_utc,\n        value.user);\n  }\n};"
  },
  {
    "path": "include/roq/data_source.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of time-series data sources\nenum class DataSource : uint8_t {\n  UNDEFINED = 0,\n  TRADE_SUMMARY,  //!< Trades\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/decimal.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include \"roq/limits.hpp\"\n#include \"roq/precision.hpp\"\n\nnamespace roq {\n\nstruct Decimal final {\n  Decimal() = default;\n\n  Decimal(double value, Precision precision) : value_{value}, precision_{precision} {}\n\n  bool empty() const { return std::isnan(value_); }\n\n  operator double() const { return value_; }\n  operator Precision() const { return precision_; }\n\n private:\n  double value_ = NaN;\n  Precision precision_ = {};\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Decimal> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Decimal const &value, format_context &context) const {\n    constexpr auto helper = [](auto precision) {\n      using result_type = int8_t;\n      if (precision >= roq::Precision::_0 && precision <= roq::Precision::_15) {\n        return static_cast<result_type>(precision) - static_cast<result_type>(roq::Precision::_0);\n      }\n      return -1;\n    };\n    // NOLINTBEGIN(readability-magic-numbers)\n    static_assert(helper(roq::Precision::UNDEFINED) == -1);\n    static_assert(helper(roq::Precision::_0) == 0);\n    static_assert(helper(roq::Precision::_15) == 15);\n    // NOLINTEND(readability-magic-numbers)\n    using namespace std::literals;\n    auto decimal_digits = helper(static_cast<roq::Precision>(value));\n    if (decimal_digits >= 0) {\n      return fmt::format_to(context.out(), \"{:.{}f}\"sv, static_cast<double>(value), decimal_digits);\n    }\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<double>(value));\n  }\n};\n"
  },
  {
    "path": "include/roq/disconnected.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/order_cancel_policy.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Disconnected\nstruct ROQ_PUBLIC Disconnected final {\n  roq::OrderCancelPolicy order_cancel_policy = {};  //!< Cancel orders on disconnect?\n};\n\ntemplate <>\nconstexpr std::string_view get_name<Disconnected>() {\n  using namespace std::literals;\n  return \"disconnected\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Disconnected> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Disconnected const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(order_cancel_policy={})\"\n        R\"(}})\"sv,\n        value.order_cancel_policy);\n  }\n};"
  },
  {
    "path": "include/roq/download_begin.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Identifies the beginning of a download sequence\nstruct ROQ_PUBLIC DownloadBegin final {\n  std::string_view account;  //!< Account name\n};\n\ntemplate <>\nconstexpr std::string_view get_name<DownloadBegin>() {\n  using namespace std::literals;\n  return \"download_begin\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::DownloadBegin> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::DownloadBegin const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\")\"\n        R\"(}})\"sv,\n        value.account);\n  }\n};"
  },
  {
    "path": "include/roq/download_end.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Identifies the end of a download sequence\nstruct ROQ_PUBLIC DownloadEnd final {\n  std::string_view account;    //!< Account name\n  uint64_t max_order_id = {};  //!< Highest previous order identifier (as seen by gateway)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<DownloadEnd>() {\n  using namespace std::literals;\n  return \"download_end\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::DownloadEnd> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::DownloadEnd const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(max_order_id={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.max_order_id);\n  }\n};"
  },
  {
    "path": "include/roq/encoding.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <cstdlib>\n\nnamespace roq {\n\n//! Enumeration of message encoding types (informational, only)\nenum class Encoding : uint32_t {  // NOLINT(performance-enum-size)\n  UNDEFINED = 0,\n  FIX = 0x1,   //!< FIX\n  JSON = 0x2,  //!< JSON\n  SBE = 0x4,   //!< SBE\n  FBS = 0x8,   //!< FlatBuffers\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Encoding> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Encoding const &value, format_context &context) const {\n    using namespace std::literals;\n    auto name = [&]() -> std::string_view {\n      switch (value) {\n        using enum roq::Encoding;\n        case UNDEFINED:\n          return \"UNDEFINED\"sv;\n        case FIX:\n          return \"FIX\"sv;\n        case JSON:\n          return \"JSON\"sv;\n        case SBE:\n          return \"SBE\"sv;\n        case FBS:\n          return \"FBS\"sv;\n      }\n      std::abort();\n    }();\n    return fmt::format_to(context.out(), \"{}\"sv, name);\n  }\n};"
  },
  {
    "path": "include/roq/error.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of error types\nenum class Error : uint8_t {\n  UNDEFINED = 0,\n  UNKNOWN,\n  NOT_SUPPORTED,                   //!< Request type not supported\n  INVALID_ACCOUNT,                 //!< Invalid account\n  INVALID_ORDER_ID,                //!< Invalid order ID\n  INVALID_EXCHANGE,                //!< Invalid exchange\n  INVALID_SYMBOL,                  //!< Invalid symbol\n  INVALID_SIDE,                    //!< Invalid side\n  INVALID_POSITION_EFFECT,         //!< Invalid position effect\n  INVALID_QUANTITY,                //!< Invalid quantity\n  INVALID_MAX_SHOW_QUANTITY,       //!< Invalid max show quantity\n  INVALID_ORDER_TYPE,              //!< Invalid order type\n  INVALID_TIME_IN_FORCE,           //!< Invalid time in force\n  INVALID_EXECUTION_INSTRUCTION,   //!< Invalid execution instruction\n  INVALID_REQUEST_TEMPLATE,        //!< Invalid request template\n  INVALID_PRICE,                   //!< Invalid price\n  INVALID_STOP_PRICE,              //!< Invalid stop price\n  INVALID_ROUTING_ID,              //!< Invalid routing ID\n  INVALID_REQUEST_VERSION,         //!< Invalid request version\n  INVALID_REQUEST_ID,              //!< Invalid request ID\n  INVALID_REQUEST_TYPE,            //!< Invalid request type\n  INVALID_REQUEST_STATUS,          //!< Invalid request status\n  INVALID_REQUEST_ARGS,            //!< Request arguments did not meet validation rules\n  UNKNOWN_EXTERNAL_ORDER_ID,       //!< An external order identifier has not yet been received\n  NOT_AUTHORIZED,                  //!< User is not authorized\n  REQUEST_RATE_LIMIT_REACHED,      //!< Request rate limit has been reached\n  GATEWAY_NOT_READY,               //!< Gateway not ready (could be disconnected or currently downloading)\n  NETWORK_ERROR,                   //!< Network disconnect event (unknown request/order status)\n  TIMEOUT,                         //!< Response has not been received (unknown request/order status)\n  PARSE_ERROR,                     //!< Message parse error (unknown request/order status)\n  MODIFY_HAS_NO_EFFECT,            //!< Modify request has no effect on order\n  TOO_LATE_TO_MODIFY_OR_CANCEL,    //!< Too late to modify or cancel (order has been filled or is already canceled)\n  CONDITIONAL_REQUEST_HAS_FAILED,  //!< Happens when gateway detects chain failure\n  UNKNOWN_ORDER_ID,                //!< Unknown order ID\n  INSUFFICIENT_FUNDS,              //!< Insufficient funds for order action\n  RISK_LIMIT_REACHED,              //!< Risk limit reached\n  INVALID_FILTER,                  //!< Invalid filter\n  INVALID_MARGIN_MODE,             //!< Invalid margin mode\n  INVALID_QUANTITY_TYPE,           //!< Invalid quantity type\n  INVALID_RELEASE_TIME,            //!< Invalid release time\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/event.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <type_traits>\n#include <utility>\n\n#include \"roq/message_info.hpp\"\n#include \"roq/name.hpp\"\n\nnamespace roq {\n\n//! Event\ntemplate <typename T>\nstruct Event final {\n  using value_type = std::remove_cvref_t<T>;\n\n  Event(MessageInfo const &message_info, T const &value) : message_info{message_info}, value{value} {}\n\n  Event(Event &&) = delete;\n  Event(Event const &) = delete;\n\n  void operator=(Event &&) = delete;\n  void operator=(Event const &) = delete;\n\n  //! Dispatch to handler\n  template <typename Result, typename Handler, typename... Args>\n  Result dispatch(Handler &&handler, Args &&...args) const {\n    return handler(*this, std::forward<Args>(args)...);\n  }\n\n  //! Access MessageInfo\n  operator MessageInfo const &() const { return message_info; }\n\n  //! Access Message\n  operator value_type const &() const { return value; }\n\n  //! Structured binding\n  operator std::pair<MessageInfo const &, value_type const &>() const { return {message_info, value}; }\n\n  MessageInfo const &message_info;  //!< MessageInfo\n  value_type const &value;          //!< Message\n\n  //! Create event and dispatch to handler\n  template <typename... Args>\n  static void create_and_dispatch(auto &handler, MessageInfo const &message_info, T const &value, Args &&...args) {\n    Event const event{message_info, value};\n    return event.template dispatch<void>(handler, std::forward<Args>(args)...);\n  }\n};\n\n//! Create event and dispatch to handler\ntemplate <typename T, typename... Args>\ninline void create_event_and_dispatch(auto &handler, MessageInfo const &message_info, T const &value, Args &&...args) {\n  return Event<T>::create_and_dispatch(handler, message_info, value, std::forward<Args>(args)...);\n}\n\n}  // namespace roq\n\ntemplate <typename T>\nstruct fmt::formatter<roq::Event<T>> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Event<T> const &event, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"({}={}, )\"\n        R\"(message_info={})\"\n        R\"(}})\"sv,\n        roq::get_name<T>(),\n        event.value,\n        event.message_info);\n  }\n};\n"
  },
  {
    "path": "include/roq/exceptions.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <stdexcept>\n#include <string>\n#include <string_view>\n#include <system_error>\n#include <typeinfo>\n#include <utility>\n\n#include \"roq/error.hpp\"\n#include \"roq/format_str.hpp\"\n#include \"roq/request_status.hpp\"\n\nnamespace roq {\n\nnamespace detail {\ntemplate <typename... Args>\nconstexpr auto create_what(fmt::string_view const &str, Args &&...args) -> std::string {\n  if (std::size(str) == 0) {\n    return {};\n  }\n  if constexpr (sizeof...(args) == 0) {\n    return {std::data(str), std::size(str)};\n  } else {\n    // XXX FIXME TODO fmt::format_string\n    return fmt::vformat(str, fmt::make_format_args(args...));\n  }\n}\n}  // namespace detail\n\n// This class hierarchy is *similar to* that of std::exception,\n// but not trying to be a mirror!\n// The reason is that a mirrored exception hierarchy would require multiple\n// inheritance and then cause issues with catch handlers.\n// The implication is that you must implement two exception handlers,\n// e.g.\n//   try {\n//     ...\n//   } catch (std::overflow_error&) {\n//     ...\n//   } catch (roq::OverflowError&) {\n//     ...\n//   }\n\n//! Base\nstruct ROQ_PUBLIC Exception : public std::exception {\n  template <typename... Args>\n  explicit Exception(format_str const &str, Args &&...args)\n      : file_name_{str.file_name}, line_{str.line}, what_{detail::create_what(str.str, std::forward<Args>(args)...)} {}\n\n  char const *what() const noexcept override { return what_.c_str(); }\n\n  virtual std::string_view file() const noexcept { return file_name_; }\n  virtual int line() const noexcept { return static_cast<int>(line_); }\n\n  template <typename Context>\n  auto format_to(Context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(type=\"{}\", )\"\n        R\"(what=\"{}\", )\"\n        R\"(file=\"{}\", )\"\n        R\"(line={})\"\n        R\"(}})\"sv,\n        typeid(*this).name(),\n        what_,\n        file_name_,\n        line_);\n  }\n\n protected:\n  detail::static_string<32> const file_name_;\n  uint32_t const line_;\n  std::string const what_;\n};\n\n//! Runtime error\nstruct ROQ_PUBLIC RuntimeError : public Exception {\n  using Exception::Exception;\n};\n\n//! SystemError\nstruct ROQ_PUBLIC SystemError : public RuntimeError {\n public:\n  std::error_code const &code() const noexcept { return error_; }\n\n  template <typename... Args>\n  SystemError(std::error_code error, format_str const &fmt, Args &&...args) : RuntimeError{fmt, std::forward<Args>(args)...}, error_{error} {}\n\n  template <typename Context>\n  auto format_to(Context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(type=\"{}\", )\"\n        R\"(what=\"{}\", )\"\n        R\"(file=\"{}\", )\"\n        R\"(line={}, )\"\n        R\"(error_code={{)\"\n        R\"(message=\"{}\", )\"\n        R\"(value={})\"\n        R\"(}})\"\n        R\"(}})\"sv,\n        typeid(*this).name(),\n        what_,\n        file_name_,\n        line_,\n        error_.message(),\n        error_.value());\n  }\n\n private:\n  std::error_code const error_;\n};\n\n//! RangeError\nstruct ROQ_PUBLIC RangeError : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! OverflowError\nstruct ROQ_PUBLIC OverflowError : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! LogicError\nstruct ROQ_PUBLIC LogicError : public Exception {\n  using Exception::Exception;\n};\n\n//! InvalidArgument\nstruct ROQ_PUBLIC InvalidArgument : public LogicError {\n  using LogicError::LogicError;\n};\n\n//! OutOfRange\nstruct ROQ_PUBLIC OutOfRange : public LogicError {\n  using LogicError::LogicError;\n};\n\n//! LengthError\nstruct ROQ_PUBLIC LengthError : public LogicError {\n  using LogicError::LogicError;\n};\n\n// ROQ SPECIFIC\n\n//! Fatal\nstruct ROQ_PUBLIC Fatal : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! File does not exist\nstruct ROQ_PUBLIC FileDoesNotExist : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! Not ready\nstruct ROQ_PUBLIC NotReady : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! Not implemented\nstruct ROQ_PUBLIC NotImplemented : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! Not supported\nstruct ROQ_PUBLIC NotSupported : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n//! Bad state\nstruct ROQ_PUBLIC BadState : public RuntimeError {\n  using RuntimeError::RuntimeError;\n};\n\n// network errors\n\n//! Base class for network errors\nstruct ROQ_PUBLIC NetworkError : public RuntimeError {\n  template <typename... Args>\n  NetworkError(RequestStatus request_status, Error error, format_str const &fmt, Args &&...args)\n      : RuntimeError{fmt, std::forward<Args>(args)...}, request_status_{request_status}, error_{error} {}\n\n  RequestStatus request_status() const noexcept { return request_status_; }\n  Error error() const noexcept { return error_; }\n\n private:\n  RequestStatus const request_status_;\n  Error const error_;\n};\n\n// transport errors\n\n//! Base class for transport errors\nstruct ROQ_PUBLIC TransportError : public NetworkError {\n  using NetworkError::NetworkError;\n};\n\n//! Not connected\nstruct ROQ_PUBLIC NotConnected : public TransportError {\n  template <typename... Args>\n  explicit NotConnected(format_str const &fmt, Args &&...args)\n      : TransportError{RequestStatus::REJECTED, Error::GATEWAY_NOT_READY, fmt, std::forward<Args>(args)...} {}\n};\n\n//! Connection refused\nstruct ROQ_PUBLIC ConnectionRefused : public TransportError {\n  template <typename... Args>\n  explicit ConnectionRefused(format_str const &fmt, Args &&...args)\n      : TransportError{RequestStatus::REJECTED, Error::GATEWAY_NOT_READY, fmt, std::forward<Args>(args)...} {}\n};\n\n//! Timed out\nstruct ROQ_PUBLIC TimedOut : public TransportError {\n  template <typename... Args>\n  explicit TimedOut(format_str const &fmt, Args &&...args) : TransportError{RequestStatus::TIMEOUT, Error::TIMEOUT, fmt, std::forward<Args>(args)...} {}\n};\n\n// session errors\n\n//! Base class for session errors\nstruct ROQ_PUBLIC SessionError : public NetworkError {\n  using NetworkError::NetworkError;\n};\n\n//! Permissions denied (operating system)\nstruct ROQ_PUBLIC PermissionDenied : public SessionError {\n  template <typename... Args>\n  explicit PermissionDenied(format_str const &fmt, Args &&...args)\n      : SessionError{RequestStatus::UNDEFINED, Error::UNDEFINED, fmt, std::forward<Args>(args)...} {}\n};\n\n//! Order not live\nstruct ROQ_PUBLIC OrderNotLive : public SessionError {\n  template <typename... Args>\n  explicit OrderNotLive(format_str const &fmt, Args &&...args)\n      : SessionError{RequestStatus::REJECTED, Error::TOO_LATE_TO_MODIFY_OR_CANCEL, fmt, std::forward<Args>(args)...} {}\n};\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Exception> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Exception const &value, format_context &context) const { return value.format_to(context); }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::RuntimeError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RuntimeError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::SystemError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::SystemError const &value, format_context &context) const { return value.format_to(context); }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::RangeError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RangeError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::OverflowError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::OverflowError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::LogicError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::LogicError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::InvalidArgument> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::InvalidArgument const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::OutOfRange> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::OutOfRange const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::LengthError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::LengthError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Fatal> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Fatal const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::FileDoesNotExist> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::FileDoesNotExist const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::NotReady> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::NotReady const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::BadState> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::BadState const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::NetworkError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::NetworkError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::TransportError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TransportError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::NotConnected> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::NotConnected const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ConnectionRefused> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ConnectionRefused const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::TimedOut> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TimedOut const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::SessionError> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::SessionError const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::PermissionDenied> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::PermissionDenied const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::OrderNotLive> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::OrderNotLive const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<roq::Exception const &>(value));\n  }\n};\n"
  },
  {
    "path": "include/roq/execution_instruction.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <cstdlib>\n\nnamespace roq {\n\n//! Enumeration of execution types\nenum class ExecutionInstruction : uint32_t {  // NOLINT(performance-enum-size)\n  UNDEFINED = 0,\n  PARTICIPATE_DO_NOT_INITIATE = 0x1,  //!< Cancel if order would have executed on placement (i.e. not as maker)\n  CANCEL_IF_NOT_BEST = 0x2,           //!< Cancel if order can not be placed at best price\n  DO_NOT_INCREASE = 0x4,              //!< Order may only reduce net position, order quantity can automatically be reduced by exchange\n  DO_NOT_REDUCE = 0x8,                //!< Order can not be partially filled, aka. all-or-none (AON) orders\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ExecutionInstruction> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ExecutionInstruction const &value, format_context &context) const {\n    using namespace std::literals;\n    auto name = [&]() -> std::string_view {\n      switch (value) {\n        using enum roq::ExecutionInstruction;\n        case UNDEFINED:\n          return \"UNDEFINED\"sv;\n        case PARTICIPATE_DO_NOT_INITIATE:\n          return \"PARTICIPATE_DO_NOT_INITIATE\"sv;\n        case CANCEL_IF_NOT_BEST:\n          return \"CANCEL_IF_NOT_BEST\"sv;\n        case DO_NOT_INCREASE:\n          return \"DO_NOT_INCREASE\"sv;\n        case DO_NOT_REDUCE:\n          return \"DO_NOT_REDUCE\"sv;\n      }\n      std::abort();\n    }();\n    return fmt::format_to(context.out(), \"{}\"sv, name);\n  }\n};"
  },
  {
    "path": "include/roq/external_latency.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Update relating to external latency\nstruct ROQ_PUBLIC ExternalLatency final {\n  uint16_t stream_id = {};                //!< Stream identifier\n  std::string_view account;               //!< Account name\n  std::chrono::nanoseconds latency = {};  //!< latency measurement (1-way)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<ExternalLatency>() {\n  using namespace std::literals;\n  return \"external_latency\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ExternalLatency> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ExternalLatency const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(latency={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.latency);\n  }\n};"
  },
  {
    "path": "include/roq/fill.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n\n#include \"roq/limits.hpp\"\n#include \"roq/liquidity.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Represents a single fill (match) when an order is being partially or fully filled\nstruct ROQ_PUBLIC Fill final {\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  roq::ExternalTradeId external_trade_id;           //!< External trade identifier\n  double quantity = roq::NaN;                       //!< Quantity\n  double price = roq::NaN;                          //!< Price\n  roq::Liquidity liquidity = {};                    //!< Liquidity indicator\n  double commission_amount = roq::NaN;              //!< Funds (commission currency, optional)\n  roq::Currency commission_currency;                //!< Commission currency\n  double base_amount = roq::NaN;                    //!< Funds (base currency, internal)\n  double quote_amount = roq::NaN;                   //!< Funds (quote currency, internal)\n  double profit_loss_amount = roq::NaN;             //!< P&L (settlement currency, internal)\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Fill> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Fill const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(external_trade_id=\"{}\", )\"\n        R\"(quantity={}, )\"\n        R\"(price={}, )\"\n        R\"(liquidity={}, )\"\n        R\"(commission_amount={}, )\"\n        R\"(commission_currency=\"{}\", )\"\n        R\"(base_amount={}, )\"\n        R\"(quote_amount={}, )\"\n        R\"(profit_loss_amount={})\"\n        R\"(}})\"sv,\n        value.exchange_time_utc,\n        value.external_trade_id,\n        value.quantity,\n        value.price,\n        value.liquidity,\n        value.commission_amount,\n        value.commission_currency,\n        value.base_amount,\n        value.quote_amount,\n        value.profit_loss_amount);\n  }\n};"
  },
  {
    "path": "include/roq/filter.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <cstdlib>\n\nnamespace roq {\n\n//! Enumeration of filter fields\nenum class Filter : uint64_t {  // NOLINT(performance-enum-size)\n  UNDEFINED = 0,\n  ACCOUNT = 0x1,      //!< By account\n  EXCHANGE = 0x2,     //!< By exchange\n  SYMBOL = 0x4,       //!< By symbol\n  STRATEGY_ID = 0x8,  //!< By strategy_id\n  SIDE = 0x10,        //!< By side\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Filter> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Filter const &value, format_context &context) const {\n    using namespace std::literals;\n    auto name = [&]() -> std::string_view {\n      switch (value) {\n        using enum roq::Filter;\n        case UNDEFINED:\n          return \"UNDEFINED\"sv;\n        case ACCOUNT:\n          return \"ACCOUNT\"sv;\n        case EXCHANGE:\n          return \"EXCHANGE\"sv;\n        case SYMBOL:\n          return \"SYMBOL\"sv;\n        case STRATEGY_ID:\n          return \"STRATEGY_ID\"sv;\n        case SIDE:\n          return \"SIDE\"sv;\n      }\n      std::abort();\n    }();\n    return fmt::format_to(context.out(), \"{}\"sv, name);\n  }\n};"
  },
  {
    "path": "include/roq/format_str.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <array>\n#include <source_location>\n#include <string_view>\n\n// capture source location\n\nnamespace roq {\n\nnamespace detail {\n// compile-time evaluated string\ntemplate <std::size_t N>\nstruct static_string final {\n  consteval static_string(std::string_view const &str) : length_{std::min(N, std::size(str))}, buffer_{create(str, length_)} {}\n\n  static_string(static_string &&) = delete;\n  static_string(static_string const &) = default;\n\n  constexpr operator std::string_view() const { return {std::data(buffer_), length_}; }\n\n protected:\n  static consteval auto create(std::string_view const &str, std::size_t length) {\n    static_assert(N > 0);\n    std::array<char, N> buffer;\n    for (std::size_t i = 0; i < length; ++i) {\n      buffer[i] = str[i];\n    }\n    for (std::size_t i = length; i < N; ++i) {\n      buffer[i] = '\\0';\n    }\n    return buffer;\n  }\n\n private:\n  std::size_t const length_;\n  std::array<char, N> const buffer_;\n};\n}  // namespace detail\n\nstruct format_str final {\n  template <typename T>\n  consteval format_str(T const &str, std::source_location const loc = std::source_location::current())\n      : str{str}, file_name{extract_basename(loc.file_name())}, line{loc.line()} {}\n\n  // note! string could be truncated\n  using file_name_type = detail::static_string<32>;  // NOLINT(readability-magic-numbers)\n\n  std::string_view const str;\n  file_name_type const file_name;\n  std::uint32_t const line;\n\n private:\n  static consteval std::string_view extract_basename(char const *path) {\n    if (path == nullptr) {\n      return {};\n    }\n    std::string_view tmp{path};\n    if (std::empty(tmp)) {\n      return tmp;\n    }\n    auto pos = tmp.find_last_of('/');\n    if (pos == std::string_view::npos || pos == (std::size(tmp) - 1)) {\n      return tmp;\n    }\n    return tmp.substr(++pos);\n  }\n};\n}  // namespace roq\n\ntemplate <size_t N>\nstruct fmt::formatter<roq::detail::static_string<N>> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::detail::static_string<N> const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n"
  },
  {
    "path": "include/roq/funds_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to available funds\nstruct ROQ_PUBLIC FundsUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view account;                         //!< Account name\n  std::string_view currency;                        //!< Currency\n  roq::MarginMode margin_mode = {};                 //!< Margin mode\n  double balance = roq::NaN;                        //!< Total funds\n  double hold = roq::NaN;                           //!< Funds on hold (aka locked)\n  double borrowed = roq::NaN;                       //!< Borrowed funds (margin trading)\n  double unrealized_pnl = roq::NaN;                 //!< Unrealized P&L\n  std::string_view external_account;                //!< External account name\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<FundsUpdate>() {\n  using namespace std::literals;\n  return \"funds_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::FundsUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::FundsUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(currency=\"{}\", )\"\n        R\"(margin_mode={}, )\"\n        R\"(balance={}, )\"\n        R\"(hold={}, )\"\n        R\"(borrowed={}, )\"\n        R\"(unrealized_pnl={}, )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.currency,\n        value.margin_mode,\n        value.balance,\n        value.hold,\n        value.borrowed,\n        value.unrealized_pnl,\n        value.external_account,\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/gateway_settings.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/filter.hpp\"\n#include \"roq/interval.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/mask.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/request_id_type.hpp\"\n#include \"roq/support_type.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Gateway settings\nstruct ROQ_PUBLIC GatewaySettings final {\n  roq::Mask<roq::SupportType> supports;            //!< Supported update types\n  uint16_t mbp_max_depth = {};                     //!< MBP max depth\n  double mbp_tick_size_multiplier = roq::NaN;      //!< MBP multiplier used to manage prices as integer\n  double mbp_min_trade_vol_multiplier = roq::NaN;  //!< MBP multiplier used to manage quantities as integer\n  bool mbp_allow_remove_non_existing = false;      //!< MBP allow remove operation on non-existing level?\n  bool mbp_allow_price_inversion = false;          //!< MBP allow price inversion?\n  bool mbp_checksum = false;                       //!< MBP compute checksum?\n  bool oms_download_has_state = false;             //!< OMS download includes state information?\n  bool oms_download_has_routing_id = false;        //!< OMS download includes routing_id?\n  roq::RequestIdType oms_request_id_type = {};     //!< OMS request identifier type\n  roq::Mask<roq::Filter> oms_cancel_all_orders;    //!< Supported filters for CancelAllOrders\n  roq::Interval ts_interval = {};                  //!< Time-series interval\n  uint16_t ts_max_history = {};                    //!< Time-series max history (bars)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<GatewaySettings>() {\n  using namespace std::literals;\n  return \"gateway_settings\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::GatewaySettings> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::GatewaySettings const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(supports={}, )\"\n        R\"(mbp_max_depth={}, )\"\n        R\"(mbp_tick_size_multiplier={}, )\"\n        R\"(mbp_min_trade_vol_multiplier={}, )\"\n        R\"(mbp_allow_remove_non_existing={}, )\"\n        R\"(mbp_allow_price_inversion={}, )\"\n        R\"(mbp_checksum={}, )\"\n        R\"(oms_download_has_state={}, )\"\n        R\"(oms_download_has_routing_id={}, )\"\n        R\"(oms_request_id_type={}, )\"\n        R\"(oms_cancel_all_orders={}, )\"\n        R\"(ts_interval={}, )\"\n        R\"(ts_max_history={})\"\n        R\"(}})\"sv,\n        value.supports,\n        value.mbp_max_depth,\n        value.mbp_tick_size_multiplier,\n        value.mbp_min_trade_vol_multiplier,\n        value.mbp_allow_remove_non_existing,\n        value.mbp_allow_price_inversion,\n        value.mbp_checksum,\n        value.oms_download_has_state,\n        value.oms_download_has_routing_id,\n        value.oms_request_id_type,\n        value.oms_cancel_all_orders,\n        value.ts_interval,\n        value.ts_max_history);\n  }\n};"
  },
  {
    "path": "include/roq/gateway_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/mask.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/support_type.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Update relating to current gateway service status\nstruct ROQ_PUBLIC GatewayStatus final {\n  std::string_view account;                 //!< Account name\n  roq::Mask<roq::SupportType> supported;    //!< Supported update types\n  roq::Mask<roq::SupportType> available;    //!< Available update types (union of all streams, one or more available)\n  roq::Mask<roq::SupportType> unavailable;  //!< Unavailable update types (union of all streams, one or more unavailable)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<GatewayStatus>() {\n  using namespace std::literals;\n  return \"gateway_status\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::GatewayStatus> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::GatewayStatus const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(supported={}, )\"\n        R\"(available={}, )\"\n        R\"(unavailable={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.supported,\n        value.available,\n        value.unavailable);\n  }\n};"
  },
  {
    "path": "include/roq/interval.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of time-series update frequencies\nenum class Interval : uint8_t {\n  UNDEFINED = 0,\n  _1,     //!< 1 second\n  _5,     //!< 5 seconds\n  _10,    //!< 10 seconds\n  _15,    //!< 15 seconds\n  _30,    //!< 30 seconds\n  _60,    //!< 1 minute\n  _300,   //!< 5 minutes\n  _600,   //!< 10 minutes\n  _900,   //!< 15 minutes\n  _1800,  //!< 30 minutes\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/layer.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n\nnamespace roq {\n\n//! Represents aggregate order book bid/ask information at a given depth\nstruct ROQ_PUBLIC Layer final {\n  double bid_price = roq::NaN;  //!< Bid price level\n  double bid_quantity = {};     //!< Total quantity available at bid\n  double ask_price = roq::NaN;  //!< Ask price level\n  double ask_quantity = {};     //!< Total quantity available at ask\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Layer> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Layer const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(bid_price={}, )\"\n        R\"(bid_quantity={}, )\"\n        R\"(ask_price={}, )\"\n        R\"(ask_quantity={})\"\n        R\"(}})\"sv,\n        value.bid_price,\n        value.bid_quantity,\n        value.ask_price,\n        value.ask_quantity);\n  }\n};"
  },
  {
    "path": "include/roq/leg.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/state.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Represents current state of a strategy leg\nstruct ROQ_PUBLIC Leg final {\n  uint16_t leg_id = {};    //!< Index\n  roq::Account account;    //!< Account (optional)\n  roq::Exchange exchange;  //!< Exchange (optional)\n  roq::Symbol symbol;      //!< Symbol (optional)\n  roq::State state = {};   //!< Strategy state\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Leg> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Leg const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(leg_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(state={})\"\n        R\"(}})\"sv,\n        value.leg_id,\n        value.account,\n        value.exchange,\n        value.symbol,\n        value.state);\n  }\n};"
  },
  {
    "path": "include/roq/legs_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/leg.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Legs update\nstruct ROQ_PUBLIC LegsUpdate final {\n  std::string_view user;             //!< Service name\n  uint32_t strategy_id = {};         //!< Strategy ID\n  std::span<roq::Leg const> legs;    //!< List of leg updates\n  roq::UpdateType update_type = {};  //!< Update type\n};\n\ntemplate <>\nconstexpr std::string_view get_name<LegsUpdate>() {\n  using namespace std::literals;\n  return \"legs_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::LegsUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::LegsUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(legs=[{}], )\"\n        R\"(update_type={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.strategy_id,\n        fmt::join(value.legs, \", \"sv),\n        value.update_type);\n  }\n};"
  },
  {
    "path": "include/roq/limits.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <limits>\n\nnamespace roq {\nconstexpr auto const NaN = std::numeric_limits<double>::quiet_NaN();\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/liquidity.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of liquidity type\nenum class Liquidity : uint8_t {\n  UNDEFINED = 0,\n  MAKER,  //!< Maker\n  TAKER,  //!< Taker\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/map.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <optional>\n#include <tuple>\n\nnamespace roq {\n\nnamespace detail {\n// note! constexpr helper for static testing\ntemplate <typename... Args>\nstruct MapHelper final {\n  constexpr explicit MapHelper(std::tuple<Args...> const &args) : args_{args} {}\n  constexpr explicit MapHelper(Args &&...args_) : args_{std::forward<Args>(args_)...} {}\n\n  template <typename R>\n  constexpr operator std::optional<R>() const;\n\n  template <typename R>\n  constexpr bool operator==(R rhs) const {\n    auto tmp = (*this).operator std::optional<R>();\n    if (tmp.has_value()) {\n      return tmp.value() == rhs;\n    }\n    return false;\n  }\n\n private:\n  std::tuple<Args...> const args_;\n};\n}  // namespace detail\n\ntemplate <typename... Args>\nstruct Map final {\n  explicit Map(Args &&...args) : args_{std::forward<Args>(args)...} {}\n  explicit Map(Args const &...args) : args_{args...} {}\n\n  Map(Map const &) = delete;\n\n  template <typename R>\n  operator R() const {\n    return helper<R>().value();\n  }\n\n  template <typename R>\n  R get() const {\n    return helper<R>().value();\n  }\n\n protected:\n  template <typename R>\n  std::optional<R> helper() const {\n    static_assert(false, \"mapping has not been declared\");\n  }\n\n private:\n  std::tuple<Args...> const args_;\n};\n\ntemplate <typename... Args>\ninline auto map(Args &&...args) {\n  return Map{std::forward<Args>(args)...};\n}\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/margin_mode.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of margin modes\nenum class MarginMode : uint8_t {\n  UNDEFINED = 0,\n  ISOLATED,   //!< Isolated\n  CROSS,      //!< Cross\n  PORTFOLIO,  //!< Portfolio\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/market_by_order_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/mbo_update.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/precision.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to market by order\nstruct ROQ_PUBLIC MarketByOrderUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  std::span<roq::MBOUpdate const> orders;           //!< List of order updates\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n  roq::Precision price_precision = {};              //!< Precision (decimal digits) required to represent prices (dynamic)\n  roq::Precision quantity_precision = {};           //!< Precision (decimal digits) required to represent quantities (dynamic)\n  uint16_t max_depth = {};                          //!< Maximum depth (zero means unlimited)\n  uint32_t checksum = {};                           //!< Checksum (internal)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<MarketByOrderUpdate>() {\n  using namespace std::literals;\n  return \"market_by_order_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MarketByOrderUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MarketByOrderUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(orders=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(price_precision={}, )\"\n        R\"(quantity_precision={}, )\"\n        R\"(max_depth={}, )\"\n        R\"(checksum={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.orders, \", \"sv),\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.price_precision,\n        value.quantity_precision,\n        value.max_depth,\n        value.checksum);\n  }\n};"
  },
  {
    "path": "include/roq/market_by_price_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/mbp_update.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/precision.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to market by price\nstruct ROQ_PUBLIC MarketByPriceUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  std::span<roq::MBPUpdate const> bids;             //!< List of bids\n  std::span<roq::MBPUpdate const> asks;             //!< List of asks\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n  roq::Precision price_precision = {};              //!< Precision (decimal digits) required to represent prices (dynamic)\n  roq::Precision quantity_precision = {};           //!< Precision (decimal digits) required to represent quantities (dynamic)\n  uint16_t max_depth = {};                          //!< Maximum depth (zero means unlimited)\n  uint32_t checksum = {};                           //!< Checksum (internal)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<MarketByPriceUpdate>() {\n  using namespace std::literals;\n  return \"market_by_price_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MarketByPriceUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MarketByPriceUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(bids=[{}], )\"\n        R\"(asks=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(price_precision={}, )\"\n        R\"(quantity_precision={}, )\"\n        R\"(max_depth={}, )\"\n        R\"(checksum={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.bids, \", \"sv),\n        fmt::join(value.asks, \", \"sv),\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.price_precision,\n        value.quantity_precision,\n        value.max_depth,\n        value.checksum);\n  }\n};"
  },
  {
    "path": "include/roq/market_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/trading_status.hpp\"\n\nnamespace roq {\n\n//! Update relating to current trading status of a symbol\nstruct ROQ_PUBLIC MarketStatus final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  roq::TradingStatus trading_status = {};           //!< Trading status\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<MarketStatus>() {\n  using namespace std::literals;\n  return \"market_status\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MarketStatus> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MarketStatus const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(trading_status={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        value.trading_status,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/mask.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_flags.hpp>\n\n#include <initializer_list>\n#include <limits>\n#include <ranges>\n#include <type_traits>\n#include <utility>\n\nnamespace roq {\n\n// implements a bitmap mask using an underlying enumeration\n// some limitations:\n// - flag (enum value) should not be 0 -- we don't currently check\n// - flag (enum value) should be powers of two, or combinations -- we don't currently check\n\ntemplate <typename T>\n  requires std::is_enum_v<T>\nstruct Mask final {\n  using value_type = typename std::underlying_type_t<T>;\n\n  struct sentinel final {};\n\n  struct iterator final {\n    // std::iterator_traits\n    using difference_type = std::ptrdiff_t;\n    using value_type = T const;\n    using pointer = T const *;\n    using reference = T const;\n    using iterator_category = std::forward_iterator_tag;\n\n    using underlying_type = std::underlying_type_t<T>;\n\n    iterator(Mask<T> value) : value_{value.get()} {}\n\n    bool operator==(sentinel const &) const {\n      for (; bit_ < std::numeric_limits<underlying_type>::digits; ++bit_) {\n        auto mask = static_cast<underlying_type>(size_t{1} << bit_);\n        if (value_ < mask) {\n          break;\n        }\n        if (value_ & mask) {\n          return false;\n        }\n      }\n      return true;\n    }\n\n    reference operator*() const {\n      auto mask = static_cast<underlying_type>(size_t{1} << bit_++);\n      return static_cast<value_type>(mask);\n    }\n\n    iterator &operator++() { return *this; }\n    void operator++(int) { ++(*this); }\n\n   private:\n    underlying_type value_;\n    mutable size_t bit_ = 0;  // skip undefined\n  };\n\n  constexpr Mask() = default;\n\n  constexpr explicit Mask(value_type mask) : value_{mask} {}\n\n  constexpr explicit Mask(T flag) : value_{static_cast<value_type>(flag)} {}\n\n  constexpr Mask(std::initializer_list<T> flags) {\n    for (auto &flag : flags) {\n      value_ |= static_cast<value_type>(flag);\n    }\n  }\n\n  template <typename... Args>\n  constexpr Mask(Mask const &other, Args &&...args) : value_{other.value_ | Mask{std::forward<Args>(args)...}.get()} {}\n\n  constexpr auto operator<=>(Mask const &) const = default;\n\n  constexpr bool empty() const { return value_ == value_type{}; }\n\n  constexpr void reset() { value_ = value_type{}; }\n\n  constexpr value_type get() const { return value_; }\n\n  constexpr bool is_same(T flag) const { return value_ == static_cast<value_type>(flag); }\n\n  constexpr bool has(T flag) const { return value_ & static_cast<value_type>(flag); }\n\n  constexpr bool has_any(T flag) const { return (value_ & static_cast<value_type>(flag)) != value_type{}; }\n\n  constexpr bool has_any(std::initializer_list<T> flags) const {\n    value_type value = {};\n    for (auto &flag : flags) {\n      value |= static_cast<value_type>(flag);\n    }\n    return value_ & value;\n  }\n\n  constexpr bool has_any(Mask rhs) const { return (value_ & rhs.value_) != value_type{}; }\n\n  constexpr bool has_all(T flag) const { return (value_ & static_cast<value_type>(flag)) == static_cast<value_type>(flag); }\n\n  constexpr bool has_all(std::initializer_list<T> flags) const {\n    value_type value = {};\n    for (auto &flag : flags) {\n      value |= static_cast<value_type>(flag);\n    }\n    return (value_ & value) == value;\n  }\n\n  constexpr bool has_all(Mask rhs) const { return (value_ & rhs.value_) == rhs.value_; }\n\n  constexpr Mask &set(T flag) {\n    value_ |= static_cast<value_type>(flag);\n    return *this;\n  }\n\n  constexpr Mask &set(Mask rhs) {\n    value_ |= rhs.value_;\n    return *this;\n  }\n\n  constexpr Mask &remove(T flag) {\n    value_ &= ~static_cast<value_type>(flag);\n    return *this;\n  }\n\n  constexpr Mask &remove(Mask rhs) {\n    value_ &= ~rhs.value_;\n    return *this;\n  }\n\n  constexpr bool has_none(T flag) const { return !has_any(flag); }\n\n  constexpr bool has_none(std::initializer_list<T> flags) const { return !has_any(flags); }\n\n  constexpr bool has_none(Mask rhs) const { return !has_any(rhs); }\n\n  constexpr Mask negate() const { return Mask{~value_}; }\n\n  constexpr Mask logical_and(Mask rhs) const { return Mask{value_ & rhs.value_}; }\n\n  constexpr Mask &set(std::initializer_list<T> flags) {\n    for (auto &flag : flags) {\n      value_ |= static_cast<value_type>(flag);\n    }\n    return *this;\n  }\n\n  constexpr Mask operator~() const { return negate(); }\n\n  constexpr Mask operator&(Mask rhs) const { return logical_and(rhs); }\n\n  constexpr Mask &operator|=(T flag) {\n    set(flag);\n    return *this;\n  }\n\n  constexpr Mask &operator|=(Mask rhs) {\n    set(rhs);\n    return *this;\n  }\n\n private:\n  value_type value_ = {};\n};\n\n}  // namespace roq\n\ntemplate <typename T>\nstruct fmt::formatter<roq::Mask<T>> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Mask<T> const &value, format_context &context) const {\n    using namespace std::literals;\n    using iterator = typename roq::Mask<T>::iterator;\n    using sentinel = typename roq::Mask<T>::sentinel;\n    return fmt::format_to(context.out(), \"{}\"sv, fmt::join(iterator{value}, sentinel{}, \"|\"sv));\n  }\n};\n"
  },
  {
    "path": "include/roq/mass_quote.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/quote.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Quotes\nstruct ROQ_PUBLIC MassQuote final {\n  std::string_view account;                       //!< Account name\n  uint32_t quote_id = {};                         //!< Quote ID\n  std::span<roq::Quote const> quotes;             //!< Quotes\n  bool mmp_reset = false;                         //!< Market Maker Protection reset? (when supported by exchange)\n  std::string_view mmp_group;                     //!< Market Maker Protection group name (when supported by exchange)\n  std::chrono::nanoseconds valid_until_utc = {};  //!< Quote valid until UTC timestamp (when supported by exchange)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<MassQuote>() {\n  using namespace std::literals;\n  return \"mass_quote\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MassQuote> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MassQuote const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(quote_id={}, )\"\n        R\"(quotes=[{}], )\"\n        R\"(mmp_reset={}, )\"\n        R\"(mmp_group=\"{}\", )\"\n        R\"(valid_until_utc={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.quote_id,\n        fmt::join(value.quotes, \", \"sv),\n        value.mmp_reset,\n        value.mmp_group,\n        value.valid_until_utc);\n  }\n};"
  },
  {
    "path": "include/roq/mass_quote_ack.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/error.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Acknowledgement that a mass quote request has been seen by gateway/exchange\nstruct ROQ_PUBLIC MassQuoteAck final {\n  uint16_t stream_id = {};                 //!< Stream identifier\n  std::string_view account;                //!< Account name\n  uint32_t quote_id = {};                  //!< Quote ID\n  roq::Origin origin = {};                 //!< Origin of ack\n  roq::RequestStatus request_status = {};  //!< Request status\n  roq::Error error = {};                   //!< Error code\n  std::string_view text;                   //!< Descriptive text\n  std::string_view request_id;             //!< Request identifier\n  std::string_view external_account;       //!< External account name\n};\n\ntemplate <>\nconstexpr std::string_view get_name<MassQuoteAck>() {\n  using namespace std::literals;\n  return \"mass_quote_ack\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MassQuoteAck> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MassQuoteAck const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(quote_id={}, )\"\n        R\"(origin={}, )\"\n        R\"(request_status={}, )\"\n        R\"(error={}, )\"\n        R\"(text=\"{}\", )\"\n        R\"(request_id=\"{}\", )\"\n        R\"(external_account=\"{}\")\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.quote_id,\n        value.origin,\n        value.request_status,\n        value.error,\n        value.text,\n        value.request_id,\n        value.external_account);\n  }\n};"
  },
  {
    "path": "include/roq/mbo_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/string_types.hpp\"\n#include \"roq/update_action.hpp\"\n#include \"roq/update_reason.hpp\"\n\nnamespace roq {\n\n//! Represents an update to be applied to an order book\nstruct ROQ_PUBLIC MBOUpdate final {\n  double price = roq::NaN;        //!< Price level\n  double quantity = {};           //!< Order quantity (remaining unless update action is fill)\n  uint64_t priority = {};         //!< Queue priority (optional)\n  roq::MBOOrderId order_id;       //!< Order identifier (optional when deleting)\n  roq::Side side = {};            //!< Order side (optional when updating an existing order)\n  roq::UpdateAction action = {};  //!< Update action\n  roq::UpdateReason reason = {};  //!< Update reason (optional)\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MBOUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MBOUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(price={}, )\"\n        R\"(quantity={}, )\"\n        R\"(priority={}, )\"\n        R\"(order_id=\"{}\", )\"\n        R\"(side={}, )\"\n        R\"(action={}, )\"\n        R\"(reason={})\"\n        R\"(}})\"sv,\n        value.price,\n        value.quantity,\n        value.priority,\n        value.order_id,\n        value.side,\n        value.action,\n        value.reason);\n  }\n};"
  },
  {
    "path": "include/roq/mbp_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/update_action.hpp\"\n\nnamespace roq {\n\n//! Represents the update status of a single aggregate price level in the order book\nstruct ROQ_PUBLIC MBPUpdate final {\n  double price = roq::NaN;               //!< Price\n  double quantity = {};                  //!< Total quantity available at price (zero means remove price level)\n  double implied_quantity = roq::NaN;    //!< Total implied quantity at price (optional)\n  uint16_t number_of_orders = {};        //!< Number of orders at price (optional)\n  roq::UpdateAction update_action = {};  //!< Type of update action\n  uint32_t price_level = {};             //!< Price level (0-based indexing)\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MBPUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MBPUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(price={}, )\"\n        R\"(quantity={}, )\"\n        R\"(implied_quantity={}, )\"\n        R\"(number_of_orders={}, )\"\n        R\"(update_action={}, )\"\n        R\"(price_level={})\"\n        R\"(}})\"sv,\n        value.price,\n        value.quantity,\n        value.implied_quantity,\n        value.number_of_orders,\n        value.update_action,\n        value.price_level);\n  }\n};"
  },
  {
    "path": "include/roq/measurement.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! A single measurement point\nstruct ROQ_PUBLIC Measurement final {\n  roq::MeasurementKey name;  //!< Key\n  double value = roq::NaN;   //!< Value\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Measurement> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Measurement const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(name=\"{}\", )\"\n        R\"(value={})\"\n        R\"(}})\"sv,\n        value.name,\n        value.value);\n  }\n};"
  },
  {
    "path": "include/roq/message_info.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/uuid.hpp\"\n\nnamespace roq {\n\n//! Trace information relating to the current message\nstruct ROQ_PUBLIC MessageInfo final {\n  uint8_t source = {};                                   //!< Source identifier (index into the list of connections)\n  std::string_view source_name;                          //!< Source name\n  roq::UUID source_session_id = {};                      //!< Session identifier (UUID)\n  uint64_t source_seqno = {};                            //!< Sequence number (strictly increasing)\n  std::chrono::nanoseconds receive_time_utc = {};        //!< Client receive time (realtime clock)\n  std::chrono::nanoseconds receive_time = {};            //!< Client receive time (monotonic clock)\n  std::chrono::nanoseconds source_send_time = {};        //!< Source send time (monotonic clock)\n  std::chrono::nanoseconds source_receive_time = {};     //!< Source receive time (monotonic clock)\n  std::chrono::nanoseconds origin_create_time = {};      //!< Origin create time (monotonic clock)\n  std::chrono::nanoseconds origin_create_time_utc = {};  //!< Origin create time (realtime clock)\n  bool is_last = false;                                  //!< Is last in batch?\n  uint64_t opaque = {};                                  //!< Opaque value (internal)\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::MessageInfo> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MessageInfo const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(source={}, )\"\n        R\"(source_name=\"{}\", )\"\n        R\"(source_session_id={}, )\"\n        R\"(source_seqno={}, )\"\n        R\"(receive_time_utc={}, )\"\n        R\"(receive_time={}, )\"\n        R\"(source_send_time={}, )\"\n        R\"(source_receive_time={}, )\"\n        R\"(origin_create_time={}, )\"\n        R\"(origin_create_time_utc={}, )\"\n        R\"(is_last={}, )\"\n        R\"(opaque={})\"\n        R\"(}})\"sv,\n        value.source,\n        value.source_name,\n        value.source_session_id,\n        value.source_seqno,\n        value.receive_time_utc,\n        value.receive_time,\n        value.source_send_time,\n        value.source_receive_time,\n        value.origin_create_time,\n        value.origin_create_time_utc,\n        value.is_last,\n        value.opaque);\n  }\n};"
  },
  {
    "path": "include/roq/modify_order.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Fields required to modify an existing order\nstruct ROQ_PUBLIC ModifyOrder final {\n  std::string_view account;                        //!< Account name\n  uint64_t order_id = {};                          //!< Order identifier\n  std::string_view request_template;               //!< Request template (gateway configured)\n  double quantity = roq::NaN;                      //!< New (total) quantity\n  double price = roq::NaN;                         //!< New limit price\n  std::string_view routing_id;                     //!< Routing identifier\n  uint32_t version = {};                           //!< Version number (strictly increasing, optional)\n  uint32_t conditional_on_version = {};            //!< Auto-reject if this version has positively failed (optional)\n  std::chrono::nanoseconds release_time_utc = {};  //!< Request release time (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<ModifyOrder>() {\n  using namespace std::literals;\n  return \"modify_order\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ModifyOrder> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ModifyOrder const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(request_template=\"{}\", )\"\n        R\"(quantity={}, )\"\n        R\"(price={}, )\"\n        R\"(routing_id=\"{}\", )\"\n        R\"(version={}, )\"\n        R\"(conditional_on_version={}, )\"\n        R\"(release_time_utc={})\"\n        R\"(}})\"sv,\n        value.account,\n        value.order_id,\n        value.request_template,\n        value.quantity,\n        value.price,\n        value.routing_id,\n        value.version,\n        value.conditional_on_version,\n        value.release_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/name.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <string_view>\n\nnamespace roq {\n\ntemplate <typename T>\nconstexpr std::string_view get_name();\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/option_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of option types\nenum class OptionType : uint8_t {\n  UNDEFINED = 0,\n  CALL,  //!< Call\n  PUT,   //!< Put\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/order_ack.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/error.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/position_effect.hpp\"\n#include \"roq/quantity_type.hpp\"\n#include \"roq/request_status.hpp\"\n#include \"roq/request_type.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Acknowledgement that a create/modify/cancel order request has been seen by gateway/exchange\nstruct ROQ_PUBLIC OrderAck final {\n  uint16_t stream_id = {};                           //!< Stream identifier\n  std::string_view account;                          //!< Account name\n  uint64_t order_id = {};                            //!< Order identifier\n  std::string_view exchange;                         //!< Exchange\n  std::string_view symbol;                           //!< Symbol\n  roq::Side side = {};                               //!< Side\n  roq::PositionEffect position_effect = {};          //!< Position effect\n  roq::MarginMode margin_mode = {};                  //!< Margin mode\n  roq::QuantityType quantity_type = {};              //!< Type of quantity (requires ecxhange support)\n  roq::RequestType request_type = {};                //!< Request type\n  roq::Origin origin = {};                           //!< Origin of ack\n  roq::RequestStatus request_status = {};            //!< Request status\n  roq::Error error = {};                             //!< Error code\n  std::string_view text;                             //!< Descriptive text\n  std::string_view request_id;                       //!< Request identifier\n  std::string_view external_account;                 //!< External account name\n  std::string_view external_order_id;                //!< External order identifier\n  std::string_view client_order_id;                  //!< Client order identifier\n  double quantity = roq::NaN;                        //!< Quantity (total, indicative)\n  double price = roq::NaN;                           //!< Price\n  double stop_price = roq::NaN;                      //!< Stop price (depends on order_type and time_in_force)\n  double leverage = roq::NaN;                        //!< Leverage (requires exchange support)\n  std::string_view routing_id;                       //!< Routing identifier\n  uint32_t version = {};                             //!< Version number (strictly increasing, optional)\n  double risk_exposure = roq::NaN;                   //!< Risk exposure\n  double risk_exposure_change = roq::NaN;            //!< Risk exposure change\n  double traded_quantity = roq::NaN;                 //!< Quantity (total traded)\n  std::chrono::nanoseconds round_trip_latency = {};  //!< Round-trip latency (interpretation depends on origin)\n  std::string_view user;                             //!< User name (optional, only relevant for drop-copy)\n  uint32_t strategy_id = {};                         //!< Strategy identifier (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<OrderAck>() {\n  using namespace std::literals;\n  return \"order_ack\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::OrderAck> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::OrderAck const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(side={}, )\"\n        R\"(position_effect={}, )\"\n        R\"(margin_mode={}, )\"\n        R\"(quantity_type={}, )\"\n        R\"(request_type={}, )\"\n        R\"(origin={}, )\"\n        R\"(request_status={}, )\"\n        R\"(error={}, )\"\n        R\"(text=\"{}\", )\"\n        R\"(request_id=\"{}\", )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(external_order_id=\"{}\", )\"\n        R\"(client_order_id=\"{}\", )\"\n        R\"(quantity={}, )\"\n        R\"(price={}, )\"\n        R\"(stop_price={}, )\"\n        R\"(leverage={}, )\"\n        R\"(routing_id=\"{}\", )\"\n        R\"(version={}, )\"\n        R\"(risk_exposure={}, )\"\n        R\"(risk_exposure_change={}, )\"\n        R\"(traded_quantity={}, )\"\n        R\"(round_trip_latency={}, )\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.order_id,\n        value.exchange,\n        value.symbol,\n        value.side,\n        value.position_effect,\n        value.margin_mode,\n        value.quantity_type,\n        value.request_type,\n        value.origin,\n        value.request_status,\n        value.error,\n        value.text,\n        value.request_id,\n        value.external_account,\n        value.external_order_id,\n        value.client_order_id,\n        value.quantity,\n        value.price,\n        value.stop_price,\n        value.leverage,\n        value.routing_id,\n        value.version,\n        value.risk_exposure,\n        value.risk_exposure_change,\n        value.traded_quantity,\n        value.round_trip_latency,\n        value.user,\n        value.strategy_id);\n  }\n};"
  },
  {
    "path": "include/roq/order_cancel_policy.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of order cancel policies\nenum class OrderCancelPolicy : uint8_t {\n  UNDEFINED = 0,\n  MANAGED_ORDERS,  //!< Cancel managed orders\n  BY_ACCOUNT,      //!< Cancel by account\n  BY_STRATEGY,     //!< Cancel by strategy\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/order_management.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of a specific order management style\nenum class OrderManagement : uint8_t {\n  UNDEFINED = 0,\n  FIX,  //!< Client provides a globally unique routing_id\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/order_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Last known order status received from exchange\nenum class OrderStatus : uint8_t {\n  UNDEFINED = 0,\n  SENT,       //!< Order has been sent to exchange (no response has been received yet)\n  ACCEPTED,   //!< Order has been accepted by exchange and is not yet been activated\n  SUSPENDED,  //!< Order has been suspended and requires external action to re-activate\n  WORKING,    //!< Order is working and has not yet been completely filled\n  STOPPED,    //!< Order has guaranteed fill at as of yet unknown price\n  COMPLETED,  //!< Order has been completely filled\n  EXPIRED,    //!< Order has expired\n  CANCELED,   //!< Order has been canceled\n  REJECTED,   //!< Order has been rejected\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/order_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of order types\nenum class OrderType : uint8_t {\n  UNDEFINED = 0,\n  MARKET,  //!< Market order\n  LIMIT,   //!< Limit order\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/order_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/execution_instruction.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/liquidity.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/mask.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/order_status.hpp\"\n#include \"roq/order_type.hpp\"\n#include \"roq/position_effect.hpp\"\n#include \"roq/quantity_type.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/time_in_force.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to current status of an order\nstruct ROQ_PUBLIC OrderUpdate final {\n  uint16_t stream_id = {};                                      //!< Stream identifier\n  std::string_view account;                                     //!< Account name\n  uint64_t order_id = {};                                       //!< Order identifier\n  std::string_view exchange;                                    //!< Exchange\n  std::string_view symbol;                                      //!< Symbol\n  roq::Side side = {};                                          //!< Side\n  roq::PositionEffect position_effect = {};                     //!< Position effect\n  roq::MarginMode margin_mode = {};                             //!< Margin mode\n  roq::QuantityType quantity_type = {};                         //!< Type of quantity (requires ecxhange support)\n  double max_show_quantity = roq::NaN;                          //!< Quantity visible to market (base currency, requires exchange support)\n  roq::OrderType order_type = {};                               //!< Order type\n  roq::TimeInForce time_in_force = {};                          //!< Time in force\n  roq::Mask<roq::ExecutionInstruction> execution_instructions;  //!< Execution instructions\n  std::chrono::nanoseconds create_time_utc = {};                //!< Created timestamp (UTC)\n  std::chrono::nanoseconds update_time_utc = {};                //!< Updated timestamp (UTC)\n  std::string_view external_account;                            //!< External account name\n  std::string_view external_order_id;                           //!< External order identifier\n  std::string_view client_order_id;                             //!< Client order identifier\n  roq::OrderStatus order_status = {};                           //!< Order status\n  double quantity = roq::NaN;                                   //!< Quantity (base currency, total, indicative)\n  double price = roq::NaN;                                      //!< Price\n  double stop_price = roq::NaN;                                 //!< Stop price (depends on order_type and time_in_force)\n  double leverage = roq::NaN;                                   //!< Leverage (requires exchange support)\n  double risk_exposure = roq::NaN;                              //!< Risk exposure\n  double risk_exposure_change = roq::NaN;                       //!< Risk exposure change\n  double remaining_quantity = roq::NaN;                         //!< Quantity (base currency, remaining)\n  double traded_quantity = roq::NaN;                            //!< Quantity (base currency, total traded)\n  double average_traded_price = roq::NaN;                       //!< Average price (total traded)\n  double last_traded_quantity = roq::NaN;                       //!< Traded quantity (base currency, last trade)\n  double last_traded_price = roq::NaN;                          //!< Traded price (last trade)\n  roq::Liquidity last_liquidity = {};                           //!< Liquidity indicator (last trade)\n  std::string_view routing_id;                                  //!< Routing identifier\n  uint32_t max_request_version = {};                            //!< Last request version\n  uint32_t max_response_version = {};                           //!< Last response version\n  uint32_t max_accepted_version = {};                           //!< Last accepted version\n  roq::UpdateType update_type = {};                             //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};              //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                              //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};               //!< Exchange sending timestamp (UTC)\n  std::string_view user;                                        //!< User name (optional, only relevant for drop-copy)\n  uint32_t strategy_id = {};                                    //!< Strategy identifier (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<OrderUpdate>() {\n  using namespace std::literals;\n  return \"order_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::OrderUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::OrderUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(side={}, )\"\n        R\"(position_effect={}, )\"\n        R\"(margin_mode={}, )\"\n        R\"(quantity_type={}, )\"\n        R\"(max_show_quantity={}, )\"\n        R\"(order_type={}, )\"\n        R\"(time_in_force={}, )\"\n        R\"(execution_instructions={}, )\"\n        R\"(create_time_utc={}, )\"\n        R\"(update_time_utc={}, )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(external_order_id=\"{}\", )\"\n        R\"(client_order_id=\"{}\", )\"\n        R\"(order_status={}, )\"\n        R\"(quantity={}, )\"\n        R\"(price={}, )\"\n        R\"(stop_price={}, )\"\n        R\"(leverage={}, )\"\n        R\"(risk_exposure={}, )\"\n        R\"(risk_exposure_change={}, )\"\n        R\"(remaining_quantity={}, )\"\n        R\"(traded_quantity={}, )\"\n        R\"(average_traded_price={}, )\"\n        R\"(last_traded_quantity={}, )\"\n        R\"(last_traded_price={}, )\"\n        R\"(last_liquidity={}, )\"\n        R\"(routing_id=\"{}\", )\"\n        R\"(max_request_version={}, )\"\n        R\"(max_response_version={}, )\"\n        R\"(max_accepted_version={}, )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.order_id,\n        value.exchange,\n        value.symbol,\n        value.side,\n        value.position_effect,\n        value.margin_mode,\n        value.quantity_type,\n        value.max_show_quantity,\n        value.order_type,\n        value.time_in_force,\n        value.execution_instructions,\n        value.create_time_utc,\n        value.update_time_utc,\n        value.external_account,\n        value.external_order_id,\n        value.client_order_id,\n        value.order_status,\n        value.quantity,\n        value.price,\n        value.stop_price,\n        value.leverage,\n        value.risk_exposure,\n        value.risk_exposure_change,\n        value.remaining_quantity,\n        value.traded_quantity,\n        value.average_traded_price,\n        value.last_traded_quantity,\n        value.last_traded_price,\n        value.last_liquidity,\n        value.routing_id,\n        value.max_request_version,\n        value.max_response_version,\n        value.max_accepted_version,\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.user,\n        value.strategy_id);\n  }\n};"
  },
  {
    "path": "include/roq/origin.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of origin types\nenum class Origin : uint8_t {\n  UNDEFINED = 0,\n  CLIENT,    //!< Client\n  GATEWAY,   //!< Gateway\n  BROKER,    //!< Broker\n  EXCHANGE,  //!< Exchange\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/parameter.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Represents a single parameter\nstruct ROQ_PUBLIC Parameter final {\n  roq::ParameterKey label;    //!< Label\n  uint32_t strategy_id = {};  //!< Strategy identifier (optional)\n  roq::Account account;       //!< Account name\n  roq::Exchange exchange;     //!< Exchange\n  roq::Symbol symbol;         //!< Symbol\n  roq::ParameterValue value;  //!< Value\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Parameter> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Parameter const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(label=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(value=\"{}\")\"\n        R\"(}})\"sv,\n        value.label,\n        value.strategy_id,\n        value.account,\n        value.exchange,\n        value.symbol,\n        value.value);\n  }\n};"
  },
  {
    "path": "include/roq/parameters_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/parameter.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to parameters\nstruct ROQ_PUBLIC ParametersUpdate final {\n  std::span<roq::Parameter const> parameters;  //!< List of parameters\n  roq::UpdateType update_type = {};            //!< Update type\n  std::string_view user;                       //!< User name (optional, only relevant for drop-copy)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<ParametersUpdate>() {\n  using namespace std::literals;\n  return \"parameters_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ParametersUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ParametersUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(parameters=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(user=\"{}\")\"\n        R\"(}})\"sv,\n        fmt::join(value.parameters, \", \"sv),\n        value.update_type,\n        value.user);\n  }\n};"
  },
  {
    "path": "include/roq/portfolio.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/position.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n#include \"roq/uuid.hpp\"\n\nnamespace roq {\n\n//! Portfolio\nstruct ROQ_PUBLIC Portfolio final {\n  std::string_view user;                            //!< User (optional)\n  uint32_t strategy_id = {};                        //!< Strategy identifier (optional)\n  std::string_view account;                         //!< Account name\n  std::span<roq::Position const> positions;         //!< Position updates\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  roq::UUID session_id = {};                        //!< Reference (UUID)\n  uint64_t seqno = {};                              //!< Reference (sequencing)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<Portfolio>() {\n  using namespace std::literals;\n  return \"portfolio\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Portfolio> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Portfolio const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(positions=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(session_id={}, )\"\n        R\"(seqno={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.strategy_id,\n        value.account,\n        fmt::join(value.positions, \", \"sv),\n        value.update_type,\n        value.exchange_time_utc,\n        value.session_id,\n        value.seqno);\n  }\n};"
  },
  {
    "path": "include/roq/portfolio_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/position.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Portfolio update\nstruct ROQ_PUBLIC PortfolioUpdate final {\n  std::string_view user;                            //!< User (optional)\n  uint32_t strategy_id = {};                        //!< Strategy identifier (optional)\n  std::string_view account;                         //!< Account name\n  std::span<roq::Position const> positions;         //!< Position updates\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<PortfolioUpdate>() {\n  using namespace std::literals;\n  return \"portfolio_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::PortfolioUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::PortfolioUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(positions=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.strategy_id,\n        value.account,\n        fmt::join(value.positions, \", \"sv),\n        value.update_type,\n        value.exchange_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/position.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Position\nstruct ROQ_PUBLIC Position final {\n  roq::Exchange exchange;              //!< Exchange\n  roq::Symbol symbol;                  //!< Symbol\n  double position = 0.0;               //!< Position (quantity)\n  double profit_loss_amount = 0.0;     //!< P&L (internal)\n  roq::Currency profit_loss_currency;  //!< P&L currency\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Position> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Position const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(position={}, )\"\n        R\"(profit_loss_amount={}, )\"\n        R\"(profit_loss_currency=\"{}\")\"\n        R\"(}})\"sv,\n        value.exchange,\n        value.symbol,\n        value.position,\n        value.profit_loss_amount,\n        value.profit_loss_currency);\n  }\n};"
  },
  {
    "path": "include/roq/position_effect.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of position effect types\nenum class PositionEffect : uint8_t {\n  UNDEFINED = 0,\n  OPEN,   //!< Open position\n  CLOSE,  //!< Close position\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/position_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to current position for a symbol/side/account\nstruct ROQ_PUBLIC PositionUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view account;                         //!< Account name\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  roq::MarginMode margin_mode = {};                 //!< Margin mode\n  std::string_view external_account;                //!< External account name\n  double long_quantity = roq::NaN;                  //!< Current long position (absolute)\n  double short_quantity = roq::NaN;                 //!< Current short position (absolute)\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<PositionUpdate>() {\n  using namespace std::literals;\n  return \"position_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::PositionUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::PositionUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(margin_mode={}, )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(long_quantity={}, )\"\n        R\"(short_quantity={}, )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.exchange,\n        value.symbol,\n        value.margin_mode,\n        value.external_account,\n        value.long_quantity,\n        value.short_quantity,\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/precision.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of decimal precision (digits)\nenum class Precision : uint8_t {\n  UNDEFINED = 0,\n  _0,\n  _1,\n  _2,\n  _3,\n  _4,\n  _5,\n  _6,\n  _7,\n  _8,\n  _9,\n  _10,\n  _11,\n  _12,\n  _13,\n  _14,\n  _15,\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/precision_2.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/precision.hpp\"\n\nnamespace roq {\n\n//! Numerical precision\n// XXX TODO rename\nstruct ROQ_PUBLIC Precision2 final {\n  double increment = NaN;\n  Precision precision = {};\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Precision2> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Precision2 const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(increment={}, )\"\n        R\"(precision={})\"\n        R\"(}})\"sv,\n        value.increment,\n        value.precision);\n  }\n};\n"
  },
  {
    "path": "include/roq/priority.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of priority\nenum class Priority : uint8_t {\n  UNDEFINED = 0,\n  PRIMARY,    //!< Primary\n  SECONDARY,  //!< Secondary\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/protocol.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of protocol types (layer 7)\nenum class Protocol : uint8_t {\n  UNDEFINED = 0,\n  FIX,   //!< FIX\n  WS,    //!< Web-Socket\n  HTTP,  //!< HTTP (REST)\n  SBE,   //!< Simple Binary Encoding\n  ROQ,   //!< UDP messaging\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/quality_of_service.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of quality of service\nenum class QualityOfService : uint8_t {\n  UNDEFINED = 0,\n  IMMEDIATE,  //!< Immediate\n  CRITICAL,   //!< Critical\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/quantity_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of the type of quantity\nenum class QuantityType : uint8_t {\n  UNDEFINED = 0,\n  UNITS,      //!< Units\n  CONTRACTS,  //!< Contracts\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/quote.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/execution_instruction.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/mask.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Quote\nstruct ROQ_PUBLIC Quote final {\n  uint32_t quote_entry_id = {};                                 //!< Quote Entry ID\n  roq::Exchange exchange;                                       //!< Exchange\n  roq::Symbol symbol;                                           //!< Symbol\n  double bid_price = roq::NaN;                                  //!< Bid price level\n  double bid_quantity = {};                                     //!< Total quantity available at bid\n  double ask_price = roq::NaN;                                  //!< Ask price level\n  double ask_quantity = {};                                     //!< Total quantity available at ask\n  uint16_t quote_set_id = {};                                   //!< Quote Set ID (can be used to group and cancel quotes)\n  roq::Mask<roq::ExecutionInstruction> execution_instructions;  //!< Execution instructions\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Quote> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Quote const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(quote_entry_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(bid_price={}, )\"\n        R\"(bid_quantity={}, )\"\n        R\"(ask_price={}, )\"\n        R\"(ask_quantity={}, )\"\n        R\"(quote_set_id={}, )\"\n        R\"(execution_instructions={})\"\n        R\"(}})\"sv,\n        value.quote_entry_id,\n        value.exchange,\n        value.symbol,\n        value.bid_price,\n        value.bid_quantity,\n        value.ask_price,\n        value.ask_quantity,\n        value.quote_set_id,\n        value.execution_instructions);\n  }\n};"
  },
  {
    "path": "include/roq/rate_limit.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n\n#include \"roq/rate_limit_type.hpp\"\n\nnamespace roq {\n\n//! Rate-limit\nstruct ROQ_PUBLIC RateLimit final {\n  roq::RateLimitType type = {};            //!< Type\n  std::chrono::seconds period = {};        //!< Monitor period\n  std::chrono::seconds end_time_utc = {};  //!< End of current period\n  uint32_t limit = {};                     //!< Limit\n  uint32_t value = {};                     //!< Value\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RateLimit> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RateLimit const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(type={}, )\"\n        R\"(period={}, )\"\n        R\"(end_time_utc={}, )\"\n        R\"(limit={}, )\"\n        R\"(value={})\"\n        R\"(}})\"sv,\n        value.type,\n        value.period,\n        value.end_time_utc,\n        value.limit,\n        value.value);\n  }\n};"
  },
  {
    "path": "include/roq/rate_limit_trigger.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/buffer_capacity.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/rate_limit_type.hpp\"\n#include \"roq/string_types.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Rate-limit trigger\nstruct ROQ_PUBLIC RateLimitTrigger final {\n  std::string_view name;                      //!< Configuration name\n  roq::Origin origin = {};                    //!< Origin\n  roq::RateLimitType type = {};               //!< Rate-limit type\n  std::span<roq::User const> users;           //!< Sorted list of users being affected (empty list means: all)\n  std::span<roq::Account const> accounts;     //!< Sorted list of accounts being affected (empty list means: all)\n  std::chrono::nanoseconds ban_expires = {};  //!< System time when ban expires (zero means: ban is no longer effective)\n  std::string_view triggered_by;              //!< Trigger activated by this user\n  roq::BufferCapacity buffer_capacity = {};   //!< Buffer capacity (indicator for how full or empty the buffer is)\n  uint32_t remaining_requests = {};           //!< The buffer becomes full if this many requests are sent instantly\n};\n\ntemplate <>\nconstexpr std::string_view get_name<RateLimitTrigger>() {\n  using namespace std::literals;\n  return \"rate_limit_trigger\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RateLimitTrigger> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RateLimitTrigger const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(name=\"{}\", )\"\n        R\"(origin={}, )\"\n        R\"(type={}, )\"\n        R\"(users=[{}], )\"\n        R\"(accounts=[{}], )\"\n        R\"(ban_expires={}, )\"\n        R\"(triggered_by=\"{}\", )\"\n        R\"(buffer_capacity={}, )\"\n        R\"(remaining_requests={})\"\n        R\"(}})\"sv,\n        value.name,\n        value.origin,\n        value.type,\n        fmt::join(value.users, \", \"sv),\n        fmt::join(value.accounts, \", \"sv),\n        value.ban_expires,\n        value.triggered_by,\n        value.buffer_capacity,\n        value.remaining_requests);\n  }\n};"
  },
  {
    "path": "include/roq/rate_limit_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Rate limit type\nenum class RateLimitType : uint8_t {\n  UNDEFINED = 0,\n  ORDER_ACTION,    //!< Any order action: create, modify, cancel, etc.\n  CREATE_ORDER,    //!< Only create order\n  REQUEST,         //!< Requests (count)\n  REQUEST_WEIGHT,  //!< Requests (weighted)\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/rate_limits_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/rate_limit.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Rate-limits update\nstruct ROQ_PUBLIC RateLimitsUpdate final {\n  uint16_t stream_id = {};                      //!< Stream identifier\n  std::string_view account;                     //!< Account name\n  roq::Origin origin = {};                      //!< Origin\n  std::span<roq::RateLimit const> rate_limits;  //!< Rate-limits updates\n};\n\ntemplate <>\nconstexpr std::string_view get_name<RateLimitsUpdate>() {\n  using namespace std::literals;\n  return \"rate_limits_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RateLimitsUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RateLimitsUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(origin={}, )\"\n        R\"(rate_limits=[{}])\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.origin,\n        fmt::join(value.rate_limits, \", \"sv));\n  }\n};"
  },
  {
    "path": "include/roq/ready.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Marks the end of the initial download phase\nstruct ROQ_PUBLIC Ready final {};\n\ntemplate <>\nconstexpr std::string_view get_name<Ready>() {\n  using namespace std::literals;\n  return \"ready\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Ready> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Ready const &, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), R\"({{}})\"sv);\n  }\n};"
  },
  {
    "path": "include/roq/reference_data.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/limits.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/option_type.hpp\"\n#include \"roq/security_type.hpp\"\n#include \"roq/tick_size_step.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Update relating to the reference data for a symbol\nstruct ROQ_PUBLIC ReferenceData final {\n  uint16_t stream_id = {};                             //!< Stream identifier\n  std::string_view exchange;                           //!< Exchange\n  std::string_view symbol;                             //!< Symbol\n  std::string_view description;                        //!< Description\n  roq::SecurityType security_type = {};                //!< Security type\n  int32_t external_security_id = {};                   //!< Security ID\n  std::string_view cfi_code;                           //!< CFI code\n  std::string_view base_currency;                      //!< Base currency\n  std::string_view quote_currency;                     //!< Quote currency\n  std::string_view settlement_currency;                //!< Settlement currency\n  std::string_view margin_currency;                    //!< Margin currency\n  std::string_view commission_currency;                //!< Commission currency\n  double tick_size = roq::NaN;                         //!< Minimum price increment\n  std::span<roq::TickSizeStep const> tick_size_steps;  //!< List of tick size steps\n  double multiplier = roq::NaN;                        //!< Multiplier (notional)\n  double min_notional = roq::NaN;                      //!< Minimum notional (price * quantity)\n  double min_trade_vol = roq::NaN;                     //!< Minimum trade volume\n  double max_trade_vol = roq::NaN;                     //!< Maximum trade volume\n  double trade_vol_step_size = roq::NaN;               //!< Trade volume step size\n  roq::OptionType option_type = {};                    //!< Option type\n  std::string_view strike_currency;                    //!< Strike currency\n  double strike_price = roq::NaN;                      //!< Strike price\n  std::string_view underlying;                         //!< Underlying instrument\n  std::string_view time_zone;                          //!< Time-zone\n  std::chrono::days issue_date = {};                   //!< Issue date\n  std::chrono::days settlement_date = {};              //!< Settlement date\n  std::chrono::seconds expiry_datetime = {};           //!< Expiry datetime\n  std::chrono::seconds expiry_datetime_utc = {};       //!< Expiry datetime\n  std::chrono::nanoseconds exchange_time_utc = {};     //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                     //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};      //!< Exchange sending timestamp (UTC)\n  bool discard = false;                                //!< Discard market data updates?\n};\n\ntemplate <>\nconstexpr std::string_view get_name<ReferenceData>() {\n  using namespace std::literals;\n  return \"reference_data\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ReferenceData> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ReferenceData const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(description=\"{}\", )\"\n        R\"(security_type={}, )\"\n        R\"(external_security_id={}, )\"\n        R\"(cfi_code=\"{}\", )\"\n        R\"(base_currency=\"{}\", )\"\n        R\"(quote_currency=\"{}\", )\"\n        R\"(settlement_currency=\"{}\", )\"\n        R\"(margin_currency=\"{}\", )\"\n        R\"(commission_currency=\"{}\", )\"\n        R\"(tick_size={}, )\"\n        R\"(tick_size_steps=[{}], )\"\n        R\"(multiplier={}, )\"\n        R\"(min_notional={}, )\"\n        R\"(min_trade_vol={}, )\"\n        R\"(max_trade_vol={}, )\"\n        R\"(trade_vol_step_size={}, )\"\n        R\"(option_type={}, )\"\n        R\"(strike_currency=\"{}\", )\"\n        R\"(strike_price={}, )\"\n        R\"(underlying=\"{}\", )\"\n        R\"(time_zone=\"{}\", )\"\n        R\"(issue_date={}, )\"\n        R\"(settlement_date={}, )\"\n        R\"(expiry_datetime={}, )\"\n        R\"(expiry_datetime_utc={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(discard={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        value.description,\n        value.security_type,\n        value.external_security_id,\n        value.cfi_code,\n        value.base_currency,\n        value.quote_currency,\n        value.settlement_currency,\n        value.margin_currency,\n        value.commission_currency,\n        value.tick_size,\n        fmt::join(value.tick_size_steps, \", \"sv),\n        value.multiplier,\n        value.min_notional,\n        value.min_trade_vol,\n        value.max_trade_vol,\n        value.trade_vol_step_size,\n        value.option_type,\n        value.strike_currency,\n        value.strike_price,\n        value.underlying,\n        value.time_zone,\n        value.issue_date,\n        value.settlement_date,\n        value.expiry_datetime,\n        value.expiry_datetime_utc,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.discard);\n  }\n};"
  },
  {
    "path": "include/roq/remove_routes.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Remove route(s)\nstruct ROQ_PUBLIC RemoveRoutes final {\n  std::span<uint32_t const> strategy_ids;  //!< List of strategy_id's to remove\n};\n\ntemplate <>\nconstexpr std::string_view get_name<RemoveRoutes>() {\n  using namespace std::literals;\n  return \"remove_routes\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RemoveRoutes> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RemoveRoutes const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(strategy_ids=[{}])\"\n        R\"(}})\"sv,\n        fmt::join(value.strategy_ids, \", \"sv));\n  }\n};"
  },
  {
    "path": "include/roq/request_id_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Request identifier\nenum class RequestIdType : uint8_t {\n  UNDEFINED = 0,\n  BASE64,  //!< Base64 encoded\n  BASE32,  //!< Base32 encoded\n  SIMPLE,  //!< Simple encoded\n  UUID,    //!< UUID encoded\n  HEX16,   //!< Hex encoded (len=16)\n  HEX32,   //!< Hex encoded (len=32)\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/request_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of request status types\nenum class RequestStatus : uint8_t {\n  UNDEFINED = 0,\n  FORWARDED,     //!< Forwarded to broker/exchange\n  ACCEPTED,      //!< Accepted by broker/exchange\n  REJECTED,      //!< Rejected by broker/exchange\n  DISCONNECTED,  //!< Disconnected\n  TIMEOUT,       //!< Timed out\n  FAILED,        //!< Generic failure\n  ERROR,         //!< Generic error, possibly parse error\n  ENQUEUED,      //!< Enqueued for later release time to broker/exchange\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/request_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of request types\nenum class RequestType : uint8_t {\n  UNDEFINED = 0,\n  CREATE_ORDER,  //!< Create order\n  MODIFY_ORDER,  //!< Modify order\n  CANCEL_ORDER,  //!< Cancel order\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/risk_limit.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Risk limit for {exchange, symbol}\nstruct ROQ_PUBLIC RiskLimit final {\n  roq::Exchange exchange;                       //!< Exchange\n  roq::Symbol symbol;                           //!< Symbol\n  double long_position = 0.0;                   //!< Position (long)\n  double short_position = 0.0;                  //!< Position (short)\n  double long_position_limit = roq::NaN;        //!< Position limit (long)\n  double short_position_limit = roq::NaN;       //!< Position limit (short)\n  double long_risk_exposure_limit = roq::NaN;   //!< Risk exposure limit (long)\n  double short_risk_exposure_limit = roq::NaN;  //!< Risk exposure limit (short)\n  bool allow_netting = false;                   //!< Allow netting?\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RiskLimit> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RiskLimit const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(long_position={}, )\"\n        R\"(short_position={}, )\"\n        R\"(long_position_limit={}, )\"\n        R\"(short_position_limit={}, )\"\n        R\"(long_risk_exposure_limit={}, )\"\n        R\"(short_risk_exposure_limit={}, )\"\n        R\"(allow_netting={})\"\n        R\"(}})\"sv,\n        value.exchange,\n        value.symbol,\n        value.long_position,\n        value.short_position,\n        value.long_position_limit,\n        value.short_position_limit,\n        value.long_risk_exposure_limit,\n        value.short_risk_exposure_limit,\n        value.allow_netting);\n  }\n};"
  },
  {
    "path": "include/roq/risk_limits.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/risk_limit.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/uuid.hpp\"\n\nnamespace roq {\n\n//! Risk limits (receive) !!! EXPERIMENTAL !!!\nstruct ROQ_PUBLIC RiskLimits final {\n  std::string_view user;                   //!< User name (optional)\n  uint32_t strategy_id = {};               //!< Strategy identifier (optional)\n  std::string_view account;                //!< Account name (optional)\n  std::span<roq::RiskLimit const> limits;  //!< Risk limits per {exchange, symbol}\n  roq::UUID session_id = {};               //!< Reference (UUID)\n  uint64_t seqno = {};                     //!< Reference (sequencing)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<RiskLimits>() {\n  using namespace std::literals;\n  return \"risk_limits\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RiskLimits> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RiskLimits const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(limits=[{}], )\"\n        R\"(session_id={}, )\"\n        R\"(seqno={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.strategy_id,\n        value.account,\n        fmt::join(value.limits, \", \"sv),\n        value.session_id,\n        value.seqno);\n  }\n};"
  },
  {
    "path": "include/roq/risk_limits_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/risk_limit.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Risk limits (publish) !!! EXPERIMENTAL !!!\nstruct ROQ_PUBLIC RiskLimitsUpdate final {\n  std::string_view user;                   //!< User name (optional)\n  uint32_t strategy_id = {};               //!< Strategy identifier (optional)\n  std::string_view account;                //!< Account name (optional)\n  std::span<roq::RiskLimit const> limits;  //!< Risk limits per {exchange, symbol}\n  roq::UpdateType update_type = {};        //!< Update type\n};\n\ntemplate <>\nconstexpr std::string_view get_name<RiskLimitsUpdate>() {\n  using namespace std::literals;\n  return \"risk_limits_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RiskLimitsUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RiskLimitsUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(limits=[{}], )\"\n        R\"(update_type={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.strategy_id,\n        value.account,\n        fmt::join(value.limits, \", \"sv),\n        value.update_type);\n  }\n};"
  },
  {
    "path": "include/roq/route.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/route_request_status.hpp\"\n\nnamespace roq {\n\n//! Route\nstruct ROQ_PUBLIC Route final {\n  uint32_t strategy_id = {};            //!< Strategy identifier (optional)\n  roq::RouteRequestStatus status = {};  //!< Response to the request\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Route> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Route const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(strategy_id={}, )\"\n        R\"(status={})\"\n        R\"(}})\"sv,\n        value.strategy_id,\n        value.status);\n  }\n};"
  },
  {
    "path": "include/roq/route_ack.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/route.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Response to route request\nstruct ROQ_PUBLIC RouteAck final {\n  std::span<roq::Route const> routes;  //!< Response per strategy_id\n  std::string_view user;               //!< User name (optional, only relevant for drop-copy)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<RouteAck>() {\n  using namespace std::literals;\n  return \"route_ack\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::RouteAck> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RouteAck const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(routes=[{}], )\"\n        R\"(user=\"{}\")\"\n        R\"(}})\"sv,\n        fmt::join(value.routes, \", \"sv),\n        value.user);\n  }\n};"
  },
  {
    "path": "include/roq/route_request_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Route request status\nenum class RouteRequestStatus : uint8_t {\n  UNDEFINED = 0,\n  CREATED,   //!< Created\n  REMOVED,   //!< Removed\n  REJECTED,  //!< Rejected\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/routing.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/quality_of_service.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Routing\nstruct ROQ_PUBLIC Routing final {\n  uint8_t source = {};                            //!< source\n  bool is_last = false;                           //!< is last?\n  roq::QualityOfService quality_of_service = {};  //!< quality of service\n};\n\ntemplate <>\nconstexpr std::string_view get_name<Routing>() {\n  using namespace std::literals;\n  return \"routing\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Routing> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Routing const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(source={}, )\"\n        R\"(is_last={}, )\"\n        R\"(quality_of_service={})\"\n        R\"(}})\"sv,\n        value.source,\n        value.is_last,\n        value.quality_of_service);\n  }\n};"
  },
  {
    "path": "include/roq/security_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of security/instrument types\nenum class SecurityType : uint8_t {\n  UNDEFINED = 0,\n  SPOT,     //!< Spot\n  FUTURES,  //!< Futures\n  OPTION,   //!< Option\n  SWAP,     //!< Perpetuals (like a futures contract but without an expiration date)\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/service_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/connection_status.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/state.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Service update\nstruct ROQ_PUBLIC ServiceUpdate final {\n  std::string_view user;                         //!< Service name (optional)\n  std::string_view description;                  //!< Service description\n  roq::ConnectionStatus connection_status = {};  //!< Service connection status\n  roq::State state = {};                         //!< Service state\n  roq::UpdateType update_type = {};              //!< Update type\n};\n\ntemplate <>\nconstexpr std::string_view get_name<ServiceUpdate>() {\n  using namespace std::literals;\n  return \"service_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::ServiceUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ServiceUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(description=\"{}\", )\"\n        R\"(connection_status={}, )\"\n        R\"(state={}, )\"\n        R\"(update_type={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.description,\n        value.connection_status,\n        value.state,\n        value.update_type);\n  }\n};"
  },
  {
    "path": "include/roq/side.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of the side of a trade\nenum class Side : uint8_t {\n  UNDEFINED = 0,\n  BUY,   //!< Buy\n  SELL,  //!< Sell\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/start.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Signals a start event\nstruct ROQ_PUBLIC Start final {};\n\ntemplate <>\nconstexpr std::string_view get_name<Start>() {\n  using namespace std::literals;\n  return \"start\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Start> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Start const &, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), R\"({{}})\"sv);\n  }\n};"
  },
  {
    "path": "include/roq/state.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of target state\nenum class State : uint8_t {\n  UNDEFINED = 0,\n  ENABLED,   //!< Enabled\n  DISABLED,  //!< Disabled\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/statistics.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n\n#include \"roq/limits.hpp\"\n#include \"roq/statistics_type.hpp\"\n\nnamespace roq {\n\n//! Represents a single statistic\nstruct ROQ_PUBLIC Statistics final {\n  roq::StatisticsType type = {};             //!< Statistics type\n  double value = roq::NaN;                   //!< Value\n  std::chrono::seconds begin_time_utc = {};  //!< Sample period begin time\n  std::chrono::seconds end_time_utc = {};    //!< Sample period end time\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Statistics> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Statistics const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(type={}, )\"\n        R\"(value={}, )\"\n        R\"(begin_time_utc={}, )\"\n        R\"(end_time_utc={})\"\n        R\"(}})\"sv,\n        value.type,\n        value.value,\n        value.begin_time_utc,\n        value.end_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/statistics_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of a statistics type\nenum class StatisticsType : uint8_t {\n  UNDEFINED = 0,\n  OPEN_PRICE,               //!< Open price\n  SETTLEMENT_PRICE,         //!< Settlement price\n  CLOSE_PRICE,              //!< Close price\n  OPEN_INTEREST,            //!< Open interest\n  PRE_OPEN_INTEREST,        //!< Pre-open interest\n  PRE_SETTLEMENT_PRICE,     //!< Pre-settlement price\n  PRE_CLOSE_PRICE,          //!< Pre-close price\n  HIGHEST_TRADED_PRICE,     //!< Highest traded price\n  LOWEST_TRADED_PRICE,      //!< Lowest traded price\n  UPPER_LIMIT_PRICE,        //!< Upper limit price\n  LOWER_LIMIT_PRICE,        //!< Lower limit price\n  INDEX_VALUE,              //!< Index value\n  MARGIN_RATE,              //!< Margin rate\n  FUNDING_RATE,             //!< Funding rate\n  FUNDING_RATE_PREDICTION,  //!< Funding rate prediction\n  TRADE_VOLUME,             //!< Trade volume\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/statistics_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/statistics.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to statistics published by the exchange\nstruct ROQ_PUBLIC StatisticsUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  std::span<roq::Statistics const> statistics;      //!< List of statistics\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<StatisticsUpdate>() {\n  using namespace std::literals;\n  return \"statistics_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::StatisticsUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::StatisticsUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(statistics=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.statistics, \", \"sv),\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/stop.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Signals a stop event\nstruct ROQ_PUBLIC Stop final {};\n\ntemplate <>\nconstexpr std::string_view get_name<Stop>() {\n  using namespace std::literals;\n  return \"stop\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Stop> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Stop const &, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), R\"({{}})\"sv);\n  }\n};"
  },
  {
    "path": "include/roq/strategy_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/state.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Strategy update\nstruct ROQ_PUBLIC StrategyUpdate final {\n  std::string_view user;             //!< Service name\n  uint32_t strategy_id = {};         //!< Strategy ID\n  std::string_view description;      //!< Strategy description\n  roq::State state = {};             //!< Strategy state\n  roq::UpdateType update_type = {};  //!< Update type\n};\n\ntemplate <>\nconstexpr std::string_view get_name<StrategyUpdate>() {\n  using namespace std::literals;\n  return \"strategy_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::StrategyUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::StrategyUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={}, )\"\n        R\"(description=\"{}\", )\"\n        R\"(state={}, )\"\n        R\"(update_type={})\"\n        R\"(}})\"sv,\n        value.user,\n        value.strategy_id,\n        value.description,\n        value.state,\n        value.update_type);\n  }\n};"
  },
  {
    "path": "include/roq/stream_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <string_view>\n\n#include \"roq/connection_status.hpp\"\n#include \"roq/encoding.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/mask.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/priority.hpp\"\n#include \"roq/protocol.hpp\"\n#include \"roq/support_type.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/transport.hpp\"\n\nnamespace roq {\n\n//! Update relating to current stream status\nstruct ROQ_PUBLIC StreamStatus final {\n  uint16_t stream_id = {};                       //!< Stream identifier\n  std::string_view account;                      //!< Account name\n  roq::Mask<roq::SupportType> supports;          //!< Supported update types\n  roq::Transport transport = {};                 //!< Transport type (layer 4)\n  roq::Protocol protocol = {};                   //!< Communication protocol (layer 7)\n  roq::Mask<roq::Encoding> encoding;             //!< Message encoding\n  roq::Priority priority = {};                   //!< Priority\n  roq::ConnectionStatus connection_status = {};  //!< Connection status (when applicable)\n  std::string_view reason;                       //!< Reason (last change)\n  std::string_view interface;                    //!< Local network interface\n  std::string_view authority;                    //!< URL authority (network end-point)\n  std::string_view path;                         //!< URL path\n  std::string_view proxy;                        //!< Network proxy\n};\n\ntemplate <>\nconstexpr std::string_view get_name<StreamStatus>() {\n  using namespace std::literals;\n  return \"stream_status\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::StreamStatus> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::StreamStatus const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(supports={}, )\"\n        R\"(transport={}, )\"\n        R\"(protocol={}, )\"\n        R\"(encoding={}, )\"\n        R\"(priority={}, )\"\n        R\"(connection_status={}, )\"\n        R\"(reason=\"{}\", )\"\n        R\"(interface=\"{}\", )\"\n        R\"(authority=\"{}\", )\"\n        R\"(path=\"{}\", )\"\n        R\"(proxy=\"{}\")\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.supports,\n        value.transport,\n        value.protocol,\n        value.encoding,\n        value.priority,\n        value.connection_status,\n        value.reason,\n        value.interface,\n        value.authority,\n        value.path,\n        value.proxy);\n  }\n};"
  },
  {
    "path": "include/roq/string.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <algorithm>\n#include <array>\n#include <compare>\n#include <string>\n#include <string_view>\n#include <utility>\n\n#include \"roq/exceptions.hpp\"\n\nnamespace roq {\n\n// fixed length string buffer\n//! A fixed-length string buffer with automatic conversion to/from\n//! \\ref std::string_view.\n/*!\n * This is useful for managing fixed length arrays as if they were string-like.\n * Typically used to avoid heap allocations, e.g. stack allocated structs used\n * for messaging.\n\n * This is a higher level abstraction than \\ref std::array to provide\n * more * string-specific features.\n * The interface is a subset of \\ref std::string and \\ref std::string_view.\n */\ntemplate <std::size_t N>\nstruct ROQ_PACKED String {\n  using value_type = char;\n\n  constexpr String() = default;\n\n  constexpr String(String &&) noexcept = default;\n  constexpr String(String const &) = default;\n\n  constexpr String &operator=(String &&) noexcept = default;\n  constexpr String &operator=(String const &) = default;\n\n  constexpr String(std::string_view const &text) { copy(text); }\n\n  constexpr String(std::string const &text) { copy(text); }\n\n  constexpr String(value_type const *text) : String{std::string_view{text}} {}\n\n  constexpr String &operator=(std::string_view const &text) {\n    copy(text);\n    return *this;\n  }\n\n  constexpr String &operator=(std::string const &text) {\n    copy(text);\n    return *this;\n  }\n\n  template <std::size_t M>\n  constexpr auto operator<=>(String<M> const &rhs) const {\n    return static_cast<std::string_view>(*this) <=> static_cast<std::string_view>(rhs);\n  }\n\n  template <std::size_t M>\n  constexpr bool operator==(String<M> const &rhs) const {\n    return (*this) == static_cast<std::string_view>(rhs);\n  }\n\n  constexpr auto operator<=>(std::string_view const &rhs) const { return static_cast<std::string_view>(*this) <=> rhs; }\n\n  constexpr bool operator==(std::string_view const &rhs) const { return static_cast<std::string_view>(*this) == rhs; }\n\n  constexpr value_type &operator[](size_t index) { return buffer_[index]; }\n\n  constexpr value_type operator[](size_t index) const { return buffer_[index]; }\n\n  constexpr std::size_t size() const { return N; }\n\n  constexpr std::size_t length() const {\n    auto tmp = static_cast<size_t>(static_cast<unsigned char>(buffer_[N - 1]));\n    if (buffer_[N - 2]) {\n      return N - (tmp != 0 ? 0 : 1);\n    }\n    return tmp;\n  }\n\n  constexpr bool empty() const { return length() == 0; }\n\n  constexpr value_type const *data() const { return std::data(buffer_); }\n\n  constexpr operator std::string_view() const { return {data(), length()}; }\n\n  constexpr void clear() {\n    // note!\n    // we prefer to clear the entire buffer (for security reasons)\n    // even though it would be enough to only set the first element\n    std::fill(std::begin(buffer_), std::end(buffer_), '\\0');\n  }\n\n  constexpr void push_back(value_type value) {\n    using namespace std::literals;\n    auto len = length();\n    if (N <= len) [[unlikely]] {\n      throw LengthError{\"String buffer is full\"sv};\n    }\n    buffer_[len] = value;\n    set_length(++len);\n  }\n\n protected:\n  constexpr value_type *data() { return std::data(buffer_); }\n\n  constexpr void copy(std::string_view const &text) {\n    using namespace std::literals;\n    auto len = std::size(text);\n    if (N < len) [[unlikely]] {\n      throw LengthError{R\"(can't copy: len(text=\"{}\")={} exceeds size={})\"sv, text, len, N};\n    }\n    std::copy(std::begin(text), std::end(text), std::begin(buffer_));\n    set_length(len);\n  }\n\n  constexpr void set_length(size_t len) {\n    if (len < N) {\n      size_t last;\n      if (len < (N - 1)) {\n        buffer_[N - 2] = {};\n        last = len;\n      } else {\n        last = {};\n      }\n      buffer_[N - 1] = static_cast<value_type>(last);\n    }\n  }\n\n private:\n  std::array<value_type, N> buffer_ = {};\n};\n}  // namespace roq\n\ntemplate <size_t N>\nstruct fmt::formatter<roq::String<N>> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::String<N> const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n"
  },
  {
    "path": "include/roq/string_types.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include \"roq/string.hpp\"\n\nnamespace roq {\n\nnamespace detail {\nstatic constexpr size_t const MAX_LENGTH_SOURCE = 16;\nstatic constexpr size_t const MAX_LENGTH_USER = 16;\n\nstatic constexpr size_t const MAX_LENGTH_ACCOUNT = 32;\nstatic constexpr size_t const MAX_LENGTH_EXCHANGE = 32;\nstatic constexpr size_t const MAX_LENGTH_SYMBOL = 64;\nstatic constexpr size_t const MAX_LENGTH_CURRENCY = 32;\n\nstatic constexpr size_t const MAX_LENGTH_CFI_CODE = 6;\n\nstatic constexpr size_t const MAX_LENGTH_MBO_ORDER_ID = 36;  // note! UUID\n\nstatic constexpr size_t const MAX_LENGTH_REQUEST_TEMPLATE = 16;\nstatic constexpr size_t const MAX_LENGTH_EXTERNAL_ACCOUNT = 64;\nstatic constexpr size_t const MAX_LENGTH_EXTERNAL_ORDER_ID = 64;\nstatic constexpr size_t const MAX_LENGTH_EXTERNAL_TRADE_ID = 40;\nstatic constexpr size_t const MAX_LENGTH_ROUTING_ID = 64;\n\nstatic constexpr size_t const MAX_LENGTH_CL_ORD_ID = 36;\nstatic constexpr size_t const MAX_LENGTH_REQUEST_ID = 36;\n\nstatic constexpr size_t const MAX_LENGTH_LABEL = 32;\nstatic constexpr size_t const MAX_LENGTH_MEASUREMENT_KEY = 8;\n\nstatic constexpr size_t const MAX_LENGTH_MATRIX_KEY = 8;\n\nstatic constexpr size_t const MAX_LENGTH_DESCRIPTION = 128;\nstatic constexpr size_t const MAX_LENGTH_TIME_ZONE = 32;\n\nstatic constexpr size_t const MAX_LENGTH_PARAMETER_KEY = 32;\nstatic constexpr size_t const MAX_LENGTH_PARAMETER_VALUE = 32;\n}  // namespace detail\n\nstruct ROQ_PUBLIC Source final : public String<detail::MAX_LENGTH_USER> {\n  using String<detail::MAX_LENGTH_USER>::String;\n};\n\nstruct ROQ_PUBLIC User final : public String<detail::MAX_LENGTH_USER> {\n  using String<detail::MAX_LENGTH_USER>::String;\n};\n\nstruct ROQ_PUBLIC Account final : public String<detail::MAX_LENGTH_ACCOUNT> {\n  using String<detail::MAX_LENGTH_ACCOUNT>::String;\n};\n\nstruct ROQ_PUBLIC Exchange final : public String<detail::MAX_LENGTH_EXCHANGE> {\n  using String<detail::MAX_LENGTH_EXCHANGE>::String;\n};\n\nstruct ROQ_PUBLIC Symbol final : public String<detail::MAX_LENGTH_SYMBOL> {\n  using String<detail::MAX_LENGTH_SYMBOL>::String;\n};\n\nstruct ROQ_PUBLIC Currency final : public String<detail::MAX_LENGTH_CURRENCY> {\n  using String<detail::MAX_LENGTH_CURRENCY>::String;\n};\n\nstruct ROQ_PUBLIC CFICode final : public String<detail::MAX_LENGTH_CFI_CODE> {\n  using String<detail::MAX_LENGTH_CFI_CODE>::String;\n};\n\nstruct ROQ_PUBLIC MBOOrderId final : public String<detail::MAX_LENGTH_MBO_ORDER_ID> {\n  using String<detail::MAX_LENGTH_MBO_ORDER_ID>::String;\n};\n\nstruct ROQ_PUBLIC RequestTemplate final : public String<detail::MAX_LENGTH_REQUEST_TEMPLATE> {\n  using String<detail::MAX_LENGTH_REQUEST_TEMPLATE>::String;\n};\n\nstruct ROQ_PUBLIC ExternalAccount final : public String<detail::MAX_LENGTH_EXTERNAL_ACCOUNT> {\n  using String<detail::MAX_LENGTH_EXTERNAL_ACCOUNT>::String;\n};\n\nstruct ROQ_PUBLIC ExternalOrderId final : public String<detail::MAX_LENGTH_EXTERNAL_ORDER_ID> {\n  using String<detail::MAX_LENGTH_EXTERNAL_ORDER_ID>::String;\n};\n\nstruct ROQ_PUBLIC ExternalTradeId final : public String<detail::MAX_LENGTH_EXTERNAL_TRADE_ID> {\n  using String<detail::MAX_LENGTH_EXTERNAL_TRADE_ID>::String;\n};\n\nstruct ROQ_PUBLIC RoutingId final : public String<detail::MAX_LENGTH_ROUTING_ID> {\n  using String<detail::MAX_LENGTH_ROUTING_ID>::String;\n};\n\nstruct ROQ_PUBLIC ClOrdId final : public String<detail::MAX_LENGTH_CL_ORD_ID> {\n  using String<detail::MAX_LENGTH_CL_ORD_ID>::String;\n};\n\nstruct ROQ_PUBLIC RequestId final : public String<detail::MAX_LENGTH_REQUEST_ID> {\n  using String<detail::MAX_LENGTH_REQUEST_ID>::String;\n};\n\nstruct ROQ_PUBLIC Label final : public String<detail::MAX_LENGTH_LABEL> {\n  using String<detail::MAX_LENGTH_LABEL>::String;\n};\n\nstruct ROQ_PUBLIC MeasurementKey final : public String<detail::MAX_LENGTH_MEASUREMENT_KEY> {\n  using String<detail::MAX_LENGTH_MEASUREMENT_KEY>::String;\n};\n\nstruct ROQ_PUBLIC MatrixKey final : public String<detail::MAX_LENGTH_MATRIX_KEY> {\n  using String<detail::MAX_LENGTH_MATRIX_KEY>::String;\n};\n\nstruct ROQ_PUBLIC Description final : public String<detail::MAX_LENGTH_DESCRIPTION> {\n  using String<detail::MAX_LENGTH_DESCRIPTION>::String;\n};\n\nstruct ROQ_PUBLIC TimeZone final : public String<detail::MAX_LENGTH_TIME_ZONE> {\n  using String<detail::MAX_LENGTH_TIME_ZONE>::String;\n};\n\nstruct ROQ_PUBLIC ParameterKey final : public String<detail::MAX_LENGTH_PARAMETER_KEY> {\n  using String<detail::MAX_LENGTH_PARAMETER_KEY>::String;\n};\n\nstruct ROQ_PUBLIC ParameterValue final : public String<detail::MAX_LENGTH_PARAMETER_VALUE> {\n  using String<detail::MAX_LENGTH_PARAMETER_VALUE>::String;\n};\n\n// validate\n\nstatic_assert(sizeof(Source) == detail::MAX_LENGTH_USER);\nstatic_assert(sizeof(User) == detail::MAX_LENGTH_USER);\nstatic_assert(sizeof(Account) == detail::MAX_LENGTH_ACCOUNT);\nstatic_assert(sizeof(Exchange) == detail::MAX_LENGTH_EXCHANGE);\nstatic_assert(sizeof(Symbol) == detail::MAX_LENGTH_SYMBOL);\nstatic_assert(sizeof(Currency) == detail::MAX_LENGTH_CURRENCY);\nstatic_assert(sizeof(CFICode) == detail::MAX_LENGTH_CFI_CODE);\nstatic_assert(sizeof(MBOOrderId) == detail::MAX_LENGTH_MBO_ORDER_ID);\nstatic_assert(sizeof(RequestTemplate) == detail::MAX_LENGTH_REQUEST_TEMPLATE);\nstatic_assert(sizeof(ExternalAccount) == detail::MAX_LENGTH_EXTERNAL_ACCOUNT);\nstatic_assert(sizeof(ExternalOrderId) == detail::MAX_LENGTH_EXTERNAL_ORDER_ID);\nstatic_assert(sizeof(ExternalTradeId) == detail::MAX_LENGTH_EXTERNAL_TRADE_ID);\nstatic_assert(sizeof(RoutingId) == detail::MAX_LENGTH_ROUTING_ID);\nstatic_assert(sizeof(ClOrdId) == detail::MAX_LENGTH_CL_ORD_ID);\nstatic_assert(sizeof(RequestId) == detail::MAX_LENGTH_REQUEST_ID);\nstatic_assert(sizeof(Label) == detail::MAX_LENGTH_LABEL);\nstatic_assert(sizeof(MeasurementKey) == detail::MAX_LENGTH_MEASUREMENT_KEY);\nstatic_assert(sizeof(MatrixKey) == detail::MAX_LENGTH_MATRIX_KEY);\nstatic_assert(sizeof(Description) == detail::MAX_LENGTH_DESCRIPTION);\nstatic_assert(sizeof(TimeZone) == detail::MAX_LENGTH_TIME_ZONE);\nstatic_assert(sizeof(ParameterKey) == detail::MAX_LENGTH_PARAMETER_KEY);\nstatic_assert(sizeof(ParameterValue) == detail::MAX_LENGTH_PARAMETER_VALUE);\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Source> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Source const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::User> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::User const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Account> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Account const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Exchange> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Exchange const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Symbol> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Symbol const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Currency> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Currency const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::CFICode> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::CFICode const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::MBOOrderId> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MBOOrderId const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::RequestTemplate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RequestTemplate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ExternalAccount> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ExternalAccount const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ExternalOrderId> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ExternalOrderId const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ExternalTradeId> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ExternalTradeId const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::RoutingId> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RoutingId const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ClOrdId> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ClOrdId const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::RequestId> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::RequestId const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Label> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Label const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::MeasurementKey> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MeasurementKey const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::MatrixKey> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::MatrixKey const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::Description> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Description const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::TimeZone> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TimeZone const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ParameterKey> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ParameterKey const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n\ntemplate <>\nstruct fmt::formatter<roq::ParameterValue> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::ParameterValue const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}\"sv, static_cast<std::string_view>(value));\n  }\n};\n"
  },
  {
    "path": "include/roq/subscribe.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/string_types.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Dynamic subscription\nstruct ROQ_PUBLIC Subscribe final {\n  std::string_view exchange;             //!< Exchange\n  std::span<roq::Symbol const> symbols;  //!< Symbols\n};\n\ntemplate <>\nconstexpr std::string_view get_name<Subscribe>() {\n  using namespace std::literals;\n  return \"subscribe\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Subscribe> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Subscribe const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbols=[{}])\"\n        R\"(}})\"sv,\n        value.exchange,\n        fmt::join(value.symbols, \", \"sv));\n  }\n};"
  },
  {
    "path": "include/roq/support_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <cstdlib>\n\nnamespace roq {\n\n//! Enumeration of support types\nenum class SupportType : uint64_t {  // NOLINT(performance-enum-size)\n  UNDEFINED = 0,\n  REFERENCE_DATA = 0x1,    //!< Reference data\n  MARKET_STATUS = 0x2,     //!< Market status\n  TOP_OF_BOOK = 0x4,       //!< Top of book\n  MARKET_BY_PRICE = 0x8,   //!< Market by price\n  MARKET_BY_ORDER = 0x10,  //!< Market by order\n  TRADE_SUMMARY = 0x20,    //!< Trade summary\n  STATISTICS = 0x40,       //!< Statistics\n  TIME_SERIES = 0x80,      //!< Time-series\n  CREATE_ORDER = 0x10000,  //!< Create order\n  MODIFY_ORDER = 0x20000,  //!< Modify order\n  CANCEL_ORDER = 0x40000,  //!< Cancel order\n  ORDER_ACK = 0x80000,     //!< Order ack\n  ORDER = 0x100000,        //!< Order\n  ORDER_STATE = 0x800000,  //!< Order\n  TRADE = 0x200000,        //!< Trade\n  POSITION = 0x400000,     //!< Position\n  FUNDS = 0x10000000,      //!< Funds\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::SupportType> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::SupportType const &value, format_context &context) const {\n    using namespace std::literals;\n    auto name = [&]() -> std::string_view {\n      switch (value) {\n        using enum roq::SupportType;\n        case UNDEFINED:\n          return \"UNDEFINED\"sv;\n        case REFERENCE_DATA:\n          return \"REFERENCE_DATA\"sv;\n        case MARKET_STATUS:\n          return \"MARKET_STATUS\"sv;\n        case TOP_OF_BOOK:\n          return \"TOP_OF_BOOK\"sv;\n        case MARKET_BY_PRICE:\n          return \"MARKET_BY_PRICE\"sv;\n        case MARKET_BY_ORDER:\n          return \"MARKET_BY_ORDER\"sv;\n        case TRADE_SUMMARY:\n          return \"TRADE_SUMMARY\"sv;\n        case STATISTICS:\n          return \"STATISTICS\"sv;\n        case TIME_SERIES:\n          return \"TIME_SERIES\"sv;\n        case CREATE_ORDER:\n          return \"CREATE_ORDER\"sv;\n        case MODIFY_ORDER:\n          return \"MODIFY_ORDER\"sv;\n        case CANCEL_ORDER:\n          return \"CANCEL_ORDER\"sv;\n        case ORDER_ACK:\n          return \"ORDER_ACK\"sv;\n        case ORDER:\n          return \"ORDER\"sv;\n        case ORDER_STATE:\n          return \"ORDER_STATE\"sv;\n        case TRADE:\n          return \"TRADE\"sv;\n        case POSITION:\n          return \"POSITION\"sv;\n        case FUNDS:\n          return \"FUNDS\"sv;\n      }\n      std::abort();\n    }();\n    return fmt::format_to(context.out(), \"{}\"sv, name);\n  }\n};"
  },
  {
    "path": "include/roq/tick_size_step.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n\nnamespace roq {\n\n//! Represents tick size for a range starting from a minimum price\nstruct ROQ_PUBLIC TickSizeStep final {\n  double min_price = roq::NaN;  //!< Minimum price (of range)\n  double tick_size = roq::NaN;  //!< Tick size\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::TickSizeStep> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TickSizeStep const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(min_price={}, )\"\n        R\"(tick_size={})\"\n        R\"(}})\"sv,\n        value.min_price,\n        value.tick_size);\n  }\n};"
  },
  {
    "path": "include/roq/time_in_force.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Order life-time, aka time in force\nenum class TimeInForce : uint8_t {\n  UNDEFINED = 0,\n  GFD,                    //!< Good for day, aka DAY\n  GTC,                    //!< Good till canceled\n  OPG,                    //!< At the open\n  IOC,                    //!< Immediate or cancel\n  FOK,                    //!< Fill or kill\n  GTX,                    //!< Good till crossing\n  GTD,                    //!< Good till date\n  AT_THE_CLOSE,           //!< At the close\n  GOOD_THROUGH_CROSSING,  //!< Good through crossing\n  AT_CROSSING,            //!< At crossing\n  GOOD_FOR_TIME,          //!< Good for time\n  GFA,                    //!< Good for auction\n  GFM,                    //!< Good for this month\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/time_series_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/bar.hpp\"\n#include \"roq/data_source.hpp\"\n#include \"roq/event.hpp\"\n#include \"roq/interval.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/origin.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to time-series\nstruct ROQ_PUBLIC TimeSeriesUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  roq::DataSource data_source = {};                 //!< Data source\n  roq::Interval interval = {};                      //!< Update frequency\n  roq::Origin origin = {};                          //!< Origin of time-series\n  std::span<roq::Bar const> bars;                   //!< List of updated bars\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<TimeSeriesUpdate>() {\n  using namespace std::literals;\n  return \"time_series_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::TimeSeriesUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TimeSeriesUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(data_source={}, )\"\n        R\"(interval={}, )\"\n        R\"(origin={}, )\"\n        R\"(bars=[{}], )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        value.data_source,\n        value.interval,\n        value.origin,\n        fmt::join(value.bars, \", \"sv),\n        value.update_type,\n        value.exchange_time_utc);\n  }\n};"
  },
  {
    "path": "include/roq/timer.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/trace.hpp\"\n\nnamespace roq {\n\n//! Represents a timer update\nstruct ROQ_PUBLIC Timer final {\n  std::chrono::nanoseconds now = {};  //!< Current time (monotonic clock)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<Timer>() {\n  using namespace std::literals;\n  return \"timer\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Timer> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Timer const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(now={})\"\n        R\"(}})\"sv,\n        value.now);\n  }\n};"
  },
  {
    "path": "include/roq/top_of_book.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/layer.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/precision.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to top of book (aggregate price)\nstruct ROQ_PUBLIC TopOfBook final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  roq::Layer layer = {};                            //!< Top of book\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n  roq::Precision price_precision = {};              //!< Precision (decimal digits) required to represent prices (dynamic)\n  roq::Precision quantity_precision = {};           //!< Precision (decimal digits) required to represent quantities (dynamic)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<TopOfBook>() {\n  using namespace std::literals;\n  return \"top_of_book\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::TopOfBook> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TopOfBook const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(layer={}, )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(price_precision={}, )\"\n        R\"(quantity_precision={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        value.layer,\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.price_precision,\n        value.quantity_precision);\n  }\n};"
  },
  {
    "path": "include/roq/trace.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <type_traits>\n#include <utility>\n\n#include \"roq/name.hpp\"\n#include \"roq/trace_info.hpp\"\n\nnamespace roq {\n\ntemplate <typename T>\nstruct Trace final {\n  using value_type = std::remove_cvref_t<T>;\n\n  Trace(TraceInfo const &trace_info, T const &value) : trace_info{trace_info}, value{value} {}\n\n  Trace(Trace &&) = delete;\n  Trace(Trace const &) = delete;\n\n  void operator=(Trace &&) = delete;\n  void operator=(Trace const &) = delete;\n\n  operator TraceInfo const &() const { return trace_info; }\n  operator value_type const &() const { return value; }\n\n  operator std::pair<TraceInfo const &, T const &>() const { return {trace_info, value}; }\n\n  TraceInfo const &trace_info;\n  value_type const &value;\n\n  template <typename... Args>\n  static void create_and_dispatch(auto &handler, TraceInfo const &trace_info, T const &value, Args &&...args) {\n    Trace const event{trace_info, value};\n    handler(event, std::forward<Args>(args)...);\n  }\n};\n\ntemplate <typename T, typename... Args>\ninline void create_trace_and_dispatch(auto &handler, TraceInfo const &trace_info, T const &value, Args &&...args) {\n  Trace<T>::create_and_dispatch(handler, trace_info, value, std::forward<Args>(args)...);\n}\n\n}  // namespace roq\n\ntemplate <typename T>\nstruct fmt::formatter<roq::Trace<T>> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Trace<T> const &event, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"({}={}, )\"\n        R\"(trace_info={})\"\n        R\"(}})\"sv,\n        roq::get_name<T>(),\n        event.value,\n        event.trace_info);\n  }\n};\n"
  },
  {
    "path": "include/roq/trace_info.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n\n#include <chrono>\n#include <string_view>\n\n#include \"roq/clock.hpp\"\n#include \"roq/message_info.hpp\"\n\nnamespace roq {\n\n// note!\n// certain use-cases are not allowed, e.g. zero initialization, copy construction and assignment\n// this is done to prevent specific mistakes from happening\n\nstruct ROQ_PUBLIC TraceInfo final {\n  // note! default initialization is using *current* time\n  TraceInfo() : source_receive_time{clock::get_system()}, origin_create_time{source_receive_time}, origin_create_time_utc{clock::get_realtime()} {}\n\n  // note! meant for internal use, only\n  TraceInfo(auto source_receive_time, auto origin_create_time, auto origin_create_time_utc)\n      : source_receive_time{source_receive_time}, origin_create_time{origin_create_time}, origin_create_time_utc{origin_create_time_utc} {}\n\n  // note! meant for internal use, only\n  TraceInfo(MessageInfo const &message_info)\n      : TraceInfo{\n            message_info.source_receive_time,\n            message_info.origin_create_time,\n            message_info.origin_create_time_utc,\n        } {}\n\n  TraceInfo(TraceInfo const &) = delete;\n  void operator=(TraceInfo const &) = delete;\n\n  std::chrono::nanoseconds const source_receive_time;\n  std::chrono::nanoseconds const origin_create_time;\n  std::chrono::nanoseconds const origin_create_time_utc;\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::TraceInfo> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TraceInfo const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        \"{{\"\n        \"source_receive_time={}, \"\n        \"origin_create_time={}, \"\n        \"origin_create_time_utc={}\"\n        \"}}\"sv,\n        value.source_receive_time,\n        value.origin_create_time,\n        value.origin_create_time_utc);\n  }\n};\n"
  },
  {
    "path": "include/roq/trade.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/limits.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/string_types.hpp\"\n\nnamespace roq {\n\n//! Represents a single trade (a match) as part of trade reporting by the exchange\nstruct ROQ_PUBLIC Trade final {\n  roq::Side side = {};                  //!< Side (by convention: side of the taker)\n  double price = roq::NaN;              //!< Price\n  double quantity = roq::NaN;           //!< Quantity\n  roq::ExternalTradeId trade_id;        //!< Trade identifier\n  roq::ExternalOrderId taker_order_id;  //!< External order identifier (taker)\n  roq::ExternalOrderId maker_order_id;  //!< External order identifier (maker)\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Trade> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Trade const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(side={}, )\"\n        R\"(price={}, )\"\n        R\"(quantity={}, )\"\n        R\"(trade_id=\"{}\", )\"\n        R\"(taker_order_id=\"{}\", )\"\n        R\"(maker_order_id=\"{}\")\"\n        R\"(}})\"sv,\n        value.side,\n        value.price,\n        value.quantity,\n        value.trade_id,\n        value.taker_order_id,\n        value.maker_order_id);\n  }\n};"
  },
  {
    "path": "include/roq/trade_summary.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/precision.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/trade.hpp\"\n\nnamespace roq {\n\n//! Update relating to trade reporting by the exchange\nstruct ROQ_PUBLIC TradeSummary final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  std::span<roq::Trade const> trades;               //!< List of trades\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n  roq::Precision price_precision = {};              //!< Precision (decimal digits) required to represent prices (dynamic)\n  roq::Precision quantity_precision = {};           //!< Precision (decimal digits) required to represent quantities (dynamic)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<TradeSummary>() {\n  using namespace std::literals;\n  return \"trade_summary\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::TradeSummary> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TradeSummary const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(trades=[{}], )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(price_precision={}, )\"\n        R\"(quantity_precision={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.exchange,\n        value.symbol,\n        fmt::join(value.trades, \", \"sv),\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.price_precision,\n        value.quantity_precision);\n  }\n};"
  },
  {
    "path": "include/roq/trade_update.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include \"roq/compat.hpp\"\n\n#include <fmt/chrono.h>\n#include <fmt/format.h>\n#include <fmt/ranges.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include <chrono>\n#include <span>\n#include <string_view>\n\n#include \"roq/event.hpp\"\n#include \"roq/fill.hpp\"\n#include \"roq/margin_mode.hpp\"\n#include \"roq/name.hpp\"\n#include \"roq/position_effect.hpp\"\n#include \"roq/quantity_type.hpp\"\n#include \"roq/side.hpp\"\n#include \"roq/trace.hpp\"\n#include \"roq/update_type.hpp\"\n\nnamespace roq {\n\n//! Update relating to order being partially or fully filled\nstruct ROQ_PUBLIC TradeUpdate final {\n  uint16_t stream_id = {};                          //!< Stream identifier\n  std::string_view account;                         //!< Account name\n  uint64_t order_id = {};                           //!< Order identifier\n  std::string_view exchange;                        //!< Exchange\n  std::string_view symbol;                          //!< Symbol\n  roq::Side side = {};                              //!< Side\n  roq::PositionEffect position_effect = {};         //!< Position effect\n  roq::MarginMode margin_mode = {};                 //!< Margin mode\n  roq::QuantityType quantity_type = {};             //!< Type of quantity (requires ecxhange support)\n  std::chrono::nanoseconds create_time_utc = {};    //!< Created timestamp (UTC)\n  std::chrono::nanoseconds update_time_utc = {};    //!< Updated timestamp (UTC)\n  std::string_view external_account;                //!< External account name\n  std::string_view external_order_id;               //!< External order identifier\n  std::string_view client_order_id;                 //!< Client order identifier\n  std::span<roq::Fill const> fills;                 //!< List of fills\n  std::string_view routing_id;                      //!< Routing identifier\n  roq::UpdateType update_type = {};                 //!< Update type\n  std::chrono::nanoseconds exchange_time_utc = {};  //!< Exchange timestamp, possibly from matching engine (UTC)\n  uint64_t exchange_sequence = {};                  //!< Exchange message sequence number\n  std::chrono::nanoseconds sending_time_utc = {};   //!< Exchange sending timestamp (UTC)\n  std::string_view user;                            //!< User name (optional, only relevant for drop-copy)\n  uint32_t strategy_id = {};                        //!< Strategy identifier (optional)\n};\n\ntemplate <>\nconstexpr std::string_view get_name<TradeUpdate>() {\n  using namespace std::literals;\n  return \"trade_update\"sv;\n}\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::TradeUpdate> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::TradeUpdate const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(\n        context.out(),\n        R\"({{)\"\n        R\"(stream_id={}, )\"\n        R\"(account=\"{}\", )\"\n        R\"(order_id={}, )\"\n        R\"(exchange=\"{}\", )\"\n        R\"(symbol=\"{}\", )\"\n        R\"(side={}, )\"\n        R\"(position_effect={}, )\"\n        R\"(margin_mode={}, )\"\n        R\"(quantity_type={}, )\"\n        R\"(create_time_utc={}, )\"\n        R\"(update_time_utc={}, )\"\n        R\"(external_account=\"{}\", )\"\n        R\"(external_order_id=\"{}\", )\"\n        R\"(client_order_id=\"{}\", )\"\n        R\"(fills=[{}], )\"\n        R\"(routing_id=\"{}\", )\"\n        R\"(update_type={}, )\"\n        R\"(exchange_time_utc={}, )\"\n        R\"(exchange_sequence={}, )\"\n        R\"(sending_time_utc={}, )\"\n        R\"(user=\"{}\", )\"\n        R\"(strategy_id={})\"\n        R\"(}})\"sv,\n        value.stream_id,\n        value.account,\n        value.order_id,\n        value.exchange,\n        value.symbol,\n        value.side,\n        value.position_effect,\n        value.margin_mode,\n        value.quantity_type,\n        value.create_time_utc,\n        value.update_time_utc,\n        value.external_account,\n        value.external_order_id,\n        value.client_order_id,\n        fmt::join(value.fills, \", \"sv),\n        value.routing_id,\n        value.update_type,\n        value.exchange_time_utc,\n        value.exchange_sequence,\n        value.sending_time_utc,\n        value.user,\n        value.strategy_id);\n  }\n};"
  },
  {
    "path": "include/roq/trading_status.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of the tradig status of a symbol\nenum class TradingStatus : uint8_t {\n  UNDEFINED = 0,\n  START_OF_DAY,         //!< No matching, no order actions\n  PRE_OPEN,             //!< No matching, all order actions\n  PRE_OPEN_NO_CANCEL,   //!< No matching, only new orders\n  PRE_OPEN_FREEZE,      //!< Matching, no order actions\n  OPEN,                 //!< Matching, all order actions\n  FAST_MARKET,          //!< Same as Open, some settings could be relaxed by the exchange\n  HALT,                 //!< No matching, only order cancellation\n  CLOSE_NOT_FINAL,      //!< Same as Close, state required to support mid-session PreOpen\n  PRE_CLOSE,            //!< No matching, all order actions\n  PRE_CLOSE_NO_CANCEL,  //!< No matching, only new orders\n  PRE_CLOSE_FREEZE,     //!< Matching, no order actions\n  CLOSE,                //!< No matching, no order actions, good-for-day orders automatically canceled\n  POST_CLOSE,           //!< No matching, all order actions (only with next-trading-day validity)\n  END_OF_DAY,           //!< No matching, no order actions\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/transport.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of transport types (layer 4)\nenum class Transport : uint8_t {\n  UNDEFINED = 0,\n  TCP,  //!< TCP\n  UDP,  //!< UDP\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/update_action.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of update actions\nenum class UpdateAction : uint8_t {\n  UNDEFINED = 0,\n  NEW,     //!< New\n  CHANGE,  //!< Change\n  DELETE,  //!< Delete\n  TRADE,   //!< Trade  !!! FOR INTERNAL USE !!!\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/update_reason.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of update reasons\nenum class UpdateReason : uint8_t {\n  UNDEFINED = 0,\n  CREATED,   //!< Created\n  MODIFIED,  //!< Modified\n  CANCELED,  //!< Canceled\n  FILLED,    //!< Filled\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/update_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of update types\nenum class UpdateType : uint8_t {\n  UNDEFINED = 0,\n  SNAPSHOT,     //!< Full snapshot\n  INCREMENTAL,  //!< Incremental change\n  STALE,        //!< Stale awaiting full snapshot\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/uuid.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <fmt/format.h>\n\n#include <bit>\n\nnamespace roq {\n\n// NOLINTBEGIN(readability-magic-numbers)\n\n// note!\n//   interface using native byte order\n//   network byte order for internal representation\n\nstruct alignas(16) UUID final {\n  using value_type = __uint128_t;\n\n  UUID() = default;\n\n  UUID(UUID const &) = default;\n\n  UUID &operator=(UUID const &) = default;\n\n  explicit UUID(value_type value) : value_{create(value)} {}\n\n  UUID(uint64_t high, uint64_t low) : value_{create(high, low)} {}\n\n  constexpr auto operator<=>(UUID const &) const = default;\n\n  constexpr operator value_type() const {\n    if constexpr (std::endian::native == std::endian::little) {\n      return std::byteswap(value_);\n    }\n    return value_;\n  }\n\n  constexpr operator std::pair<uint64_t, uint64_t>() const {\n    if constexpr (std::endian::native == std::endian::little) {\n      // note! legacy (testing purposes) -- inconsistent with uint128_t constructor\n      auto high = static_cast<uint64_t>(value_);\n      auto low = static_cast<uint64_t>(value_ >> 64);\n      return {high, low};\n    } else {\n      auto high = static_cast<uint64_t>(value_ >> 64);\n      auto low = static_cast<uint64_t>(value_);\n      return {high, low};\n    }\n  }\n\n  constexpr value_type *data() { return &value_; }\n  constexpr value_type const *data() const { return &value_; }\n\n  constexpr size_t size() const { return sizeof(value_); }\n\n  constexpr bool empty() const { return value_ == value_type{}; }\n\n protected:\n  static value_type create(value_type value) {\n    if constexpr (std::endian::native == std::endian::little) {\n      return std::byteswap(value);\n    }\n    return value;\n  }\n\n  static value_type create(uint64_t high, uint64_t low) {\n    if constexpr (std::endian::native == std::endian::little) {\n      // note! legacy (testing purposes) -- inconsistent with uint128_t constructor\n      return static_cast<value_type>(low) << 64 | static_cast<value_type>(high);\n    }\n    return static_cast<value_type>(high) << 64 | static_cast<value_type>(low);\n  }\n\n private:\n  value_type value_ = {};\n};\n\nstatic_assert(sizeof(UUID) == 16);\n\n// NOLINTEND(readability-magic-numbers)\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::UUID> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::UUID const &value, format_context &context) const {\n    using namespace std::literals;\n    auto data = reinterpret_cast<char const *>(std::data(value));\n    // NOLINTBEGIN(readability-magic-numbers)\n    return fmt::format_to(\n        context.out(),\n        \"{:02x}{:02x}{:02x}{:02x}-\"\n        \"{:02x}{:02x}-\"\n        \"{:02x}{:02x}-\"\n        \"{:02x}{:02x}-\"\n        \"{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}\",\n        data[0],\n        data[1],\n        data[2],\n        data[3],\n        data[4],\n        data[5],\n        data[6],\n        data[7],\n        data[8],\n        data[9],\n        data[10],\n        data[11],\n        data[12],\n        data[13],\n        data[14],\n        data[15]);\n    // NOLINTEND(readability-magic-numbers)\n  }\n};\n"
  },
  {
    "path": "include/roq/variant_type.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n/* !!! THIS FILE HAS BEEN AUTO-GENERATED !!! */\n\n#pragma once\n\n#include <cstdint>\n\nnamespace roq {\n\n//! Enumeration of variant types\nenum class VariantType : uint8_t {\n  UNDEFINED = 0,\n  STRING,    //!< ASCII string\n  BOOL,      //!< Boolean\n  INT8,      //!< Signed 8 bit integer\n  UINT8,     //!< Unsigned 8 bit integer\n  INT16,     //!< Signed 16 bit integer\n  UINT16,    //!< Unsigned 16 bit integer\n  INT32,     //!< Signed 32 bit integer\n  UINT32,    //!< Unsigned 32 bit integer\n  INT64,     //!< Signed 64 bit integer\n  UINT64,    //!< Unsigned 64 bit integer\n  FLOAT,     //!< 32 bit floating point\n  DOUBLE,    //!< 64 bit floating point\n  ENUM,      //!< Enumeration\n  DATETIME,  //!< Nanoseconds relative to Unix epoch\n};\n\n}  // namespace roq\n"
  },
  {
    "path": "include/roq/version.hpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#pragma once\n\n#include <cstdint>\n\n#include <fmt/format.h>\n\nnamespace roq {\n\nstruct Version final {\n  uint8_t major = {};\n  uint8_t minor = {};\n  uint16_t revision = {};\n\n  auto operator<=>(Version const &) const = default;\n};\n\n}  // namespace roq\n\ntemplate <>\nstruct fmt::formatter<roq::Version> {\n  constexpr auto parse(format_parse_context &context) { return std::begin(context); }\n  auto format(roq::Version const &value, format_context &context) const {\n    using namespace std::literals;\n    return fmt::format_to(context.out(), \"{}.{}.{}\"sv, value.major, value.minor, value.revision);\n  }\n};\n"
  },
  {
    "path": "schema/roq/CMakeLists.txt",
    "content": "set(TARGET_NAME ${PROJECT_NAME}-schema-roq)\n\n# XXX FIXME share with other subdirectories\nset(SCHEMA_ROQ\n    action.json\n    add_routes.json\n    batch_begin.json\n    batch_end.json\n    buffer_capacity.json\n    cancel_all_orders_ack.json\n    cancel_all_orders.json\n    cancel_order.json\n    cancel_quotes_ack.json\n    category.json\n    connected.json\n    connection_status.json\n    control.json\n    control_ack.json\n    create_order.json\n    custom_matrix.json\n    custom_matrix_update.json\n    custom_metrics.json\n    custom_metrics_update.json\n    data_source.json\n    disconnected.json\n    download_begin.json\n    download_end.json\n    encoding.json\n    error.json\n    execution_instruction.json\n    external_latency.json\n    fill.json\n    filter.json\n    funds_update.json\n    gateway_settings.json\n    gateway_status.json\n    interval.json\n    layer.json\n    leg.json\n    legs_update.json\n    liquidity.json\n    margin_mode.json\n    market_by_order_update.json\n    market_by_price_update.json\n    market_status.json\n    mass_quote_ack.json\n    mbo_update.json\n    mbp_update.json\n    measurement.json\n    message_info.json\n    modify_order.json\n    option_type.json\n    order_ack.json\n    order_cancel_policy.json\n    order_management.json\n    order_status.json\n    order_type.json\n    order_update.json\n    origin.json\n    parameter.json\n    parameters_update.json\n    portfolio.json\n    portfolio_update.json\n    position_effect.json\n    position.json\n    position_update.json\n    precision.json\n    priority.json\n    protocol.json\n    quality_of_service.json\n    quantity_type.json\n    rate_limit.json\n    rate_limits_update.json\n    rate_limit_trigger.json\n    rate_limit_type.json\n    ready.json\n    reference_data.json\n    remove_routes.json\n    request_id_type.json\n    request_status.json\n    request_type.json\n    risk_limit.json\n    risk_limits.json\n    risk_limits_update.json\n    route_ack.json\n    route.json\n    route_request_status.json\n    routing.json\n    security_type.json\n    service_update.json\n    side.json\n    start.json\n    state.json\n    statistics.json\n    statistics_type.json\n    statistics_update.json\n    stop.json\n    stream_status.json\n    subscribe.json\n    support_type.json\n    tick_size_step.json\n    time_in_force.json\n    timer.json\n    time_series_update.json\n    top_of_book.json\n    trade.json\n    trade_summary.json\n    trade_update.json\n    trading_status.json\n    transport.json\n    update_action.json\n    update_reason.json\n    update_type.json\n    variant_type.json)\n"
  },
  {
    "path": "schema/roq/action.json",
    "content": "{\n  \"link\": \"roq/Action\"\n}\n"
  },
  {
    "path": "schema/roq/add_market.json",
    "content": "{\n  \"link\": \"roq/AddMarket\"\n}\n"
  },
  {
    "path": "schema/roq/add_routes.json",
    "content": "{\n  \"link\": \"roq/AddRoutes\"\n}\n"
  },
  {
    "path": "schema/roq/bar.json",
    "content": "{\n  \"link\": \"roq/Bar\"\n}\n"
  },
  {
    "path": "schema/roq/batch_begin.json",
    "content": "{\n  \"link\": \"roq/BatchBegin\"\n}\n"
  },
  {
    "path": "schema/roq/batch_end.json",
    "content": "{\n  \"link\": \"roq/BatchEnd\"\n}\n"
  },
  {
    "path": "schema/roq/buffer_capacity.json",
    "content": "{\n  \"link\": \"roq/BufferCapacity\"\n}\n"
  },
  {
    "path": "schema/roq/cancel_all_orders.json",
    "content": "{\n  \"link\": \"roq/CancelAllOrders\"\n}\n"
  },
  {
    "path": "schema/roq/cancel_all_orders_ack.json",
    "content": "{\n  \"link\": \"roq/CancelAllOrdersAck\"\n}\n"
  },
  {
    "path": "schema/roq/cancel_order.json",
    "content": "{\n  \"link\": \"roq/CancelOrder\"\n}\n"
  },
  {
    "path": "schema/roq/cancel_quotes.json",
    "content": "{\n  \"link\": \"roq/CancelQuotes\"\n}\n"
  },
  {
    "path": "schema/roq/cancel_quotes_ack.json",
    "content": "{\n  \"link\": \"roq/CancelQuotesAck\"\n}\n"
  },
  {
    "path": "schema/roq/category.json",
    "content": "{\n  \"link\": \"roq/Category\"\n}\n"
  },
  {
    "path": "schema/roq/connected.json",
    "content": "{\n  \"link\": \"roq/Connected\"\n}\n"
  },
  {
    "path": "schema/roq/connection_status.json",
    "content": "{\n  \"link\": \"roq/ConnectionStatus\"\n}\n"
  },
  {
    "path": "schema/roq/control.json",
    "content": "{\n  \"link\": \"roq/Control\"\n}\n"
  },
  {
    "path": "schema/roq/control_ack.json",
    "content": "{\n  \"link\": \"roq/ControlAck\"\n}\n"
  },
  {
    "path": "schema/roq/create_order.json",
    "content": "{\n  \"link\": \"roq/CreateOrder\"\n}\n"
  },
  {
    "path": "schema/roq/custom_matrix.json",
    "content": "{\n  \"link\": \"roq/CustomMatrix\"\n}\n"
  },
  {
    "path": "schema/roq/custom_matrix_update.json",
    "content": "{\n  \"link\": \"roq/CustomMatrixUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/custom_metrics.json",
    "content": "{\n  \"link\": \"roq/CustomMetrics\"\n}\n"
  },
  {
    "path": "schema/roq/custom_metrics_update.json",
    "content": "{\n  \"link\": \"roq/CustomMetricsUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/data_source.json",
    "content": "{\n  \"link\": \"roq/DataSource\"\n}\n"
  },
  {
    "path": "schema/roq/disconnected.json",
    "content": "{\n  \"link\": \"roq/Disconnected\"\n}\n"
  },
  {
    "path": "schema/roq/download_begin.json",
    "content": "{\n  \"link\": \"roq/DownloadBegin\"\n}\n"
  },
  {
    "path": "schema/roq/download_end.json",
    "content": "{\n  \"link\": \"roq/DownloadEnd\"\n}\n"
  },
  {
    "path": "schema/roq/encoding.json",
    "content": "{\n  \"link\": \"roq/Encoding\"\n}\n"
  },
  {
    "path": "schema/roq/error.json",
    "content": "{\n  \"link\": \"roq/Error\"\n}\n"
  },
  {
    "path": "schema/roq/execution_instruction.json",
    "content": "{\n  \"link\": \"roq/ExecutionInstruction\"\n}\n"
  },
  {
    "path": "schema/roq/external_latency.json",
    "content": "{\n  \"link\": \"roq/ExternalLatency\"\n}\n"
  },
  {
    "path": "schema/roq/fill.json",
    "content": "{\n  \"link\": \"roq/Fill\"\n}\n"
  },
  {
    "path": "schema/roq/filter.json",
    "content": "{\n  \"link\": \"roq/Filter\"\n}\n"
  },
  {
    "path": "schema/roq/funds_update.json",
    "content": "{\n  \"link\": \"roq/FundsUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/gateway_settings.json",
    "content": "{\n  \"link\": \"roq/GatewaySettings\"\n}\n"
  },
  {
    "path": "schema/roq/gateway_status.json",
    "content": "{\n  \"link\": \"roq/GatewayStatus\"\n}\n"
  },
  {
    "path": "schema/roq/interval.json",
    "content": "{\n  \"link\": \"roq/Interval\"\n}\n"
  },
  {
    "path": "schema/roq/layer.json",
    "content": "{\n  \"link\": \"roq/Layer\"\n}\n"
  },
  {
    "path": "schema/roq/leg.json",
    "content": "{\n  \"link\": \"roq/Leg\"\n}\n"
  },
  {
    "path": "schema/roq/legs_update.json",
    "content": "{\n  \"link\": \"roq/LegsUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/liquidity.json",
    "content": "{\n  \"link\": \"roq/Liquidity\"\n}\n"
  },
  {
    "path": "schema/roq/margin_mode.json",
    "content": "{\n  \"link\": \"roq/MarginMode\"\n}\n"
  },
  {
    "path": "schema/roq/market_by_order_update.json",
    "content": "{\n  \"link\": \"roq/MarketByOrderUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/market_by_price_update.json",
    "content": "{\n  \"link\": \"roq/MarketByPriceUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/market_status.json",
    "content": "{\n  \"link\": \"roq/MarketStatus\"\n}\n"
  },
  {
    "path": "schema/roq/mass_quote.json",
    "content": "{\n  \"link\": \"roq/MassQuote\"\n}\n"
  },
  {
    "path": "schema/roq/mass_quote_ack.json",
    "content": "{\n  \"link\": \"roq/MassQuoteAck\"\n}\n"
  },
  {
    "path": "schema/roq/mbo_update.json",
    "content": "{\n  \"link\": \"roq/MBOUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/mbp_update.json",
    "content": "{\n  \"link\": \"roq/MBPUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/measurement.json",
    "content": "{\n  \"link\": \"roq/Measurement\"\n}\n"
  },
  {
    "path": "schema/roq/message_info.json",
    "content": "{\n  \"link\": \"roq/MessageInfo\"\n}\n"
  },
  {
    "path": "schema/roq/modify_order.json",
    "content": "{\n  \"link\": \"roq/ModifyOrder\"\n}\n"
  },
  {
    "path": "schema/roq/option_type.json",
    "content": "{\n  \"link\": \"roq/OptionType\"\n}\n"
  },
  {
    "path": "schema/roq/order_ack.json",
    "content": "{\n  \"link\": \"roq/OrderAck\"\n}\n"
  },
  {
    "path": "schema/roq/order_cancel_policy.json",
    "content": "{\n  \"link\": \"roq/OrderCancelPolicy\"\n}\n"
  },
  {
    "path": "schema/roq/order_management.json",
    "content": "{\n  \"link\": \"roq/OrderManagement\"\n}\n"
  },
  {
    "path": "schema/roq/order_status.json",
    "content": "{\n  \"link\": \"roq/OrderStatus\"\n}\n"
  },
  {
    "path": "schema/roq/order_type.json",
    "content": "{\n  \"link\": \"roq/OrderType\"\n}\n"
  },
  {
    "path": "schema/roq/order_update.json",
    "content": "{\n  \"link\": \"roq/OrderUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/origin.json",
    "content": "{\n  \"link\": \"roq/Origin\"\n}\n"
  },
  {
    "path": "schema/roq/parameter.json",
    "content": "{\n  \"link\": \"roq/Parameter\"\n}\n"
  },
  {
    "path": "schema/roq/parameters_update.json",
    "content": "{\n  \"link\": \"roq/ParametersUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/portfolio.json",
    "content": "{\n  \"link\": \"roq/Portfolio\"\n}\n"
  },
  {
    "path": "schema/roq/portfolio_update.json",
    "content": "{\n  \"link\": \"roq/PortfolioUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/position.json",
    "content": "{\n  \"link\": \"roq/Position\"\n}\n"
  },
  {
    "path": "schema/roq/position_effect.json",
    "content": "{\n  \"link\": \"roq/PositionEffect\"\n}\n"
  },
  {
    "path": "schema/roq/position_update.json",
    "content": "{\n  \"link\": \"roq/PositionUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/precision.json",
    "content": "{\n  \"link\": \"roq/Precision\"\n}\n"
  },
  {
    "path": "schema/roq/priority.json",
    "content": "{\n  \"link\": \"roq/Priority\"\n}\n"
  },
  {
    "path": "schema/roq/protocol.json",
    "content": "{\n  \"link\": \"roq/Protocol\"\n}\n"
  },
  {
    "path": "schema/roq/quality_of_service.json",
    "content": "{\n  \"link\": \"roq/QualityOfService\"\n}\n"
  },
  {
    "path": "schema/roq/quantity_type.json",
    "content": "{\n  \"link\": \"roq/QuantityType\"\n}\n"
  },
  {
    "path": "schema/roq/quote.json",
    "content": "{\n  \"link\": \"roq/Quote\"\n}\n"
  },
  {
    "path": "schema/roq/rate_limit.json",
    "content": "{\n  \"link\": \"roq/RateLimit\"\n}\n"
  },
  {
    "path": "schema/roq/rate_limit_trigger.json",
    "content": "{\n  \"link\": \"roq/RateLimitTrigger\"\n}\n"
  },
  {
    "path": "schema/roq/rate_limit_type.json",
    "content": "{\n  \"link\": \"roq/RateLimitType\"\n}\n"
  },
  {
    "path": "schema/roq/rate_limits_update.json",
    "content": "{\n  \"link\": \"roq/RateLimitsUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/ready.json",
    "content": "{\n  \"link\": \"roq/Ready\"\n}\n"
  },
  {
    "path": "schema/roq/reference_data.json",
    "content": "{\n  \"link\": \"roq/ReferenceData\"\n}\n"
  },
  {
    "path": "schema/roq/remove_routes.json",
    "content": "{\n  \"link\": \"roq/RemoveRoutes\"\n}\n"
  },
  {
    "path": "schema/roq/request_id_type.json",
    "content": "{\n  \"link\": \"roq/RequestIdType\"\n}\n"
  },
  {
    "path": "schema/roq/request_status.json",
    "content": "{\n  \"link\": \"roq/RequestStatus\"\n}\n"
  },
  {
    "path": "schema/roq/request_type.json",
    "content": "{\n  \"link\": \"roq/RequestType\"\n}\n"
  },
  {
    "path": "schema/roq/risk_limit.json",
    "content": "{\n  \"link\": \"roq/RiskLimit\"\n}\n"
  },
  {
    "path": "schema/roq/risk_limits.json",
    "content": "{\n  \"link\": \"roq/RiskLimits\"\n}\n"
  },
  {
    "path": "schema/roq/risk_limits_update.json",
    "content": "{\n  \"link\": \"roq/RiskLimitsUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/route.json",
    "content": "{\n  \"link\": \"roq/Route\"\n}\n"
  },
  {
    "path": "schema/roq/route_ack.json",
    "content": "{\n  \"link\": \"roq/RouteAck\"\n}\n"
  },
  {
    "path": "schema/roq/route_request_status.json",
    "content": "{\n  \"link\": \"roq/RouteRequestStatus\"\n}\n"
  },
  {
    "path": "schema/roq/routing.json",
    "content": "{\n  \"link\": \"roq/Routing\"\n}\n"
  },
  {
    "path": "schema/roq/security_type.json",
    "content": "{\n  \"link\": \"roq/SecurityType\"\n}\n"
  },
  {
    "path": "schema/roq/service_update.json",
    "content": "{\n  \"link\": \"roq/ServiceUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/side.json",
    "content": "{\n  \"link\": \"roq/Side\"\n}\n"
  },
  {
    "path": "schema/roq/start.json",
    "content": "{\n  \"link\": \"roq/Start\"\n}\n"
  },
  {
    "path": "schema/roq/state.json",
    "content": "{\n  \"link\": \"roq/State\"\n}\n"
  },
  {
    "path": "schema/roq/statistics.json",
    "content": "{\n  \"link\": \"roq/Statistics\"\n}\n"
  },
  {
    "path": "schema/roq/statistics_type.json",
    "content": "{\n  \"link\": \"roq/StatisticsType\"\n}\n"
  },
  {
    "path": "schema/roq/statistics_update.json",
    "content": "{\n  \"link\": \"roq/StatisticsUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/stop.json",
    "content": "{\n  \"link\": \"roq/Stop\"\n}\n"
  },
  {
    "path": "schema/roq/strategy_update.json",
    "content": "{\n  \"link\": \"roq/StrategyUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/stream_status.json",
    "content": "{\n  \"link\": \"roq/StreamStatus\"\n}\n"
  },
  {
    "path": "schema/roq/subscribe.json",
    "content": "{\n  \"link\": \"roq/Subscribe\"\n}\n"
  },
  {
    "path": "schema/roq/support_type.json",
    "content": "{\n  \"link\": \"roq/SupportType\"\n}\n"
  },
  {
    "path": "schema/roq/tick_size_step.json",
    "content": "{\n  \"link\": \"roq/TickSizeStep\"\n}\n"
  },
  {
    "path": "schema/roq/time_in_force.json",
    "content": "{\n  \"link\": \"roq/TimeInForce\"\n}\n"
  },
  {
    "path": "schema/roq/time_series_update.json",
    "content": "{\n  \"link\": \"roq/TimeSeriesUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/timer.json",
    "content": "{\n  \"link\": \"roq/Timer\"\n}\n"
  },
  {
    "path": "schema/roq/top_of_book.json",
    "content": "{\n  \"link\": \"roq/TopOfBook\"\n}\n"
  },
  {
    "path": "schema/roq/trade.json",
    "content": "{\n  \"link\": \"roq/Trade\"\n}\n"
  },
  {
    "path": "schema/roq/trade_summary.json",
    "content": "{\n  \"link\": \"roq/TradeSummary\"\n}\n"
  },
  {
    "path": "schema/roq/trade_update.json",
    "content": "{\n  \"link\": \"roq/TradeUpdate\"\n}\n"
  },
  {
    "path": "schema/roq/trading_status.json",
    "content": "{\n  \"link\": \"roq/TradingStatus\"\n}\n"
  },
  {
    "path": "schema/roq/transport.json",
    "content": "{\n  \"link\": \"roq/Transport\"\n}\n"
  },
  {
    "path": "schema/roq/update_action.json",
    "content": "{\n  \"link\": \"roq/UpdateAction\"\n}\n"
  },
  {
    "path": "schema/roq/update_reason.json",
    "content": "{\n  \"link\": \"roq/UpdateReason\"\n}\n"
  },
  {
    "path": "schema/roq/update_type.json",
    "content": "{\n  \"link\": \"roq/UpdateType\"\n}\n"
  },
  {
    "path": "schema/roq/variant_type.json",
    "content": "{\n  \"link\": \"roq/VariantType\"\n}\n"
  },
  {
    "path": "test/.clang-tidy",
    "content": "---\nInheritParentConfig: true\nChecks: -clang-analyzer-security.insecureAPI.rand, -readability-function-cognitive-complexity,\n  -readability-isolate-declaration, -readability-magic-numbers,\n"
  },
  {
    "path": "test/.gitignore",
    "content": "roq-api-test\n"
  },
  {
    "path": "test/CMakeLists.txt",
    "content": "set(TARGET_NAME ${PROJECT_NAME}-test)\n\nset(SOURCES\n    alignment.cpp\n    compat.cpp\n    exceptions.cpp\n    format.cpp\n    mask.cpp\n    side.cpp\n    span.cpp\n    string.cpp\n    support_type.cpp\n    version.cpp\n    main.cpp)\n\nadd_executable(${TARGET_NAME} ${SOURCES})\n\nadd_dependencies(${TARGET_NAME} ${PROJECT_NAME}-include-cpp)\n\ntarget_link_libraries(${TARGET_NAME} PRIVATE fmt::fmt magic_enum::magic_enum nameof::nameof Catch2::Catch2)\n\nif(ROQ_BUILD_TYPE STREQUAL \"Release\")\n  set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS_RELEASE -s)\nendif()\n\nadd_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})\n"
  },
  {
    "path": "test/alignment.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include \"roq/api.hpp\"\n\nusing namespace roq;\n\nTEST_CASE(\"alignment_layer\", \"[alignment]\") {\n  std::array<Layer, 2> value;\n  auto offset = reinterpret_cast<uint8_t *>(&value[1]) - reinterpret_cast<uint8_t *>(std::data(value));\n  CHECK(offset == std::ptrdiff_t{32});\n}\n\nTEST_CASE(\"alignment_mbp_update\", \"[alignment]\") {\n  std::array<MBPUpdate, 2> value;\n  auto offset = reinterpret_cast<uint8_t *>(&value[1]) - reinterpret_cast<uint8_t *>(std::data(value));\n  CHECK(offset == std::ptrdiff_t{32});\n}\n\nTEST_CASE(\"alignment_mbo_update\", \"[alignment]\") {\n  std::array<MBOUpdate, 2> value;\n  auto offset = reinterpret_cast<uint8_t *>(&value[1]) - reinterpret_cast<uint8_t *>(std::data(value));\n  CHECK(offset == std::ptrdiff_t{64});\n}\n\nTEST_CASE(\"alignment_trade\", \"[alignment]\") {\n  std::array<Trade, 2> value;\n  auto offset = reinterpret_cast<uint8_t *>(&value[1]) - reinterpret_cast<uint8_t *>(std::data(value));\n  CHECK(offset == std::ptrdiff_t{192});\n}\n\nTEST_CASE(\"alignment_fill\", \"[alignment]\") {\n  std::array<Fill, 2> value;\n  auto offset = reinterpret_cast<uint8_t *>(&value[1]) - reinterpret_cast<uint8_t *>(std::data(value));\n  CHECK(offset == std::ptrdiff_t{136});\n}\n"
  },
  {
    "path": "test/compat.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <new>\n\n#if defined(__APPLE__)\n#if defined(__arm64__)\nstatic_assert(std::hardware_destructive_interference_size == 256);\nstatic_assert(std::hardware_constructive_interference_size == 64);\n#else  // not __arm64__\nstatic_assert(std::hardware_destructive_interference_size == 64);\nstatic_assert(std::hardware_constructive_interference_size == 64);\n#endif\n#else  // not __APPLE__\n#if defined(__arm64__)\nstatic_assert(std::hardware_destructive_interference_size == 256);  // note! since gcc12\nstatic_assert(std::hardware_constructive_interference_size == 64);\n#else  // not __arm64__\n// static_assert(std::hardware_destructive_interference_size == 64);\n// static_assert(std::hardware_destructive_interference_size == 256);\nstatic_assert(std::hardware_constructive_interference_size == 64);\n#endif\n#endif\n"
  },
  {
    "path": "test/exceptions.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include \"roq/exceptions.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nTEST_CASE(\"exceptions_simple_1\", \"[exceptions]\") {\n  auto success = false;\n  try {\n    throw NotReady{\"something's not right\"sv};\n  } catch (std::exception &) {\n    success = true;\n  }\n  CHECK(success == true);\n}\n\nTEST_CASE(\"exceptions_simple_2\", \"[exceptions]\") {\n  auto success = false;\n  try {\n    throw NotReady{\"something's not right\"sv};\n  } catch (Exception &) {\n    success = true;\n  }\n  CHECK(success == true);\n}\n\nTEST_CASE(\"exceptions_simple_3\", \"[exceptions]\") {\n  auto success = false;\n  try {\n    throw NotReady{\"something's not right\"sv};\n  } catch (RuntimeError &) {\n    success = true;\n  }\n  CHECK(success == true);\n}\n\nTEST_CASE(\"exceptions_simple_4\", \"[exceptions]\") {\n  auto success = false;\n  try {\n    throw NotReady{\"something's not right\"sv};\n  } catch (NotReady &) {\n    success = true;\n  }\n  CHECK(success == true);\n}\n\nTEST_CASE(\"exceptions_simple_5\", \"[exceptions]\") {\n  auto success = false;\n  try {\n    throw RuntimeError{\"something's not right\"sv};\n  } catch (RuntimeError &) {\n    success = true;\n  }\n  CHECK(success == true);\n}\n\nTEST_CASE(\"exceptions_what\", \"[exceptions]\") {\n  auto success = false;\n  try {\n    throw NotReady{\"{}\"sv, 123};\n  } catch (NotReady &e) {\n    success = true;\n    CHECK(e.what() == \"123\"sv);\n  }\n  CHECK(success == true);\n  success = false;\n  try {\n    throw NotReady{\"123\"sv};\n  } catch (NotReady &e) {\n    success = true;\n    CHECK(e.what() == \"123\"sv);\n  }\n  CHECK(success == true);\n}\n"
  },
  {
    "path": "test/format.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include <array>\n\n#include \"roq/market_by_order_update.hpp\"\n#include \"roq/market_by_price_update.hpp\"\n#include \"roq/side.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nTEST_CASE(\"format_side\", \"[format]\") {\n  CHECK(fmt::format(\"{}\"sv, Side{Side::UNDEFINED}) == \"UNDEFINED\"sv);\n  CHECK(fmt::format(\"{}\"sv, Side{Side::BUY}) == \"BUY\"sv);\n  CHECK(fmt::format(\"{}\"sv, Side{Side::SELL}) == \"SELL\"sv);\n}\n\nTEST_CASE(\"format_string\", \"[format]\") {\n  MBOOrderId order_id = \"1234\"sv;\n  CHECK(fmt::format(\"{}\"sv, order_id) == \"1234\"sv);\n}\n\nTEST_CASE(\"format_market_by_price\", \"[format]\") {\n  std::array<MBPUpdate, 5> bids{{\n      {\n          .price = 1.0,\n          .quantity = 2.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 2.0,\n          .quantity = 4.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 3.0,\n          .quantity = 8.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 4.0,\n          .quantity = 10.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 5.0,\n          .quantity = 12.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n  }};\n  std::array<MBPUpdate, 5> asks{{\n      {\n          .price = 1.0,\n          .quantity = 2.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 2.0,\n          .quantity = 4.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 3.0,\n          .quantity = 8.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 4.0,\n          .quantity = 10.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n      {\n          .price = 5.0,\n          .quantity = 12.0,\n          .implied_quantity = 3.0,\n          .number_of_orders = 2,\n          .update_action = {},\n          .price_level = 1,\n      },\n  }};\n  auto market_by_price = MarketByPriceUpdate{\n      .stream_id = {},\n      .exchange = \"deribit\"sv,\n      .symbol = \"BTC-27DEC19\"sv,\n      .bids = bids,\n      .asks = asks,\n      .update_type = UpdateType::SNAPSHOT,\n      .exchange_time_utc = {},\n      .exchange_sequence = 123,\n      .price_precision = Precision::_0,\n      .quantity_precision = Precision::_1,\n      .max_depth = 10,\n      .checksum = 123,\n  };\n  auto result = fmt::format(\"{}\"sv, market_by_price);\n  CHECK(std::size(result) > 0UZ);\n  auto expected = R\"({)\"\n                  R\"(stream_id=0, )\"\n                  R\"(exchange=\"deribit\", )\"\n                  R\"(symbol=\"BTC-27DEC19\", )\"\n                  R\"(bids=[)\"\n                  R\"({price=1, quantity=2, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=2, quantity=4, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=3, quantity=8, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=4, quantity=10, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=5, quantity=12, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1})\"\n                  R\"(], )\"\n                  R\"(asks=[)\"\n                  R\"({price=1, quantity=2, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=2, quantity=4, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=3, quantity=8, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=4, quantity=10, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1}, )\"\n                  R\"({price=5, quantity=12, implied_quantity=3, number_of_orders=2, update_action=UNDEFINED, price_level=1})\"\n                  R\"(], )\"\n                  R\"(update_type=SNAPSHOT, )\"\n                  R\"(exchange_time_utc=0ns, )\"\n                  R\"(exchange_sequence=123, )\"\n                  R\"(sending_time_utc=0ns, )\"\n                  R\"(price_precision=_0, )\"\n                  R\"(quantity_precision=_1, )\"\n                  R\"(max_depth=10, )\"\n                  R\"(checksum=123)\"\n                  R\"(})\"sv;\n  CHECK(result == expected);\n}\n"
  },
  {
    "path": "test/main.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#define CATCH_CONFIG_RUNNER\n\n#include <catch2/catch_session.hpp>\n\nint main(int argc, char **argv) {\n  return Catch::Session{}.run(argc, argv);\n}\n"
  },
  {
    "path": "test/mask.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/mask.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nnamespace {\nenum class E : uint32_t {\n  A = 1,\n  B = 2,\n  C = 4,\n};\n\n// compile-time checks\nstatic_assert(Mask<E>{E::A} == Mask<E>{E::A});\nstatic_assert(Mask<E>{E::A} != Mask<E>{});\nstatic_assert(Mask<E>{E::A} != Mask<E>{E::B});\nstatic_assert(Mask<E>{E::A} == Mask<E>{}.set(E::A));\nstatic_assert(Mask<E>{E::A, E::B} == Mask<E>{}.set(E::A).set(E::B));\nstatic_assert(Mask<E>{E::A, E::B, E::C} == Mask<E>{}.set(E::A).set(E::B).set(E::C));\n}  // namespace\n\n// run-time checks\n\nTEST_CASE(\"mask_simple\", \"[mask]\") {\n  auto mask_1 = Mask{\n      E::A,\n  };\n  CHECK(mask_1.has(E::A) == true);\n  CHECK(mask_1.has(E::B) == false);\n  auto mask_2 = Mask{mask_1, E::B};\n  CHECK(mask_2.has(E::A) == true);\n  CHECK(mask_2.has(E::B) == true);\n  CHECK(mask_2.has_any(E::A) == true);\n  CHECK(mask_2.has_any({E::A, E::B}) == true);\n  CHECK(mask_2.has_any({E::A, E::B, E::C}) == true);\n  CHECK(fmt::format(\"{}\"sv, Mask{E::A}) == \"A\"sv);\n  CHECK(fmt::format(\"{}\"sv, Mask{E::B, E::C}) == \"B|C\"sv);\n  CHECK(fmt::format(\"{}\"sv, Mask{E::A, E::B, E::C}) == \"A|B|C\"sv);\n}\n\nnamespace {\nenum class E2 : uint32_t {\n  U = 0,  // \"undefined\"\n  A = 1,\n  B = 2,\n  C = 4,\n};\n}\n\nTEST_CASE(\"mask_with_undefined\", \"[mask]\") {\n  SKIP(\"format broken with magic_enum 0.9.0\");\n  CHECK(fmt::format(\"{}\"sv, Mask<E2>{}) == \"U\"sv);\n  CHECK(fmt::format(\"{}\"sv, Mask{E2::U}) == \"U\"sv);\n  CHECK(fmt::format(\"{}\"sv, Mask{E2::A}) == \"A\"sv);\n  CHECK(fmt::format(\"{}\"sv, Mask{E2::A, E2::C}) == \"A|C\"sv);\n  CHECK(fmt::format(\"{}\"sv, Mask{E2::A, E2::B, E2::C}) == \"A|B|C\"sv);\n}\n"
  },
  {
    "path": "test/side.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include <fmt/format.h>\n\n#include <magic_enum/magic_enum_format.hpp>\n\n#include \"roq/side.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nTEST_CASE(\"side_simple\", \"[side]\") {\n  CHECK(fmt::format(\"{}\"sv, Side::BUY) == \"BUY\"sv);\n  CHECK(fmt::format(\"{}\"sv, Side::SELL) == \"SELL\"sv);\n}\n"
  },
  {
    "path": "test/span.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_approx.hpp>\n#include <catch2/catch_test_macros.hpp>\n\n#include <array>\n#include <iterator>\n#include <span>\n#include <string>\n#include <string_view>\n#include <vector>\n\nusing namespace std::literals;\n\nusing namespace Catch::literals;\n\nTEST_CASE(\"span_simple\", \"[span]\") {\n  // initialize empty\n  std::vector<double> empty;\n  std::span empty_span{empty};\n  CHECK(std::empty(empty_span) == true);\n  // initialize non-empty\n  std::array<double, 3> raw{{\n      0.0,\n      2.0,\n      3.0,\n  }};\n  std::span span{raw};\n  CHECK(std::empty(span) == false);\n  span[0] = 1.0;\n  CHECK(span[0] == 1.0_a);\n  CHECK(span[1] == 2.0_a);\n  CHECK(span[2] == 3.0_a);\n  // assignment\n  std::span<double> span_2;\n  CHECK(std::empty(span_2) == true);\n  span_2 = span;\n  CHECK(std::empty(span_2) == false);\n  CHECK(span_2[0] == 1.0_a);\n  CHECK(span_2[1] == 2.0_a);\n  CHECK(span_2[2] == 3.0_a);\n}\n\nTEST_CASE(\"span_string_view\", \"[span]\") {\n  std::vector<std::string_view> raw{\n      \"abc\"sv,\n      \"def\"sv,\n  };\n  std::span span{raw};\n  CHECK(span[0] == \"abc\"sv);\n  CHECK(span[1] == \"def\"sv);\n}\n"
  },
  {
    "path": "test/string.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include <string_view>\n\n#include \"roq/string.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nstatic_assert(String<4>{\"12\"sv} < \"2\"sv);\nstatic_assert(String<4>{\"12\"sv} == \"12\"sv);\nstatic_assert(String<4>{\"2\"sv} > \"12\"sv);\n\nTEST_CASE(\"string_empty\", \"[string]\") {\n  String<4> str;\n  CHECK(str.size() == 4);\n  CHECK(str.length() == 0);  // NOLINT(readability-container-size-empty)\n  CHECK(std::empty(str));\n  auto view = static_cast<std::string_view>(str);\n  CHECK(std::empty(view) == true);\n  CHECK(std::size(view) == 0);\n}\n\nTEST_CASE(\"string_partial\", \"[string]\") {\n  constexpr auto text = \"12\"sv;\n  String<4> str = text;\n  CHECK(str.size() == 4);\n  CHECK(str.length() == 2);\n  auto view = static_cast<std::string_view>(str);\n  CHECK(std::empty(view) == false);\n  CHECK(std::size(view) == 2);\n  CHECK(view == text);\n}\n\nTEST_CASE(\"string_almost_full\", \"[string]\") {\n  constexpr auto text = \"123\"sv;\n  String<4> str = text;\n  CHECK(str.size() == 4);\n  CHECK(str.length() == 3);\n  auto view = static_cast<std::string_view>(str);\n  CHECK(std::empty(view) == false);\n  CHECK(std::size(view) == 3);\n  CHECK(view == text);\n}\n\nTEST_CASE(\"string_full\", \"[string]\") {\n  constexpr auto text = \"1234\"sv;\n  String<4> str = text;\n  CHECK(str.size() == 4);\n  CHECK(str.length() == 4);\n  auto view = static_cast<std::string_view>(str);\n  CHECK(std::empty(view) == false);\n  CHECK(std::size(view) == 4);\n  CHECK(view == text);\n}\n\nTEST_CASE(\"string_construct\", \"[string]\") {\n  String<4>{};\n  String<4>{\"1\"sv};\n  String<4>{\"12\"sv};\n  String<4>{\"123\"sv};\n  String<4>{\"1234\"sv};\n  CHECK_THROWS_AS(String<4>{\"12345\"sv}, LengthError);\n}\n\nTEST_CASE(\"string_push_back\", \"[string]\") {\n  String<4> str;\n  CHECK(str.length() == 0);  // NOLINT(readability-container-size-empty)\n  CHECK(std::empty(str));\n  CHECK(str == \"\"sv);  // NOLINT(readability-container-size-empty)\n  str.push_back('1');\n  CHECK(str.length() == 1);\n  CHECK(str == \"1\"sv);\n  str.push_back('2');\n  CHECK(str.length() == 2);\n  CHECK(str == \"12\"sv);\n  str.push_back('3');\n  CHECK(str.length() == 3);\n  CHECK(str == \"123\"sv);\n  str.push_back('4');\n  CHECK(str.length() == 4);\n  CHECK(str == \"1234\"sv);\n  CHECK_THROWS_AS(str.push_back('5'), LengthError);\n}\n\nTEST_CASE(\"string_signed_unsigned_issue\", \"[string]\") {\n  constexpr auto text =\n      \"01234567890123456789012345678901234567890123456789012345678901234567890123456789\"\n      \"01234567890123456789012345678901234567890123456789012345678901234567890123456789\"sv;\n  String<192> str = text;\n  CHECK(str.size() == 192);\n  CHECK(str.length() == 160);\n  auto view = static_cast<std::string_view>(str);\n  CHECK(std::empty(view) == false);\n  CHECK(std::size(view) == 160);\n  CHECK(view == text);\n}\n\nTEST_CASE(\"string_spaceship\", \"[string]\") {\n  String<8> str = \"1234\"sv;\n  // String<8>\n  CHECK(str == String<8>{\"1234\"sv});\n  CHECK(str != String<8>{\"2345\"sv});\n  CHECK(str < String<8>{\"2345\"sv});\n  CHECK(str <= String<8>{\"2345\"sv});\n  CHECK(str > String<8>{\"0123\"sv});\n  CHECK(str >= String<8>{\"0123\"sv});\n  CHECK(str != String<8>{});  // NOLINT(readability-container-size-empty)\n  // String<16>\n  CHECK(str == String<16>{\"1234\"sv});\n  CHECK(str != String<16>{\"2345\"sv});\n  CHECK(str < String<16>{\"2345\"sv});\n  CHECK(str <= String<16>{\"2345\"sv});\n  CHECK(str > String<16>{\"0123\"sv});\n  CHECK(str >= String<16>{\"0123\"sv});\n  CHECK(str != String<16>{});  // NOLINT(readability-container-size-empty)\n  // String<4>\n  CHECK(str == String<4>{\"1234\"sv});\n  CHECK(str != String<4>{\"2345\"sv});\n  CHECK(str < String<4>{\"2345\"sv});\n  CHECK(str <= String<4>{\"2345\"sv});\n  CHECK(str > String<4>{\"0123\"sv});\n  CHECK(str >= String<4>{\"0123\"sv});\n  CHECK(str != String<4>{});  // NOLINT(readability-container-size-empty)\n  // std::string_view\n  CHECK(str == \"1234\"sv);\n  CHECK(str != \"2345\"sv);\n  CHECK(str < \"2345\"sv);\n  CHECK(str <= \"2345\"sv);\n  CHECK(str > \"0123\"sv);\n  CHECK(str >= \"0123\"sv);\n  CHECK(str != std::string_view{});  // NOLINT(readability-container-size-empty)\n}\n"
  },
  {
    "path": "test/support_type.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include \"roq/mask.hpp\"\n#include \"roq/support_type.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nTEST_CASE(\"support_type_format\", \"[support_type]\") {\n  CHECK(fmt::format(\"{}\"sv, SupportType::UNDEFINED) == \"UNDEFINED\"sv);\n  CHECK(fmt::format(\"{}\"sv, SupportType::REFERENCE_DATA) == \"REFERENCE_DATA\"sv);\n  // ...\n  CHECK(fmt::format(\"{}\"sv, SupportType::FUNDS) == \"FUNDS\"sv);\n}\n\nTEST_CASE(\"support_type_mask_empty\", \"[support_type]\") {\n  auto supports = Mask<SupportType>{};\n  CHECK(fmt::format(\"{}\"sv, supports) == \"\"sv);  // NOLINT(readability-container-size-empty)\n}\n\nTEST_CASE(\"support_type_mask_lower_bits\", \"[support_type]\") {\n  auto supports = Mask{\n      SupportType::REFERENCE_DATA,\n      SupportType::TOP_OF_BOOK,\n  };\n  REQUIRE(supports.has(SupportType::REFERENCE_DATA));\n  REQUIRE(supports.has(SupportType::TOP_OF_BOOK));\n  CHECK(fmt::format(\"{}\"sv, supports) == \"REFERENCE_DATA|TOP_OF_BOOK\"sv);\n}\n\nTEST_CASE(\"support_type_mask_higher_bits\", \"[support_type]\") {\n  auto supports = Mask{\n      SupportType::ORDER_ACK,\n      SupportType::ORDER,\n      SupportType::FUNDS,\n  };\n  REQUIRE(supports.has(SupportType::ORDER_ACK));\n  REQUIRE(supports.has(SupportType::ORDER));\n  REQUIRE(supports.has(SupportType::FUNDS));\n  CHECK(fmt::format(\"{}\"sv, supports) == \"ORDER_ACK|ORDER|FUNDS\"sv);\n}\n"
  },
  {
    "path": "test/version.cpp",
    "content": "/* Copyright (c) 2017-2026, Hans Erik Thrane */\n\n#include <catch2/catch_all.hpp>\n\n#include \"roq/version.hpp\"\n\nusing namespace std::literals;\n\nusing namespace roq;\n\nTEST_CASE(\"simple\", \"[version]\") {\n  CHECK(Version{1, 2, 3} == Version{1, 2, 3});\n  CHECK(Version{1, 2, 3} <= Version{1, 2, 3});\n  CHECK(Version{1, 2, 3} >= Version{1, 2, 3});\n  CHECK(Version{} < Version{1, 2, 3});\n  CHECK(Version{} <= Version{1, 2, 3});\n  CHECK(Version{} != Version{1, 2, 3});\n  CHECK(Version{1, 2, 3} > Version{});\n  CHECK(Version{1, 2, 3} >= Version{});\n  CHECK(Version{1, 2, 3} != Version{});\n}\n"
  }
]