def get_vxmt_daily(): url = 'http://www.cboe.com/publish/ScheduledTask/MktData/datahouse/vxmtdailyprices.csv' content = HttpHelper.http_get(url) records = content.split('\r\n')[3:-1] yahoo_records = ['Date,Open,High,Low,Close,Adj Close,Volume'] + map(CBOEScraper.to_yahoo_format, records) yahoo_content = '\r\n'.join(yahoo_records) path = PathMgr.get_historical_etf_path('^VXMT') write_to_file(path, yahoo_content)
def ingest_all_historical_etf(date_from = '1993-01-29', date_to=None, symbols=None): if symbols is None: symbols = Symbols.get_all_symbols() date_to = date_to or datetime.date.today().strftime("%Y-%m-%d") logger = Logger(__name__, PathMgr.get_log_path()) for symbol in symbols: logger.info('ingest for %s...' % symbol) path = PathMgr.get_historical_etf_path(symbol) content = YahooScraper.download_quote2(symbol, date_from, date_to) write_to_file(path, content) time.sleep(1)
def insert_all(self): for symbol in Symbols.get_all_symbols(): self.logger.info('insert data for %s...' % symbol) path = PathMgr.get_historical_etf_path(symbol) df = pd.read_csv(path) self.insert(symbol, df)
def save_all(self, symbols=Symbols.get_all_symbols()): for symbol in symbols: self.logger.info('save data for %s...' % symbol) path = PathMgr.get_historical_etf_path(symbol) df = pd.read_csv(path) self.save(symbol, df)