def __init__(self, ticker): self.mongodb = s.StockMongo() try: self.ticker = ticker self.options = self.collect_eod_options(self.ticker) self.start_date = min(self.options.index) self.end_date = max(self.options.index) self.strike_dates = [] self.strikeDates = [] self.formula = {} self.prepare_options() except: self.len_records = 0 self.map_strike_dates() try: self.stock_data = StockData(ticker) self.vix = StockData("^VIX") self.merge_stock_data() self.merge_vix_data() self.count_records() except: self.len_records = 0 self.analyse_options() self.map_strike_date_objects() self.map_strike_dates_returns()
def main(): print("getting symbols") m = s.StockMongo() symbols = m.get_symbols() tickers = [] for sym in symbols: tickers.append(sym['sym']) print("running data collection") for tick in tickers[:10]: o = Options(tick) o.regression() print("Completed for " + str(tick))
def main(): d = datetime.datetime.now() day_of_month = int(d.strftime("%d")) print("getting symbols") m = s.StockMongo() symbols = m.get_symbols() tickers = [] for sym in symbols: tickers.append(sym['sym']) start = int(10 * (day_of_month-1)) if start-9 <= len(tickers): print("running data collection") for tick in tickers[start+6:start+10]: try: o = Options(tick) o.regression() print("Completed for " + str(tick)) except: print("Error for " + str(tick))