def for_random_views(args, key, *other_args): """ Analyze data for a completely random set of views """ prices = cruncher.get_stock_data(args, key) for _ in xrange(RANDOM_VIEWS_PER_STOCK): day = randint(args.interval, len(prices) - args.interval) get_pre_and_post_returns(args, day, prices)
def for_historical_views(args, key, outliers, quantile): """ Analyze all desired wikipedia pages over the current year for trends involving outliers in page views and accompanying changes in stock prices 10 business days afterwards. """ prices = cruncher.get_stock_data(args, key) for date, val in outliers: day_of_year = int( convert_wiki_date_to_datetime(date).strftime("%j")) - 1 get_pre_and_post_returns(args, day_of_year, prices)