Example #1
0
def _get_data_one(sym, start, end, interval, retry_count, pause):
    """
    Get historical data for the given name from google.
    Date format is datetime

    Returns a DataFrame.
    """
    start, end = _sanitize_dates(start, end)

    # www.google.com/finance/historical?q=GOOG&startdate=Jun+9%2C+2011&enddate=Jun+8%2C+2013&output=csv
    params = {"q": sym, "startdate": start.strftime("%b %d, %Y"), "enddate": end.strftime("%b %d, %Y"), "output": "csv"}
    url = _encode_url(_URL, params)
    return _retry_read_url(url, retry_count, pause, "Google")
Example #2
0
def _get_data_one(sym, start, end, interval, retry_count, pause):
    """
    Get historical data for the given name from google.
    Date format is datetime

    Returns a DataFrame.
    """
    start, end = _sanitize_dates(start, end)

    # www.google.com/finance/historical?q=GOOG&startdate=Jun+9%2C+2011&enddate=Jun+8%2C+2013&output=csv
    params = {
        'q': sym,
        'startdate': start.strftime('%b %d, %Y'),
        'enddate': end.strftime('%b %d, %Y'),
        'output': "csv"
    }
    url = _encode_url(_URL, params)
    return _retry_read_url(url, retry_count, pause, 'Google')
Example #3
0
def _get_data_one(sym, start, end, interval, retry_count, pause):
    """
    Get historical data for the given name from yahoo.
    Date format is datetime

    Returns a DataFrame.
    """
    start, end = _sanitize_dates(start, end)
    params = {
        's': sym,
        'a': start.month - 1,
        'b': start.day,
        'c': start.year,
        'd': end.month - 1,
        'e': end.day,
        'f': end.year,
        'g': interval,
        'ignore': '.csv'
    }
    url = _encode_url(_URL, params)
    return _retry_read_url(url, retry_count, pause, 'Yahoo!')