laplace-api 1.4.4 → 1.4.6

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.4.4",
3
+ "version": "1.4.6",
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": {
@@ -44,7 +44,6 @@ export class LivePriceClient extends Client {
44
44
  feeds: LivePriceFeed[]
45
45
  ): Promise<string> {
46
46
  const url = new URL(`${this["baseUrl"]}/api/v2/ws/url`);
47
- url.searchParams.append("region", Region.Tr);
48
47
 
49
48
  const params: WebSocketUrlParams = {
50
49
  externalUserId,
@@ -1,5 +1,6 @@
1
1
  import { Client } from './client';
2
2
  import { Region, Locale } from './collections';
3
+ import { LaplaceHTTPError } from './errors';
3
4
 
4
5
  export enum AssetType {
5
6
  Stock = 'stock',
@@ -174,7 +175,7 @@ export class StockClient extends Client {
174
175
  const pattern = /^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$/;
175
176
  const matched = date.match(pattern);
176
177
  if (!matched) {
177
- throw new Error("Invalid date format, allowed formats: YYYY-MM-DD, YYYY-MM-DD HH:MM:SS");
178
+ throw new LaplaceHTTPError(400, "Invalid date format, allowed formats: YYYY-MM-DD, YYYY-MM-DD HH:MM:SS");
178
179
  }
179
180
  }
180
181
 
@@ -82,37 +82,36 @@ describe("LivePrice", () => {
82
82
  );
83
83
  });
84
84
 
85
- //TODO: Use this test after region issue fixed
86
- // describe("US Live Price Tests", () => {
87
- // const symbols = ["AAPL"];
88
-
89
- // it(
90
- // "should receive data for initial and updated symbols for us",
91
- // async () => {
92
- // const receivedData: USStockLiveData[] = [];
93
-
94
- // let unsubscribe: (() => void) | null =
95
- // ws.subscribe<LivePriceFeed.LiveUs>(
96
- // symbols,
97
- // LivePriceFeed.LiveUs,
98
- // (data) => {
99
- // console.log("RECEIVED DATA FOR US", data);
100
- // receivedData.push(data);
101
- // }
102
- // );
103
-
104
- // await new Promise((resolve) => setTimeout(resolve, 20000));
105
-
106
- // for (const symbol of symbols) {
107
- // const symbolData = receivedData.filter(
108
- // (data) => data.symbol === symbol
109
- // );
110
- // expect(symbolData.length).toBeGreaterThan(0);
111
- // }
112
-
113
- // unsubscribe();
114
- // },
115
- // TEST_CONSTANTS.JEST_TIMEOUT
116
- // );
117
- // });
85
+ describe("US Live Price Tests", () => {
86
+ const symbols = ["AAPL"];
87
+
88
+ it(
89
+ "should receive data for initial and updated symbols for us",
90
+ async () => {
91
+ const receivedData: USStockLiveData[] = [];
92
+
93
+ let unsubscribe: (() => void) | null =
94
+ ws.subscribe<LivePriceFeed.LiveUs>(
95
+ symbols,
96
+ LivePriceFeed.LiveUs,
97
+ (data) => {
98
+ console.log("RECEIVED DATA FOR US", data);
99
+ receivedData.push(data);
100
+ }
101
+ );
102
+
103
+ await new Promise((resolve) => setTimeout(resolve, 20000));
104
+
105
+ for (const symbol of symbols) {
106
+ const symbolData = receivedData.filter(
107
+ (data) => data.symbol === symbol
108
+ );
109
+ expect(symbolData.length).toBeGreaterThan(0);
110
+ }
111
+
112
+ unsubscribe();
113
+ },
114
+ TEST_CONSTANTS.JEST_TIMEOUT
115
+ );
116
+ });
118
117
  });
@@ -1,2 +1,2 @@
1
- BASE_URL=https://api.finfree.app
2
- API_KEY=api-6fa6cefb-16df-4a19-8351-54f83c6bbe2f
1
+ BASE_URL=
2
+ API_KEY=