I am currently a PhD student focusing on research in The US Corporate Bond Market. Especially the financial microstructures of The US Corporate Bond Market.
I wrote a package of code to calculate the roundtrip spread with a similar logic from Goldstein and Hotchkiss 2020. The codes allow the dealers' to split orders, Match the Buy and Sell Orders for up to 60 days.
The Part of The Code To Clean Trace Academic Data is Obtained From Jens Dick-Nielsen Websites, How to clean ACADEMIC TRACE data.
Here is the Code: https://www.dropbox.com/s/2mdouky94g60938/MathTheRoundTripTrade.rar?dl=0
More modifications and regular updates will be added to make it more user-friendly.