Skip to main content

BUSINESS.md: Exchange8:RefData — Business Requirements & Functionality

Audience: product owners, business analysts, and anyone evaluating what Exchange8:RefData does for the business. For architecture read README.md; for wire-level detail read DESIGN.md.

1. Business Purpose​

  • Be the single source of truth for the trading universe: what instruments exist, where they trade, in what currency, at what precision, and in what market state.
  • Turn corporate-action announcements (dividends, splits, mergers, spin-offs, rights, symbol changes, delistings) into a controlled, auditable lifecycle with per-holder entitlements — so holders are credited exactly once and market data stays consistent through the transition.
  • Give every tenant (environment) an isolated reference-data namespace: securities, customers, books and calendars are invisible across tenants by construction (Row-Level Security), not by convention.
  • Protect order flow: read access to the security master is available to order-placing clients without giving them any write power over reference data.
  • Serve as the identity cross-walk of the market — symbol, ISIN, CUSIP, SEDOL and FIGI all resolve to one security, with conflicting mappings flagged for operations rather than guessed.

2. Business Scope​

What the service provides​

CapabilityWhere it lives todayNotes
Security master with per-env isolation — list/detail/create/update/delete securitiesImplemented — GET/POST /v1/securities, GET/PUT/DELETE /v1/securities/{id} (+ /v1/admin/securities aliases incl. POST /update//delete)filters by symbol, type, market; page limit capped; referenced rows delete-guarded (delist instead)
Precision contract (price_scale, qty_scale, min_size)Implemented — security create + update with defaults (×10⁴ prices)consumers key on the scales
Market definitions (Exchange/MTF/Dark, lot size, calendar vs continuous mode)Implemented — GET/POST /v1/markets, PUT /v1/markets/{id} (+ /v1/admin/markets, POST /update)single-char code unique per env; type/mode vocabulary validated
MIC venue registry + currency/FX-rate registryTable-backed (seeded CAD/USD/BTC, XTSX/XTSE/XCNQ/LX)refdata.venue, refdata.currency
Customer/firm directory with sites, contacts, traders, notional capitalizationTable-backed — API not yet exposedrefdata.customer*, refdata.broker_trader, refdata.capitalization
Order-book configuration (book codes, tokens, preferencing, session times, connections)Membership API live — POST /v1/books/connections (outbox event); book master/session times table-backedrefdata.book*
Tick rules & tick bandsImplemented — GET/POST /v1/tick-rules, PUT /v1/tick-rules/{id} (rule + bands in one write)refdata.tick_rule*
Market holiday calendarsImplemented — POST /v1/holidays (date + name + per-market closure rows)reads table-backed; refdata.holiday*
Security identifier cross-reference (SYMBOL/ISIN/CUSIP/SEDOL/FIGI) with conflict flaggingImplemented as domain library + tableCrossRef, refdata.security_identifier
Corporate-action catalogue: 9 action kinds with ratio, dates and lifecycle stageImplemented — announce (POST /v1/corporate-actions), cancel, calendar view; transitions are Sentin8:Cron-driven (the proxy-back executes them)refdata.corporate_action*
Ex-date adjustment math (positions & reference prices) and entitlement snapshotsImplemented as domain library (value-preserving integer math)adjust_qty, adjust_price, snapshot_entitlements
Corporate-action calendar windows (ex/record/pay per date)Implemented as domain libraryCaCalendar
Shield policy administration (policy sets, relations, attributes)Implemented — shell-mounted, per-service scopepolicy-admin API
Admin console pages for the reference-data surface (RFW)Implemented — `GET /v1/admin/ui/{securitiesmarkets

What the service does NOT own (business boundary)​

ConcernOwning service
Trade capture, trade ledger, trade bustsExchange8:Clearing
Order matching and instrument halt/resume executionExchange8:ME
Delivery of cash/stock entitlementsExchange8:Settlement
Margin and collateral treatment (futures/options)Exchange8:Margin
Order-management state and client ordersExchange8:OMS
Market-data publication and replayExchange8:MD
Venue feed adapters and external data ingestExchange8:VFeeds
Smart order routingExchange8:SOR
Surveillance detection and case actionsExchange8:Surveillance
Regulatory reportingExchange8:Regulatory
FX pair quotes and RFQ negotiationExchange8:RFQ
Corporate-action stage transitions (scheduling)Sentin8:Cron
Event transport and durable streamsSentin8:Bus
Identity, tokens, rolesSentin8:Auth
Audit-event ingestSentin8:Sys
Admin UI renderingSentin8:Dash

3. Business Capabilities​

Security master​

CapabilityBusiness rule
Create securityRequires a write-authorized principal; symbol must be non-empty; symbol is unique per environment (duplicate → conflict); currency must exist; precision defaults to ×10⁴ price scale, integer quantities
List securitiesAny reader (refdata reader, order-placer, or env/platform admin) sees only its own environment's securities, filterable and capped
Get securitySame isolation; unknown id → not-found error code exchange8_security_not_found
Market state fieldstrading_state Open/Closed, halted flag, shortable Y/E/N, permanently_delisted — the operating states every service keys trading behavior against

Customer & firm directory​

CapabilityBusiness rule
Customer masterEach firm carries status (E enabled / D disabled / H held), vendor flag, STP code + STP action, a unique executing-broker id, a 5-char clearing id (CUID), and book tokens it may trade in
Sites (locations)Primary/shipping/billing addresses per firm, enablement status per site
Contacts & mappingContact rows (type, name, phone, email) tied to firms and to their locations
TradersA trader belongs to exactly one firm per environment (user_id unique per firm), with optional CUID override
CapitalizationNotional base per (location, currency) — the notional base business relies on for entitlement/capitalization checks

Markets, venues & calendars​

CapabilityBusiness rule
Market definitionsOne-character market code unique per environment; type Exchange/MTF/Dark; lot size; hidden-order and EBBO flags; calendar vs continuous market mode
MIC venuesISO 10383 MIC registry with names, per environment
Currencies3-letter ISO code registry with the LIS exchange rate used by LIS checks and FX-adjacent flows
HolidaysMarket holiday calendar (date + name) mapped per market — feeding trading-calendar behavior

Order books​

CapabilityBusiness rule
Book master4-character book code and single-character token both unique; time vs broker preferencing; anonymous flag; default book flag
Book membershipBooks carry connections (gateway comp ids) with sequence and enablement status
Session timesPer-book event codes and times define the trading session

Tick rules & LIS​

CapabilityBusiness rule
Tick rule valuesPrice-band table (min/max/tick) applied per security through refdata.security.tick_rule_id
Large-in-scaleClass thresholds (order_volume) for LIS classification

Corporate actions​

CapabilityBusiness rule
Action catalogueNine kinds: cash dividend, stock dividend, split, reverse split, merger, spin-off, rights, symbol change, delisting
Lifecycleannounced → ex-date → record-date → pay-date; pay-date is terminal; irreversible kinds (merger, delisting) terminate at ex-date with removal rather than record/pay
Quantity adjustmentsSplit multiplies quantity by the ratio; reverse split consolidates; stock dividend adds the ratio; cash actions leave quantity unchanged
Price adjustmentsScales/divides for splits and stock dividends; subtracts cash per share on the ex-date for dividends
EntitlementsRecord-date snapshot: cash per share × holding for dividends; new shares per held share for stock actions, spin-offs and rights
SchedulingTransitions run on Sentin8:Cron; Exchange8:Settlement performs delivery on the pay date

Cross-reference resolution​

CapabilityBusiness rule
Resolve by scheme+valueExact lookup in SYMBOL, ISIN, CUSIP, SEDOL, FIGI
Resolve any schemeAll scheme matches must agree on one security; disagreement is flagged for operations, never auto-resolved
Reverse viewAll identifiers of one security, scheme-sorted

4. Business Events (Outbound)​

Event (vocabulary)When it firesStatus
exchange8:refdata:security:created / …:updated / …:deletedA security row is created/updated/deletedEmitted (outbox row in the domain transaction; relay pushes to Bus)
exchange8:refdata:market:created / …:updatedA market row is created/updatedEmitted
exchange8:refdata:corporate-action:announcedAn action is announced (stage announced)Emitted
exchange8:refdata:corporate-action:stage-advanced / …:completedThe Sentin8:Cron transition run advances a stage; completed = the terminal pay-date handoff to Exchange8:SettlementEmitted per advanced transition
exchange8:refdata:corporate-action:cancelledAn operator withdraws an action still in announcedEmitted
exchange8:refdata:tick-rule:created / …:updatedTick rule + bands writtenEmitted
exchange8:refdata:book-connection:createdA book↔connection membership is registeredEmitted
exchange8:refdata:holiday:createdA market holiday is declaredEmitted
Audit events to Sentin8:Sys (POST /v1/audit)Every mutation (the journal row is written in the same domain transaction)Emitted

Inbound (consumed): none today. The transition work ARRIVES as the Sentin8:Cron proxy-back (POST /v1/internal/schedules/run, M2M) rather than a bus event; Shield policy-set changes reach it through the shell's hot-reload consumer rather than business events. Position snapshots for record-date entitlements would be the future inbound surface.

5. Business Rules & Invariants​

  1. Each environment sees exactly its own reference data — enforced by RLS on every table, plus the explicit environment filter on every query; a caller with no tenant context sees nothing and may write nothing.
  2. Securities are unique by symbol per environment; currency must resolve to the currency registry.
  3. Reference data is read-only for order-placing clients; only refdata writers (and platform administrators) may create or change securities.
  4. Every corporate action runs its lifecycle in order — announcements precede ex-dates, record dates precede pay dates; pay-date is terminal and no stage can be skipped or reversed.
  5. Ex-date adjustments are value-preserving: $qty × price$ (in raw ticks) is invariant across split/reverse-split/cash-dividend adjustments (integer raw-tick math, no floating point, no rounding drift).
  6. Entitlements are computed from the record-date position snapshot only — holders at record date, not at pay date, receive the entitlement.
  7. Identifier cross-references never guess: a value mapping to two securities through different schemes is flagged, not resolved.
  8. Reference data contains no secrets: provider credentials, keys, or payment details never appear in any refdata table.
  9. Events are delivered at-least-once with dedupe by the outbox row id — consumers can treat delivery as effectively exactly-once.
  10. Audit is never lost to an outage: journal rows persist locally until Sentin8:Sys acknowledges them.

6. Target-User Roles & Use Cases​

PersonaRole/scopeWhat they do with Exchange8:RefData
Exchange operator (env admin)exchange8:admin, refdata writeCreates and maintains securities, markets, books, calendars; declares corporate actions
Platform operationssentin8:sys:adminCross-env administration, policy administration, health and upgrade supervision
Order-placement client (member firm)exchange8:order:readReads the securities it trades against (precision, trading state, shortability)
Compliance/issuer ops`exchange8:corporate-action:readwrite`
Matching/venue servicesM2M with declared SELECT grantsReads refdata.security for instrument behavior at the trading hot path
Market-data/venue-feed servicesM2M with declared SELECT grantsRe-keys feeds against the security master and identifiers
Business analystDashboard consumerViews securities, markets and corporate-action pages through Sentin8:Dash RFW

7. KPIs / Success Criteria​

  • Correctness: zero value drift across corporate-action adjustments (quantity × price preserved in raw ticks); entitlement snapshots match position records at record date.
  • Isolation: zero cross-environment reference-data leakage (the SQL matrix — no context, own env, cross env — passes on every table).
  • Read latency: security lookups answered from a single indexed query on env_id (no N+1 behavior, per-request limit ≤ 500).
  • Availability: the service boots and serves read traffic even when Sentin8:Bus or Sys is down (fail-open durability tasks keep retries local); liveness endpoint exposes in-flight count for zero-downtime upgrades.
  • Security posture: no BYPASSRLS role, no plaintext secrets, all authorization decided by Shield with the registered mirror set covering every endpoint gate (wiring tests prove coverage parity).
  • Throughput ceiling by design: low event volume (dozens of corporate actions per day) — correctness outranks throughput.

8. Dependencies & Reliance on Other Services​

RelianceWhy
Sentin8:AuthOnly identity issuer; JWKS verification, M2M client registration (DCR, cert-bound) for all five workloads
Sentin8:Policy (Shield)The step-5 authorization decision over the live effective scope set; policy sets and hot reload
Sentin8:DB (PostgreSQL 18, db exchange8)All persistence; RLS helpers; per-service role
Sentin8:BusEvent transport for the outbox relay (produce API, consumer groups, DLQ)
Sentin8:SysAudit ingest (POST /v1/audit), hostname resolution for the database-free TLS path
Sentin8:CronScheduling of corporate-action lifecycle transitions and calendar-driven work
Sentin8:Shell (sentin8 crate)Boot order, capped pool, health, middleware, policy-admin mount, relays, TLS library
Sentin8:DashRenders the RFW admin pages; Sentin8:BFF proxies all client traffic
Exchange8:SettlementDelivers cash/stock entitlements on the pay date
Exchange8:ClearingSource of position snapshots for entitlement modeling; position adjustments applied there

9. Acceptance Criteria​

  1. A tenant administrator can list securities for its environment, filtered by symbol/type/market, and create a security with unique symbol, existing currency, and precise scales — receiving a full projection response.
  2. A client holding only the order-reading scope can read securities but cannot create or change them (403 on write paths).
  3. A caller from another environment (or with no tenant context) sees zero rows and cannot insert — verified per table against the shipped schema.
  4. Every endpoint rejects bearer-less or wrongly-scoped calls with 401/403 and never touches the database on auth failure; errors are plain text and never leak SQL internals.
  5. Corporate-action math passes its property-style tests: split 2:1, reverse split 1:10, cash and stock dividends compute quantity, price and entitlement values exactly.
  6. The RFW admin surface serves icon-hex, POST-alias-friendly, scope-stamped page definitions (securities / markets / corporate-actions) that Sentin8:Dash can render; the matching data endpoints enforce the same decisions as the public routes.
  7. The policy set declared at registration covers every gate the handlers evaluate (including the Cron proxy-back transition action) and passes the enrollment dry-run; tenant-authored forbid rules override platform permits.
  8. Durability pairs behave to spec: every mutation writes the outbox envelope (payload-complete snapshot) + the audit journal row in the same transaction; outbox rows are produced with idempotency by row id and survive Bus outages; audit journal rows reach Sys and survive Sys outages.
  9. The Sentin8:Cron transition run advances only rows whose milestone date has passed, dedupes on (action id, target stage), and re-runs safely after a missed tick (retroactive advancement, each step audited).
  10. The service fails fast at boot against a wrong database or PostgreSQL below the required version, and upgrades drain in-flight requests via the health-payload connection count.

10. Open Business Questions​

  • The customer/location/contact/trader/capitalization master is table-complete but unexposed — which flows need those APIs first (onboarding, entitlements, capitalization checks) is a product call.
  • Who is the authoritative source for corporate-action announcements — manual admin entry, an external feed via Exchange8:VFeeds, or both — and with what review/approval workflow before actions become effective.
  • Reconciliation ownership for entitlement snapshots: Exchange8:RefData produces the ratio math and the record-date transition events; who owns the discrepancy report when snapshots diverge from the position ledger.
  • Tenant self-service: may environment admins author their own currencies, markets and books, or are those platform-curated catalogs per vertical.
  • Crypto corporate actions (forks, airdrops, staking rewards) are designed at the schema level (security_type='Crypto', asset_id) with no action-kind support yet — product timing undecided.
  • Hot-path caching of the security master for matching engines: acceptable staleness window and invalidation surface (MemBus state refresh vs event-driven re-key) is undecided.

Design attribution: exchange8:refdata and its underlying concepts were designed by Hamid Jahanzad Hamid@Jahanzad.com.