Hello Folks, I hope you can help, I am just an amateur trader, so forgive me for the dumb questions... I would like to build a strategy to buy/sell treasuries and backtest it. Questions: 1) among the many Python frameworks (Zipline, Qstrader, Backtrader, etc), is there anything that has already libraries/code written for fixed income securities? 2) Data... any good source for historical data for government bonds? Ideally not just US securities, but also other countries. I would love especially historical data on the yield curves. 3) Basic math question... given that the only historical data easily accessible is the 10Y yield, I can start backtesting the strategy with that. So let's say in the backtest my trade gets in when the 10Y yield was at 5% and exits when it was at 2%. Treating it as a zero coupon, is the gain the Present Value of the bond calculated with 5% yield and 10Y TTM minus PV at 2% and 10Y TTM, or am I missing something? thank you
Yahoo finance has free, long daily histories for several interest rates. Treasury Bill 13 Week (^IRX) Jan 02, 1960 Treasury Yield 5 Years (^FVX) Dec 31, 1961 Treasury Yield 10 Years (^TNX) Dec 31, 1961 Treasury Yield 30 Years (^TYX) Feb 13, 1977
for low frequency trader, you don’t need back tests, just understand the relationship between macro economic data and bond basis, you will be fine. and doesn’t matter you back test or not, you can’t compete with any ficc desks. express your view and trade your own rhythm.
For shorter holding periods (days - couple weeks) you can ignore the higher moments and use the yield changes, size it to some level of DV01 risk. For example you have $1000 of DV01 risk and yields move 3bps you can assume 3k pnl. For longer holding periods (weeks/months/yrs) you might want to find bond futures data as the carry roll down and convexity are mostly captured in the price of the future and the futures roll.