ores.trading.api

Table of Contents

1. Diagram

ores.trading.api component diagram

Figure 1: ores.trading.api

2. Summary

ores.trading.api is a header-only library that defines the shared contract for the trading domain. It provides all instrument and trade domain types (~30 instrument categories across rates, FX, equity, credit, and scripted products), JSON and formatted-table I/O generated by the codec library, and the NATS message protocol schemas (request/response pairs for every operation in the 0x5000–0x5FFF range). Both ores.trading.core (the server) and UI client components depend on this library.

3. Inputs

  • Upstream domain definitions: instrument type headers under domain/.
  • Protocol schema definitions: message type headers under messaging/.

4. Outputs

  • C++ headers for all trading domain types with JSON and table serialisation: domain/trade.hpp, domain/bond_instrument.hpp, etc.
  • NATS protocol headers: messaging/trade_protocol.hpp, messaging/instrument_protocol.hpp, and per-instrument variants.
  • Enumeration types with JSON/table I/O: activity_type, trade_type, day_count_fraction_type, etc.

5. Entry points

  • include/ores.trading.api/domain/ — all domain entity headers.
  • include/ores.trading.api/messaging/ — all NATS protocol message headers.
  • include/ores.trading.api/export.hpp — DLL-export macro.

6. Dependencies

  • fort — formatted table rendering.

7. Build dependencies

What the shared profile cannot know, declared here rather than hand-edited into the generated build file. Each block is spliced into its generated file after the profile's baseline.

8. See also

9. CMake

The trade_instrument variant needs a constexpr depth far past the default 512. PUBLIC so every consumer inherits it rather than setting it again.

target_compile_options(${lib_target_name} PUBLIC
    $<$<AND:$<CXX_COMPILER_ID:MSVC>,$<COMPILE_LANGUAGE:CXX>>:/constexpr:depth100000>
    $<$<AND:$<CXX_COMPILER_ID:MSVC>,$<COMPILE_LANGUAGE:CXX>>:/constexpr:steps10000000>
    $<$<AND:$<CXX_COMPILER_ID:Clang>,$<COMPILE_LANGUAGE:CXX>>:-fbracket-depth=1024>)

10. Test dependencies

The suites link what the profile cannot know about.

target_link_libraries(${lib_target_name}
    PUBLIC
        ores.dq.api.lib
        ores.marketdata.api.lib
        ores.eventing.api.lib
        ores.platform.lib
    PRIVATE
        ores.utility.lib
        faker-cxx::faker-cxx
        libfort::fort)

target_link_libraries(${lib_target_name} PRIVATE ores.codec.pch)
target_link_libraries(${tests_target_name}
    PRIVATE
        ores.trading.api.lib
        ores.telemetry.core.lib
        ores.utility.lib
        ores.testing.lib
        faker-cxx::faker-cxx
        Catch2::Catch2
        ores.openssl_cleanup
        Threads::Threads)

Emacs 29.3 (Org mode 9.6.15)