node-ib
node-ib copied to clipboard
reqRealTimeBars not working
I was trying to get the premarket/aftermarket bar, with useRTH=false, and in following the example
var requestId=1000;
ib.reqRealTimeBars(requestId, ib.contract.stock('AAPL'), 5, 'TRADES', false);
The request happens to go through without an error or server message, and there is no response to the function
ib.on('realtimeBar', function (reqId, time, open, high, low, close, volume, wap, count) {
console.log(reqId, time, open, high, low, close, volume, wap, count);
}
According to the docs at interactive brokers api reference guide
Regular Trading Hours only. Valid values include:
0 = all data available during the time span requested is returned, including time intervals when the market in question was outside of regular trading hours.
1 = only data within the regular trading hours for the product requested is returned, even if the time time span falls partially or completely outside.
However in the code, useRTH it is a boolean... Relevant code https://github.com/pilwon/node-ib/blob/master/lib/index.js#L336
When it maybe should be integer? Could this be why it is not working (similar to reqHistoricalData)?
assert(_.isNumber(useRTH), '"useRTH" must be an integer - ' + useRTH);
Thanks!
I ran into this. After speaking with IB support, it turned out I was requesting data outside RTH for a contract that didn't trade outside RTH.
@buzzcloudau Thanks!
This is also what I have noticed as well, outside RTH