Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoqey/ib

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoqey/ib - npm Package Compare versions

Comparing version 1.3.17 to 1.3.18

2

dist/api/data/enum/sec-type.d.ts

@@ -38,4 +38,4 @@ /**

/** Cryptocurrency. */
CRYPTO = "CRYPTO "
CRYPTO = "CRYPTO"
}
export default SecType;

@@ -45,5 +45,5 @@ "use strict";

/** Cryptocurrency. */
SecType["CRYPTO"] = "CRYPTO ";
SecType["CRYPTO"] = "CRYPTO";
})(SecType || (exports.SecType = SecType = {}));
exports.default = SecType;
//# sourceMappingURL=sec-type.js.map
import { Observable } from "rxjs";
import { EventName } from "../..";
import { IBApiNextError, IBApiNext, ItemListUpdate } from "../../api-next";
import { IBApiNext, IBApiNextError, ItemListUpdate } from "../../api-next";
import { IBApiAutoConnection } from "./auto-connection";

@@ -5,0 +5,0 @@ import { IBApiNextSubscription } from "./subscription";

@@ -68,3 +68,3 @@ "use strict";

// get the existing registry entries, or add if not existing yet
const entires = [];
const entries = [];
eventHandler.forEach((handler) => {

@@ -79,3 +79,3 @@ const eventName = handler[0];

});
entires.push(entry);
entries.push(entry);
});

@@ -85,3 +85,3 @@ // lookup subscription by instance id

if (instanceId) {
entires.forEach((entry) => {
entries.forEach((entry) => {
const values = entry.subscriptions.values();

@@ -108,3 +108,3 @@ while (!subscription) {

}, () => {
entires.forEach((entry) => {
entries.forEach((entry) => {
entry.subscriptions.delete(subscription.reqId);

@@ -119,3 +119,3 @@ if (!entry.subscriptions.size) {

}, instanceId);
entires.forEach((entry) => {
entries.forEach((entry) => {
this.apiNext.logger.debug(LOG_TAG, `Add IBApiNextSubscription on EventName.${entry.eventName} for ${subscription.reqId}.`);

@@ -122,0 +122,0 @@ entry.subscriptions.set(subscription.reqId, subscription);

@@ -132,2 +132,3 @@ import { EventName } from "../../api/data/enum/event-name";

* Returns Number.MAX_VALUE if the token is empty.
* @deprecated readIntOrUndefined is probably what you are looking for
*/

@@ -134,0 +135,0 @@ readIntMax(): number;

@@ -11,3 +11,2 @@ "use strict";

const clientId = Math.floor(Math.random() * 32766) + 1; // ensure unique client
let subscription$;
let api;

@@ -14,0 +13,0 @@ let error$;

@@ -33,4 +33,4 @@ "use strict";

let refId;
const contract = new __1.Stock("SPY");
const order = {
const refContract = new __1.Stock("SPY");
const refOrder = {
orderType: __1.OrderType.LMT,

@@ -47,12 +47,11 @@ action: __1.OrderAction.BUY,

refId = orderId;
ib.placeOrder(refId, contract, order);
ib.placeOrder(refId, refContract, refOrder);
})
.on(__1.EventName.openOrder, (orderId, contract, order, _orderState) => {
expect(orderId).toEqual(refId);
expect(contract.symbol).toEqual("AAPL");
expect(order.totalQuantity).toEqual(2);
if (orderId == refId) {
expect(contract.symbol).toEqual(refContract.symbol);
expect(order.totalQuantity).toEqual(refOrder.totalQuantity);
done();
}
})
.on(__1.EventName.openOrderEnd, () => {
done();
})
.on(__1.EventName.error, (error, code, reqId, _advancedOrderReject) => {

@@ -64,3 +63,4 @@ if (reqId === -1) {

const msg = `[${reqId}] ${error.message} (Error #${code})`;
if (error.message.includes("Warning:")) {
if (error.message.includes("Warning:") ||
error.message.includes("Order Message:")) {
logger_1.default.warn(msg);

@@ -79,5 +79,5 @@ }

// buy an Apple call, with a PriceCondition on underlying
const contract = new __1.Option("AAPL", "20251219", 200, __1.OptionType.Call);
const refContract = new __1.Option("AAPL", "20251219", 200, __1.OptionType.Call);
const priceCondition = new __1.PriceCondition(29, __1.TriggerMethod.Default, 265598, "SMART", true, __1.ConjunctionConnection.OR);
const order = {
const refOrder = {
orderType: __1.OrderType.LMT,

@@ -95,10 +95,56 @@ action: __1.OrderAction.BUY,

refId = orderId;
ib.placeOrder(refId, contract, order);
ib.placeOrder(refId, refContract, refOrder);
})
.on(__1.EventName.openOrder, (orderId, _contract, _order, _orderState) => {
expect(orderId).toEqual(refId);
.on(__1.EventName.openOrder, (orderId, contract, order, _orderState) => {
if (orderId == refId) {
expect(contract.symbol).toEqual(refContract.symbol);
expect(order.totalQuantity).toEqual(refOrder.totalQuantity);
done();
}
})
.on(__1.EventName.openOrderEnd, () => {
done();
.on(__1.EventName.error, (error, code, reqId, _advancedOrderReject) => {
if (reqId === -1) {
logger_1.default.info(error.message);
}
else {
const msg = `[${reqId}] ${error.message} (Error #${code})`;
if (error.message.includes("Warning:") ||
error.message.includes("Order Message:")) {
logger_1.default.warn(msg);
}
else {
ib.disconnect();
done(msg);
}
}
});
ib.connect().reqOpenOrders();
});
test("What if Order", (done) => {
let refId;
const refContract = new __1.Stock("SPY");
const refOrder = {
orderType: __1.OrderType.LMT,
action: __1.OrderAction.BUY,
lmtPrice: 1,
orderId: refId,
totalQuantity: 2,
tif: __1.TimeInForce.DAY,
transmit: true,
whatIf: true,
};
ib.once(__1.EventName.nextValidId, (orderId) => {
refId = orderId;
ib.placeOrder(refId, refContract, refOrder);
})
.on(__1.EventName.openOrder, (orderId, contract, order, orderState) => {
if (orderId == refId) {
expect(contract.symbol).toEqual(refContract.symbol);
expect(order.totalQuantity).toEqual(refOrder.totalQuantity);
if (orderState.minCommission || orderState.maxCommission) {
expect(orderState.commissionCurrency).toEqual(refContract.currency);
done();
}
}
})
.on(__1.EventName.error, (error, code, reqId, _advancedOrderReject) => {

@@ -110,3 +156,4 @@ if (reqId === -1) {

const msg = `[${reqId}] ${error.message} (Error #${code})`;
if (error.message.includes("Warning:")) {
if (error.message.includes("Warning:") ||
error.message.includes("Order Message:")) {
logger_1.default.warn(msg);

@@ -113,0 +160,0 @@ }

{
"name": "@stoqey/ib",
"version": "1.3.17",
"version": "1.3.18",
"private": false,

@@ -71,3 +71,3 @@ "description": "Interactive Brokers TWS/IB Gateway API client library for Node.js (TS)",

"command-buffer": "^0.1.0",
"dotenv": "^16.3.1",
"dotenv": "^16.4.4",
"eventemitter3": "^5.0.1",

@@ -78,4 +78,4 @@ "function-rate-limit": "^1.1.0",

"devDependencies": {
"@types/jest": "^29.5.11",
"@types/node": "^18.17.15",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.15",
"@types/source-map-support": "^0.5.10",

@@ -86,3 +86,3 @@ "@typescript-eslint/eslint-plugin": "^6.18.1",

"eslint": "^8.56.0",
"eslint-plugin-jest": "^27.6.2",
"eslint-plugin-jest": "^27.8.0",
"eslint-plugin-rxjs": "^5.0.3",

@@ -92,4 +92,4 @@ "jest": "^29.7.0",

"jest-junit": "^16.0.0",
"ts-jest": "^29.1.1",
"typedoc": "^0.25.7",
"ts-jest": "^29.1.2",
"typedoc": "^0.25.8",
"typescript": "^5.2.2"

@@ -96,0 +96,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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