以编程方式下载R中的ROIC和其他财务数据

时间:2013-04-25 19:12:32

标签: r stock

我是否可以通过编程方式下载ROIC以及公司季度报告中通常报告的其他数据?

我知道我可以从http://chart.yahoo.com/table.csv访问某个股票的每日价格数据,但我找不到任何有关财务业绩的信息。

谢谢!

1 个答案:

答案 0 :(得分:1)

Intrinio使用httr包在R中提供数据。您可以关注instructions here,我会在此处修改它们以获得ROIC:

#Install httr, which you need to request data via API
install.packages("httr")
require("httr")

#Create variables for your usename and password, get those at intrinio.com/login
username <- "Your_API_Username"
password <- "Your_API_Password"

#Making an api call for roic. This puts together the different parts of the API call

base <- "https://api.intrinio.com/"
endpoint <- "data_point"
stock <- "T"
item1 <- "roic"
call1 <- paste(base,endpoint,"?","ticker","=", stock, "&","item","=",item1, sep="")

#Now we use the API call to request the data from Intrinio's database

ATT_roic <- GET(call1, authenticate(username,password, type = "basic"))

#That gives us the ROIC value, but it isn't in a good format so we parse it

test1 <- unlist(content(ATT_roic,"parsed"))

df <- data.frame(test1)

您可以修改任何美国代码的代码,您可以更改数百个其他财务指标。如果您想在特定日期范围内提取历史漫游或漫游,请参阅我在此答案开头发布的说明。