Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-24.049
Tracking Error
0.123
Treynor Ratio
0
Total Fees
$0.00
# Find more symbols here: http://quantconnect.com/data
import numpy as np

### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class FischerBlack(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(2020, 11, 30)  #Set Start Date
        self.SetEndDate(2020, 12, 20)   #Set End Date
        self.SetCash(100000)        #Set Strategy Cash
        self.spy = self.AddEquity("SPY", Resolution.Hour)
        
        self.etf = self.AddEquity("UNG", Resolution.Hour)
        
        #self.etf.SetDataNormalizationMode(DataNormalizationMode.SplitAdjusted)
        self.etf.SetDataNormalizationMode(DataNormalizationMode.Raw)
        

        self.SetWarmUp(50)



        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 0), self.LogCollection_0)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 60), self.LogCollection_1)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 120), self.LogCollection_2)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 180), self.LogCollection_3)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 240), self.LogCollection_4)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 300), self.LogCollection_5)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 360), self.LogCollection_6)
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.BeforeMarketClose('SPY',0), self.LogCollection_close)
        
    def LogCollection_0(self):
        self.l_coll = (f"{self.Time}    UNG_price_0: {self.etf.Price}\n")
    def LogCollection_1(self):
        self.l_coll += (f"{self.Time}    UNG_price_1: {self.etf.Price}\n")
    def LogCollection_2(self):
        self.l_coll += (f"{self.Time}    UNG_price_2: {self.etf.Price}\n")
    def LogCollection_3(self):
        self.l_coll += (f"{self.Time}    UNG_price_3: {self.etf.Price}\n")
    def LogCollection_4(self):
        self.l_coll += (f"{self.Time}    UNG_price_4: {self.etf.Price}\n")
    def LogCollection_5(self):
        self.l_coll += (f"{self.Time}    UNG_price_5: {self.etf.Price}\n")
    def LogCollection_6(self):
        self.l_coll += (f"{self.Time}    UNG_price_6: {self.etf.Price}\n")
    def LogCollection_close(self):
        self.l_coll += (f"{self.Time}    UNG_price_close: {self.etf.Price}\n")
        self.Log ('\n' + str(self.l_coll))
        
    def OnData(self, data):
        return 1