My journal used to hold trades, meaning entries and exits. What it didn't hold was everything that happened in between: orders sent, modified, partly filled, cancelled. That middle part is where a lot of my execution problems were hiding. So my order tool now writes every event to a CSV, and the review works from that file.
## The schema (one row per event)
- ts_et: timestamp in ET, to the millisecond if the API gives it
- symbol
- order_id and parent_id (for bracket children)
- event: SENT, ACK, PARTIAL, FILLED, MODIFIED, CANCEL_SENT, CANCELLED, REJECTED
- side, qty, price (limit or stop price), and filled_qty and avg_fill_price where relevant
- reason: a short tag I choose when I send or modify, for example ENTRY_ORB, STOP_TIGHTEN or MANUAL_EXIT
- quote_bid and quote_ask at the moment of the event, from my own feed
## Rails
- The logger writes before the order goes out and again on every callback. If the write fails, the order doesn't go out.
- Every day gets its own file. Files are never edited, only appended to.
- The review script calculates three things per trade: time from SENT to FILLED, the number of MODIFIED events, and fill price against the quote at SENT.
## Worked example (illustrative)
One trade from the log, lightly abbreviated:
10:31:05.120 SENT buy 300 @ 22.41 ENTRY_VWAP (quote 22.39 × 22.41)
10:31:05.410 PARTIAL 100 @ 22.41
10:31:07.900 MODIFIED price 22.43 (reason MANUAL_CHASE)
10:31:08.050 FILLED 300 avg 22.423
From SENT to FILLED took about 2.9 seconds. There's one MODIFIED, and it's tagged as a chase. The fill came in about 1.3 cents above the offer at SENT. The trade itself was a 9-cent winner, and the journal would only have shown that. The log shows I chased by 2 cents to get the last 200 shares. That's worth knowing even on a winner.
## Failure modes
- Logging only fills, which leaves out everything that explains them.
- Free-text reason fields. Six months later I can't group them. Tags come from a fixed list.
- Relying on the platform's own trade history, which often drops cancels and modifications.
## When to skip
- If the logger can't open today's file at startup, the order tool doesn't start.
- Manual orders placed outside the tool don't get logged, so I keep those to emergencies and note them by hand.
Diagram: a flow from the order tool to the CSV file with event tags (SENT, PARTIAL, MODIFIED, FILLED) as boxes along an arrow, and a review script box reading the file.
Logging every order event to CSV: a minimal schema for scalp review
Logging every order event to CSV: a minimal schema for scalp review
- Attachments
-
- 23-diagram.png (18.85 KiB) Viewed 57 times