Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
import numpy as np import pandas as pd from collections import deque class QuantumOptimizedPrism(QCAlgorithm): def Initialize(self): '''Look back for breakout''' self.Lookback = 160 self.SetBrokerageModel(BrokerageName.Binance, AccountType.Cash) self.SetCash(50000) self.symbolList = [ "BUSDUSDT", "BTCUSDT", "ETHUSDT", "ETHBTC", "BNBUSDT"] #"USDTUSD","BCHUSDT", "ATOMTUSDT", "BCHBNB", "BTCBNB","ETHBNB","DOGEBTC", "ADABNB" self.rollingWindow = {} self.weights = {} self.flashcheck = {} for name in self.symbolList: self.AddCrypto(name, Resolution.Hour, Market.Binance) self.rollingWindow["close_top_{0}".format(name)] = deque(maxlen=self.Lookback) self.weights[name] = 0.5 self.flashcheck[name] = 0 self.SetStartDate(2021, 1, 5) self.SetBenchmark("BTCUSDT") self.SetWarmUp(self.Lookback) #self.Schedule.On(self.DateRules.EveryDay("BTCUSD"), self.TimeRules.Every(timedelta(minutes=480)), self.Rebalance) #self.Notify.Sms("17574091415", ("Hello Apollos, The Cryptocurrency Trading Algorithm was relaunched (7/29/2020) to fix the SMS Text message bug. I am now live trading again!!")) #self.Notify.Sms("12409972566", ("Howdy Steve, The Cryptocurrency Algorithm was relaunched (7/29/2020) to fix the SMS Text message bug. I am now live trading again!!")) def OnData(self, data): #if not self.rollingWindow.empty '''The data is bugged on this day for BTC''' if self.Time.day == 10 and self.Time.month == 8 and self.Time.year == 2018: return if self.IsWarmingUp: return for symbol in self.symbolList: sym_price = data[symbol].Price stop = self.flashcrashcheck(symbol, sym_price) self.rollingWindow["close_top_{0}".format(symbol)].appendleft(sym_price) if not self.IsWarmingUp and not stop: top, bot = self.indicator(symbol) if sym_price >= top: self.SetHoldings(symbol, self.weights[symbol]) elif sym_price <= bot: self.SetHoldings(symbol, 0) else: pass ''' def Rebalance(self): self.SetHoldings("BTCUSD", 0.40) #self.SetHoldings("ETHUSD", 0.25) #self.SetHoldings("ETHBTC", -0.18) self.SetHoldings("BCHBTC", 0.25) self.SetHoldings("BCHUSD", -0.25) ''' def OnOrderEvent(self, orderEvent): self.Log("{} {}".format(self.Time, orderEvent.ToString())) self.Notify.Sms("17574091415", ("Apollos, I just ordered these Crypto for you today: " + str(orderEvent) + " and Total Unrealized Profit is: " + str(self.Portfolio.TotalUnrealisedProfit))) #self.Notify.Sms("12409972566", ("Steve, I just ordered these Crypto for you today: " + str(orderEvent) + " and Total Unrealized Profit is: " + str(self.Portfolio.TotalUnrealisedProfit))) #order = self.Transactions.GetOrderById(orderEvent.OrderId) #if orderEvent.Status == OrderStatus.Invalid: