Overall Statistics
Total Trades
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
-98.024%
Drawdown
19.200%
Expectancy
0
Net Profit
-10.954%
Sharpe Ratio
-2.322
Probabilistic Sharpe Ratio
2.246%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-1.483
Beta
-0.83
Annual Standard Deviation
0.417
Annual Variance
0.174
Information Ratio
-0.659
Tracking Error
0.531
Treynor Ratio
1.168
Total Fees
$1.00
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.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)  # allows short selling of crypto
        self.SetBrokerageModel(BrokerageName.Default, AccountType.Margin)

        self.symbols = [ 
                    Symbol.Create("SPY", SecurityType.Equity, Market.USA),
                    Symbol.Create("BTCUSD", SecurityType.Crypto, Market.Bitfinex),
                    ]        
        self.SetUniverseSelection(ManualUniverseSelectionModel(self.symbols) )
        self.UniverseSettings.Resolution = Resolution.Daily
                    

    def OnData(self, data):

        for key in self.Portfolio.Keys:
            if data.ContainsKey(key):
                if not self.Portfolio[key].Invested:
                    #self.Debug(str(self.Time) + " trading " + str(key))
                    self.MarketOrder(key, -2)