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 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
class UncoupledParticleEngine(QCAlgorithm): def Initialize(self): self.SetStartDate(2015, 1, 1) # Set Start Date self.SetEndDate(2015, 7, 1) # Set End Date self.SetCash(100000) # Set Strategy Cash self.AddEquity("SPY", Resolution.Minute) # self.AddEquity("SPY", Resolution.Minute) self.rsi = self.RSI("SPY", 10, MovingAverageType.Simple, Resolution.Daily) # set a warm-up period to initialize the indicator self.SetWarmUp(timedelta(20)) # Warm-up the indicator with bar count # self.SetWarmUp(10, Resolution.Daily) def OnData(self, data): ## You can access the TradeBar dictionary in the slice object and then subset by symbol ## to get the TradeBar for SPY if data.Bars.ContainsKey("SPY"): spyTradeBar = data.Bars['SPY'] spyOpen = spyTradeBar.Open ## Open price spyClose = spyTradeBar.Close ## Close price # if not self.Portfolio.Invested: # self.SetHoldings("SPY", 1) else: self.Debug(f"On time >> {self.Time} :: Tradebar does not contain SPY!") ## Condition to see if SPY is in the Dividend DataDictionary if data.Dividends.ContainsKey("SPY"): ## Log the dividend distribution self.Debug(f"On time >> {self.Time} :: SPY paid a dividend of {data.Dividends['SPY'].Distribution}")