download_wrds.process_trace_data()

Clean Enhanced TRACE trade reports.

Usage

Source

download_wrds.process_trace_data(trace_all)

Applies the Dick-Nielsen cleaning protocol to the raw Enhanced TRACE message stream, removing cancellations, corrections, and reversals and producing one observation per executed corporate bond trade.

Parameters

trace_all: pl.DataFrame
Raw Enhanced TRACE messages with the message-status columns used by the cleaning protocol (‘trc_st’, ‘msg_seq_nb’, ‘orig_msg_seq_nb’, ‘trd_rpt_dt’, ‘trd_rpt_tm’, ‘trd_exctn_dt’, ‘trd_exctn_tm’, ‘cusip_id’, ‘entrd_vol_qt’, ‘rptd_pr’, ‘rpt_side_cd’, ‘cntra_mp_id’, ‘asof_cd’).

Returns

pl.DataFrame
Cleaned trade panel containing only executed trades with cancellations, corrections, and reversals already removed.

Notes

Trades are cleaned under two regimes split by 2012-02-06, the date the Enhanced TRACE message-status format changed. Trades reported on or after this cutoff are cleaned with the post-2012 logic (status flags ‘T’, ‘R’, ‘X’, ‘C’, ‘Y’); earlier trades use the pre-2012 logic (status flags ‘T’, ‘C’, ‘W’ plus ‘asof_cd’ reversals). The cutoff date follows Dick-Nielsen (2014).

References

Dick-Nielsen, J. (2009). Liquidity biases in TRACE. Journal of Fixed Income, 19(2), 43-55. https://doi.org/10.3905/jfi.2009.19.2.043

Dick-Nielsen, J. (2014). How to clean enhanced TRACE data. Working Paper. https://ssrn.com/abstract=2337908