如何下载多只股票的收盘价?

时间:2019-07-26 17:17:58

标签: python python-3.x pandas numpy

这里有人可以共享一些代码来下载多个股票行情收录器的历史数据吗?下面的示例代码将于2018年3月截止。这不是很有用。 :(

无论如何,我正在寻找类似的东西,但是数据要到昨天为止。

import quandl
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

pd.set_option('display.max_rows', 500)

# get adjusted closing prices of 5 selected companies with Quandl
quandl.ApiConfig.api_key = ''
selected = ['T',
'KMX',
'BKNG',
'ADS',
'ADBE',
'AEP',
'ALK',
'LNT',
'AKAM',
'BXP',
'COF',
'BBY',
'AOS']
data = quandl.get_table('WIKI/PRICES', ticker = selected,
                        qopts = { 'columns': ['date', 'ticker', 'adj_close'] },
                        date = { 'gte': '2017-7-24', 'lte': '2019-7-24' }, paginate=True)

# reorganise data pulled by setting date as index with
# columns of tickers and their corresponding adjusted prices
clean = data.set_index('date')
table = clean.pivot(columns='ticker')

0 个答案:

没有答案