laplace-api 1.2.2 → 1.3.0
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
|
@@ -29,6 +29,8 @@ export interface StockStats {
|
|
|
29
29
|
dailyChange: number;
|
|
30
30
|
dayLow: number;
|
|
31
31
|
dayHigh: number;
|
|
32
|
+
lowerPriceLimit: number;
|
|
33
|
+
upperPriceLimit: number;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export enum StockStatsKey {
|
|
@@ -67,11 +69,10 @@ export class FinancialFundamentalsClient extends Client {
|
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
async getStockStats(symbols: string[],
|
|
71
|
-
const url = new URL(`${this['baseUrl']}/api/
|
|
72
|
+
async getStockStats(symbols: string[], region: Region): Promise<StockStats[]> {
|
|
73
|
+
const url = new URL(`${this['baseUrl']}/api/v2/stock/stats`);
|
|
72
74
|
url.searchParams.append('symbols', symbols.join(','));
|
|
73
75
|
url.searchParams.append('region', region);
|
|
74
|
-
url.searchParams.append('keys', keys.join(','));
|
|
75
76
|
|
|
76
77
|
return this.sendRequest<StockStats[]>({
|
|
77
78
|
method: 'GET',
|
|
@@ -28,26 +28,7 @@ describe('FinancialFundamentals', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test('GetStockStats', async () => {
|
|
31
|
-
|
|
32
|
-
StockStatsKey.PreviousClose,
|
|
33
|
-
StockStatsKey.MarketCap,
|
|
34
|
-
StockStatsKey.FK,
|
|
35
|
-
StockStatsKey.PDDD,
|
|
36
|
-
StockStatsKey.YearLow,
|
|
37
|
-
StockStatsKey.YearHigh,
|
|
38
|
-
StockStatsKey.WeeklyReturn,
|
|
39
|
-
StockStatsKey.MonthlyReturn,
|
|
40
|
-
StockStatsKey.ThreeMonthReturn,
|
|
41
|
-
StockStatsKey.YtdReturn,
|
|
42
|
-
StockStatsKey.YearlyReturn,
|
|
43
|
-
StockStatsKey.ThreeYearReturn,
|
|
44
|
-
StockStatsKey.FiveYearReturn,
|
|
45
|
-
StockStatsKey.LatestPrice,
|
|
46
|
-
StockStatsKey.DailyChange,
|
|
47
|
-
StockStatsKey.DayLow,
|
|
48
|
-
StockStatsKey.DayHigh,
|
|
49
|
-
]
|
|
50
|
-
const resp = await stockClient.getStockStats(['TUPRS'], statKeys, Region.Tr);
|
|
31
|
+
const resp = await stockClient.getStockStats(['TUPRS'], Region.Tr);
|
|
51
32
|
expect(resp).not.toBeEmpty();
|
|
52
33
|
expect(resp.length).toBe(1);
|
|
53
34
|
|
|
@@ -61,17 +42,19 @@ describe('FinancialFundamentals', () => {
|
|
|
61
42
|
expect(currentStockStats.pbRatio).not.toBe(0.0);
|
|
62
43
|
expect(currentStockStats.yearLow).toBeGreaterThan(0.0);
|
|
63
44
|
expect(currentStockStats.yearHigh).toBeGreaterThan(0.0);
|
|
64
|
-
expect(currentStockStats.weeklyReturn).
|
|
65
|
-
expect(currentStockStats.monthlyReturn).
|
|
66
|
-
expect(currentStockStats['3MonthReturn']).
|
|
67
|
-
expect(currentStockStats.ytdReturn).
|
|
68
|
-
expect(currentStockStats.yearlyReturn).
|
|
69
|
-
expect(currentStockStats['3YearReturn']).
|
|
70
|
-
expect(currentStockStats['5YearReturn']).
|
|
45
|
+
expect(typeof currentStockStats.weeklyReturn).toBe('number');;
|
|
46
|
+
expect(typeof currentStockStats.monthlyReturn).toBe('number');
|
|
47
|
+
expect(typeof currentStockStats['3MonthReturn']).toBe('number');
|
|
48
|
+
expect(typeof currentStockStats.ytdReturn).toBe('number');
|
|
49
|
+
expect(typeof currentStockStats.yearlyReturn).toBe('number');
|
|
50
|
+
expect(typeof currentStockStats['3YearReturn']).toBe('number');
|
|
51
|
+
expect(typeof currentStockStats['5YearReturn']).toBe('number');
|
|
71
52
|
expect(currentStockStats.latestPrice).toBeGreaterThan(0.0);
|
|
72
|
-
expect(currentStockStats.dailyChange).
|
|
53
|
+
expect(typeof currentStockStats.dailyChange).toBe('number');
|
|
73
54
|
expect(currentStockStats.dayLow).toBeGreaterThan(0.0);
|
|
74
55
|
expect(currentStockStats.dayHigh).toBeGreaterThan(0.0);
|
|
56
|
+
expect(currentStockStats.upperPriceLimit).toBeGreaterThan(0.0)
|
|
57
|
+
expect(currentStockStats.lowerPriceLimit).toBeGreaterThan(0.0)
|
|
75
58
|
});
|
|
76
59
|
|
|
77
60
|
test('GetTopMovers', async () => {
|