PyQuantimClient 1.0.26__tar.gz → 1.0.28__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyQuantimClient
3
- Version: 1.0.26
3
+ Version: 1.0.28
4
4
  Summary: Python client to access quantIM services
5
5
  Author: Daniel Velasquez
6
6
  Author-email: daniel.velasquez@sura-im.com
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyQuantimClient
3
- Version: 1.0.26
3
+ Version: 1.0.28
4
4
  Summary: Python client to access quantIM services
5
5
  Author: Daniel Velasquez
6
6
  Author-email: daniel.velasquez@sura-im.com
@@ -4,7 +4,7 @@ setup(
4
4
  name='PyQuantimClient',
5
5
  packages=['PyQuantimClient'],
6
6
  package_dir={'PyQuantimClient': 'src'},
7
- version='1.0.26',
7
+ version='1.0.28',
8
8
  description='Python client to access quantIM services',
9
9
  author='Daniel Velasquez',
10
10
  author_email='daniel.velasquez@sura-im.com',
@@ -214,13 +214,6 @@ def procesamiento_aseguradoras(date_port, port_name, ruta, ruta_precia, portfoli
214
214
  # Reemplazo [NULL] con NaN.
215
215
  Portafolio = Portafolio.replace("[NULL]", np.nan)
216
216
  Portafolio = Portafolio.replace('NA', np.nan)
217
-
218
- ########################################################################################################################
219
- # Agrego portfolioNAV
220
- Portafolio['portfolioNAV'] = Portafolio['mktValue'].sum()
221
- # Añadir diferenciación en base a cada portafolio dentro del archivo unico 351.
222
- ########################################################################################################################
223
-
224
217
 
225
218
  # Cruzo con archivo NEMOS-ISIN.xlsx - SI ES IBR.
226
219
  Nemos.rename(columns={'NEMO NUEVO': 'assetId', 'USO TASA ACTUAL': 'cpnFirstActual', 'TIPO TASA': 'cpnRateType', 'TASA REFERENCIA': 'indexRate_Nemo'}, inplace=True)
@@ -285,6 +278,7 @@ def procesamiento_aseguradoras(date_port, port_name, ruta, ruta_precia, portfoli
285
278
  # Reemplazo [NULL] con NaN.
286
279
  Portafolio = Portafolio.replace("[NULL]", np.nan)
287
280
  Portafolio = Portafolio.replace('NA', np.nan)
281
+ Portafolio = Portafolio.replace('nan', np.nan)
288
282
 
289
283
  # Union con formato regional.
290
284
  df_aladdin = pd.DataFrame(columns=portfolio_fields['Fields'].dropna().unique().tolist())
@@ -297,8 +291,39 @@ def procesamiento_aseguradoras(date_port, port_name, ruta, ruta_precia, portfoli
297
291
 
298
292
  Portafolio['portfolioName'] = portfolioName
299
293
 
294
+ # Agrego portfolioNAV
295
+ df_NAV = Portafolio.groupby('subGroup').agg(portfolioNAV=('mktValue', 'sum')).reset_index()
296
+ Portafolio['portfolioNAV'] = np.nan
297
+ Portafolio['portfolioNAV'] = Portafolio['portfolioNAV'].fillna(Portafolio['subGroup'].map(df_NAV.set_index('subGroup')['portfolioNAV']))
298
+
299
+
300
300
  # Ajuste YTM
301
301
  Portafolio['yieldToMaturity'] = np.where(Portafolio['valuationMethod']==9, Portafolio['discountRate'], Portafolio['yieldToMaturity'])
302
302
 
303
+
304
+ # Correccion a campos amortizationType y valuationMethod.
305
+ # amortizationType
306
+ amortType_options = [(Portafolio.amortizationType == 1), (Portafolio.amortizationType == 2), (Portafolio.amortizationType == 3), (Portafolio.amortizationType == 4)]
307
+ amortType_values = ('Bullet', 'Amortizable', 'Intereses Especiales', 'Amortizable con Intereses Especiales')
308
+ Portafolio['amortizationType'] = np.select(amortType_options, amortType_values, np.nan)
309
+
310
+
311
+ # valuationMethod
312
+ valMethod_options = [(Portafolio.valuationMethod == 9), (Portafolio.valuationMethod == 12), (Portafolio.valuationMethod == 13),
313
+ (Portafolio.valuationMethod == 14), (Portafolio.valuationMethod == 15), (Portafolio.valuationMethod == 16),
314
+ (Portafolio.valuationMethod == 17), (Portafolio.valuationMethod == 19), (Portafolio.valuationMethod == 20), (Portafolio.valuationMethod == 21)]
315
+ valMethod_values = ('TIR - Tasa interna de retorno', 'Precio bolsa de valores en el exterior', 'Valor de unidad', 'Avalúo comercial',
316
+ 'Precio justo de intercambio para títulos y/o valores hechos a la medida',
317
+ 'Precio justo de intercambio para los CDM, Certificados de Depósito de Mercancia',
318
+ 'TCRM', 'Precio emisor', 'Costo (+/-) variación del patrimonio del Emisor', 'Precio publicado por Proveedor de Precios')
319
+ Portafolio['valuationMethod'] = np.select(valMethod_options, valMethod_values, np.nan)
320
+
321
+ cols = ['amortizationType', 'valuationMethod']
322
+ Portafolio[cols] = Portafolio[cols].replace('nan', np.nan)
323
+ Portafolio[cols] = Portafolio[cols].replace(0, np.nan)
324
+ Portafolio[cols] = Portafolio[cols].replace('0', np.nan)
325
+
326
+ Portafolio['cpnFirstActual'] = ['ACTUAL' if cFA == 'A' else 'PREVIA' if cFA == 'P' else cFA for cFA in Portafolio['cpnFirstActual']]
327
+
303
328
 
304
329
  return Portafolio