PositionEvent schema + action enum (Buy/Sell/Close, unsigned volume) #114
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix the canonical Rust representation of C10's derived position-event table, living in
aura-enginealongsideRunMetrics/ColumnarTrace(it is a post-run reduction, same home assummarize):event_ts: Timestampaction: i64— Buy / Sell / Close (a closed three-value enum mapped to i64). Direction IS the action, volume is unsigned — no signed-volume trick (ledger-forbidden).position_id: i64(monotonic, assigned at open)instrument_id: i64volume: f64(lots, unsigned)Pin the serde shape and the i64 action encoding. A
Closereferences an existingposition_idand may be partial via its ownvolume. Oneevent_tsmay carry >1 row (a reversal emits Close then open at the sameevent_ts) — document close-before-open ordering. Noopen_tsstored (it is the opening event'sevent_ts; ledger-forbidden to store it). No friction logic here — pure schema.depends on: nothing
context: every downstream piece (derivation, broker audit, persistence) wires to this shape; pinning it stops column-order/encoding disagreement (the silent-wiring hazard SimBroker's load-bearing slot order already warns about).
Delivered in cycle 0063 (commit
b91c89f): PositionAction { Buy, Sell, Close } + PositionEvent live in aura-engine beside RunMetrics (crates/aura-engine/src/report.rs:220-267), serde-encoded as a bare i64 0/1/2 via From/TryFrom (out-of-range rejected on read), with the reversal-at-same-event_ts round-trip pinned in crates/aura-engine/tests/position_event_table.rs. Acceptance met; the delivering commit used refs not closes, so the issue stayed open. Closing as done.