laplace-api 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -99,6 +99,7 @@ export class LivePriceWebSocketClient {
|
|
|
99
99
|
feed: LivePriceFeed;
|
|
100
100
|
}
|
|
101
101
|
>();
|
|
102
|
+
private symbolLastData = new Map<string, BISTStockLiveData | USStockLiveData>();
|
|
102
103
|
private reconnectAttempts = 0;
|
|
103
104
|
private reconnectTimeout: NodeJS.Timeout | null = null;
|
|
104
105
|
private isClosed: boolean = false;
|
|
@@ -263,6 +264,7 @@ export class LivePriceWebSocketClient {
|
|
|
263
264
|
} as USStockLiveData;
|
|
264
265
|
}
|
|
265
266
|
if (priceData.symbol) {
|
|
267
|
+
this.symbolLastData.set(priceData.symbol, priceData);
|
|
266
268
|
const handlers = this.getHandlersForSymbol(
|
|
267
269
|
priceData.symbol,
|
|
268
270
|
feed
|
|
@@ -380,8 +382,14 @@ export class LivePriceWebSocketClient {
|
|
|
380
382
|
});
|
|
381
383
|
|
|
382
384
|
for (const symbol of symbols) {
|
|
383
|
-
|
|
385
|
+
const symbolHandlers = this.getHandlersForSymbol(symbol, feed);
|
|
386
|
+
if (symbolHandlers.length === 1) {
|
|
384
387
|
symbolsToAdd.push(symbol);
|
|
388
|
+
} else if (symbolHandlers.length > 1) {
|
|
389
|
+
const lastData: BISTStockLiveData | USStockLiveData | undefined = this.symbolLastData.get(symbol);
|
|
390
|
+
if (lastData) {
|
|
391
|
+
typedHandler(lastData);
|
|
392
|
+
}
|
|
385
393
|
}
|
|
386
394
|
}
|
|
387
395
|
this.addSymbols(symbolsToAdd, feed);
|