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A,uBAAwB,SAAU,EAAO,EAAS,EAAW,GAC3D,KAAK,UAAU,WACb,KAAK,OAAO,uBAAuB,EAAO,EAAS,EAAW,EAChE,GACF,EAQA,0BAA2B,SAAU,GACnC,KAAK,UAAU,WACb,KAAK,OAAO,0BAA0B,EACxC,GACF,EAYA,mBAAoB,SAAU,EAAO,EAAkB,EACzB,EAAmB,GAC/C,KAAK,UAAU,WACb,KAAK,OAAO,mBAAmB,EAAO,EAAkB,EACzB,EAAmB,EACpD,GACF,EAQA,mBAAoB,SAAU,GAC5B,KAAK,UAAU,WACb,KAAK,OAAO,mBAAmB,EACjC,GACF,EAYA,OAAQ,SAAU,GAChB,KAAK,UAAU,WACb,KAAK,OAAO,OAAO,EACrB,GACF,EAOA,eAAgB,WACd,KAAK,UAAS,WAAc,KAAK,OAAO,gBAAkB,GAC5D,EAEA,SAAU,SAAU,GAClB,KAAK,QAAQ,aAAa,EAAG,SAAU,EAAK,GAC1C,EAAO,KAAK,KAAZ,EACF,EAAE,KAAK,MACT,GAGF,QAAU,OAAO,QAAU,CACzB,UAAa,UACb,WAAc,WACd,SAAY,SACZ,UAAa,UACb,oBAAuB,oBACvB,gBAAmB,gBACnB,MAAS","file":"/npm/ibapi@2.5.5/ibapi.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ibapi@2.5.5/ibapi.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n// module for event driven methods\nvar addon = require('./build/Release/NodeIbapiAddon'),\n  contract = require('./lib/contract'),\n  order = require('./lib/order'),\n  execution = require('./lib/execution'),\n  contractDetails = require('./lib/contractDetails'),\n  scannerSubscription = require('./lib/scannerSubscription'),\n  messageIds = require('./messageIds'),\n  async = require(\"async\"),\n  RateLimiter = require(\"limiter\").RateLimiter;\n\n/**\n  * Constructor. Default rate limited to 50 output requests per second\n  * @constructor\n  */\nfunction NodeIbapi() {\n  this.client = new addon.NodeIbapi();\n  this.limiter = new RateLimiter(50, 'second');\n  this.handlers = {};\n  this.isProcessing=false;\n}\n\nNodeIbapi.prototype = {\n\n  _consumeMessages: function () {\n    async.forever( this._processMessage.bind(this),\n      function(err) {\n        console.error(err);\n        throw err;\n      }\n    );\n  },\n\n  _processMessage: function (next) {\n    this.client.processMsg();\n    var message = this.client.getInboundMsg();\n    if (message.messageId in this.handlers) {\n      var handler = this.handlers[message.messageId];\n      handler(message);\n    }\n    if (!this.client.isConnected()) {\n      message = {};\n      message.messageId = 'disconnected';\n      if (message.messageId in this.handlers) {\n        var dcHandler = this.handlers[message.messageId];\n        dcHandler(message);\n      }\n    }\n    setTimeout(next,0);\n  },\n\n  /**\n    * This function must be called before any other. There is no feedback for a\n    * successful connection, but a subsequent attempt to connect will return the\n    * message \"Already connected.\" See\n    * interactivebrokers.com/en/software/api/apiguide/c/econnect.htm\n    * @memberof NodeIbapi\n    * @param {string} host -\n    * @param {uint} port -\n    * @param {int} clientId -\n    * @param {bool} extraAuth -\n    */\n  connect: function (host, port, clientId, extraAuth) {\n    return this.client.connect(host, port, clientId, extraAuth);\n  },\n\n  /**\n    * Call this function to start processing incoming and outgoing messages\n    * @memberof NodeIbapi\n    */\n  beginProcessing: function () {\n    if (!this.isProcessing) {\n      this._consumeMessages();\n      this.isProcessing = true;\n    }\n  },\n\n  /**\n    * Call this function to terminate the connections with TWS. Calling this\n    * function does not cancel orders that have already been sent. See\n    * interactivebrokers.com/en/software/api/apiguide/c/edisconnect.htm\n    * @memberof NodeIbapi\n    */\n  disconnect: function () {\n    this.doAction( function () {\n      this.client.disconnect();\n    });\n  },\n\n  /**\n    * Call this function to check if there is a connection with TWS. See\n    * interactivebrokers.com/en/software/api/apiguide/c/isconnected.htm\n    * @memberof NodeIbapi\n    */\n  isConnected: function () {\n    return this.client.isConnected();\n  },\n\n  /**\n    * Returns the time the API application made a connection to TWS. See\n    * interactivebrokers.com/en/software/api/apiguide/c/twsconnectiontime.htm\n    * @memberof NodeIbapi\n    */\n  twsConnectionTime: function () {\n    return this.client.twsConnectionTime();\n  },\n\n  /**\n    * Call this function to request market data. The market data will be \n    * returned by the tickPrice and tickSize events. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqmktdata.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId - \n    * @param {contract} contract - see contract.js\n    * @param {string} genericTickType -\n    * @param {bool} snapShot - \n    */\n  reqMktData: function (reqId, contract, genericTickType, snapShot) {\n    this.doAction( function () {\n      this.client.reqMktData(reqId, contract, genericTickType, snapShot);\n    });\n  },\n\n  /**\n    * After calling this function, market data for the specified id will stop\n    * flowing. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelmktdata.htm\n    * @memberof NodeIbapi\n    * @param {uint} reqId -\n    */\n  cancelMktData: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelMktData(reqId);\n    });\n  },\n\n  /**\n    * Call this function to place an order. The order status will be returned \n    * by the orderStatus event. See\n    * interactivebrokers.com/en/software/api/apiguide/c/placeorder.htm\n    * @memberof NodeIbapi\n    * @param {int} orderId -\n    * @param {contract} contract - \n    * @param {order} order - \n    */\n  placeOrder: function (orderId, contract, order) {\n    this.doAction( function () {\n      this.client.placeOrder(orderId, contract, order);\n    });\n  },\n\n  /**\n    * Call this function to place an order. Short form. The order status will \n    * be returned by the orderStatus event. See\n    * interactivebrokers.com/en/software/api/apiguide/c/placeorder.htm\n    * @memberof NodeIbapi\n    * @param {int} orderId -\n    * @param {contract} contract - \n    * @param {string} action - \"BUY\", \"SELL\"\n    * @param {int} quantity -\n    * @param {string} orderType - \"LMT\", \"MKT\", etc\n    * @param {double} price -\n    * @param {double} auxPrice -\n    */\n  placeSimpleOrder: function (orderId, contract, action, quantity, orderType,\n                              price, auxPrice) {\n    this.doAction( function () {\n      this.client.placeOrder(orderId, contract, action, quantity, orderType,\n                              price, auxPrice);\n    });\n  },\n\n  /**\n    * Call this function to cancel an order.\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelorder.htm\n    * @memberof NodeIbapi\n    * @param {uint} orderId - orderId\n    */\n  cancelOrder: function (orderId) {\n    this.doAction( function () {\n      this.client.cancelOrder(orderId);\n    });\n  },\n\n  /**\n    * Call this function to request the open orders that were placed from this\n    * client. Each open order will be fed back through the openOrder() and\n    * orderStatus() functions on the EWrapper.\n    * See interactivebrokers.com/en/software/api/apiguide/c/reqopenorders.htm\n    * @memberof NodeIbapi\n    */\n  reqOpenOrders: function () {\n    this.doAction( function () {\n      this.client.reqOpenOrders();\n    });\n  },\n\n  /**\n    * Call this function to start getting account values, portfolio, and last\n    * update time information. See \n    * interactivebrokers.com/en/software/api/apiguide/c/reqaccountupdates.htm\n    * @memberof NodeIbapi\n    * @param {bool} subscribe -\n    * @param {string} acctCode -\n    */\n  reqAccountUpdates: function (subscribe, acctCode) {\n    this.doAction( function () {\n      this.client.reqAccountUpdates(subscribe, acctCode);\n    });\n  },\n\n  /**\n    * When this function is called, the execution reports that meet the filter\n    * criteria are downloaded to the client via the execDetails() function. To\n    * view executions beyond the past 24 hours, open the Trade Log in TWS and,\n    * while the Trade Log is displayed, request the executions again from the\n    * API. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqexecutions.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {executionFilter} filter - see execution.js\n    */\n  reqExecutions: function (reqId, executionFilter) {\n    this.doAction( function () {\n      this.client.reqExecutions(reqId, executionFilter);\n    });\n  },\n\n  /**\n    * Call this function to download all details for a particular underlying.\n    * The contract details will be received via the contractDetails() function\n    * on the EWrapper. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqcontractdetails.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {contract} contract -\n    */\n  reqContractDetails: function (reqId, contract) {\n    this.doAction( function () {\n      this.client.reqContractDetails(reqId, contract);\n    });\n  },\n\n  /**\n    * Call this function to request market depth for a specific contract. The\n    * market depth will be returned by the updateMktDepth() and\n    * updateMktDepthL2() events. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqmktdepth.htm\n    * @memberof NodeIbapi\n    * @param {int} tickerId -\n    * @param {contract} contract -\n    * @param {int} numRows -\n    */\n  reqMktDepth: function (tickerId, contract, numRows) {\n    this.doAction( function () {\n      this.client.reqMktDepth(tickerId, contract, numRows);\n    });\n  },\n\n  /**\n    * After calling this function, market depth data for the specified id will\n    * stop flowing. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelmktdepth.htm\n    * @memberof NodeIbapi\n    * @param {int} tickerId -\n    */\n  cancelMktDepth: function (tickerId) {\n    this.doAction( function () {\n      this.client.cancelMktDepth(tickerId);\n    });\n  },\n\n  /**\n    * Call this function to start receiving news bulletins. Each bulletin will\n    * be returned by the updatedNewsBulletin() event. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqnewsbulletins.htm\n    * @memberof NodeIbapi\n    * @param {bool} allMsgs -\n    */\n  reqNewsBulletins: function (allMsgs) {\n    this.doAction( function () {\n      this.client.reqNewsBulletins(allMsgs);\n    });\n  },\n\n  /**\n    * Call this function to stop receiving news bulletins. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelnewsbulletins.htm\n    * @memberof NodeIbapi\n    */\n  cancelNewsBulletins: function () {\n    this.doAction( function () {\n      this.client.cancelNewsBulletins();\n    });\n  },\n\n  /**\n    * The default detail level is ERROR. See\n    * interactivebrokers.com/en/software/api/apiguide/c/setloglevel.htm\n    * @memberof NodeIbapi\n    * @param {int} level -\n    */\n  setServerLogLevel: function (level) {\n    this.doAction( function () {\n      this.client.setServerLogLevel(level);\n    });\n  },\n\n  /**\n    * Call this function to request that newly created TWS orders be implicitly\n    * associated with the client. When a new TWS order is created, the order\n    * will be associated with the client, and fed back through the openOrder()\n    * and orderStatus() functions on the EWrapper. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqautoopenorders.htm\n    * @memberof NodeIbapi\n    * @param {bool} bAutoBind -\n    */\n  reqAutoOpenOrders: function (bAutoBind) {\n    this.doAction( function () {\n      this.client.reqAutoOpenOrders(bAutoBind);\n    });\n  },\n\n  /**\n    * Call this function to request the open orders placed from all clients and\n    * also from TWS. Each open order will be fed back through the openOrder()\n    * and orderStatus() functions on the EWrapper. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqallopenorders.htm\n    * @memberof NodeIbapi\n    */\n  reqAllOpenOrders: function () {\n    this.doAction( function () {\n      this.client.reqAllOpenOrders();\n    });\n  },\n\n  /**\n    * Call this function to request the list of managed accounts. The list will\n    * be returned by the managedAccounts() function on the EWrapper. Note: This\n    * request can only be made when connected to a FA managed account. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqmanagedaccts.htm\n    * @memberof NodeIbapi\n    */\n  reqManagedAccts: function () {\n    this.doAction( function () {\n      this.client.reqManagedAccts();\n    });\n  },\n\n  /**\n    * Request historical data. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqhistoricaldata.htm\n    * @memberof NodeIbapi\n    * @param {int} id -\n    * @param {contract} contract -\n    * @param {string} endDateTime -\n    * @param {string} durationStr -\n    * @param {string} barSizeSetting -\n    * @param {string} whatToShow -\n    * @param {int} useRTH -\n    * @param {int} formatDate -\n    */\n  reqHistoricalData: function (id, contract, endDateTime, durationStr,\n                               barSizeSetting, whatToShow, useRTH, formatDate) {\n    this.doAction( function () {\n      this.client.reqHistoricalData(id, contract, endDateTime, durationStr,\n                               barSizeSetting, whatToShow, useRTH, formatDate);\n    });\n  },\n\n  /**\n    * See interactivebrokers.com/en/software/api/apiguide/c/exerciseoptions.htm\n    * @memberof NodeIbapi\n    * @param {int} id -\n    * @param {contract} contract -\n    * @param {int} exerciseAction -\n    * @param {int} exerciseQuantity -\n    * @param {string} account -\n    * @param {int} override -\n    */\n  exerciseOptions: function (id, contract, exerciseAction,\n                              excerciseQuantity, account, override) {\n    this.doAction( function () {\n      this.client.exerciseOptions(id, contract, exerciseAction,\n                                  excerciseQuantity, account, override);\n    });\n  },\n\n  /**\n    * Used if an internet disconnect has occurred or the results of a query are\n    * otherwise delayed and the application is no longer interested in receiving\n    * the data. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelhistoricaldata.htm\n    * @memberof NodeIbapi\n    * @param {int} tickerId -\n    */\n  cancelHistoricalData: function (tickerId) {\n    this.doAction( function () {\n      this.client.cancelHistoricalData(tickerId);\n    });\n  },\n\n  /**\n    * Call the reqRealTimeBars() function to start receiving real time bar\n    * results through the realtimeBar() EWrapper function. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqrealtimebars.htm\n    * @memberof NodeIbapi\n    * @param {int} id -\n    * @param {contract} contract -\n    * @param {int} barSize -\n    * @param {string} whatToShow -\n    * @param {bool} useRTH -\n    */\n  reqRealtimeBars: function (id, contract, barSize, whatToShow, useRTH) {\n    this.doAction( function () {\n      this.client.reqRealtimeBars(id, contract, barSize, whatToShow, useRTH);\n    });\n  },\n\n  /**\n    * Call the cancelRealTimeBars() function to stop receiving real time bar\n    * results. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelrealtimebars.htm\n    * @memberof NodeIbapi\n    * @param {int} tickerId - \n    */\n  cancelRealTimeBars: function (tickerId) {\n    this.doAction( function () {\n      this.client.cancelRealTimeBars(tickerId);\n    });\n  },\n\n  /**\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelscannersubscription.htm\n    * @memberof NodeIbapi\n    * @param {int} tickerId -\n    */\n  cancelScannerSubscription: function (tickerId) {\n    this.doAction( function () {\n      this.client.cancelScannerSubscription(tickerId);\n    });\n  },\n\n  /**\n    * Requests an XML string that describes all possible scanner queries. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqscannerparameters.htm\n    * @memberof NodeIbapi\n    */\n  reqScannerParameters: function () {\n    this.doAction( function () {\n      this.client.reqScannerParameters();\n    });\n  },\n\n  /**\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqscannersubscription.htm\n    * @memberof NodeIbapi\n    * @param {int} tickerId -\n    * @param {scannerSubscription} subscription - see scannerSubscription.js\n    */\n  reqScannerSubscription: function (tickerId, scannerSubscription) {\n    this.doAction( function () {\n      this.client.reqScannerSubscription(tickerId, scannerSubscription);\n    });\n  },\n\n  /**\n    * Call this function to receive Reuters global fundamental data for stocks.\n    * There must be a subscription to Reuters Fundamental set up in Account\n    * Management before you can receive this data. reqFundamentalData() can\n    * handle conid specified in the Contract object, but not tradingClass or\n    * multiplier. This is because reqFundamentalData() is used only for stocks\n    * and stocks do not have a multiplier and trading class. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqfundamentaldata.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {contract} contract -\n    * @param {string} reportType -\n    */\n  reqFundamentalData: function (reqId, contract, reportType) {\n    this.doAction( function () {\n      this.client.reqFundamentalData(reqId, contract, reportType);\n    });\n  },\n\n  /**\n    * Call this function to stop receiving Reuters global fundamental data. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelfundamentaldata.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  cancelFundamentalData: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelFundamentalData(reqId);\n    });\n  },\n\n  /**\n    * Call this function to calculate volatility for a supplied option price and\n    * underlying price. See\n    * interactivebrokers.com/en/software/api/apiguide/c/calculateimpliedvolatility.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {contract} contract -\n    * @param {double} optionPrice -\n    * @param {double} underPrice -\n    */\n  calculateImpliedVolatility: function (reqId, contract, optionPrice,\n                                        underPrice) {\n    this.doAction( function () {\n      this.client.calculateImpliedVolatility(reqId, contract, optionPrice,\n                                        underPrice);\n    });\n  },\n\n  /**\n    * Call this function to calculate option price and greek values for a\n    * supplied volatility and underlying price. See\n    * interactivebrokers.com/en/software/api/apiguide/c/calculateoptionprice.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {contract} contract -\n    * @param {double} volatility -\n    * @param {double} underPrice -\n    */\n  calculateOptionPrice: function (reqId, contract, volatility, underPrice) {\n    this.doAction( function () {\n      this.client.calculateOptionPrice(reqId, contract, volatility, underPrice);\n    });\n  },\n\n  /**\n    * Call this function to cancel a request to calculate volatility for a\n    * supplied option price and underlying price. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelcalculateimpliedvolatility.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  cancelCalculateImpliedVolatility: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelCalculateImpliedVolatility(reqId);\n    });\n  },\n\n  /**\n    * Call this function to cancel a request to calculate the option price and\n    * greek values for a supplied volatility and underlying price. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelcalculateoptionprice.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  cancelCalculateOptionPrice: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelCalculateOptionPrice(reqId);\n    });\n  },\n\n  /**\n    * Use this function to cancel all open orders globally. It cancels both API\n    * and TWS open orders. If the order was created in TWS, it also gets\n    * canceled. If the order was initiated in the API, it also gets canceled.\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqglobalcancel.htm\n    * @memberof NodeIbapi\n    */\n  reqGlobalCancel: function () {\n    this.doAction( function () {\n      this.client.reqGlobalCancel();\n    });\n  },\n\n  /**\n    * The API can receive frozen market data from Trader Workstation. Frozen\n    * market data is the last data recorded in our system. During normal trading\n    * hours, the API receives real-time market data. If you use this function,\n    * you are telling TWS to automatically switch to frozen market data after\n    * the close. Then, before the opening of the next trading day, market data\n    * will automatically switch back to real-time market data. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqmarketdatatype.htm\n    * @memberof NodeIbapi\n    * @param {int} marketDataType -\n    */\n  reqMarketDataType: function (marketDataType) {\n    this.doAction( function () {\n      this.client.reqMarketDataType(marketDataType);\n    });\n  },\n\n  /**\n    * Requests real-time position data for all accounts. Note: This request can\n    * only be made when connected to an FA managed account. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqpositions.htm\n    * @memberof NodeIbapi\n    */\n  reqPositions: function () {\n    this.doAction( function () {\n      this.client.reqPositions();\n    });\n  },\n\n  /**\n    * Cancels real-time position updates. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelpositions.htm\n    * @memberof NodeIbapi\n    */\n  cancelPositions: function () {\n    this.doAction( function () {\n      this.client.cancelPositions();\n    });\n  },\n\n  /**\n    * Call this method to request and keep up to date the data that appears on\n    * the TWS Account Window Summary tab. The data is returned by\n    * accountSummary(). See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqaccountsummary.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {string} groupName -\n    * @param {string} tags -\n    */\n  reqAccountSummary: function (reqId, groupName, tags) {\n    this.doAction( function () {\n      this.client.reqAccountSummary(reqId, groupName, tags);\n    });\n  },\n\n  /**\n    * Cancels the request for Account Window Summary tab data. See\n    * interactivebrokers.com/en/software/api/apiguide/c/cancelaccountsummary.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  cancelAccountSummary: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelAccountSummary(reqId);\n    });\n  },\n\n  verifyRequest: function (apiName, apiVersion) {\n    this.doAction( function () {\n      this.client.verifyRequest(apiName, apiVersion);\n    });\n  },\n\n  verifyMessage: function (apiData) {\n    this.doAction( function () {\n      this.client.verifyMessage(apiData);\n    });\n  },\n\n  /**\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/querydisplaygroups.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  queryDisplayGroups: function (reqId) {\n    this.doAction( function () {\n      this.client.queryDisplayGroups(reqId);\n    });\n  },\n\n  /**\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/subscribetogroupevents.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId - \n    * @param {int} groupId -\n    */\n  subscribeToGroupEvents: function (reqId, groupId) {\n    this.doAction( function () {\n      this.client.subscribeToGroupEvents(reqId, groupId);\n    });\n  },\n\n  /**\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/updatedisplaygroup.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {string} contractInfo -\n    */\n  updateDisplayGroup: function (reqId, contractInfo) {\n    this.doAction( function () {\n      this.client.updateDisplayGroup(reqId, contractInfo);\n    });\n  },\n\n  /**\n    * See\n    * interactivebrokers.com/en/software/api/apiguide/c/unsubscribefromgroupevents.htm\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  unsubscribeFromGroupEvents: function (reqId) {\n    this.doAction( function () {\n      this.client.unsubscribeFromGroupEvents(reqId);\n    });\n  },\n\n  /**\n    * See\n    * https://interactivebrokers.github.io/tws-api/classIBApi_1_1EClient.html#a4fa2744c3459f9f6cf695980267608c3\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {string} account -\n    * @param {string} modelCode -\n    */\n  reqPositionsMulti: function (reqId, account, modelCode) {\n    this.doAction( function () {\n      this.client.reqPositionsMulti(reqId, account, modelCode);\n    });\n  },\n\n  /**\n    * See\n    * https://interactivebrokers.github.io/tws-api/classIBApi_1_1EClient.html#ae919658c15bceba6b6cf2a1336d0acbf\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  cancelPositionsMulti: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelPositionsMulti(reqId);\n    });\n  },\n\n  /**\n    * See\n    * https://interactivebrokers.github.io/tws-api/classIBApi_1_1EClient.html#a7233f67c6c69f3057994b6b97a366dfb\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {string} account -\n    * @param {string} modelCode -\n    * @param {bool} ledgerAndNLV -\n    */\n  reqAccountUpdatesMulti: function (reqId, account, modelCode, ledgerAndNLV) {\n    this.doAction( function () {\n      this.client.reqAccountUpdatesMulti(reqId, account, modelCode, ledgerAndNLV);\n    });\n  },\n\n  /**\n    * See\n    * https://interactivebrokers.github.io/tws-api/classIBApi_1_1EClient.html#aff0d1003f82436d8bd1ba2e5a1cf09d5\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  cancelAccountUpdatesMulti: function (reqId) {\n    this.doAction( function () {\n      this.client.cancelAccountUpdatesMulti(reqId);\n    });\n  },\n\n  /**\n    * See\n    * https://interactivebrokers.github.io/tws-api/classIBApi_1_1EClient.html#adb17b291044d2f8dcca5169b2c6fd690\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    * @param {string} underlyingSymbol -\n    * @param {string} futFopExchange -\n    * @param {string} underlyingSecType -\n    * @param {int} underlyingConId -\n    */\n  reqSecDefOptParams: function (reqId, underlyingSymbol, futFopExchange,\n                                underlyingSecType, underlyingConId) {\n    this.doAction( function () {\n      this.client.reqSecDefOptParams(reqId, underlyingSymbol, futFopExchange,\n                                     underlyingSecType, underlyingConId);\n    });\n  },\n\n  /**\n    * See\n    * https://interactivebrokers.github.io/tws-api/classIBApi_1_1EClient.html#a3a187b45bb69f801b1c67bdf3fb66a88\n    * @memberof NodeIbapi\n    * @param {int} reqId -\n    */\n  reqSoftDollarTiers: function (reqId) {\n    this.doAction( function () {\n      this.client.reqSoftDollarTiers(reqId);\n    });\n  },\n\n  /**\n    * Call this function to request from TWS the next valid ID that can be used\n    * when placing an order.  After calling this function, the nextValidId()\n    * event will be triggered, and the id returned is that next valid ID. That\n    * ID will reflect any autobinding that has occurred (which generates new IDs\n    * and increments the next valid ID therein). See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqids.htm\n    * @memberof NodeIbapi\n    * @param {int} numIds -\n    */\n  reqIds: function (numIds) {\n    this.doAction( function () {\n      this.client.reqIds(numIds);\n    });\n  },\n\n  /**\n    * Returns the current system time on the server side. See\n    * interactivebrokers.com/en/software/api/apiguide/c/reqcurrenttime.htm\n    * @memberof NodeIbapi\n    */\n  reqCurrentTime: function () {\n    this.doAction(function () { this.client.reqCurrentTime(); });\n  },\n\n  doAction: function (action) {\n    this.limiter.removeTokens(1, function (err, remainingRequests) {\n      action.bind(this)();\n    }.bind(this));\n  }\n};\n\nexports = module.exports = {\n  \"NodeIbapi\": NodeIbapi,\n  \"messageIds\": messageIds,\n  \"contract\": contract,\n  \"execution\": execution,\n  \"scannerSubscription\": scannerSubscription,\n  \"contractDetails\": contractDetails,\n  \"order\": order\n};\n"]}