有没有办法自动获取许多股票的一般信息,如市盈率,收益率等等?

dan*_*uan 7 python r stocks

我知道一些方法来获得R或python中的每日股票价格和交易量,但只是想知道这些是否是一种方式(使用R或python)来获得有关股票的更多信息,如市盈率,公司网站,收益率等等on,最好不仅是当前值,还有历史值.

谢谢.

GSe*_*See 10

历史将是困难的.R 的quantmodgetQuoteyahooQF您一起获得当前值所需的全部内容.

require("quantmod")
getQuote("GS", what = yahooQF(c("Market Capitalization", "Earnings/Share", 
         "P/E Ratio", "Book Value", "EBITDA", "52-week Range")))

            Trade Time Market Capitalization Earnings/Share P/E Ratio Book Value EBITDA  52-week Range
GS 2012-06-21 04:00:00               47.870B          6.764     14.27    134.476      0 84.27 - 139.25
Run Code Online (Sandbox Code Playgroud)

另外,试试吧

getQuote("GS", what=yahooQF())
Run Code Online (Sandbox Code Playgroud)

这将为您提供要求的字段选择菜单.

您可以从Google财经获取最近的财务报表 getFinancials

还有FinancialInstrument包,它有几个update_instruments.*功能来下载有关乐器的元数据(在这种情况下是股票).例如,这是雅虎所做的

require("FinancialInstrument")
stock("GS", currency("USD")) # define the stock
#[1] "GS"
update_instruments.yahoo("GS") #update with yahoo
#[1] "GS"
getInstrument("GS")
#primary_id          :"GS"
#currency            :"USD"
#multiplier          :1
#tick_size           :0.01
#identifiers         : list()
#type                :"stock"
#name                :"Goldman Sachs Gro"
#exchange            :"NYSE"
#market.cap          :"47.870B"
#avg.volume          :5480530
#EPS                 :6.76
#EPS.current.year.est:11.4
#EPS.next.year.est   :12.9
#book.value          :134
#EBITDA              :0
#range.52wk          :"84.27 - 139.25"
#defined.by          :"yahoo"
#updated             : POSIXct, format: "2012-06-21 19:31:11"
Run Code Online (Sandbox Code Playgroud)

如果您有InteractiveBrokers帐户,您可以使用优秀的IBrokers软件包获取大量有关仪器的信息.此外,如果您有一个IB帐户,您将需要查看我的twsInstrument包,它具有许多便利功能.