-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for reqHistoricalTicks & reqTickByTickData #127
Conversation
@mvberg Thanks for the great contribution. Merged and published as v0.2.5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handy events, but they differ from the official IB API
exchange = this.dequeue(); | ||
specialConditions = this.dequeue(); | ||
|
||
this._emit('historicalTickTradeData', reqId, date, mask, price, size, exchange, specialConditions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name historicalTickTradeData
doesn't match the IB API documentation for TRADE data ticks. It should be historicalTicksLast
. I've spent quite a bit of time trying to figure out this mismatch, because node-ib doesn't have documentation and points at the official IB API docs.
sizeBid = this.dequeueInt(); | ||
priceAsk = this.dequeueFloat(); | ||
sizeAsk = this.dequeueInt(); | ||
this._emit('historicalTickBidAskData', reqId, date, mask, priceBid, priceAsk, sizeBid, sizeAsk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be historicalTicksBidAsk
.
price = this.dequeueFloat(); | ||
size = this.dequeueInt(); | ||
|
||
this._emit('historicalTickMidPointData', reqId, date, price, size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be historicalTicks
for conformance with the IB API documentation.
var done = this.dequeueBool(); | ||
|
||
if (done) { | ||
this._emit('historicalTickDataEnd', reqId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful event but no correspondence with the IB API. By reading the documentation, I expected two parameters - an array of ticks, and a Boolean done
. I agree it's helpful to do this sort of work for the user, but this breaks the expectations of those who read the official IB API docs.
} | ||
}; | ||
|
||
Incoming.prototype._HISTORICAL_TICKS = function() { // MIDPOINT (size appears to always be zero) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here :-(
Thanks @meteorpublish this is very helpful. Could you please submit a PR for this change? |
example is in example/reqHistTickData.js
IB Docs: https://interactivebrokers.github.io/tws-api/historical_time_and_sales.html (TWS 968+)
also adds support for
reqTickByTickData
(streaming time & sales)IB Docs: https://interactivebrokers.github.io/tws-api/tick_data.html