Overall Statistics |
Total Orders 71 Average Win 4.32% Average Loss -2.45% Compounding Annual Return 5.646% Drawdown 32.800% Expectancy 0.105 Start Equity 100000 End Equity 108105.86 Net Profit 8.106% Sharpe Ratio 0.202 Sortino Ratio 0.253 Probabilistic Sharpe Ratio 14.750% Loss Rate 60% Win Rate 40% Profit-Loss Ratio 1.76 Alpha 0.097 Beta -0.332 Annual Standard Deviation 0.279 Annual Variance 0.078 Information Ratio -0.164 Tracking Error 0.406 Treynor Ratio -0.17 Total Fees $599.05 Estimated Strategy Capacity $320000000.00 Lowest Capacity Asset AAPL R735QTJ8XC9X Portfolio Turnover 12.82% |
from AlgorithmImports import * from QuantConnect.DataSource import * class QuiverCongressDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2019, 1, 1) self.set_end_date(2020, 6, 1) self.set_cash(100000) # Requesting data aapl = self.add_equity("AAPL", Resolution.DAILY).symbol quiver_congress_symbol = self.add_data(QuiverCongress, aapl).symbol # Historical data history = self.history(QuiverCongress, quiver_congress_symbol, 60, Resolution.DAILY) self.debug(f"We got {len(history)} items from our history request"); def on_data(self, slice: Slice) -> None: congress_by_symbol = slice.Get(QuiverCongress) # Determine net direction of Congress trades for each security net_quantity_by_symbol = {} for symbol, points in congress_by_symbol.items(): symbol = symbol.underlying if symbol not in net_quantity_by_symbol: net_quantity_by_symbol[symbol] = 0 for point in points: net_quantity_by_symbol[symbol] += (1 if point.transaction == OrderDirection.BUY else -1) * point.amount for symbol, net_quantity in net_quantity_by_symbol.items(): if net_quantity == 0: self.liquidate(symbol) continue # Buy when Congress members have bought, short otherwise self.set_holdings(symbol, 1 if net_quantity > 0 else -1)