首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python Matplotlib Finance:获取股票的季度每股收益

Python Matplotlib Finance:获取股票的季度每股收益
EN

Stack Overflow用户
提问于 2016-05-17 21:23:22
回答 1查看 2.3K关注 0票数 1

我正在使用Matplotlib金融与Python获得股票报价,从雅虎!金融。

我想知道是否有办法获得本季度每股收益,以及过去5年(即过去20个季度)使用Matplotlib金融公司获得的每股收益。

如果没有,有人能告诉我有这些数据的python库吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-01 14:51:22

这对我有用。

代码语言:javascript
复制
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‘

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37286465

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档