PINK Phases 1-4: E-anchored capital, atomic snapshot, sizer feedback, kernel hardening
Phase 1: account.py anchor_to_exchange, capital_source provenance, settle includes fees in capital delta. Phase 2: atomic snapshot swap, CH provenance DDL (08_provenance.sql), naive-UTC timestamps, ch_writer wait_for_async_insert=1 for all tables, head-of-line stuck-row logging at WARNING per 100 attempts. Phase 3: sizer feedback uses slot realized_pnl (not capital delta), FILL_SETTLED repairs slot-level PnL for price-less exit legs. Phase 4: resolve_slot returns Option<usize>, UNRESOLVED_SLOT diagnostic. bars_held clamped to max(0, ...) at row-build time.
This commit is contained in:
17
prod/clickhouse/pink/08_provenance.sql
Normal file
17
prod/clickhouse/pink/08_provenance.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- Phase 2: provenance columns (E-anchored capital, PnL source)
|
||||
-- Apply BEFORE deploying code that emits these fields.
|
||||
-- ALTER TABLE ... ADD COLUMN IF NOT EXISTS is idempotent.
|
||||
|
||||
ALTER TABLE dolphin_pink.account_events
|
||||
ADD COLUMN IF NOT EXISTS `capital_source` LowCardinality(String) DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS `account_event_seq` UInt64 DEFAULT 0;
|
||||
|
||||
ALTER TABLE dolphin_pink.status_snapshots
|
||||
ADD COLUMN IF NOT EXISTS `capital_source` LowCardinality(String) DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS `account_event_seq` UInt64 DEFAULT 0;
|
||||
|
||||
ALTER TABLE dolphin_pink.trade_events
|
||||
ADD COLUMN IF NOT EXISTS `pnl_source` LowCardinality(String) DEFAULT '';
|
||||
|
||||
ALTER TABLE dolphin_pink.trade_exit_legs
|
||||
ADD COLUMN IF NOT EXISTS `pnl_source` LowCardinality(String) DEFAULT '';
|
||||
Reference in New Issue
Block a user