| Overall Statistics |
|
Total Trades 3 Average Win 0% Average Loss -16.27% Compounding Annual Return 11.673% Drawdown 22.400% Expectancy -1 Net Profit 3.758% Sharpe Ratio 0.551 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.348 Beta -9.682 Annual Standard Deviation 0.272 Annual Variance 0.074 Information Ratio 0.475 Tracking Error 0.272 Treynor Ratio -0.015 Total Fees $7.50 |
class BootCampTask(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 12, 1) # Set Start Date
self.SetEndDate(2019, 4, 1) # Set End Date
self.SetCash(100000) # Set Strategy Cash
# Subscribe to SPY
self.AddSecurity(SecurityType.Equity,"SPY", Resolution.Daily)
def OnData(self, data):
if not self.Portfolio.Invested:
# Create market order for some units of SPY
self.MarketOrder("SPY", 500)
# Create stop loss through a stop market order
self.StopMarketOrder("SPY", -500, 0.9 * self.Securities["SPY"].Close)