| Overall Statistics |
|
Total Orders 2 Average Win 0% Average Loss 0% Compounding Annual Return 7.522% Drawdown 23.500% Expectancy 0 Start Equity 100000 End Equity 154507.17 Net Profit 54.507% Sharpe Ratio 0.374 Sortino Ratio 0.358 Probabilistic Sharpe Ratio 7.368% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.009 Beta 0.675 Annual Standard Deviation 0.113 Annual Variance 0.013 Information Ratio -0.591 Tracking Error 0.057 Treynor Ratio 0.063 Total Fees $4.66 Estimated Strategy Capacity $2100000.00 Lowest Capacity Asset BND TRO5ZARLX6JP Portfolio Turnover 0.05% Drawdown Recovery 190 |
# region imports
from AlgorithmImports import *
# endregion
class StockBondAllocationAlgorithm(QCAlgorithm):
"""
Static allocation between equities and bonds.
"""
def initialize(self):
# keep in mind data snooping bias:
# always leave some (typically more recent) time period for testing!
self.set_start_date(2017, 1, 1)
self.set_end_date(2022, 12, 31)
self.add_equity("SPY", Resolution.MINUTE)
self.add_equity("BND", Resolution.MINUTE)
self.settings.daily_precise_end_time = False
def on_data(self, data):
if not self.portfolio.invested:
self.set_holdings("SPY", 0.6)
self.set_holdings("BND", 0.4)