Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
10.350%
Drawdown
1.100%
Expectancy
0
Net Profit
0.135%
Sharpe Ratio
-5.253
Probabilistic Sharpe Ratio
6.757%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.013
Beta
1.174
Annual Standard Deviation
0.075
Annual Variance
0.006
Information Ratio
-4.25
Tracking Error
0.011
Treynor Ratio
-0.335
Total Fees
$5.00
Estimated Strategy Capacity
$100000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# region imports
from AlgorithmImports import *
from pprint import pprint
# endregion

class SpyDataReadFailure(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2004, 11, 12)          
        self.SetEndDate(2004, 11, 16)          
        self.SetCash(100000)  

        spy = self.AddEquity("SPY", Resolution.Daily)        
        spy.SetDataNormalizationMode(DataNormalizationMode.Raw)
        self.spy = spy.Symbol
         
    def OnData(self, data: Slice):
        if not self.spy in data: 
            self.Log("data but not spy?")
            return
        
        close = self.Securities[self.spy].Close

        try:
            close1 = data[self.spy].Close
            self.Log("close: " + str(close) + " close1: " + str(close1))
        except:
            self.Log("close: " + str(close) + " close1: unavailable")
        
        if not self.Portfolio[self.spy].Invested:
            self.MarketOrder(self.spy, 1000)