laplace-api 1.4.1 → 1.4.2
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
|
@@ -57,6 +57,12 @@ export interface TopMover {
|
|
|
57
57
|
symbol: string;
|
|
58
58
|
percent_change: number;
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
export enum TopMoverDirection {
|
|
62
|
+
Gainers = "gainers",
|
|
63
|
+
Losers = "losers"
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
export class FinancialFundamentalsClient extends Client {
|
|
61
67
|
async getStockDividends(symbol: string, region: Region): Promise<StockDividend[]> {
|
|
62
68
|
const url = new URL(`${this['baseUrl']}/api/v1/stock/dividends`);
|
|
@@ -80,9 +86,12 @@ export class FinancialFundamentalsClient extends Client {
|
|
|
80
86
|
});
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
async getTopMovers(region: Region): Promise<TopMover[]> {
|
|
84
|
-
const url = new URL(`${this['baseUrl']}/api/
|
|
89
|
+
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection): Promise<TopMover[]> {
|
|
90
|
+
const url = new URL(`${this['baseUrl']}/api/v2/stock/top-movers`);
|
|
85
91
|
url.searchParams.append('region', region);
|
|
92
|
+
url.searchParams.append('page', page.toString());
|
|
93
|
+
url.searchParams.append('pageSize', pageSize.toString());
|
|
94
|
+
url.searchParams.append('direction', direction);
|
|
86
95
|
|
|
87
96
|
return this.sendRequest<TopMover[]>({
|
|
88
97
|
method: 'GET',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Logger } from 'winston';
|
|
2
2
|
import { LaplaceConfiguration } from '../utilities/configuration';
|
|
3
|
-
import { Client
|
|
4
|
-
import { FinancialFundamentalsClient } from '../client/financial_fundamentals';
|
|
3
|
+
import { Client } from '../client/client';
|
|
4
|
+
import { FinancialFundamentalsClient, TopMoverDirection } from '../client/financial_fundamentals';
|
|
5
5
|
import { Region } from '../client/collections';
|
|
6
|
-
import { StockStatsKey } from '../client/financial_fundamentals';
|
|
7
6
|
import './client_test_suite';
|
|
8
7
|
|
|
9
8
|
describe('FinancialFundamentals', () => {
|
|
@@ -58,7 +57,7 @@ describe('FinancialFundamentals', () => {
|
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
test('GetTopMovers', async () => {
|
|
61
|
-
const resp = await stockClient.getTopMovers(Region.Tr);
|
|
60
|
+
const resp = await stockClient.getTopMovers(Region.Tr, 0, 20, TopMoverDirection.Gainers);
|
|
62
61
|
expect(resp).not.toBeEmpty();
|
|
63
62
|
});
|
|
64
63
|
});
|