laplace-api 1.0.9 → 1.0.11
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 +1 -1
- package/src/client/live_price.ts +14 -11
- package/src/client/search.ts +2 -2
package/package.json
CHANGED
package/src/client/live_price.ts
CHANGED
|
@@ -2,21 +2,18 @@ import { Client } from './client';
|
|
|
2
2
|
import { Region } from './collections';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function getLivePrice<T>(
|
|
6
6
|
client: Client,
|
|
7
7
|
symbols: string[],
|
|
8
8
|
region: Region,
|
|
9
9
|
streamId: string = uuidv4(),
|
|
10
|
-
):
|
|
10
|
+
): {
|
|
11
|
+
events: AsyncIterable<T>,
|
|
12
|
+
cancel: () => void
|
|
13
|
+
} {
|
|
11
14
|
const url = `${client["baseUrl"]}/api/v1/stock/price/live?filter=${symbols.join(',')}®ion=${region}&stream=${streamId}`;
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
yield* events;
|
|
17
|
-
} finally {
|
|
18
|
-
cancel();
|
|
19
|
-
}
|
|
16
|
+
return client.sendSSERequest<T>(url);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
export interface BISTStockLiveData {
|
|
@@ -36,7 +33,10 @@ export class LivePriceClient extends Client {
|
|
|
36
33
|
symbols: string[],
|
|
37
34
|
region: Region,
|
|
38
35
|
streamId?: string,
|
|
39
|
-
):
|
|
36
|
+
): {
|
|
37
|
+
events: AsyncIterable<BISTStockLiveData>,
|
|
38
|
+
cancel: () => void
|
|
39
|
+
} {
|
|
40
40
|
return getLivePrice<BISTStockLiveData>(this, symbols, region, streamId);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -44,7 +44,10 @@ export class LivePriceClient extends Client {
|
|
|
44
44
|
symbols: string[],
|
|
45
45
|
region: Region,
|
|
46
46
|
streamId?: string,
|
|
47
|
-
):
|
|
47
|
+
): {
|
|
48
|
+
events: AsyncIterable<USStockLiveData>,
|
|
49
|
+
cancel: () => void
|
|
50
|
+
} {
|
|
48
51
|
return getLivePrice<USStockLiveData>(this, symbols, region, streamId);
|
|
49
52
|
}
|
|
50
53
|
}
|
package/src/client/search.ts
CHANGED
|
@@ -11,10 +11,10 @@ export enum SearchType {
|
|
|
11
11
|
export interface SearchResponseStock {
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
|
-
|
|
14
|
+
title: string;
|
|
15
15
|
region: string;
|
|
16
|
-
assetClass: string;
|
|
17
16
|
assetType: string;
|
|
17
|
+
type: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface SearchResponseCollection {
|