Skip to content

P&L subscription request #172

Description

@dspasyuk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions