Search code examples
rfinancialibrokers

IBrokers R - reqFundamentalData


Trying to download fundamental data using the IBrokers - R package. API documentation shows two ways

http://xavierib.github.io/twsapidocs/interfaceIBApi_1_1EWrapper.html#af209070fa9583fb4780be0f3ff1e61e4

or http://xavierib.github.io/twsapidocs/reuters_fundamentals.html

I tried

library(IBrokers)
t <- ibgConnect()
isConnected(t)
[1]TRUE
reqCurrentTime(t)
[1] "2016-03-29 19:51:28 EST"
c <- twsEquity("ibm")
x <- reqFundamentalData(t,c)
Error: could not find function "reqFundamentalData"

The documentation for IBrokers R pkg does not explicitly call out this function - so am I to assume that it is not supported? I have the reuters subscription.

========== Tried Josh Ulrich' suggestion : x <- IBrokers:::reqFundamentalData(t,c) Got an error:

Error in inherits(x, "twscontract") :
  argument "contract" is missing with no default

got the same error requesting reqID and reportType. So I modified the code to

r <- reqId(t,numId =1)
[1] "1"
x <- IBrokers:::reqFundamentalData(t,reqId = r, contract = c, reportType = "ReportFinSummary")
x
[1] NULL

Command ran without error but returned NULL


Solution

  • It's not exported, but there is a reqFundamentalData function. You can try it via:

    x <- IBrokers:::reqFundamentalData(t,c)
    

    Since it's unexported, I don't know whether or not it works. Feedback would be appreciated.