laplace-api 1.4.5 → 1.4.7
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/stocks.ts +3 -2
package/package.json
CHANGED
package/src/client/stocks.ts
CHANGED
|
@@ -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',
|
|
@@ -170,11 +171,11 @@ export class StockClient extends Client {
|
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
|
|
174
|
+
validateCustomHistoricalPriceDate(date: string) {
|
|
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
|
|
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
|
|