Overall Statistics |
Total Orders 80 Average Win 7.36% Average Loss -1.78% Compounding Annual Return 15.094% Drawdown 33.600% Expectancy 2.558 Start Equity 1000000 End Equity 5272512.05 Net Profit 427.251% Sharpe Ratio 0.675 Sortino Ratio 0.69 Probabilistic Sharpe Ratio 16.537% Loss Rate 31% Win Rate 69% Profit-Loss Ratio 4.12 Alpha 0.009 Beta 0.997 Annual Standard Deviation 0.141 Annual Variance 0.02 Information Ratio 0.396 Tracking Error 0.023 Treynor Ratio 0.095 Total Fees $8113.60 Estimated Strategy Capacity $1300000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 1.03% |
# region imports from AlgorithmImports import * # endregion class Ebayholiday(QCAlgorithm): _christmas_eve = [ datetime(2012, 12, 26), datetime(2013, 12, 26), datetime(2014, 12, 26), datetime(2015, 12, 26), datetime(2016, 12, 26), datetime(2017, 12, 26), datetime(2018, 12, 26), datetime(2019, 12, 26), datetime(2020, 12, 26), datetime(2021, 12, 26), datetime(2022, 12, 26), datetime(2023, 12, 26), # ... ] _decemeber = [ ] def initialize(self): # Locally Lean installs free sample data, to download more data please visit https://www.quantconnect.com/docs/v2/lean-cli/datasets/downloading-data self.set_start_date(2012, 10, 7) # Set Start Date self.set_end_date(2024, 10, 11) # Set End Date self.set_cash(1000000) # Set Strategy Cash self._spy = self.add_equity("SPY", Resolution.DAILY) self._ebay = self.add_equity("EBAY", Resolution.DAILY) self._etsy = self.add_equity("ETSY", Resolution.DAILY) for holidays in [self._christmas_eve]: for holiday in holidays: # Hold AMZN before the holiday. self.schedule.on( self.date_rules.on(self._spy.exchange.hours.get_next_market_close(holiday - timedelta(30), False)), self.time_rules.before_market_close(self._spy.symbol, 1), lambda: self.set_holdings([PortfolioTarget(self._ebay.symbol, 0.3),PortfolioTarget(self._etsy.symbol, 0.7)], True) ) # Hold SPY after the holiday. self.schedule.on( self.date_rules.on(self._spy.exchange.hours.get_next_market_close(holiday + timedelta(1), False)), self.time_rules.before_market_close(self._spy.symbol, 1), lambda: self.set_holdings([PortfolioTarget(self._spy.symbol, 1)], True) ) def on_data(self, data: Slice): """on_data event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data """ if not self._spy.holdings.invested: self.set_holdings("SPY", 1) self.debug("Purchased Stock") if self._ebay.holdings.invested: self.liquidate(self._ebay.symbol) self.liquidate(self._etsy.symbol) self._contract_symbol = None