|
| 1 | +# Platform Notification Outcomes |
| 2 | + |
| 3 | +Platform runtimes should use the shared execution outcome and notification |
| 4 | +envelope helpers in `quant_platform_kit` instead of defining private stage or |
| 5 | +notification sink semantics in each repository. |
| 6 | + |
| 7 | +## Execution Stages |
| 8 | + |
| 9 | +`quant_platform_kit.common.execution_outcomes` defines the shared strategy-run |
| 10 | +stages used by platform persistence, API responses, logs, and notifications: |
| 11 | + |
| 12 | +| Stage | Terminal | Meaning | |
| 13 | +| --- | --- | --- | |
| 14 | +| `ORDERS_PLANNED` | No | A plan was built before execution. | |
| 15 | +| `DRY_RUN_COMPLETED` | No | Dry-run execution finished without live orders. | |
| 16 | +| `NO_ACTION` | No | Live cycle completed with no order needed. | |
| 17 | +| `SUBMITTED` | Yes | One or more live orders were submitted. | |
| 18 | +| `EXECUTION_BLOCKED` | No | No order was submitted because of a retryable execution blocker. | |
| 19 | +| `PARTIAL_SUBMITTED` | No | Some orders were submitted, but at least one execution blocker remains. | |
| 20 | +| `FUNDING_BLOCKED` | Yes | No order was submitted because available cash cannot buy the required whole share. | |
| 21 | +| `RECONCILED` | Yes | A submitted run was reconciled by a platform-specific process. | |
| 22 | +| `COMPLETED` | Yes | A run was marked complete by a platform-specific process. | |
| 23 | + |
| 24 | +Terminal stages block duplicate live order submission for the same |
| 25 | +account/profile/period. Non-terminal execution blockers can be retried by the |
| 26 | +platform scheduler while the strategy execution window remains open. |
| 27 | + |
| 28 | +## Skip Reasons |
| 29 | + |
| 30 | +The shared helper treats these skip reasons as execution blockers by default: |
| 31 | + |
| 32 | +- `buy_quantity_zero` |
| 33 | +- `insufficient_cash_for_whole_share` |
| 34 | +- `quote_unavailable` |
| 35 | +- `sell_quantity_zero` |
| 36 | + |
| 37 | +`insufficient_cash_for_whole_share` is a terminal funding block when it is the |
| 38 | +only blocking reason and no live order was submitted. This keeps logs and |
| 39 | +notifications explicit without repeatedly retrying the same underfunded run. |
| 40 | + |
| 41 | +## Notification Envelope |
| 42 | + |
| 43 | +`quant_platform_kit.notifications.events` provides: |
| 44 | + |
| 45 | +- `RenderedNotification(detailed_text, compact_text)` |
| 46 | +- `NotificationPublisher(log_message, send_message)` |
| 47 | +- `publish_rendered_notification(...)` |
| 48 | + |
| 49 | +Platform renderers may keep broker-specific layout and order details, but they |
| 50 | +should publish through the shared envelope so logs and user notifications have a |
| 51 | +consistent delivery contract. |
| 52 | + |
| 53 | +## Platform Responsibilities |
| 54 | + |
| 55 | +Platform repositories should: |
| 56 | + |
| 57 | +- use shared stage constants and stage resolution helpers |
| 58 | +- include the resolved stage in persisted run state and API responses |
| 59 | +- render execution blockers consistently in logs and notifications |
| 60 | +- keep broker-specific order payloads, account labels, and transport wiring local |
| 61 | +- avoid documenting deployment-specific live strategy selections in public docs |
0 commit comments