Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
75.043%
Drawdown
2.700%
Expectancy
0
Net Profit
2.315%
Sharpe Ratio
7.838
Probabilistic Sharpe Ratio
85.999%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.444
Beta
0.416
Annual Standard Deviation
0.093
Annual Variance
0.009
Information Ratio
0.363
Tracking Error
0.113
Treynor Ratio
1.755
Total Fees
$0.00
class TransdimensionalCalibratedAutosequencers(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 10, 1)
        self.SetCash('USD', 10000)
        self.SetCash('BTC', 1)
        self.SetCash('ETH', 1)
        
        self.btcusd = self.AddCrypto("BTCUSD").Symbol
        self.ethbtc = self.AddCrypto("ETHBTC").Symbol
        
        self.usd_trade_amount = 1000
        self.done = False
        
        self.plot_holdings()
        

    def OnData(self, data):
        if not self.done and \
            data.ContainsKey(self.btcusd) and \
            data[self.btcusd] is not None and \
            data.ContainsKey(self.ethbtc) and \
            data[self.ethbtc] is not None:

            quantity = self.usd_trade_amount / data[self.btcusd].Price / data[self.ethbtc].Price
            self.Log(f"Ordering {quantity} ETH")
            self.MarketOrder('ETHBTC', quantity)
            self.done = True
            
            
    def OnOrderEvent(self, order_event):
        if order_event.Status == OrderStatus.Filled:
            usd_value = order_event.FillQuantity * self.CurrentSlice[self.ethbtc].Price * self.CurrentSlice[self.btcusd].Price
            self.Log(f"Spent ${usd_value} USD")
        
    def OnEndOfDay(self):
        self.plot_holdings()
    
    def plot_holdings(self):
        for currency in ['ETH', 'BTC', 'USD']:
            self.Plot(currency, "Holdings", self.Portfolio.CashBook[currency].Amount)