@stoqey/ib
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -62,5 +62,13 @@ import { Decoder, DecoderCallbacks } from "./decoder"; | ||
* Called when a message has been arrived on the API server connection. | ||
* | ||
* Used on V100 protocol. | ||
*/ | ||
onMessage(tokens: string[]): void; | ||
/** | ||
* Called when a message has been arrived on the API server connection. | ||
* | ||
* Used on pre-V100 protocol. | ||
*/ | ||
onTokens(tokens: string[]): void; | ||
/** | ||
* Get the API server version. | ||
@@ -136,10 +144,2 @@ * | ||
/** | ||
* Send an API command to the server connection. | ||
* | ||
* @param funcName API function name. | ||
* @param funcName API arguments. | ||
* | ||
* @see [[api]] | ||
*/ | ||
/** | ||
* Send raw token data to the server connection. | ||
@@ -146,0 +146,0 @@ * |
@@ -101,6 +101,16 @@ "use strict"; | ||
* Called when a message has been arrived on the API server connection. | ||
* | ||
* Used on V100 protocol. | ||
*/ | ||
Controller.prototype.onMessage = function (tokens) { | ||
this.decoder.enqueue(tokens); | ||
this.decoder.enqueueMessage(tokens); | ||
}; | ||
/** | ||
* Called when a message has been arrived on the API server connection. | ||
* | ||
* Used on pre-V100 protocol. | ||
*/ | ||
Controller.prototype.onTokens = function (tokens) { | ||
this.decoder.enqueueTokens(tokens); | ||
}; | ||
Object.defineProperty(Controller.prototype, "serverVersion", { | ||
@@ -238,18 +248,2 @@ /** | ||
/** | ||
* Send an API command to the server connection. | ||
* | ||
* @param funcName API function name. | ||
* @param funcName API arguments. | ||
* | ||
* @see [[api]] | ||
*/ | ||
/* | ||
private executeApi(funcName: string, args: unknown[]): void { | ||
if (this.encoder[funcName] instanceof Function) { | ||
this.encoder[funcName](args); | ||
} else { | ||
throw new Error("Unknown outgoing func - " + funcName); | ||
} | ||
}*/ | ||
/** | ||
* Send raw token data to the server connection. | ||
@@ -256,0 +250,0 @@ * |
@@ -57,3 +57,8 @@ import { EventName } from "../api/api"; | ||
constructor(callback: DecoderCallbacks); | ||
/** Data input queue (data that has arrived from server). */ | ||
/** | ||
* Input data queue. | ||
* | ||
* If the value is a string, this is a tokens as received from TWS / IB Gateway. | ||
* If the value is undefined, this signals the boundary (start or end) of a message (used with V100 protocol only). | ||
*/ | ||
private dataQueue; | ||
@@ -63,5 +68,13 @@ /** Data emit queue (data to be emitted to controller). */ | ||
/** | ||
* Add a new message to queue. | ||
* | ||
* Used on V100 protocol. | ||
*/ | ||
enqueueMessage(tokens: string[]): void; | ||
/** | ||
* Add new tokens to queue. | ||
* | ||
* Used on pre-V100 protocol. | ||
*/ | ||
enqueue(tokens: string[]): void; | ||
enqueueTokens(tokens: string[]): void; | ||
/** | ||
@@ -108,2 +121,6 @@ * Process the data queue and emit events. | ||
/** | ||
* Drain all tokens on queue until the start marker of a new message or until queue is empty. | ||
*/ | ||
private drainQueue; | ||
/** | ||
* Add tokens to the emit queue. | ||
@@ -110,0 +127,0 @@ */ |
@@ -62,3 +62,3 @@ import { IBApiCreationOptions } from "../api/api"; | ||
/** | ||
* Called when a message has been arrived. | ||
* Called when new tokens have been received from server. | ||
*/ | ||
@@ -65,0 +65,0 @@ private onMessage; |
@@ -181,3 +181,3 @@ "use strict"; | ||
/** | ||
* Called when a message has been arrived. | ||
* Called when new tokens have been received from server. | ||
*/ | ||
@@ -204,3 +204,8 @@ Socket.prototype.onMessage = function (data) { | ||
// post to queue | ||
this.controller.onMessage(tokens); | ||
if (this.useV100Plus) { | ||
this.controller.onMessage(tokens); | ||
} | ||
else { | ||
this.controller.onTokens(tokens); | ||
} | ||
// process queue | ||
@@ -207,0 +212,0 @@ this.controller.processIngressQueue(); |
{ | ||
"name": "@stoqey/ib", | ||
"private": false, | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Interactive Brokers TWS/IB Gateway API client library for Node.js (TS)", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
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
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
1140836
13312