Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 147.421% Drawdown 36.500% Expectancy 0 Net Profit 57.085% Sharpe Ratio 2.544 Probabilistic Sharpe Ratio 67.058% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 1.531 Beta 0 Annual Standard Deviation 0.602 Annual Variance 0.362 Information Ratio 1.838 Tracking Error 0.614 Treynor Ratio 17831.505 Total Fees $1.18 Estimated Strategy Capacity $470000000.00 |
import numpy as np import pandas as pd class JumpingBlackArmadillo(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 11, 4) self.SetCash(100000) self.symbol = self.AddEquity("TSLA", Resolution.Daily).Symbol self.equity_curve = pd.Series() def OnData(self, data): if not (data.ContainsKey(self.symbol) and data[self.symbol] is not None): return if not self.Portfolio.Invested: self.SetHoldings(self.symbol, 1) self.equity_curve = self.equity_curve.append(pd.Series(data[self.symbol].Price, index=[data.Time])) self.Plot('Drawdown Percent', 'Current', self.current_drawdown_percent(self.equity_curve)) max_dd_percent = self.max_drawdown_percent(self.equity_curve) if not np.isnan(max_dd_percent): self.Plot(f'Drawdown Percent', 'Max', max_dd_percent) def current_drawdown_percent(self, equity_curve): hwm = max(equity_curve) current = equity_curve[-1] return (hwm - current) / hwm * 100 def max_drawdown_percent(self, equity_curve): i = np.argmax(np.maximum.accumulate(equity_curve) - equity_curve) if equity_curve[:i].size == 0: return np.nan j = np.argmax(equity_curve[:i]) return abs((equity_curve[i]/equity_curve[j]) - 1) * 100