103: EMC Perps: propagate Phoenix TWAP warnings through the tree to Perpetual Contracts

This commit is contained in:
2026-10-26 06:38:53 +01:00
parent e71a8daa8d
commit cfb49ed896
22 changed files with 797 additions and 7696 deletions
+14 -3
View File
@@ -85,17 +85,28 @@ Each venue SHALL carry its last-success time and whether the latest attempt fail
- **THEN** its previous observations remain available with their original success time and failure indication
### Requirement: TWAP observations belong to existing filled positions
The service SHALL publish immutable TWAP observations only on matching existing Phoenix positions whose order has a positive actual fill and remaining executions. It SHALL preserve counters, quantities, nullable price and observation/estimated times without UI formatting. No new position SHALL be synthesized. TWAP errors SHALL retain the complete prior venue observation with failure status. Polling frequency SHALL remain unchanged.
The service SHALL publish immutable TWAP observations on matching existing Phoenix positions whose order has a positive actual fill and remaining executions, and account-owned warnings for eligible unresolved orders. It SHALL preserve counters, quantities, nullable price and observation/estimated times without UI formatting. No new position SHALL be synthesized. TWAP errors SHALL retain the complete prior venue observation with failure status. Polling frequency SHALL remain unchanged.
#### Scenario: Unfilled order or no position
- **WHEN** an active TWAP has no actual fills or has no matching open position
- **THEN** it is absent from every overview row and cannot create a visible venue
- **WHEN** an active TWAP has no actual fills or no matching open position
- **THEN** a zero-fill order is absent from every overview row and cannot create a visible venue
- **AND** an eligible filled outstanding order without a position is preserved as a warning on its actual account scope
#### Scenario: TWAP read fails
- **WHEN** the TWAP read fails after a successful venue observation
- **THEN** prior positions, TWAP observations and original timestamps remain with failed venue status
- **AND** other venues and wallets continue refreshing
#### Scenario: Filled order without position
- **WHEN** a filled outstanding order cannot match an open position
- **THEN** its warning retains the real account identity and Cross accounts remain present even without capital or positions
- **AND** warning-only data does not synthesize positions or valuations
#### Scenario: Warning recovery and retention
- **WHEN** a successful observation resolves or removes a warned order
- **THEN** its warning is cleared while unrelated warnings remain
- **AND** failed reads instead retain warnings and their original times
### Requirement: Risk observations preserve scope and exact meaning
Snapshots SHALL preserve isolated risk prices and Cross account tiers/thresholds with original observation times. Signed price distance SHALL use the current venue reference as denominator and preserve boundary crossing. Cross MM utilization SHALL use effective collateral, with nonpositive denominators unavailable. Group risk SHALL count each isolated position and shared account once and retain worst known severity plus unknown/stale counts without averaging.