Overall Statistics |
Total Orders 778 Average Win 0.52% Average Loss 0% Compounding Annual Return 27.736% Drawdown 1.700% Expectancy 0 Start Equity 100000 End Equity 100515.51 Net Profit 0.516% Sharpe Ratio 2.125 Sortino Ratio 1.831 Probabilistic Sharpe Ratio 56.856% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0.087 Annual Variance 0.008 Information Ratio 2.384 Tracking Error 0.087 Treynor Ratio 0 Total Fees $4.79 Estimated Strategy Capacity $33000000.00 Lowest Capacity Asset QQQ RIWIV7K5Z9LX Portfolio Turnover 24.82% |
''' Usage: def Initialize(self): self.log = Log(self) # code xxxxxx self.log.log("---->1") ''' from AlgorithmImports import * import time class Log(AlphaModel): def __init__(self, algo): self.timer = round(time.time() * 1000) self.algo = algo self.maxLine = 200 self.count = 0 def log(self, message): self.algo.Log(f"[LOG] {message}") def info(self, message): now = round(time.time() * 1000) timer = (now - self.timer) / 1000 self.timer = now if (self.algo.Time <= self.algo.Time.replace(hour=9, minute=35)): self.algo.Log(f"[INFO] {message}") def debug(self, message): if self.count < self.maxLine: self.algo.Log(f"[DEUBG] {message}") self.count += 1
# region imports from AlgorithmImports import * from log import * # endregion class IB00(QCAlgorithm): def initialize(self): # Locally Lean installs free sample data, to download more data please visit https://www.quantconnect.com/docs/v2/lean-cli/datasets/downloading-data self.set_start_date(2020, 1, 1) # Set Start Date self.set_end_date(2020, 1, 8) # Set Start Date self.set_cash(100000) # Set Strategy Cash self.add_equity("QQQ", Resolution.MINUTE) self.log = Log(self) self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash) self.settings.rebalance_portfolio_on_insight_changes = True self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel()) self.SetExecution(ImmediateExecutionModel()) def on_data(self, data: Slice): if not self.portfolio.invested: self.emit_insights(Insight.price("QQQ", timedelta(days=4), InsightDirection.UP))