Cleaning Enhanced TRACE

The Enhanced TRACE feed of corporate-bond transactions is not analysis-ready as delivered: it is a record of messages, including reports that were later cancelled, corrected, or reversed, plus duplicate reports of inter-dealer trades. This appendix gives the routine that turns the raw feed into a clean series of executed trades. The tidyfinance package exposes it as a single function; the steps below are what it does. Use the R | Python toggle to switch.

The one-call version

trace_enhanced <- download_data(
  type = "wrds_trace_enhanced",
  cusips = cusips,
  start_date = start_date,
  end_date = end_date
)
trace_enhanced = tf.download_data(
    domain="wrds", dataset="trace_enhanced",
    cusips=cusips, start_date=start_date, end_date=end_date
)

What the cleaning does

The procedure matches and removes the messages that undo or amend earlier ones, in order:

What remains is a clean panel of executed corporate-bond trades — price, size, time, and side — suitable for computing yields, spreads, and liquidity measures. Because the logic is intricate and easy to get subtly wrong, it is packaged as a standalone routine that the TRACE and FISD chapter and the bond research chapters reuse.


Study notes following the Tidy Finance curriculum by Scheuch, Voigt, Weiss, and Frey. Prose is my own; the R/Python code is reproduced from the book's open-source source, licensed CC BY-NC-SA 4.0.