Overall Statistics |
Total Trades 129 Average Win 11.27% Average Loss -5.02% Compounding Annual Return 84.273% Drawdown 40.000% Expectancy 1.128 Net Profit 2626.364% Sharpe Ratio 1.935 Probabilistic Sharpe Ratio 93.895% Loss Rate 34% Win Rate 66% Profit-Loss Ratio 2.24 Alpha 0.588 Beta 0.08 Annual Standard Deviation 0.309 Annual Variance 0.095 Information Ratio 1.395 Tracking Error 0.34 Treynor Ratio 7.502 Total Fees $1470112.34 Estimated Strategy Capacity $420000.00 Lowest Capacity Asset BTCUSD E3 |
# Hold for 1 month and then rebalance. import pandas as pd from datetime import datetime class AssetClassMomentumAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2016, 1, 1) self.SetCash(1000000) self.SetCash("BTC",0) self.symbols = ['BTCUSD'] ################################# ########### Brokerage ------------------ self.SetBrokerageModel(BrokerageName.AlphaStreams) for symbol in self.symbols: self.AddCrypto(symbol, Resolution.Hour, Market.Bitfinex) def OnData(self, data): ########## # 25 - 2 if self.Time.day >= 25 and self.Time.day <= 27 and not self.Securities["btcusd"].Invested :# self.Portfolio.Invested: #self.Portfolio.CashBook["BTC"].Amount == 0 : # usdTotal = self.Portfolio.CashBook ["USD"]. Amount # limitPrice = round (self.Securities ["BTCUSD"]. Price * 0.99, 2) # # use only half of our total USD # quantity = usdTotal / limitPrice # self.DefaultOrderProperties.TimeInForce = TimeInForce.Day # self.LimitOrder("BTCUSD", quantity, limitPrice) # self.MarketOrder("BTCUSD", self.Portfolio.CashBook["USD"].Amount / self.Securities["BTCUSD"].Price) self.SetHoldings("BTCUSD",1) # if self.Time.day >= 28 or self.Securities["btcusd"].Invested : if self.Time.day >= 3 and self.Time.day <= 5 and self.Portfolio.Invested: self.Liquidate() def OnEndOfDay(self, symbol): self.Plot('Strategy Q', 'Q',self.Portfolio.CashBook["USD"].Amount / self.Securities["BTCUSD"].Price)