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

P&L subscription request #172

Open
dspasyuk opened this issue Oct 16, 2021 · 2 comments
Open

P&L subscription request #172

dspasyuk opened this issue Oct 16, 2021 · 2 comments

Comments

@dspasyuk
Copy link

This project seems to be the best and most complete on the Github. Thank you!
The new TWS API supports P&L data requests but it looks like this was never implemented. I was trying to do it myself but I am getting the following error: [12345:62:76:1:0:0:0:ERR] Invalid incoming request type - 0

Here are the functions:

`Outgoing.prototype.reqPnL = function (reqId, group, tags) {
if (this._controller._serverVersion < C.MIN_SERVER_VER.ACCT_SUMMARY) {
return this._controller.emitError('It does not support PNL requests.');
}

var version = 1;

this._send(C.OUTGOING.REQ_PNL, version, reqId, group, tags);
};`

`IB.prototype.reqPnL = function (reqId, acctCode, contractID) {
assert(.isNumber(reqId), '"reqId" must be an integer - ' + reqId);
// assert(
.isNumber(contractID), '"contractID" must be an integer - ' + contractID);
assert(_.isString(acctCode), '"acctCode" must be a string - ' + acctCode);

this._send('reqPnL', reqId, acctCode, contractID);

return this;
};`

Here is the reference for the API function: https://interactivebrokers.github.io/tws-api/pnl.html

Any help appreciated.

@tredondo
Copy link
Contributor

This project seems to be the best and most complete on the Github.

Unfortunately, node-ib is no longer actively maintained, and uses old JS conventions (no async, no types).

See also @maxicus's (ib-tws-api)[https://github.com/maxicus/ib-tws-api], which has higher potential, esp. if the author will consider TypeScript.

@dspasyuk
Copy link
Author

the old convention is not a problem, we can easily promisify those functions, I have done this already for some functions, as for ib-tws-api, I tried it and I do not see any advantages in it. It seems to be very incomplete and uses ES6, which I do not like. New nodejs also require importing as a module and it is not always practical. Not to mention the developer is not very collaborative, but maybe it is just my impression.

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

No branches or pull requests

2 participants