Overall Statistics
Total Orders
1968
Average Win
1.01%
Average Loss
-1.17%
Compounding Annual Return
15.316%
Drawdown
65.500%
Expectancy
0.100
Start Equity
100000
End Equity
193129.25
Net Profit
93.129%
Sharpe Ratio
0.466
Sortino Ratio
0.465
Probabilistic Sharpe Ratio
7.978%
Loss Rate
41%
Win Rate
59%
Profit-Loss Ratio
0.86
Alpha
0.106
Beta
1.624
Annual Standard Deviation
0.517
Annual Variance
0.267
Information Ratio
0.358
Tracking Error
0.442
Treynor Ratio
0.148
Total Fees
$9262.77
Estimated Strategy Capacity
$630000.00
Lowest Capacity Asset
RY R735QTJ8XC9X
Portfolio Turnover
23.56%
# region imports
from AlgorithmImports import *
# endregion


class LeveragedCopyCongressAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2020, 1, 1)
        self.set_cash(100000)
        self._universe = self.add_universe(
            QuiverQuantCongressUniverse, 
            lambda constituents: [c.symbol for c in constituents if c.transaction == OrderDirection.BUY]
        )
        spy = Symbol.create('SPY', SecurityType.EQUITY, Market.USA)
        self.schedule.on(self.date_rules.week_start(spy), self.time_rules.after_market_open(spy, 30), self._trade)

    def _trade(self):
        if self._universe.selected is None: return
        symbols = [s for s in self._universe.selected if s in self.securities and self.securities[s].price]
        if len(symbols) == 0: return
        weight = 1.5 / len(symbols)
        targets = [PortfolioTarget(symbol, weight) for symbol in symbols]
        self.set_holdings(targets, True)