示例#1
0
def download_csv_cn(instrument, frequency=None):

    match = re.match('6', instrument)
    if match:
        url = "http://table.finance.yahoo.com/table.csv?s=%s.ss" % (instrument)
    else:
        url = "http://table.finance.yahoo.com/table.csv?s=%s.sz" % (instrument)
    return csvutils.download_csv(url)
示例#2
0
def download_csv(instrument, begin, end):
    url = "http://www.google.com/finance/historical"
    params = {
        "q": instrument,
        "startdate": begin.strftime("%Y-%m-%d"),
        "enddate": end.strftime("%Y-%m-%d"),
        "output": "csv",
    }

    return csvutils.download_csv(url, url_params=params, content_type="application/vnd.ms-excel")
示例#3
0
def download_csv(sourceCode, tableCode, begin, end, frequency, authToken):
    url = "http://www.quandl.com/api/v1/datasets/%s/%s.csv" % (sourceCode, tableCode)
    params = {
        "trim_start": begin.strftime("%Y-%m-%d"),
        "trim_end": end.strftime("%Y-%m-%d"),
        "collapse": frequency
    }
    if authToken is not None:
        params["auth_token"] = authToken

    return csvutils.download_csv(url, params)
示例#4
0
def download_csv(sourceCode, tableCode, begin, end, frequency, authToken):
    url = "http://www.quandl.com/api/v1/datasets/%s/%s.csv" % (sourceCode, tableCode)
    params = {
        "trim_start": begin.strftime("%Y-%m-%d"),
        "trim_end": end.strftime("%Y-%m-%d"),
        "collapse": frequency
    }
    if authToken is not None:
        params["auth_token"] = authToken

    return csvutils.download_csv(url, params)
示例#5
0
def download_csv(instrument, begin, end):
    url = "http://www.google.com/finance/historical"
    params = {
        "q": instrument,
        "startdate": begin.strftime("%Y-%m-%d"),
        "enddate": end.strftime("%Y-%m-%d"),
        "output": "csv",
    }

    return csvutils.download_csv(url,
                                 url_params=params,
                                 content_type="application/vnd.ms-excel")
示例#6
0
def download_csv(instrument, begin, end, frequency):
    url = "http://ichart.finance.yahoo.com/table.csv?s=%s&a=%d&b=%d&c=%d&d=%d&e=%d&f=%d&g=%s&ignore=.csv" % (instrument, __adjust_month(begin.month), begin.day, begin.year, __adjust_month(end.month), end.day, end.year, frequency)
    return csvutils.download_csv(url)
示例#7
0
def download_csv(instrument, begin, end, frequency):
    url = "http://ichart.finance.yahoo.com/table.csv?s=%s&a=%d&b=%d&c=%d&d=%d&e=%d&f=%d&g=%s&ignore=.csv" % (instrument, __adjust_month(begin.month), begin.day, begin.year, __adjust_month(end.month), end.day, end.year, frequency)
    return csvutils.download_csv(url)