Python Matplotlib Finance:获取股票的季度每股收益
我正在使用Matplotlib Finance和Python从雅虎获取股票报价!金融 我想知道是否有办法使用Matplotlib Finance获得当前季度以及过去5年各季度(即过去20个季度)的每股收益 如果没有,有人能告诉我一个python库有这些数据吗?这对我很有用Python Matplotlib Finance:获取股票的季度每股收益,python,matplotlib,yahoo-finance,Python,Matplotlib,Yahoo Finance,我正在使用Matplotlib Finance和Python从雅虎获取股票报价!金融 我想知道是否有办法使用Matplotlib Finance获得当前季度以及过去5年各季度(即过去20个季度)的每股收益 如果没有,有人能告诉我一个python库有这些数据吗?这对我很有用 from urllib import urlopen from bs4 import BeautifulSoup url = 'http://www.marketwatch.com/investing/stock/goog/
from urllib import urlopen
from bs4 import BeautifulSoup
url = 'http://www.marketwatch.com/investing/stock/goog/financials'
text_soup = BeautifulSoup(urlopen(url).read()) #read in
titles = text_soup.findAll('td', {'class': 'rowTitle'})
for title in titles:
if 'EPS (Basic)' in title.text:
print [td.text for td in title.findNextSiblings(attrs={'class': 'valueCell'}) if td.text]
结果:
[u'15.10',u'16.42',u'18.29',u'20.27',u'23.88']
[u'-'、u'8.75%、u'11.38%、u'10.85%、u'17.78%]