laplace-api 2.0.3 → 3.0.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
|
@@ -91,12 +91,13 @@ export class FinancialFundamentalsClient extends Client {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection): Promise<TopMover[]> {
|
|
94
|
+
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection, assetType?: AssetType): Promise<TopMover[]> {
|
|
95
95
|
const url = new URL(`${this['baseUrl']}/api/v2/stock/top-movers`);
|
|
96
96
|
url.searchParams.append('region', region);
|
|
97
97
|
url.searchParams.append('page', page.toString());
|
|
98
98
|
url.searchParams.append('pageSize', pageSize.toString());
|
|
99
99
|
url.searchParams.append('direction', direction);
|
|
100
|
+
if (assetType) url.searchParams.append('assetType', assetType);
|
|
100
101
|
|
|
101
102
|
return this.sendRequest<TopMover[]>({
|
|
102
103
|
method: 'GET',
|
|
@@ -212,7 +212,7 @@ export class FinancialClient extends Client {
|
|
|
212
212
|
currency: Currency,
|
|
213
213
|
region: Region
|
|
214
214
|
): Promise<HistoricalFinancialSheets> {
|
|
215
|
-
const url = new URL(`${this['baseUrl']}/api/
|
|
215
|
+
const url = new URL(`${this['baseUrl']}/api/v2/stock/historical-financial-sheets`);
|
|
216
216
|
url.searchParams.append('symbol', symbol);
|
|
217
217
|
url.searchParams.append('from', `${from.year.toString().padStart(4, '0')}-${from.month.toString().padStart(2, '0')}-${from.day.toString().padStart(2, '0')}`);
|
|
218
218
|
url.searchParams.append('to', `${to.year.toString().padStart(4, '0')}-${to.month.toString().padStart(2, '0')}-${to.day.toString().padStart(2, '0')}`);
|
|
@@ -4,6 +4,7 @@ import { Client } from '../client/client';
|
|
|
4
4
|
import { FinancialFundamentalsClient, TopMoverDirection } from '../client/financial_fundamentals';
|
|
5
5
|
import { Region } from '../client/collections';
|
|
6
6
|
import './client_test_suite';
|
|
7
|
+
import { AssetType } from '../client/stocks';
|
|
7
8
|
|
|
8
9
|
describe('FinancialFundamentals', () => {
|
|
9
10
|
let client: Client;
|
|
@@ -64,7 +65,7 @@ describe('FinancialFundamentals', () => {
|
|
|
64
65
|
const pageSize = 20;
|
|
65
66
|
|
|
66
67
|
async function testTopMovers(direction: TopMoverDirection, shouldBePositive: boolean) {
|
|
67
|
-
const result = await stockClient.getTopMovers(region, page, pageSize, direction);
|
|
68
|
+
const result = await stockClient.getTopMovers(region, page, pageSize, direction, AssetType.Stock);
|
|
68
69
|
|
|
69
70
|
expect(Array.isArray(result)).toBe(true);
|
|
70
71
|
expect(result.length).toBeGreaterThan(0);
|
|
@@ -80,6 +81,10 @@ describe('FinancialFundamentals', () => {
|
|
|
80
81
|
shouldBePositive ? mover.change > 0 : mover.change < 0
|
|
81
82
|
);
|
|
82
83
|
expect(directionCheck).toBe(true);
|
|
84
|
+
|
|
85
|
+
const assetTypeCheck = result.every(mover => mover.assetType === AssetType.Stock)
|
|
86
|
+
|
|
87
|
+
expect(assetTypeCheck).toBe(true);
|
|
83
88
|
|
|
84
89
|
expect(result.length).toBeLessThanOrEqual(pageSize);
|
|
85
90
|
}
|
|
@@ -68,10 +68,10 @@ describe('FinancialRatios', () => {
|
|
|
68
68
|
const resp = await financialClient.getHistoricalFinancialSheets(
|
|
69
69
|
'TUPRS',
|
|
70
70
|
{ year: 2022, month: 1, day: 1 },
|
|
71
|
-
{ year:
|
|
72
|
-
FinancialSheetType.
|
|
73
|
-
FinancialSheetPeriod.
|
|
74
|
-
Currency.
|
|
71
|
+
{ year: 2025, month: 1, day: 1 },
|
|
72
|
+
FinancialSheetType.CashFlow,
|
|
73
|
+
FinancialSheetPeriod.Quarterly,
|
|
74
|
+
Currency.TRY,
|
|
75
75
|
Region.Tr
|
|
76
76
|
);
|
|
77
77
|
expect(resp).not.toBeEmpty();
|