laplace-api 1.0.7 → 1.0.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laplace-api",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Client library for Laplace API for the US stock market and BIST (Istanbul stock market) fundamental financial data.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,9 +5,9 @@ import { v4 as uuidv4 } from 'uuid';
5
5
  async function* getLivePrice<T>(
6
6
  client: Client,
7
7
  symbols: string[],
8
- region: Region
8
+ region: Region,
9
+ streamId: string = uuidv4(),
9
10
  ): AsyncGenerator<T, void, undefined> {
10
- const streamId = uuidv4();
11
11
  const url = `${client["baseUrl"]}/api/v1/stock/price/live?filter=${symbols.join(',')}&region=${region}&stream=${streamId}`;
12
12
 
13
13
  const { events, cancel } = client.sendSSERequest<T>(url);
@@ -31,14 +31,20 @@ export interface USStockLiveData {
31
31
  ap: number; // AskPrice
32
32
  }
33
33
 
34
- export class LivePriceClient {
35
- constructor(private client: Client) {}
36
-
37
- getLivePriceForBIST(symbols: string[], region: Region): AsyncGenerator<BISTStockLiveData, void, undefined> {
38
- return getLivePrice<BISTStockLiveData>(this.client, symbols, region);
34
+ export class LivePriceClient extends Client {
35
+ getLivePriceForBIST(
36
+ symbols: string[],
37
+ region: Region,
38
+ streamId?: string,
39
+ ): AsyncGenerator<BISTStockLiveData, void, undefined> {
40
+ return getLivePrice<BISTStockLiveData>(this, symbols, region, streamId);
39
41
  }
40
42
 
41
- getLivePriceForUS(symbols: string[], region: Region): AsyncGenerator<USStockLiveData, void, undefined> {
42
- return getLivePrice<USStockLiveData>(this.client, symbols, region);
43
+ getLivePriceForUS(
44
+ symbols: string[],
45
+ region: Region,
46
+ streamId?: string,
47
+ ): AsyncGenerator<USStockLiveData, void, undefined> {
48
+ return getLivePrice<USStockLiveData>(this, symbols, region, streamId);
43
49
  }
44
50
  }