Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-4.147
Tracking Error
0.062
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
"""
The high-yield spread is simply the difference between
the borrowing rate for below-investment-grade corporate bonds
and a treasury bond measure. This analysis uses the Barclays
Corporate High Yield Index minus the 10-Year Treasuries Yield
"""
#https://seekingalpha.com/article/4434713-sector-rotation-strategy-using-the-high-yield-spread
#https://seekingalpha.com/article/4394646-this-sector-rotation-strategy-made-17-percent-year-since-1991

class FredAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2021, 8, 1)
        self.AddData(Fred, Fred.ICEBofAML.USHighYieldMasterIIOptionAdjustedSpread)
        
        
    def OnData(self, data):
        # Accessing via Slice event
        interventions = data.Get(Fred)
            
        for intervention in interventions.Values:
            self.Log(f"Value: {intervention.Value}")   #single value example
            
        # Request 60 days of intervention in market transactions history with the interventions Symbol
        hist = self.AddData(Fred, Fred.ICEBofAML.USHighYieldMasterIIOptionAdjustedSpread).Symbol
        interventionsHistory = self.History(Fred, hist, 60, Resolution.Daily)