laplace-api 1.1.0 → 1.1.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laplace-api",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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": {
@@ -67,13 +67,13 @@ export class CustomThemeClient extends Client {
67
67
  }
68
68
 
69
69
  async createCustomTheme(params: CreateCustomThemeParams): Promise<string> {
70
- const response = await this.sendRequest<string>({
70
+ const response = await this.sendRequest<{ id: string }>({
71
71
  method: 'POST',
72
72
  url: `/api/v1/custom-theme`,
73
73
  data: params,
74
74
  });
75
75
 
76
- return response;
76
+ return response.id;
77
77
  }
78
78
 
79
79
  async updateCustomTheme(id: string, params: UpdateCustomThemeParams): Promise<void> {
@@ -27,10 +27,16 @@ export enum HistoricalPricePeriod {
27
27
 
28
28
  export enum HistoricalPriceInterval {
29
29
  OneMinute = "1m",
30
+ ThreeMinute = "3m",
30
31
  FiveMinute = "5m",
32
+ FifteenMinute = "15m",
31
33
  ThirtyMinute = "30m",
32
34
  OneHour = "1h",
33
- OneDay = "24h",
35
+ TwoHour = "2h",
36
+ OneDay = "1d",
37
+ FiveDay = "5d",
38
+ SevenDay = "7d",
39
+ ThirtyDay = "30d",
34
40
  }
35
41
 
36
42
  export interface Stock {
@@ -121,11 +127,15 @@ export interface TickSizeRule {
121
127
  }
122
128
 
123
129
  export class StockClient extends Client {
124
- async getAllStocks(region: Region): Promise<Stock[]> {
130
+ async getAllStocks(region: Region, page: number|null = null, pageSize: number|null = null): Promise<Stock[]> {
125
131
  return this.sendRequest<Stock[]>({
126
132
  method: 'GET',
127
- url: '/api/v1/stock/all',
128
- params: { region },
133
+ url: '/api/v2/stock/all',
134
+ params: {
135
+ region,
136
+ ...(page !== null ? { page } : {}),
137
+ ...(pageSize !== null ? { pageSize } : {}),
138
+ },
129
139
  });
130
140
  }
131
141
 
@@ -26,6 +26,13 @@ describe('Stocks', () => {
26
26
  expect(resp).not.toBeEmpty();
27
27
  });
28
28
 
29
+
30
+ test('GetAllStocksWithPagination', async () => {
31
+ const resp = await client.getAllStocks(Region.Tr, 10, 10);
32
+ expect(resp).not.toBeEmpty();
33
+ expect(resp.length).toBe(10);
34
+ });
35
+
29
36
  test('GetStockDetailByID', async () => {
30
37
  const resp = await client.getStockDetailById("61dd0d6f0ec2114146342fd0", Locale.Tr);
31
38
  expect(resp).not.toBeEmpty();