I'm trying to download data from IBrokers but currently getting an error. I'm not sure how to solve it.
Note: I don't have a subscription to live quotes but I do get delayed market data.
My steps are:
security = twsSTK("AAPL")
is.twsContract(security)
1 TRUE
security_copy= twsEquity('AAPL')
reqMktData(tws,security)
Error output:
TWS Message: 2 1 162 Historical Market Data Service error message:No market data permissions for ISLAND STK TWS Message: 2 1 366 No historical data query found for ticker id:1 TWS Message: 2 1 10168 Requested market data is not subscribed. Delayed market data is not enabled
The historical data function also seems to have issues.
data_AAPL=reqHistoricalData(tws, security)
I have also tried the example in Link
IBrokersRef() # IBrokers Reference Card in PDF viewer
tws <- twsConnect() # make a new connection to the TWS
reqCurrentTime(tws) # check the server's timestamp
contract <- twsEquity('IBKR','SMART','ISLAND') # equity specification
reqHistoricalData(tws,contract) # request historical data
Result:
waiting for TWS reply on IBKR ....failed. NULL Warning message: In errorHandler(con, verbose, OK = c(165, 300, 366, 2104, 2106, :
Historical Market Data Service error message:No market data permissions for ISLAND