ribrokers

Get nse equity data using r package 'ibroker'


I'm unable to get equity data from NSE (Indian stock exchange) through ibrokers package of R. Setting the 'exch' to 'NSE' doesn't work. I tried with the following code

tws = twsConnect()
contract = twsEquity(symbol = 'SBIN', exch = 'NSE')
reqHistoricalData(tws, Contract=contract)

It works fine for US stocks. It would be nice if someone could give any pointers, maybe it's not implemented/ not supposed to work for NSE.


Solution

  • Try:

    contract = twsEquity(symbol = 'SBIN', exch = 'NSE', currency='INR')
    

    To get help, enter ?twsEquity on the R prompt. One can then see that currency = 'USD' is the default hence it does not work for 'SBIN' on 'NSE'. Cheers!