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
0.156
Tracking Error
0.141
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
# region imports
from AlgorithmImports import *
# endregion

class EnergeticYellowGreenBee(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 1, 1)
        self.SetEndDate(2019, 1, 1)
        self.SetCash(100000)

        self.VIX3M = self.AddData(VIX3M, "VIX3M", Resolution.Hour).Symbol
        self.SPX = self.AddIndex("SPX", Resolution.Hour).Symbol

        self.exchange = self.Securities[self.SPX].Exchange

    def OnData(self, data: Slice):
        if self.exchange.ExchangeOpen:
            self.Log(str('VIX3M *Import*: ') + str(self.Securities[self.VIX3M].Price))

class VIX3M(PythonData):
    def GetSource(self, config: SubscriptionDataConfig, date: datetime, isLive: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource('https://docs.google.com/spreadsheets/d/e/2PACX-1vTlzwy3eGo6wmGXad83pj8MKNsFZga6HCahd-FIoqvo4kWyWKDCSZ0wsTKz85BLt5qe7jLIIFPHtAmz/pub?output=csv', SubscriptionTransportMedium.RemoteFile)

    def Reader(self, config: SubscriptionDataConfig, line: str, date: datetime, isLive: bool) -> BaseData:

        if not (line.strip()):
            return None
        

        index = VIX3M()
        index.Symbol = config.Symbol

        try:
            # Format:
            # Date, Close
            data = line.split(',')
            index.Time = datetime.strptime(data[0], '%m/%d/%Y %H:%M:%S')
            index.EndTime = index.Time + timedelta(days=1)
            index.Value = data[1]
            index["close"] = float(data[1])

        except ValueError:
            # Do nothing
            return None

        return index