0

I have trouble retrieving EURUSD and GBPUSD currency pairs historical data from IB. The code I use works fine with CHFUSD and USDJPY but with EURUSD and GBPUSD I get a pending execution "waiting for TWS reply on EUR ...." which never ends.

I have tried this code for getting EURUSD and GBPUSD currency pairs historical data from IB.

require(IBrokers)
require(data.table)

tws <- twsConnect(port=7497)

contract <- twsCurrency(symbol="EUR",currency='USD',exch='IDEALPRO',primary='',strike='0.0',right='',local='',multiplier='',include_expired='0',conId=0)

xx <- IBrokers::reqHistoricalData(tws, Contract=contract, barSize="5 min",  endDateTime="20220426 13:00:00", duration="1 D", whatToShow="BID")

I expect it to retrieve an xts object for EURUSD and GBPUSD just as it does with CHFUSD and USDJPY, but the result is a pending execution "waiting for TWS reply on EUR ...." which never ends. It would be much appreciated if anyone could help me figure this out and get EURUSD, GBPUSD data.

Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294

0 Answers0