作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想把所有通过雅虎财经可用的共同基金的列表放到R里。TTR包里有一个stockSymbols函数,但是好像没有拿到共同基金。
谢谢,
最佳答案
我认为雅虎没有提供他们拥有数据的所有共同基金的 list
(同样,他们不提供他们所涵盖的股票 list )。
您可以从评论中提到的网站下载列表,
循环所有资金,
从雅虎检索相应的“个人资料”页面,
并提取您需要的信息——“类别”字段
似乎是最接近你想要的“部门和行业”的东西。
# Read the list of funds
# I assume the file was downloaded manually from
# http://www.eoddata.com/Data/symbollist.aspx?e=USMF
# This requires registration (free).
d <- read.delim( "USMF.txt", stringsAsFactors = FALSE )
# Retrieve the profile page, for each of the funds.
# It takes 1 second for each, and there are 24,000 of them:
# this may take more than 6 hours.
library(RCurl)
library(stringr)
d$Category <- ""
for( i in seq_len(nrow(d)) ) {
try({
url <- paste0("http://uk.finance.yahoo.com/q/pr?s=", d$Symbol[i])
cat( url, " " )
profile <- getURL(url)
row <- str_extract(profile, "Category.*?</tr>")
cell <- str_extract(row, "<td.*</td>" )
d$Category[i] <- str_replace_all( cell, "<.*?>", "" )
cat( d$Category[i], "\n" )
})
}
head(d)
关于r - 如何获取 R 中所有雅虎财经共同基金的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17759621/
所以,我有一个类似于 this one 的用例,但我觉得有一些额外的细节值得提出一个新问题。 ( related questions ,供引用) 我正在编写一个实现 a cycle 的数据结构.基本设
我正在使用 Django 编写一个社交网络应用程序,需要实现类似于 Facebook“Mutual Friends”概念的功能。我有一个像这样的简单模型: class Friend(models.Mo
我有一个 iOS 应用程序,用户可以在其中使用 Facebook 登录并授予 user_friends 权限。从 Graph API 2.0 开始,Facebook 声称你无法获取两个人之间所有的共同
我想知道将来对我来说最简单的方法是什么,可以使查询既有效又不那么复杂。 我应该像这样保存双向关系吗 from_id=1, to_id=2from_id=2, to_id=1 或者只创建一个唯一的行 f
我是一名优秀的程序员,十分优秀!