Overall Statistics |
Total Trades 4 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic 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 $4.00 Estimated Strategy Capacity $350000.00 Lowest Capacity Asset SGBX WLLX3R3P31PH |
class MinimalSGBX(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 4, 1) # Set Start Date self.SetEndDate(2020,4, 2) self.SetCash(100000) # Set Strategy Cash self.sgbx = self.AddEquity("SGBX", Resolution.Minute) self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.BeforeMarketClose("SGBX", 1), self.ClosingBar) self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen("SGBX", 2), self.OpeningBar) def LogBar(self, bar): return f"O: {bar.Open}, H: {bar.High}, L: {bar.Low}, C: {bar.Close}, V: {bar.Volume}" def OnData(self, data): tradeBars = data.Bars sgbxTradeBar = tradeBars['SGBX'] self.Log(f"OnData {self.Time} {self.LogBar(sgbxTradeBar)}") def ClosingBar(self): self.Log(f"##### Close {self.Time}") if self.Portfolio.Invested: self.Liquidate() def OpeningBar(self): self.Log(f"##### Open {self.Time}") current_price = self.Securities[self.sgbx.Symbol].Price self.Log(f"{self.Time}: Open@{current_price}") # put in short order - if the price goes above 9.30 then liquidate the position self.MarketOrder(self.sgbx.Symbol, -10) self.StopMarketOrder(self.sgbx.Symbol, 10, 9.30)