-
Notifications
You must be signed in to change notification settings - Fork 133
Description
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.