Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
8305.514%
Drawdown
29.000%
Expectancy
0
Net Profit
820.534%
Sharpe Ratio
34.603
Probabilistic Sharpe Ratio
99.782%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
27.851
Beta
0.039
Annual Standard Deviation
0.817
Annual Variance
0.667
Information Ratio
17.424
Tracking Error
1.019
Treynor Ratio
721.589
Total Fees
$400.02
Estimated Strategy Capacity
$290000.00
class GeekyFluorescentPinkJackal(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 10, 11)
        self.SetCash(100000)
        
        self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)
        security = self.AddCrypto('BTCUSD', Resolution.Daily)
        security.BuyingPowerModel = SecurityMarginModel(3.3)
        self.symbol = security.Symbol
        
        self.ordered = False
        

    def OnData(self, data):
        self.Plot("Margin", "Remaining", self.Portfolio.MarginRemaining)
        self.Plot("Margin", "TotalMarginUsed ", self.Portfolio.TotalMarginUsed )
        
        if self.ordered:
            return
        self.ordered = True
        
        usd_held = self.Portfolio.CashBook["USD"].Amount
        quantity = round(usd_held / data[self.symbol].Price * 2, 8)
        self.Log(f"Value ordered: {quantity * data[self.symbol].Price}")
        self.MarketOrder(self.symbol, quantity)