Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
3.633%
Drawdown
0.100%
Expectancy
0
Net Profit
0.098%
Sharpe Ratio
8.645
Probabilistic Sharpe Ratio
93.229%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.032
Beta
-0.005
Annual Standard Deviation
0.004
Annual Variance
0
Information Ratio
1.765
Tracking Error
0.583
Treynor Ratio
-6.866
Total Fees
$16.03
import decimal as d
import numpy as np

class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2018,12, 1)  #Set Start Date
        self.SetEndDate(2018,12,10)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        #self.SetCash('BTC', 100)
        self.SetCash(1000000)
        
        self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)

        btc = self.AddCrypto("BTCUSD")
        btc.BuyingPowerModel = SecurityMarginModel(3.3)
        

    def OnData(self, data):
        
        if not self.Portfolio.Invested:
            self.MarketOrder('BTCUSD', -2)
            self.Log(f"Cashbook: {self.Portfolio.CashBook}")