Skip to content
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

Merged
merged 4 commits into from
Jul 14, 2018

Conversation

mvberg
Copy link
Contributor

@mvberg mvberg commented Jul 12, 2018

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

@mvberg mvberg changed the title Add support for reqHistoricalTicks Add support for reqHistoricalTicks & reqTickByTickData Jul 12, 2018
@pilwon pilwon merged commit 9a4dc7b into pilwon:master Jul 14, 2018
@pilwon
Copy link
Owner

pilwon commented Jul 14, 2018

@mvberg Thanks for the great contribution. Merged and published as v0.2.5.

Copy link
Contributor

@tredondo tredondo left a 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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here :-(

@pilwon
Copy link
Owner

pilwon commented Nov 26, 2018

Thanks @meteorpublish this is very helpful. Could you please submit a PR for this change?

@tredondo
Copy link
Contributor

@pilwon: I'm afraid the changes would be rather significant, and they would break functionality for users using the API as it has been published to npm.

Since we're before v1, that might be acceptable though.

@mvberg: thoughts? Feel free to make the changes if you agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants