laplace-api 1.4.1 → 1.4.3

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.1",
3
+ "version": "1.4.3",
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": {
@@ -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/v1/stock/top-movers`);
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',
@@ -41,11 +41,10 @@ function getSSELivePrice<T>(
41
41
  export class LivePriceClient extends Client {
42
42
  async getWebSocketUrl(
43
43
  externalUserId: string,
44
- region: Region,
45
44
  feeds: LivePriceFeed[]
46
45
  ): Promise<string> {
47
46
  const url = new URL(`${this["baseUrl"]}/api/v2/ws/url`);
48
- url.searchParams.append("region", region);
47
+ url.searchParams.append("region", Region.Tr);
49
48
 
50
49
  const params: WebSocketUrlParams = {
51
50
  externalUserId,
@@ -1,9 +1,8 @@
1
1
  import { Logger } from 'winston';
2
2
  import { LaplaceConfiguration } from '../utilities/configuration';
3
- import { Client, createClient } from '../client/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
  });
@@ -30,7 +30,7 @@ describe("LivePrice", () => {
30
30
  } as unknown as Logger;
31
31
 
32
32
  livePriceUrlClient = new LivePriceClient(config, logger);
33
- url = await livePriceUrlClient.getWebSocketUrl("2459", Region.Tr, [
33
+ url = await livePriceUrlClient.getWebSocketUrl("2459", [
34
34
  LivePriceFeed.LiveBist,
35
35
  ]);
36
36