| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 49.195% Drawdown 52.800% Expectancy 0 Net Profit 132.823% Sharpe Ratio 0.886 Probabilistic Sharpe Ratio 42.660% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.49 Beta -0.245 Annual Standard Deviation 0.522 Annual Variance 0.273 Information Ratio 0.648 Tracking Error 0.547 Treynor Ratio -1.887 Total Fees $1.56 |
class DynamicVentralAntennaArray(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 1, 1) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol
self.tsla = self.AddEquity("TSLA", Resolution.Daily).Symbol
# Set Benchmark
self.SetBenchmark("SPY")
# Variable to hold the last calculated benchmark value
self.lastBenchmarkValue = None
# Our inital benchmark value scaled to match our portfolio
self.BenchmarkPerformance = self.Portfolio.TotalPortfolioValue
def OnData(self, data):
# store the current benchmark close price
benchmark = self.Securities["SPY"].Close
# enter our strategy
if not self.Portfolio.Invested:
self.SetHoldings("TSLA", 1)
# Calculate the performance of our benchmark and update our benchmark value for plotting
if self.lastBenchmarkValue is not None:
self.BenchmarkPerformance = self.BenchmarkPerformance * (benchmark/self.lastBenchmarkValue)
# store today's benchmark close price for use tomorrow
self.lastBenchmarkValue = benchmark
# make our plots
self.Plot("Strategy vs Benchmark", "Portfolio Value", self.Portfolio.TotalPortfolioValue)
self.Plot("Strategy vs Benchmark", "Benchmark", self.BenchmarkPerformance)