@infosel-sdk/securities-prices 0.2.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.
Files changed (112) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +542 -0
  3. package/common/constants/constants.d.ts +28 -0
  4. package/common/constants/constants.js +31 -0
  5. package/common/constants/constants.js.map +1 -0
  6. package/common/enum/exchange.enum.d.ts +5 -0
  7. package/common/enum/exchange.enum.js +10 -0
  8. package/common/enum/exchange.enum.js.map +1 -0
  9. package/common/enum/source.enum.d.ts +9 -0
  10. package/common/enum/source.enum.js +14 -0
  11. package/common/enum/source.enum.js.map +1 -0
  12. package/common/helper/utils.d.ts +4 -0
  13. package/common/helper/utils.js +36 -0
  14. package/common/helper/utils.js.map +1 -0
  15. package/historical/dto/historical-chart-last-traded-price.request.dto.d.ts +6 -0
  16. package/historical/dto/historical-chart-last-traded-price.request.dto.js +57 -0
  17. package/historical/dto/historical-chart-last-traded-price.request.dto.js.map +1 -0
  18. package/historical/dto/historical-chart.request.dto.d.ts +4 -0
  19. package/historical/dto/historical-chart.request.dto.js +34 -0
  20. package/historical/dto/historical-chart.request.dto.js.map +1 -0
  21. package/historical/dto/historical-report.request.dto.d.ts +5 -0
  22. package/historical/dto/historical-report.request.dto.js +28 -0
  23. package/historical/dto/historical-report.request.dto.js.map +1 -0
  24. package/historical/dto/historical.request.dto.d.ts +10 -0
  25. package/historical/dto/historical.request.dto.js +82 -0
  26. package/historical/dto/historical.request.dto.js.map +1 -0
  27. package/historical/dto/historical.response.dto.d.ts +12 -0
  28. package/historical/dto/historical.response.dto.js +13 -0
  29. package/historical/dto/historical.response.dto.js.map +1 -0
  30. package/historical/dto/index.d.ts +4 -0
  31. package/historical/dto/index.js +21 -0
  32. package/historical/dto/index.js.map +1 -0
  33. package/historical/historical.module.d.ts +2 -0
  34. package/historical/historical.module.js +19 -0
  35. package/historical/historical.module.js.map +1 -0
  36. package/historical/historical.service.d.ts +8 -0
  37. package/historical/historical.service.js +40 -0
  38. package/historical/historical.service.js.map +1 -0
  39. package/index.d.ts +2 -0
  40. package/index.js +19 -0
  41. package/index.js.map +1 -0
  42. package/intraday/dto/index.d.ts +7 -0
  43. package/intraday/dto/index.js +24 -0
  44. package/intraday/dto/index.js.map +1 -0
  45. package/intraday/dto/intraday-report.dto.d.ts +13 -0
  46. package/intraday/dto/intraday-report.dto.js +7 -0
  47. package/intraday/dto/intraday-report.dto.js.map +1 -0
  48. package/intraday/dto/intraday-report.request.dto.d.ts +15 -0
  49. package/intraday/dto/intraday-report.request.dto.js +103 -0
  50. package/intraday/dto/intraday-report.request.dto.js.map +1 -0
  51. package/intraday/dto/intraday-report.response.dto.d.ts +9 -0
  52. package/intraday/dto/intraday-report.response.dto.js +14 -0
  53. package/intraday/dto/intraday-report.response.dto.js.map +1 -0
  54. package/intraday/dto/intraday-totals.dto.d.ts +6 -0
  55. package/intraday/dto/intraday-totals.dto.js +7 -0
  56. package/intraday/dto/intraday-totals.dto.js.map +1 -0
  57. package/intraday/dto/intraday.dto.d.ts +8 -0
  58. package/intraday/dto/intraday.dto.js +7 -0
  59. package/intraday/dto/intraday.dto.js.map +1 -0
  60. package/intraday/dto/intraday.request.dto.d.ts +7 -0
  61. package/intraday/dto/intraday.request.dto.js +54 -0
  62. package/intraday/dto/intraday.request.dto.js.map +1 -0
  63. package/intraday/dto/intraday.response.dto.d.ts +5 -0
  64. package/intraday/dto/intraday.response.dto.js +10 -0
  65. package/intraday/dto/intraday.response.dto.js.map +1 -0
  66. package/intraday/intraday.module.d.ts +2 -0
  67. package/intraday/intraday.module.js +19 -0
  68. package/intraday/intraday.module.js.map +1 -0
  69. package/intraday/intraday.service.d.ts +8 -0
  70. package/intraday/intraday.service.js +60 -0
  71. package/intraday/intraday.service.js.map +1 -0
  72. package/package.json +27 -0
  73. package/securities-prices-sdk.module.d.ts +2 -0
  74. package/securities-prices-sdk.module.js +21 -0
  75. package/securities-prices-sdk.module.js.map +1 -0
  76. package/securities-prices-sdk.service.d.ts +36 -0
  77. package/securities-prices-sdk.service.js +90 -0
  78. package/securities-prices-sdk.service.js.map +1 -0
  79. package/snapshot/dto/best-bid-offer.dto.d.ts +13 -0
  80. package/snapshot/dto/best-bid-offer.dto.js +19 -0
  81. package/snapshot/dto/best-bid-offer.dto.js.map +1 -0
  82. package/snapshot/dto/best-bid-offer.request.dto.d.ts +6 -0
  83. package/snapshot/dto/best-bid-offer.request.dto.js +63 -0
  84. package/snapshot/dto/best-bid-offer.request.dto.js.map +1 -0
  85. package/snapshot/dto/depth-of-book.dto.d.ts +13 -0
  86. package/snapshot/dto/depth-of-book.dto.js +19 -0
  87. package/snapshot/dto/depth-of-book.dto.js.map +1 -0
  88. package/snapshot/dto/depth-of-book.request.dto.d.ts +5 -0
  89. package/snapshot/dto/depth-of-book.request.dto.js +36 -0
  90. package/snapshot/dto/depth-of-book.request.dto.js.map +1 -0
  91. package/snapshot/dto/index.d.ts +4 -0
  92. package/snapshot/dto/index.js +21 -0
  93. package/snapshot/dto/index.js.map +1 -0
  94. package/snapshot/dto/last-traded-price.dto.d.ts +31 -0
  95. package/snapshot/dto/last-traded-price.dto.js +38 -0
  96. package/snapshot/dto/last-traded-price.dto.js.map +1 -0
  97. package/snapshot/dto/last-traded-price.request.dto.d.ts +5 -0
  98. package/snapshot/dto/last-traded-price.request.dto.js +37 -0
  99. package/snapshot/dto/last-traded-price.request.dto.js.map +1 -0
  100. package/snapshot/dto/returns.dto.d.ts +8 -0
  101. package/snapshot/dto/returns.dto.js +16 -0
  102. package/snapshot/dto/returns.dto.js.map +1 -0
  103. package/snapshot/dto/returns.request.dto.d.ts +5 -0
  104. package/snapshot/dto/returns.request.dto.js +41 -0
  105. package/snapshot/dto/returns.request.dto.js.map +1 -0
  106. package/snapshot/snapshot.module.d.ts +2 -0
  107. package/snapshot/snapshot.module.js +19 -0
  108. package/snapshot/snapshot.module.js.map +1 -0
  109. package/snapshot/snapshot.service.d.ts +16 -0
  110. package/snapshot/snapshot.service.js +81 -0
  111. package/snapshot/snapshot.service.js.map +1 -0
  112. package/tsconfig.lib.tsbuildinfo +1 -0
package/LICENSE.md ADDED
@@ -0,0 +1,5 @@
1
+ Copyright 2024 Infosel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,542 @@
1
+ # @infosel-sdk/securities-prices
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/@infosel-sdk/securities-prices.svg)](https://www.npmjs.com/package/@infosel-sdk/securities-prices)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/@infosel-sdk/securities-prices.svg)](https://www.npmjs.com/package/@infosel-sdk/securities-prices)
5
+ [![License](https://img.shields.io/npm/l/@infosel-sdk/securities-prices.svg)](https://www.npmjs.com/package/@infosel-sdk/securities-prices)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+
8
+ SDK de Securities para acceder a precios de valores y datos del mercado financiero. Proporciona servicios para recuperar gráficos intradiarios, datos históricos, instantáneas del mercado e información financiera en tiempo real.
9
+
10
+ ## 🚀 Características
11
+
12
+ - **📊 Datos Intradiarios**: Gráficos y reportes en tiempo real
13
+ - **📈 Datos Históricos**: Información histórica con múltiples períodos
14
+ - **💹 Instantáneas del Mercado**: Últimos precios, ofertas y demandas
15
+ - **📊 Profundidad del Libro**: Información detallada de liquidez
16
+ - **📈 Rendimientos**: Cálculos de rendimiento en diferentes períodos
17
+ - **🔐 Autenticación Flexible**: Soporte para KeyCloak y tokens existentes
18
+ - **⚡ Configuración Moderna**: Builder pattern para configuración validada
19
+
20
+ ## 📦 Instalación
21
+
22
+ ```bash
23
+ npm install @infosel-sdk/securities-prices @infosel-sdk/core
24
+ ```
25
+
26
+ ## 🚀 Inicio Rápido
27
+
28
+ ### ✨ Configuración Moderna (Recomendado)
29
+
30
+ La nueva API del core proporciona una configuración más limpia y validada:
31
+
32
+ ```typescript
33
+ import { SecuritiesPricesSDK } from '@infosel-sdk/securities-prices';
34
+ import { InfoselSdkManager, AuthConfigurationBuilder } from '@infosel-sdk/core';
35
+
36
+ // Configuración moderna con Builder Pattern
37
+ const authConfig = AuthConfigurationBuilder.keyCloak()
38
+ .withRealm('hub')
39
+ .withEnvironment('qa')
40
+ .withCredentials({
41
+ grant_type: 'client_credentials',
42
+ client_id: 'tu-client-id',
43
+ client_secret: 'tu-client-secret',
44
+ })
45
+ .build();
46
+
47
+ // Inicializar SDK Manager con configuración moderna
48
+ const sdkManager = InfoselSdkManager.initWithConfiguration({
49
+ authConfiguration: authConfig,
50
+ });
51
+
52
+ // Inicializar SDK de Securities
53
+ const securitiesSDK = new SecuritiesPricesSDK(sdkManager);
54
+
55
+ // Usar el SDK
56
+ const intradayData = await securitiesSDK.getIntradayChart({
57
+ symbol: 'AMXL',
58
+ exchange: 'BMV',
59
+ period: '1D',
60
+ });
61
+ ```
62
+
63
+ ### 🔄 Configuración Legacy (Compatibilidad)
64
+
65
+ ```typescript
66
+ import { SecuritiesPricesSDK } from '@infosel-sdk/securities-prices';
67
+ import { InfoselSdkManager } from '@infosel-sdk/core';
68
+
69
+ // Configuración legacy (mantenida para compatibilidad)
70
+ const sdkManager = InfoselSdkManager.init({
71
+ mode: 'qa',
72
+ authProviderConfig: {
73
+ type: 'key-cloak',
74
+ realm: 'hub',
75
+ credentials: {
76
+ grant_type: 'client_credentials',
77
+ client_id: 'tu-client-id',
78
+ client_secret: 'tu-client-secret',
79
+ },
80
+ },
81
+ });
82
+
83
+ const securitiesSDK = new SecuritiesPricesSDK(sdkManager);
84
+ ```
85
+
86
+ ### Configuración con Token Existente
87
+
88
+ ```typescript
89
+ import { SecuritiesPricesSDK } from '@infosel-sdk/securities-prices';
90
+ import { InfoselSdkManager, AuthConfigurationBuilder, Token } from '@infosel-sdk/core';
91
+
92
+ // Configuración con token existente
93
+ const token: Token = {
94
+ accessToken: 'tu-access-token',
95
+ refreshToken: 'tu-refresh-token',
96
+ };
97
+
98
+ const authConfig = AuthConfigurationBuilder.existingToken()
99
+ .withRealm('hub')
100
+ .withEnvironment('prod')
101
+ .withClientId('hub-app')
102
+ .withToken(token)
103
+ .build();
104
+
105
+ const sdkManager = InfoselSdkManager.initWithConfiguration({
106
+ authConfiguration: authConfig,
107
+ });
108
+
109
+ const securitiesSDK = new SecuritiesPricesSDK(sdkManager);
110
+ ```
111
+
112
+ ### Configuración con Valores por Defecto
113
+
114
+ ```typescript
115
+ import { SecuritiesPricesSDK } from '@infosel-sdk/securities-prices';
116
+ import { InfoselSdkManager, AuthConfigurationBuilder } from '@infosel-sdk/core';
117
+
118
+ // Configuración mínima con valores por defecto
119
+ const authConfig = AuthConfigurationBuilder.keyCloak()
120
+ .withCredentials({
121
+ grant_type: 'client_credentials',
122
+ client_id: 'tu-client-id',
123
+ client_secret: 'tu-client-secret',
124
+ })
125
+ .build(); // Usa 'hub' como realm y 'prod' como environment por defecto
126
+
127
+ const sdkManager = InfoselSdkManager.initWithConfiguration({
128
+ authConfiguration: authConfig,
129
+ });
130
+
131
+ const securitiesSDK = new SecuritiesPricesSDK(sdkManager);
132
+ ```
133
+
134
+ ### Configuración por Ambiente
135
+
136
+ ```typescript
137
+ import { SecuritiesPricesSDK } from '@infosel-sdk/securities-prices';
138
+ import { InfoselSdkManager, AuthConfigurationBuilder, Environment } from '@infosel-sdk/core';
139
+
140
+ function createSecuritiesSDK(environment: Environment) {
141
+ const authConfig = AuthConfigurationBuilder.keyCloak()
142
+ .withEnvironment(environment)
143
+ .withRealm(environment === 'qa' ? 'qa-realm' : 'prod-realm')
144
+ .withCredentials({
145
+ grant_type: 'client_credentials',
146
+ client_id: environment === 'qa' ? 'qa-client' : 'prod-client',
147
+ client_secret: environment === 'qa' ? 'qa-secret' : 'prod-secret',
148
+ })
149
+ .build();
150
+
151
+ const sdkManager = InfoselSdkManager.initWithConfiguration({
152
+ authConfiguration: authConfig,
153
+ });
154
+
155
+ return new SecuritiesPricesSDK(sdkManager);
156
+ }
157
+
158
+ // Usar según el ambiente
159
+ const qaSecurities = createSecuritiesSDK('qa');
160
+ const prodSecurities = createSecuritiesSDK('prod');
161
+ ```
162
+
163
+ ## 🔍 Validación de Configuración
164
+
165
+ La nueva API incluye validaciones robustas:
166
+
167
+ ```typescript
168
+ import { AuthConfigurationBuilder } from '@infosel-sdk/core';
169
+
170
+ const builder = AuthConfigurationBuilder.keyCloak()
171
+ .withRealm('invalid@realm') // Caracteres inválidos
172
+ .withCredentials({
173
+ grant_type: 'client_credentials',
174
+ client_id: '', // Client ID vacío
175
+ client_secret: 'secret',
176
+ });
177
+
178
+ // Validar antes de construir
179
+ const validation = builder.validate();
180
+ if (!validation.isValid) {
181
+ console.log('Errores:', validation.errors);
182
+ // ['Realm contains invalid characters...', 'Client ID is required...']
183
+ }
184
+
185
+ // O validar automáticamente al construir
186
+ try {
187
+ const config = builder.build();
188
+ } catch (error) {
189
+ console.error(error.message); // Lista todos los errores de validación
190
+ }
191
+ ```
192
+
193
+ ### Configuración de Entorno
194
+
195
+ Para una configuración segura, usa variables de entorno:
196
+
197
+ #### Archivo `.env`
198
+
199
+ ```bash
200
+ # Configuración de entorno
201
+ NODE_ENV=prod
202
+
203
+ # Configuración de KeyCloak
204
+ KEYCLOAK_GRANT_TYPE=client_credentials
205
+ KEYCLOAK_CLIENT_ID=tu-client-id
206
+ KEYCLOAK_CLIENT_SECRET=tu-client-secret
207
+ KEYCLOAK_REALM=hub
208
+ ```
209
+
210
+ #### Configuración en código
211
+
212
+ ```typescript
213
+ import { SecuritiesPricesSDK } from '@infosel-sdk/securities-prices';
214
+ import { InfoselSdkManager, AuthConfigurationBuilder } from '@infosel-sdk/core';
215
+
216
+ // Cargar configuración desde variables de entorno
217
+ const authConfig = AuthConfigurationBuilder.keyCloak()
218
+ .withRealm(process.env.KEYCLOAK_REALM || 'hub')
219
+ .withEnvironment(process.env.NODE_ENV === 'production' ? 'prod' : 'qa')
220
+ .withCredentials({
221
+ grant_type: process.env.KEYCLOAK_GRANT_TYPE || 'client_credentials',
222
+ client_id: process.env.KEYCLOAK_CLIENT_ID!,
223
+ client_secret: process.env.KEYCLOAK_CLIENT_SECRET!,
224
+ })
225
+ .build();
226
+
227
+ const sdkManager = InfoselSdkManager.initWithConfiguration({
228
+ authConfiguration: authConfig,
229
+ });
230
+
231
+ const securitiesSDK = new SecuritiesPricesSDK(sdkManager);
232
+ ```
233
+
234
+ ## 📊 Métodos Disponibles
235
+
236
+ ### Datos Intradiarios
237
+
238
+ ```typescript
239
+ // Obtener gráfico intradiario
240
+ const intraday = await securitiesSDK.getIntradayChart({
241
+ symbol: 'AMXL',
242
+ exchange: 'BMV',
243
+ period: '1D', // '1D', '1W', '1M'
244
+ });
245
+
246
+ // Obtener reporte intradiario
247
+ const report = await securitiesSDK.getIntradayReport({
248
+ symbol: 'AMXL',
249
+ exchange: 'BMV',
250
+ period: '1D',
251
+ });
252
+ ```
253
+
254
+ ### Datos Históricos
255
+
256
+ ```typescript
257
+ // Obtener gráfico histórico
258
+ const historical = await securitiesSDK.getHistoricalChart({
259
+ symbol: 'AMXL',
260
+ exchange: 'BMV',
261
+ startDate: new Date('2024-01-01'),
262
+ endDate: new Date('2024-01-31'),
263
+ period: '1D',
264
+ });
265
+
266
+ // Obtener histórico con último precio negociado
267
+ const historicalWithLastPrice = await securitiesSDK.getHistoricalChartWithLastTradedPrice({
268
+ symbol: 'AMXL',
269
+ exchange: 'BMV',
270
+ startDate: new Date('2024-01-01'),
271
+ endDate: new Date('2024-01-31'),
272
+ period: '1D',
273
+ });
274
+
275
+ // Obtener reporte histórico
276
+ const historicalReport = await securitiesSDK.getHistoricalReport({
277
+ symbol: 'AMXL',
278
+ exchange: 'BMV',
279
+ startDate: new Date('2024-01-01'),
280
+ endDate: new Date('2024-01-31'),
281
+ period: '1D',
282
+ });
283
+ ```
284
+
285
+ ### Instantáneas del Mercado
286
+
287
+ ```typescript
288
+ // Obtener último precio negociado
289
+ const lastPrice = await securitiesSDK.getLastTradedPrice({
290
+ symbol: 'AMXL',
291
+ exchange: 'BMV',
292
+ });
293
+
294
+ // Obtener mejor oferta y demanda
295
+ const bestBidOffer = await securitiesSDK.getBestBidOffer({
296
+ symbol: 'AMXL',
297
+ exchange: 'BMV',
298
+ });
299
+
300
+ // Obtener profundidad del libro
301
+ const depthOfBook = await securitiesSDK.getDepthOfBook({
302
+ symbol: 'AMXL',
303
+ exchange: 'BMV',
304
+ levels: 5,
305
+ });
306
+
307
+ // Obtener rendimientos
308
+ const returns = await securitiesSDK.getReturns({
309
+ symbol: 'AMXL',
310
+ exchange: 'BMV',
311
+ period: '1M', // '1D', '1W', '1M', '3M', '6M', '1Y'
312
+ });
313
+ ```
314
+
315
+ ## 📋 Parámetros Comunes
316
+
317
+ ### Símbolos y Exchanges
318
+
319
+ - **Símbolos**: 'AMXL', 'FEMSAUBD', 'WALMEX', etc.
320
+ - **Exchanges**: 'BMV' (Bolsa Mexicana de Valores)
321
+
322
+ ### Períodos Disponibles
323
+
324
+ - **Intradiarios**: '1D', '1W', '1M'
325
+ - **Históricos**: '1D', '1W', '1M'
326
+ - **Rendimientos**: '1D', '1W', '1M', '3M', '6M', '1Y'
327
+
328
+ ### Modos de Operación
329
+
330
+ - **prod**: Producción
331
+ - **qa**: Pruebas
332
+ - **preprod**: Pre-producción
333
+
334
+ ## 🚨 Manejo de Errores
335
+
336
+ ```typescript
337
+ import { SdkError, SdkErrorType } from '@infosel-sdk/core';
338
+
339
+ try {
340
+ const data = await securitiesSDK.getIntradayChart({
341
+ symbol: 'AMXL',
342
+ exchange: 'BMV',
343
+ period: '1D',
344
+ });
345
+ return data;
346
+ } catch (error) {
347
+ if (error instanceof SdkError) {
348
+ switch (error.type) {
349
+ case SdkErrorType.AXIOS_RESPONSE_ERROR:
350
+ console.error('Error de respuesta HTTP:', error.message);
351
+ break;
352
+ case SdkErrorType.INVALID_AUTH_PROVIDER_CONFIG:
353
+ console.error('Configuración de autenticación inválida:', error.message);
354
+ break;
355
+ default:
356
+ console.error('Error del SDK:', error.message);
357
+ }
358
+ }
359
+ throw error;
360
+ }
361
+ ```
362
+
363
+ ## 📚 Referencia de API
364
+
365
+ ### Clases Principales
366
+
367
+ #### `SecuritiesPricesSDK`
368
+
369
+ Punto de entrada principal para el SDK de Securities. Se inicializa con el `InfoselSdkManager` y proporciona métodos para acceder a datos de precios y mercado.
370
+
371
+ #### `InfoselSdkManager`
372
+
373
+ Gestor central del SDK que maneja la configuración, autenticación y modo de operación. Se inicializa usando el método estático `initWithConfiguration()` con configuración moderna o `init()` con configuración legacy.
374
+
375
+ #### `AuthConfigurationBuilder`
376
+
377
+ Builder para crear configuraciones de autenticación validadas y centralizadas. Proporciona una API fluida para configurar autenticación KeyCloak y basada en tokens.
378
+
379
+ ### Casos de Uso
380
+
381
+ #### Datos Intradiarios
382
+
383
+ - `GetIntradayChartUseCase`: Obtener gráfico intradiario
384
+ - `GetIntradayReportUseCase`: Obtener reporte intradiario
385
+
386
+ #### Datos Históricos
387
+
388
+ - `GetHistoricalChartUseCase`: Obtener gráfico histórico
389
+ - `GetHistoricalChartWithLastTradedPriceUseCase`: Obtener histórico con último precio
390
+ - `GetHistoricalReportUseCase`: Obtener reporte histórico
391
+
392
+ #### Instantáneas del Mercado
393
+
394
+ - `GetLastTradedPriceUseCase`: Obtener último precio negociado
395
+ - `GetBestBidOfferUseCase`: Obtener mejor oferta y demanda
396
+ - `GetDepthOfBookUseCase`: Obtener profundidad del libro
397
+ - `GetReturnsUseCase`: Obtener rendimientos
398
+
399
+ ### Entidades
400
+
401
+ #### Entidades Principales
402
+
403
+ - `IntradayChart`: Datos de gráfico intradiario
404
+ - `HistoricalChart`: Datos de gráfico histórico
405
+ - `LastTradedPrice`: Último precio negociado
406
+ - `BestBidOffer`: Mejor oferta y demanda
407
+ - `DepthOfBook`: Profundidad del libro
408
+ - `Returns`: Rendimientos del instrumento
409
+
410
+ #### Entidades de Solicitud
411
+
412
+ - `IntradayChartRequest`: Parámetros para datos intradiarios
413
+ - `HistoricalChartRequest`: Parámetros para datos históricos
414
+ - `LastTradedPriceRequest`: Parámetros para último precio
415
+ - `BestBidOfferRequest`: Parámetros para oferta y demanda
416
+ - `DepthOfBookRequest`: Parámetros para profundidad del libro
417
+ - `ReturnsRequest`: Parámetros para rendimientos
418
+
419
+ ## 🔗 Dependencias
420
+
421
+ ### Peer Dependencies
422
+
423
+ - `@nestjs/common`: ^10.0.0
424
+ - `class-transformer`: ^0.5.1
425
+ - `class-validator`: ^0.14.1
426
+
427
+ ### Runtime Dependencies
428
+
429
+ - `@infosel-sdk/core`: Funcionalidad principal del SDK (versión ^0.0.4)
430
+ - `axios`: Cliente HTTP
431
+ - `tslib`: Biblioteca runtime de TypeScript
432
+
433
+ ## 🆕 Novedades en Core v0.0.4
434
+
435
+ ### ✨ Configuration Builder Pattern
436
+
437
+ - **Nueva API fluida** para configuración sin duplicaciones
438
+ - **Validaciones centralizadas** con mensajes de error descriptivos
439
+ - **Single source of truth** para configuración de realm
440
+ - **Compatibilidad hacia atrás** mantenida
441
+
442
+ ### 🔧 Mejoras en Configuración
443
+
444
+ - **Configuración dinámica de realm** para múltiples ambientes
445
+ - **Validación de formatos** de realm, client_id y credenciales
446
+ - **Valores por defecto inteligentes** basados en el tipo de autenticación
447
+ - **Type safety mejorado** con TypeScript
448
+
449
+ ### 📖 Documentación
450
+
451
+ - **Ejemplos completos** de uso del Configuration Builder
452
+ - **Guías de migración** desde configuración legacy
453
+ - **Casos de uso avanzados** para diferentes ambientes
454
+
455
+ ## 🔄 Migración desde Configuración Legacy
456
+
457
+ ### Antes
458
+
459
+ ```typescript
460
+ // ❌ Configuración duplicada
461
+ const sdk = InfoselSdkManager.init({
462
+ mode: 'qa',
463
+ realm: 'my-realm', // Primera definición
464
+ authProviderConfig: {
465
+ type: 'key-cloak',
466
+ realm: 'my-realm', // Segunda definición (duplicada)
467
+ credentials: {
468
+ /* ... */
469
+ },
470
+ },
471
+ });
472
+ ```
473
+
474
+ ### Después
475
+
476
+ ```typescript
477
+ // ✅ Single source of truth
478
+ const authConfig = AuthConfigurationBuilder.keyCloak()
479
+ .withRealm('my-realm') // Una sola definición
480
+ .withEnvironment('qa')
481
+ .withCredentials({
482
+ /* ... */
483
+ })
484
+ .build();
485
+
486
+ const sdk = InfoselSdkManager.initWithConfiguration({
487
+ authConfiguration: authConfig,
488
+ });
489
+ ```
490
+
491
+ ## 🧪 Testing
492
+
493
+ ```bash
494
+ # Ejecutar tests
495
+ npm test
496
+
497
+ # Ejecutar tests con cobertura
498
+ npm run test:coverage
499
+
500
+ # Ejecutar tests específicos
501
+ npm test -- --testPathPattern="securities_prices"
502
+ ```
503
+
504
+ ## 🔨 Development
505
+
506
+ ```bash
507
+ # Instalar dependencias
508
+ npm install
509
+
510
+ # Compilar TypeScript
511
+ npm run build:lib
512
+
513
+ # Crear distribución
514
+ npm run publish:lib
515
+ ```
516
+
517
+ ## 🤝 Contribución
518
+
519
+ 1. Fork el proyecto
520
+ 2. Crea una rama para tu feature (`git checkout -b feature/AmazingFeature`)
521
+ 3. Commit tus cambios (`git commit -m 'Add some AmazingFeature'`)
522
+ 4. Push a la rama (`git push origin feature/AmazingFeature`)
523
+ 5. Abre un Pull Request
524
+
525
+ ## 📄 Licencia
526
+
527
+ Este proyecto está bajo la Licencia ISC. Ver el archivo `LICENSE` para más detalles.
528
+
529
+ ## 🔗 Paquetes Relacionados
530
+
531
+ - `@infosel-sdk/core`: Funcionalidad core del SDK (versión ^0.0.4)
532
+ - `@infosel-sdk/markets`: SDK de mercados financieros
533
+ - `@infosel-sdk/news`: SDK de noticias y contenido
534
+ - `@infosel-sdk/funds`: SDK de fondos de inversión
535
+ - `@infosel-sdk/calendar`: SDK de calendario económico
536
+ - `@infosel-sdk/users`: SDK de gestión de usuarios
537
+
538
+ ---
539
+
540
+ **Autor**: [Infosel](https://infosel.com)
541
+ **Mantenedor**: soporte@infosel.com
542
+ **Hecho con ❤️ por el equipo de Infosel**
@@ -0,0 +1,28 @@
1
+ export declare enum MODES {
2
+ qa = "https://api-qa.infosel.com/securities-prices/api/v1",
3
+ prod = "https://api.infosel.com/securities-prices/api/v1",
4
+ preprod = "https://api-pre.infosel.com/securities-prices//api/v1"
5
+ }
6
+ export declare enum Order {
7
+ DESC = "DESC",
8
+ ASC = "ASC"
9
+ }
10
+ export declare enum Intervals {
11
+ daily = "D",
12
+ weekly = "W",
13
+ monthly = "M",
14
+ quartly = "Q",
15
+ yearly = "Y"
16
+ }
17
+ export declare enum DateFormat {
18
+ ISO = "yyyy-MM-dd'T'HH:mm:ss.SSSX",
19
+ ISO_NO_ZONE = "yyyy-MM-dd'T'HH:mm:ss.SSS",
20
+ SIMPLE_DATE = "yyyy-MM-dd",
21
+ SIMPLE_DATETIME = "yyyy-MM-dd HH:mm:ss",
22
+ TIME_ONLY = "HH:mm:ss"
23
+ }
24
+ export type DateDataTypes = Date | number | string;
25
+ export interface DateOptions {
26
+ format?: DateFormat;
27
+ timezone?: string;
28
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateFormat = exports.Intervals = exports.Order = exports.MODES = void 0;
4
+ var MODES;
5
+ (function (MODES) {
6
+ MODES["qa"] = "https://api-qa.infosel.com/securities-prices/api/v1";
7
+ MODES["prod"] = "https://api.infosel.com/securities-prices/api/v1";
8
+ MODES["preprod"] = "https://api-pre.infosel.com/securities-prices//api/v1";
9
+ })(MODES || (exports.MODES = MODES = {}));
10
+ var Order;
11
+ (function (Order) {
12
+ Order["DESC"] = "DESC";
13
+ Order["ASC"] = "ASC";
14
+ })(Order || (exports.Order = Order = {}));
15
+ var Intervals;
16
+ (function (Intervals) {
17
+ Intervals["daily"] = "D";
18
+ Intervals["weekly"] = "W";
19
+ Intervals["monthly"] = "M";
20
+ Intervals["quartly"] = "Q";
21
+ Intervals["yearly"] = "Y";
22
+ })(Intervals || (exports.Intervals = Intervals = {}));
23
+ var DateFormat;
24
+ (function (DateFormat) {
25
+ DateFormat["ISO"] = "yyyy-MM-dd'T'HH:mm:ss.SSSX";
26
+ DateFormat["ISO_NO_ZONE"] = "yyyy-MM-dd'T'HH:mm:ss.SSS";
27
+ DateFormat["SIMPLE_DATE"] = "yyyy-MM-dd";
28
+ DateFormat["SIMPLE_DATETIME"] = "yyyy-MM-dd HH:mm:ss";
29
+ DateFormat["TIME_ONLY"] = "HH:mm:ss";
30
+ })(DateFormat || (exports.DateFormat = DateFormat = {}));
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../libs/securities-prices-sdk/src/common/constants/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,mEAA0D,CAAA;IAC1D,kEAAyD,CAAA;IACzD,0EAAiE,CAAA;AACnE,CAAC,EAJW,KAAK,qBAAL,KAAK,QAIhB;AAED,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,sBAAa,CAAA;IACb,oBAAW,CAAA;AACb,CAAC,EAHW,KAAK,qBAAL,KAAK,QAGhB;AAED,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,yBAAY,CAAA;IACZ,0BAAa,CAAA;IACb,0BAAa,CAAA;IACb,yBAAY,CAAA;AACd,CAAC,EANW,SAAS,yBAAT,SAAS,QAMpB;AAED,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,gDAAkC,CAAA;IAClC,uDAAyC,CAAA;IACzC,wCAA0B,CAAA;IAC1B,qDAAuC,CAAA;IACvC,oCAAsB,CAAA;AACxB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB"}
@@ -0,0 +1,5 @@
1
+ export declare enum Exchanges {
2
+ BMV = "BMV",
3
+ BIVA = "BIVA",
4
+ CMX = "CMX"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Exchanges = void 0;
4
+ var Exchanges;
5
+ (function (Exchanges) {
6
+ Exchanges["BMV"] = "BMV";
7
+ Exchanges["BIVA"] = "BIVA";
8
+ Exchanges["CMX"] = "CMX";
9
+ })(Exchanges || (exports.Exchanges = Exchanges = {}));
10
+ //# sourceMappingURL=exchange.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.enum.js","sourceRoot":"","sources":["../../../../../libs/securities-prices-sdk/src/common/enum/exchange.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;IACb,wBAAW,CAAA;AACb,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
@@ -0,0 +1,9 @@
1
+ export declare enum Sources {
2
+ BMV = "BMV",
3
+ BIVA = "BIVA",
4
+ CMX = "CMX",
5
+ US = "US",
6
+ FX = "FX",
7
+ NASDAQ = "NASDAQ",
8
+ NYSE = "NYSE"
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sources = void 0;
4
+ var Sources;
5
+ (function (Sources) {
6
+ Sources["BMV"] = "BMV";
7
+ Sources["BIVA"] = "BIVA";
8
+ Sources["CMX"] = "CMX";
9
+ Sources["US"] = "US";
10
+ Sources["FX"] = "FX";
11
+ Sources["NASDAQ"] = "NASDAQ";
12
+ Sources["NYSE"] = "NYSE";
13
+ })(Sources || (exports.Sources = Sources = {}));
14
+ //# sourceMappingURL=source.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.enum.js","sourceRoot":"","sources":["../../../../../libs/securities-prices-sdk/src/common/enum/source.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,sBAAW,CAAA;IACX,oBAAS,CAAA;IACT,oBAAS,CAAA;IACT,4BAAiB,CAAA;IACjB,wBAAa,CAAA;AACf,CAAC,EARW,OAAO,uBAAP,OAAO,QAQlB"}
@@ -0,0 +1,4 @@
1
+ export declare const parseNumber: (value: string | number) => number;
2
+ export declare const isValidDate: (dateString: string) => boolean;
3
+ export declare const parseDate: (dateString: string) => Date;
4
+ export declare function isFirstDateAfterSecondDate(dateStringA: string, dateStringB: string): boolean;