| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 14.043% Drawdown 33.700% Expectancy 0 Net Profit 52.415% Sharpe Ratio 0.754 Probabilistic Sharpe Ratio 29.745% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 1 Annual Standard Deviation 0.225 Annual Variance 0.051 Information Ratio -0.845 Tracking Error 0 Treynor Ratio 0.17 Total Fees $19.57 Estimated Strategy Capacity $57000000.00 |
from math import floor
class BootCampTask(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 1, 4) # Set Start Date
self.SetEndDate(2021, 3, 20) # Set End Date
#self.SetEndDate(2018, 1, 5) # Set End Date
self.SetCash(1000000) # Set Strategy Cash
self.spy = self.AddEquity("SPY", Resolution.Minute)
def OnData(self, data):
#self.order = floor(self.Portfolio.Cash/self.spy.Symbol.AskPrice)
#3. Place an order for 100 shares of IWM and print the average fill price
#4. Debug the AveragePrice of IWM
order= floor(self.Portfolio.Cash/self.Securities["SPY"].Price)
if not self.Portfolio.Invested:
#self.SetHoldings("SPY", 1)
self.MarketOrder("SPY", order)
self.Debug(str(self.Portfolio["SPY"].AveragePrice))