def get_vix_records(): futures = CBOEScraper.get_vix_future() records = [] for future in futures: record = VIX() symbol = future[0].replace('X/', '') record.symbol = '%s1%s'%(symbol[0:3], symbol[3]) # record.dailyDate1dAgo = future[1] record.dailyDate1dAgo = datetime.date.today() - datetime.timedelta(days=1) record.lastPrice = future[2] record.dailyLastPrice = future[2] records.append(record) return records
def parse_vix_data(self): df = pd.read_hdf(self.vix_data_file, 'VIX') vix = VIX() for index, row in df.iterrows(): vix.symbol = index vix.lastPrice = row['lastPrice'] vix.priceChange = row['priceChange'] vix.openPrice = row['openPrice'] vix.highPrice = row['highPrice'] vix.lowPrice = row['lowPrice'] vix.previousPrice = row['previousPrice'] vix.volume = row['volume'] vix.tradeTime = row['tradeTime'] vix.dailyLastPrice = row['dailyLastPrice'] vix.dailyPriceChange = row['dailyPriceChange'] vix.dailyOpenPrice = row['dailyOpenPrice'] vix.dailyHighPrice = row['dailyHighPrice'] vix.dailyLowPrice = row['dailyLowPrice'] vix.dailyPreviousPrice = row['dailyPreviousPrice'] vix.dailyVolume = row['dailyVolume'] vix.dailyDate1dAgo = row['dailyDate1dAgo'] self.vix_records.append(vix)