Overall Statistics |
Total Trades 312 Average Win 29.28% Average Loss -1.77% Compounding Annual Return 61.030% Drawdown 38.100% Expectancy 7.766 Net Profit 159.983% Sharpe Ratio 1.014 Probabilistic Sharpe Ratio 31.022% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 16.53 Alpha 0.507 Beta 0.059 Annual Standard Deviation 0.57 Annual Variance 0.324 Information Ratio -0.752 Tracking Error 0.817 Treynor Ratio 9.787 Total Fees $4403.77 Estimated Strategy Capacity $17000.00 Lowest Capacity Asset MATICUSD 2MN |
#https://www.quantconnect.com/docs/v2/our-platform/tutorials/live-trading/brokerages/ftx to check class MovingAverageCrossAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2022, 1, 1) self.SetCash('USD',1000000) self.SetBrokerageModel(BrokerageName.FTX, AccountType.Cash) self.tickers = ["BTCUSD", "ETHUSD", "SOLUSD", "DOGEUSD", "MATICUSD", "XRPUSD", "YFIUSD"] self.symbols = [self.AddCrypto(ticker, Resolution.Minute, Market.FTX).Symbol for ticker in self.tickers] self.fast = {} self.slow = {} for symbol in self.symbols: self.fast[symbol] = self.SMA(symbol, 20, Resolution.Hour) self.slow[symbol] = self.SMA(symbol, 200, Resolution.Hour) self.SetWarmUp(200, Resolution.Hour) self.SetTimeZone("Europe/London") #self.SetBrokerageModel(BrokerageName.FTX, AccountType.Cash) def OnData(self, data): if self.IsWarmingUp: return for symbol in self.symbols: holdings = self.Portfolio[symbol].Quantity #self.Plot("holdings", symbol, holdings) for symbol in self.symbols: if not self.fast[symbol].IsReady: continue if not self.slow[symbol].IsReady: continue fast = self.fast[symbol].Current.Value slow = self.slow[symbol].Current.Value #self.Plot(symbol, "fast", fast) #self.Plot(symbol, "slow", slow) if fast > slow and self.Portfolio[symbol].Quantity <= 0: usdTotal = self.Portfolio.CashBook["USD"].Amount usdReserved = sum(x.Quantity * x.LimitPrice for x in [x for x in self.Transactions.GetOpenOrders() if x.Direction == OrderDirection.Buy and x.Type == OrderType.Limit]) usdAvailable = usdTotal - usdReserved self.Debug("usdAvailable: {}".format(usdAvailable)) limitPrice = self.Securities[symbol].Price #size for each crypto to be equally weighted quantity = (usdAvailable * 1/len(self.tickers))/limitPrice self.LimitOrder(symbol, quantity, limitPrice) elif fast < slow and self.Portfolio[symbol].Quantity > 0: #self.Liquidate(symbol)#, 0.8/len(self.symbols)) self.SetHoldings(symbol, 0)