APPLIED STUDY · ORIGINAL LESSON
Learning plan and prerequisites
Before you begin: Complete volume units, trade-count structure, corporate-action adjustments, VWAP and data-revision timing.
- Deduplicate executions and apply corrections by identifier
- Preserve then-available and revised aggregates separately
- Reconcile quantity, traded value and weighted price after each audit stage
Mechanism and interpretation
A volume capstone begins with a data contract: instrument and share class, quantity unit, venue coverage, session, timezone, eligible trade conditions, stable execution identifiers and revision handling. Derive analytical bars only after these choices are explicit. A repeated execution identifier with identical fields can be a retransmission rather than another trade. A correction message refers to an earlier record and should update its specified fields under the feed protocol rather than being counted as a fresh ordinary execution.
Keep an immutable raw-message record and a derived eligible-execution view. Log each duplicate removal, rejected malformed row and correction with its reason and availability timestamp. Then reconcile total quantity and total price-times-quantity value. Their ratio gives exact transaction VWAP for the eligible set. A then-available snapshot and a final corrected history can both be useful, but they answer different questions. A historical signal should not receive a correction before the correction was published.
Worked case — synthetic data
A synthetic stream has A at 09:30: ten shares at 100; B at 09:31: 20 at 101; an identical retransmission of B; C at 09:32: 30 at 102; D at 09:33: ordinary executed quantity -5 at 103; and E at 09:35: 15 at 104. A documented correction received at 09:34 replaces C's quantity with 25. Identifiers refer to the same instrument and venue, and D is explicitly an ordinary-trade row, not a signed correction message.
Naively summing every ordinary row gives quantity 90. Remove B's duplicate to get 70, reject the invalid negative ordinary quantity to get 75, then replace C's 30 with 25 to get final eligible volume 70. Final traded value is 1,000+2,020+2,550+1,560 = 7,130, giving VWAP approximately 101.8571. At 09:33, after duplicate and malformed-row handling but before the correction or E, the available valid set was A, B and original C: volume 60, value 6,080 and VWAP approximately 101.3333.
Context and failure modes
The order of a batch-cleaning explanation need not match message arrival, but a time-aware reconstruction must. Missing feed coverage also differs from verified absence of trades: a coverage alarm during an interval leaves its quantity unknown, not automatically zero. Reconcile against compatible source totals where available, while recognizing that trade-condition filters can create documented differences. A clean numeric total is insufficient if it combines inconsistent sessions, units or revised information unavailable at the modeled decision time.
Practice task
A second synthetic batch contains A: ten shares at 50; B: 20 at 51; an identical B retransmission; and C: 30 at 52. A documented replacement changes C's quantity to ten. Compute the deduplicated pre-correction quantity and value, final eligible quantity and value, final trade count and final VWAP. Assume no other eligible records.
Worked practice answer
Before the correction, the unique executions total 60 shares with value 500+1,020+1,560 = 3,080. Replacing C's quantity gives final volume 40 and value 500+1,020+520 = 2,040. There are three eligible execution identifiers, and final VWAP is 2,040/40 = 51. The duplicate and correction messages do not create extra unique trades. Preserve both aggregate versions with their information timestamps.