ores.trading.core

Table of Contents

1. Diagram

ores.trading.core component diagram

Figure 1: ores.trading.core

2. Summary

ores.trading.core is the primary component for trade booking and lifecycle management in ORE Studio. It implements the domain model for financial trades and instruments (rates, FX, equity, credit, scripted), the trade status FSM (see trade lifecycle for its states and transitions) enforced via ores.dq infrastructure, and a full persistence layer with temporal versioning and amendment history. Business logic is exposed as NATS message handlers in the 0x5000–0x5FFF range. The component also ships synthetic-data generators for test and development use.

3. Inputs

  • NATS request messages from peer services and UI clients (create/amend/cancel/ query operations on trades and instruments).
  • PostgreSQL connections to ores_trading_* tables via the ores.dq ORM infrastructure.
  • Reference-data lookups via ores.refdata.core (trade types, activity types, party roles).

4. Outputs

  • Trade and instrument records persisted to the ores_trading schema with full temporal history.
  • NATS response messages returned to callers.
  • Lifecycle events and activity records for P&L attribution.

5. Entry points

  • include/ores.trading.core/ores.trading.core.hpp — aggregate include for all public API headers.
  • include/ores.trading.core/messaging/registrar.hpp — registers all NATS handlers with the service host.
  • include/ores.trading.core/service/trade_operations_service.hpp — books a trade: its anchor, booking and first state in one write.
  • include/ores.trading.core/service/trade_export_service.hpp — reads a portfolio's trades back from their anchors and components for export.

6. Dependencies

  • ores.trading.api — shared domain types and NATS protocol schemas.
  • ores.dq — FSM infrastructure, ORM base classes, and data-quality checks.
  • ores.iam.core — identity and authorisation context.
  • ores.refdata.core — enumeration reference data (trade types, activity types).
  • fort — formatted table output.
  • soci — SQL ORM for PostgreSQL persistence.
  • nats.c — NATS messaging client.

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. Test dependencies

The suites link what the profile cannot know about.

target_link_libraries(${lib_target_name}
    PUBLIC
        ores.trading.api.lib
        ores.nats.lib
        ores.diff.lib
        ores.refdata.api.lib
    PRIVATE
        ores.service.lib
        ores.storage.core.lib
        ores.database.lib
        ores.dq.api.lib
        ores.inbox.api.lib
        ores.inbox.core.lib
        ores.history.core.lib
        ores.diff.lib
        ores.utility.lib
        ores.security.lib
        faker-cxx::faker-cxx
        libfort::fort
        Boost::boost)
target_link_libraries(${tests_target_name}
    PRIVATE
        ${lib_target_name}
        ores.utility.lib
        ores.testing.lib
        ores.logging.lib
        ores.eventing.api.lib
        ores.eventing.core.lib
        ores.nats.lib
        ores.dq.api.lib
        ores.dq.core.lib
        ores.refdata.api.lib
        ores.refdata.core.lib
        ores.iam.api.lib
        ores.iam.core.lib
        ores.inbox.api.lib
        ores.inbox.core.lib
        Catch2::Catch2
        faker-cxx::faker-cxx
        ores.openssl_cleanup
        Threads::Threads)

Emacs 29.3 (Org mode 9.6.15)