Comparing version 0.2.1 to 0.2.2
@@ -31,2 +31,21 @@ var _ = require('lodash'); | ||
Incoming.prototype._ACCOUNT_UPDATE_MULTI_END = function () { | ||
var version = this.dequeueInt(); | ||
var reqId = this.dequeue(); | ||
this._emit('accountUpdateMultiEnd', reqId); | ||
}; | ||
Incoming.prototype._ACCOUNT_UPDATE_MULTI = function () { | ||
var version = this.dequeueInt(); | ||
var reqId = this.dequeueInt(); | ||
var account = this.dequeue(); | ||
var modelCode = this.dequeue(); | ||
var key = this.dequeue(); | ||
var value = this.dequeue(); | ||
var currency = this.dequeue(); | ||
this._emit('accountUpdateMulti', reqId, account, modelCode, key, value, currency); | ||
}; | ||
Incoming.prototype._ACCOUNT_SUMMARY_END = function () { | ||
@@ -950,2 +969,35 @@ var version = this.dequeueInt(); | ||
Incoming.prototype._POSITION_MULTI = function () { | ||
var version = this.dequeueInt(); | ||
var reqId = this.dequeueInt(); | ||
var account = this.dequeue(); | ||
var modelCode = null; | ||
var contract = {}; | ||
contract.conId = this.dequeueInt(); | ||
contract.symbol = this.dequeue(); | ||
contract.secType = this.dequeue(); | ||
contract.expiry = this.dequeue(); | ||
contract.strike = this.dequeueFloat(); | ||
contract.right = this.dequeue(); | ||
contract.multiplier = this.dequeue(); | ||
contract.exchange = this.dequeue(); | ||
contract.currency = this.dequeue(); | ||
contract.localSymbol = this.dequeue(); | ||
contract.tradingClass = this.dequeue(); | ||
var pos = this.dequeueInt(); | ||
var avgCost = 0; | ||
avgCost = this.dequeueFloat(); | ||
this._emit('positionMulti', reqId, account, modelCode, contract, pos, avgCost); | ||
}; | ||
Incoming.prototype._POSITION_MULTI_END = function () { | ||
var version = this.dequeueInt(); | ||
var reqId = this.dequeueInt(); | ||
this._emit('positionMultiEnd', reqId); | ||
}; | ||
Incoming.prototype._REAL_TIME_BARS = function () { | ||
@@ -1032,7 +1084,7 @@ var version = this.dequeueInt(); | ||
var expirations = []; | ||
for (var i = 0; i < expCount; i++) { | ||
expirations.push(this.dequeue()); | ||
expirations.push(this.dequeue()); | ||
} | ||
var strikeCount = this.dequeueInt(); | ||
@@ -1043,5 +1095,5 @@ var strikes = []; | ||
} | ||
this._emit('securityDefinitionOptionParameter', reqId, exchange, underlyingConId, tradingClass, multiplier, expirations, strikes); | ||
}; | ||
@@ -1051,3 +1103,3 @@ | ||
var reqId = this.dequeueInt(); | ||
this._emit('securityDefinitionOptionParameterEnd', reqId); | ||
this._emit('securityDefinitionOptionParameterEnd', reqId); | ||
}; | ||
@@ -1220,3 +1272,3 @@ | ||
var list = this.dequeue(); | ||
this._emit("displayGroupList", reqId, list); | ||
@@ -1229,3 +1281,3 @@ }; | ||
var contractInfo = this.dequeue(); | ||
this._emit("displayGroupUpdated", reqId, contractInfo); | ||
@@ -1232,0 +1284,0 @@ }; |
@@ -58,2 +58,18 @@ var assert = require('assert'); | ||
IB.prototype.cancelPositionsMulti = function (reqId) { | ||
assert(_.isNumber(reqId), '"reqId" must be an integer - ' + reqId); | ||
this._send('cancelPositionsMulti', reqId); | ||
return this; | ||
}; | ||
IB.prototype.cancelAccountUpdatesMulti = function (reqId) { | ||
assert(_.isNumber(reqId), '"reqId" must be an integer - ' + reqId); | ||
this._send('cancelAccountUpdatesMulti', reqId); | ||
return this; | ||
}; | ||
IB.prototype.cancelCalculateImpliedVolatility = function (reqId) { | ||
@@ -198,2 +214,13 @@ assert(_.isNumber(reqId), '"reqId" must be an integer - ' + reqId); | ||
IB.prototype.reqAccountUpdatesMulti = function (reqId, acctCode, modelCode, ledgerAndNLV) { | ||
assert(_.isNumber(reqId), '"reqId" must be an integer - ' + reqId); | ||
assert(_.isString(acctCode), '"acctCode" must be a string - ' + acctCode); | ||
assert(_.isString(modelCode) || _.isNull(modelCode), '"modelCode" must be a string or null - ' + modelCode); | ||
assert(_.isBoolean(ledgerAndNLV), '"ledgerAndNLV" must be a boolean - ' + ledgerAndNLV); | ||
this._send('reqAccountUpdatesMulti', reqId, acctCode, modelCode, ledgerAndNLV); | ||
return this; | ||
}; | ||
IB.prototype.reqAllOpenOrders = function () { | ||
@@ -259,3 +286,3 @@ this._send('reqAllOpenOrders'); | ||
assert(_.isNumber(formatDate), '"formatDate" must be an integer - ' + formatDate); | ||
this._send('reqHeadTimestamp', reqId, contract, whatToShow, useRTH, formatDate); | ||
this._send('reqHeadTimestamp', reqId, contract, whatToShow, useRTH, formatDate); | ||
}; | ||
@@ -270,3 +297,3 @@ | ||
this._send('reqSecDefOptParams', reqId, underlyingSymbol, futFopExchange, underlyingSecType, underlyingConId); | ||
this._send('reqSecDefOptParams', reqId, underlyingSymbol, futFopExchange, underlyingSecType, underlyingConId); | ||
return this; | ||
@@ -358,2 +385,13 @@ } | ||
// input params account here is acctCode, we name it account to be consistent with IB document | ||
IB.prototype.reqPositionsMulti = function (reqId, account, modelCode) { | ||
assert(_.isNumber(reqId), '"reqId" must be an integer - ' + reqId); | ||
assert(_.isString(account), '"account" must be a string - ' + account); | ||
assert(_.isString(modelCode) || _.isNull(modelCode), '"modelCode" must be a string or null - ' + modelCode); | ||
this._send('reqPositionsMulti', reqId, account, modelCode); | ||
return this; | ||
}; | ||
IB.prototype.reqRealTimeBars = function (tickerId, contract, barSize, whatToShow, useRTH) { | ||
@@ -402,3 +440,3 @@ assert(_.isNumber(tickerId), '"tickerId" must be an integer - ' + tickerId); | ||
IB.prototype.queryDisplayGroups = function (reqId) { | ||
IB.prototype.queryDisplayGroups = function (reqId) { | ||
assert(_.isNumber(reqId), '"reqId" must be an integer - ' + reqId); | ||
@@ -405,0 +443,0 @@ |
@@ -110,2 +110,14 @@ var _ = require('lodash'); | ||
Outgoing.prototype.cancelAccountUpdatesMulti = function (reqId) { | ||
var version = 2; | ||
this._send(C.OUTGOING.CANCEL_ACCOUNT_UPDATES_MULTI, version, reqId); | ||
}; | ||
Outgoing.prototype.cancelPositionsMulti = function (reqId) { | ||
var version = 2; | ||
this._send(C.OUTGOING.CANCEL_POSITIONS_MULTI, version, reqId); | ||
}; | ||
Outgoing.prototype.cancelCalculateImpliedVolatility = function (reqId) { | ||
@@ -774,2 +786,7 @@ if (this._controller._serverVersion < C.MIN_SERVER_VER.CANCEL_CALC_IMPLIED_VOLAT) { | ||
Outgoing.prototype.reqAccountUpdatesMulti = function (reqId, acctCode, modelCode, ledgerAndNLV) { | ||
var version = 2; | ||
this._send(C.OUTGOING.REQ_ACCOUNT_UPDATES_MULTI, version, reqId, acctCode, modelCode, ledgerAndNLV); | ||
}; | ||
Outgoing.prototype.reqAllOpenOrders = function () { | ||
@@ -817,3 +834,3 @@ var version = 1; | ||
}; | ||
@@ -1027,7 +1044,7 @@ | ||
} | ||
if (this._controller._serverVersion >= C.MIN_SERVER_VER.SYNT_REALTIME_BARS) { | ||
args.push(keepUpToDate); | ||
} | ||
if (this._controller._serverVersion >= C.MIN_SERVER_VER.LINKING) { | ||
@@ -1156,7 +1173,7 @@ args.push(""); | ||
} | ||
if (this._controller._serverVersion >= C.MIN_SERVER_VER.REQ_SMART_COMPONENTS) { | ||
args.push(regulatorySnapshot); | ||
} | ||
if (this._controller._serverVersion >= C.MIN_SERVER_VER.LINKING) { | ||
@@ -1237,2 +1254,12 @@ args.push(""); | ||
Outgoing.prototype.reqPositionsMulti = function (reqId, account, modelCode) { | ||
if (this._controller._serverVersion < C.MIN_SERVER_VER.ACCT_SUMMARY) { | ||
return this._controller.emitError('It does not support position requests.'); | ||
} | ||
var version = 1; | ||
this._send(C.OUTGOING.REQ_POSITIONS_MULTI, version, reqId, account, modelCode); | ||
}; | ||
Outgoing.prototype.reqRealTimeBars = function (tickerId, contract, barSize, whatToShow, useRTH) { | ||
@@ -1370,3 +1397,3 @@ if (this._controller._serverVersion < C.MIN_SERVER_VER.REAL_TIME_BARS) { | ||
//return this._controller.emitError('It does not support reqSecDefOptParams.'); | ||
} | ||
} | ||
this._send(C.OUTGOING.REQ_SEC_DEF_OPT_PARAMS, reqId, underlyingSymbol, futFopExchange, underlyingSecType, underlyingConId); | ||
@@ -1373,0 +1400,0 @@ } |
{ | ||
"name": "ib", | ||
"description": "Interactive Brokers TWS (or IB Gateway) API client library for Node.js", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "MIT", | ||
@@ -59,5 +59,5 @@ "author": { | ||
"scripts": { | ||
"prepublish": "npm prune", | ||
"prepare": "npm prune", | ||
"test": "grunt test" | ||
} | ||
} |
@@ -59,2 +59,3 @@ [![Logo](https://raw.github.com/pilwon/node-ib/master/logo.jpg)](http://interactivebrokers.com/) | ||
.cancelAccountSummary(reqId) | ||
.cancelAccountUpdatesMulti(requestId) | ||
.cancelCalculateImpliedVolatility(reqId) | ||
@@ -69,2 +70,3 @@ .cancelCalculateOptionPrice(reqId) | ||
.cancelPositions() | ||
.cancelPositionsMulti(requestId) | ||
.cancelRealTimeBars(tickerId) | ||
@@ -77,2 +79,3 @@ .cancelScannerSubscription(tickerId) | ||
.reqAccountUpdates(subscribe, acctCode) | ||
.reqAccountUpdatesMulti(requestId, account, modelCode, ledgerAndNLV) | ||
.reqAllOpenOrders() | ||
@@ -94,2 +97,3 @@ .reqAutoOpenOrders(bAutoBind) | ||
.reqPositions() | ||
.reqPositionsMulti(requestId, account, modelCode) | ||
.reqRealTimeBars(tickerId, contract, barSize, whatToShow, useRTH) | ||
@@ -123,2 +127,4 @@ .reqScannerParameters() | ||
.on('accountDownloadEnd', function (accountName)) | ||
.on('accountUpdateMulti', function (reqId, account, modelCode, key, value, currency)) | ||
.on('accountUpdateMultiEnd', function (reqId)) | ||
.on('accountSummary', function (reqId, account, tag, value, currency)) | ||
@@ -144,2 +150,4 @@ .on('accountSummaryEnd', function (reqId)) | ||
.on('positionEnd', function ()) | ||
.on('positionMulti', function (reqId, account, modelCode, contract, pos, avgCost)) | ||
.on('positionMultiEnd', function (reqId)) | ||
.on('realtimeBar', function (reqId, time, open, high, low, close, volume, wap, count)) | ||
@@ -146,0 +154,0 @@ .on('receiveFA', function (faDataType, xml)) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130516
3321
230