Exemplo n.º 1
0
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)
Exemplo n.º 2
0
def for_recent_views(args, key, outliers, quantile):
    """
    Analyze all desired wikipedia for recent outliers. Respond to user if the
    company has generated an outlier within the past number of user specified
    days
    """
    for date, val in outliers:
        unix_time = int(convert_wiki_date_to_datetime(
            date, hour=23).strftime("%s")
        )
        cur_unix_time = time()
        if cur_unix_time - unix_time <= 60 * 60 * 12 * args.days:
            print(key, date, val, quantile)