New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ib

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ib - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

12

lib/constants.js

@@ -78,2 +78,6 @@ exports.VERSION = 'twsapi_macunix.970.01';

HISTOGRAM_DATA : 89,
HISTORICAL_TICKS : 96,
HISTORICAL_TICKS_BID_ASK : 97,
HISTORICAL_TICKS_LAST : 98,
TICK_BY_TICK : 99
};

@@ -147,3 +151,6 @@

REQ_HISTOGRAM_DATA : 88,
CANCEL_HISTOGRAM_DATA : 89
CANCEL_HISTOGRAM_DATA : 89,
REQ_HISTORICAL_TICKS : 96,
REQ_TICK_BY_TICK_DATA : 97,
CANCEL_TICK_BY_TICK_DATA : 98
};

@@ -224,3 +231,4 @@

NEWS_QUERY_ORIGINS : 128,
SERVER_VER_UNREALIZED_PNL : 129
SERVER_VER_UNREALIZED_PNL : 129,
MIN_SERVER_VER_HISTORICAL_TICKS: 130
};

@@ -227,0 +235,0 @@

@@ -423,2 +423,124 @@ var _ = require('lodash');

Incoming.prototype._HISTORICAL_TICKS_LAST = function() {
var reqId = this.dequeueInt();
var tickCount = this.dequeueInt();
var date;
var mask;
var price;
var size;
var exchange;
var specialConditions;
while (tickCount--) {
date = this.dequeue();
mask = this.dequeueInt();
price = this.dequeueFloat();
size = this.dequeueInt();
exchange = this.dequeue();
specialConditions = this.dequeue();
this._emit('historicalTickTradeData', reqId, date, mask, price, size, exchange, specialConditions);
}
var done = this.dequeueBool();
if (done) {
this._emit('historicalTickDataEnd', reqId);
}
};
Incoming.prototype._HISTORICAL_TICKS_BID_ASK = function() {
var reqId = this.dequeueInt();
var tickCount = this.dequeueInt();
var date;
var mask;
var priceBid;
var sizeBid;
var priceAsk;
var sizeAsk;
while (tickCount--) {
date = this.dequeue();
mask = this.dequeueInt();
priceBid = this.dequeueFloat();
sizeBid = this.dequeueInt();
priceAsk = this.dequeueFloat();
sizeAsk = this.dequeueInt();
this._emit('historicalTickBidAskData', reqId, date, mask, priceBid, priceAsk, sizeBid, sizeAsk);
}
var done = this.dequeueBool();
if (done) {
this._emit('historicalTickDataEnd', reqId);
}
};
Incoming.prototype._HISTORICAL_TICKS = function() { // MIDPOINT (size appears to always be zero)
var reqId = this.dequeueInt();
var tickCount = this.dequeueInt();
var date;
var price;
var size;
while (tickCount--) {
date = this.dequeue();
this.dequeueInt();//for consistency
price = this.dequeueFloat();
size = this.dequeueInt();
this._emit('historicalTickMidPointData', reqId, date, price, size);
}
var done = this.dequeueBool();
if (done) {
this._emit('historicalTickDataEnd', reqId);
}
};
Incoming.prototype._TICK_BY_TICK = function () {
var reqId = this.dequeueInt();
var tickType = this.dequeueInt();
var time = this.dequeue();
var mask;
switch (tickType){
case 0: // None
break;
case 1: // Last
case 2: // Alllast
var price = this.dequeueFloat();
var size = this.dequeueInt();
mask = this.dequeueInt();
var pastLimit = (mask & (1 << 0)) !== 0;
var unreported = (mask & (1 << 1)) !== 0;
var exchange = this.dequeue();
var specialConditions = this.dequeue();
this._emit('tickByTickAllLast', reqId, tickType, time, price, size, { pastLimit, unreported }, exchange, specialConditions);
break;
case 3: // BidAsk
var bidPrice = this.dequeueFloat();
var askPrice = this.dequeueFloat();
var bidSize = this.dequeueInt();
var askSize = this.dequeueInt();
mask = this.dequeueInt();
var bidPastLow = (mask & (1 << 0)) !== 0;
var askPastHigh = (mask & (1 << 1)) !== 0;
this._emit('tickByTickBidAsk', reqId, time, bidPrice, askPrice, bidSize, askSize, { bidPastLow, askPastHigh });
break;
case 4: // MidPoint
var midPoint = this.dequeueFloat();
this._emit('tickByTickMidPoint', reqId, time, midPoint);
break;
}
};
Incoming.prototype._HEAD_TIMESTAMP = function() {

@@ -425,0 +547,0 @@ var reqId = this.dequeueInt();

@@ -316,2 +316,40 @@ var assert = require('assert');

IB.prototype.reqHistoricalTicks = function (tickerId, contract, startDateTime, endDateTime, numberOfTicks,
whatToShow, useRTH, ignoreSize){
assert(_.isNumber(tickerId), '"tickerId" must be an integer - ' + tickerId);
assert(_.isPlainObject(contract), '"contract" must be a plain object - ' + contract);
if (startDateTime && endDateTime || !startDateTime && !endDateTime) {
assert.fail('specify one of "startDateTime" or "endDateTime" (as a string) but not both - ' + startDateTime + ':' + endDateTime);
}
assert(_.isNumber(numberOfTicks), '"numberOfTicks" must be a number - ' + numberOfTicks);
assert(_.isString(whatToShow), '"whatToShow" must be a string - ' + whatToShow);
assert(_.isNumber(useRTH), '"useRTH" must be an integer - ' + useRTH);
assert(_.isBoolean(ignoreSize), '"ignoreSize" must be an boolean - ' + ignoreSize);
this._send('reqHistoricalTicks', tickerId, contract, startDateTime, endDateTime, numberOfTicks,
whatToShow, useRTH, ignoreSize);
return this;
};
IB.prototype.reqTickByTickData = function (tickerId, contract, tickType, numberOfTicks, ignoreSize) {
assert(_.isNumber(tickerId), '"tickerId" must be an integer - ' + tickerId);
assert(_.isPlainObject(contract), '"contract" must be a plain object - ' + contract);
assert(_.isString(tickType), '"tickType" must be a string - ' + tickType);
assert(_.isNumber(numberOfTicks), '"numberOfTicks" must be a number - ' + numberOfTicks);
assert(_.isBoolean(ignoreSize), '"ignoreSize" must be an boolean - ' + ignoreSize);
this._send('reqTickByTickData', tickerId, contract, tickType, numberOfTicks, ignoreSize);
return this;
};
IB.prototype.cancelTickByTickData = function (tickerId) {
assert(_.isNumber(tickerId), '"tickerId" must be an integer - ' + tickerId);
this._send('cancelTickByTickData', tickerId);
return this;
};
IB.prototype.reqIds = function (numIds) {

@@ -318,0 +356,0 @@ assert(_.isNumber(numIds), '"numIds" must be an integer - ' + numIds);

2

lib/order/market.js

@@ -7,3 +7,3 @@ var assert = require('assert');

assert(_.isString(action), 'Action must be a string.');
assert(_.isNumber(quantity), 'Quantity must be a string.');
assert(_.isNumber(quantity), 'Quantity must be a number.');

@@ -10,0 +10,0 @@ if (transmitOrder === undefined) {

@@ -7,3 +7,3 @@ var assert = require('assert');

assert(_.isString(action), 'Action must be a string.');
assert(_.isNumber(quantity), 'Quantity must be a string.');
assert(_.isNumber(quantity), 'Quantity must be a number.');

@@ -10,0 +10,0 @@ if (transmitOrder === undefined) {

@@ -7,3 +7,3 @@ var assert = require('assert');

assert(_.isString(action), 'Action must be a string.');
assert(_.isNumber(quantity), 'Quantity must be a string.');
assert(_.isNumber(quantity), 'Quantity must be a number.');
assert(_.isNumber(stopPrice), 'Stop price must be a number.');

@@ -10,0 +10,0 @@ assert(_.isNumber(limitPrice), 'Limit price must be a number.');

@@ -1053,2 +1053,99 @@ var _ = require('lodash');

Outgoing.prototype.reqHistoricalTicks = function (tickerId, contract, startDateTime, endDateTime,
numberOfTicks, whatToShow, useRTH, ignoreSize) {
if (this._controller._serverVersion < 73) {
return this._controller.emitError('It does not support historical tick data backfill.');
}
var args = [C.OUTGOING.REQ_HISTORICAL_TICKS, tickerId];
// send contract fields
if (this._controller._serverVersion >= C.MIN_SERVER_VER.TRADING_CLASS) {
args.push(contract.conId);
}
args.push(contract.symbol);
args.push(contract.secType);
args.push(contract.expiry);
args.push(contract.strike);
args.push(contract.right);
args.push(contract.multiplier);
args.push(contract.exchange);
args.push(contract.primaryExch);
args.push(contract.currency);
args.push(contract.localSymbol);
args.push(contract.tradingClass);
args.push(contract.includeExpired);
args.push(startDateTime);
args.push(endDateTime);
args.push(numberOfTicks);
args.push(whatToShow);
args.push(useRTH);
if (_.isString(contract.secType) &&
C.BAG_SEC_TYPE.toUpperCase() === contract.secType.toUpperCase()) {
if (!_.isArray(contract.comboLegs)) {
args.push(0);
} else {
args.push(contract.comboLegs.length);
contract.comboLegs.forEach(function (comboLeg) {
args.push(comboLeg.conId);
args.push(comboLeg.ratio);
args.push(comboLeg.action);
args.push(comboLeg.exchange);
});
}
}
args.push(ignoreSize);
if (this._controller._serverVersion >= C.MIN_SERVER_VER.LINKING) {
args.push('');
}
this._send(args);
};
Outgoing.prototype.reqTickByTickData = function (tickerId, contract, tickType, numberOfTicks, ignoreSize){
if (this._controller._serverVersion < 73) {
return this._controller.emitError('It does not support tick by tick data.');
}
var args = [C.OUTGOING.REQ_TICK_BY_TICK_DATA, tickerId];
// send contract fields
args.push(contract.conId);
args.push(contract.symbol);
args.push(contract.secType);
args.push(contract.expiry);
args.push(contract.strike);
args.push(contract.right);
args.push(contract.multiplier);
args.push(contract.exchange);
args.push(contract.primaryExch);
args.push(contract.currency);
args.push(contract.localSymbol);
args.push(contract.tradingClass);
args.push(tickType);
args.push(numberOfTicks);
args.push(ignoreSize);
this._send(args);
};
Outgoing.prototype.cancelTickByTickData = function (tickerId) {
if (this._controller._serverVersion < 73) {
return this._controller.emitError('It does not support tick by tick data.');
}
var args = [C.OUTGOING.CANCEL_TICK_BY_TICK_DATA, tickerId];
this._send(args);
};
Outgoing.prototype.reqIds = function (numIds) {

@@ -1055,0 +1152,0 @@ var version = 1;

{
"name": "ib",
"description": "Interactive Brokers TWS (or IB Gateway) API client library for Node.js",
"version": "0.2.4",
"version": "0.2.5",
"license": "MIT",

@@ -6,0 +6,0 @@ "author": {

@@ -72,2 +72,3 @@ [![Logo](https://raw.github.com/pilwon/node-ib/master/logo.jpg)](http://interactivebrokers.com/)

.cancelScannerSubscription(tickerId)
.cancelTickByTickData(tickerId)
.exerciseOptions(tickerId, contract, exerciseAction, exerciseQuantity, account, override)

@@ -87,2 +88,4 @@ .placeOrder(id, contract, order)

.reqHistoricalData(tickerId, contract, endDateTime, durationStr, barSizeSetting, whatToShow, useRTH, formatDate, keepUpToDate)
.reqHistoricalTicks(tickerId, contract, startDateTime, endDateTime, numberOfTicks, whatToShow, useRTH, ignoreSize)
.reqTickByTickData(tickerId, contract, tickType, numberOfTicks, ignoreSize)
.reqIds(numIds)

@@ -139,2 +142,8 @@ .reqManagedAccts()

.on('historicalData', function (reqId, date, open, high, low, close, volume, count, WAP, hasGaps))
.on('historicalTickTradeData', (reqId, timestamp, mask, price, size, exchange, specialConditions))
.on('historicalTickBidAskData', (reqId, timestamp, mask, priceBid, priceAsk, sizeBid, sizeAsk))
.on('historicalTickMidPointData', (reqId, timestamp, price, size))
.on('tickByTickAllLast', reqId, tickType, time, price, size, { pastLimit, unreported }, exchange, specialConditions)
.on('tickByTickBidAsk', reqId, time, bidPrice, askPrice, bidSize, askSize, { bidPastLow, askPastHigh })
.on('tickByTickMidPoint', reqId, time, midPoint))
.on('managedAccounts', function (accountsList))

@@ -141,0 +150,0 @@ .on('marketDataType', function (reqId, marketDataType))

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc