PyQuantimClient 2.0.52__tar.gz → 2.0.53__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.
Files changed (24) hide show
  1. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/PKG-INFO +1 -1
  2. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/PyQuantimClient.egg-info/PKG-INFO +1 -1
  3. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/setup.py +1 -1
  4. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/api.py +2 -2
  5. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/risk.py +24 -0
  6. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/PyQuantimClient.egg-info/SOURCES.txt +0 -0
  7. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/PyQuantimClient.egg-info/dependency_links.txt +0 -0
  8. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/PyQuantimClient.egg-info/top_level.txt +0 -0
  9. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/README.md +0 -0
  10. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/setup.cfg +0 -0
  11. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/__init__.py +0 -0
  12. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/alm.py +0 -0
  13. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/benchmarks.py +0 -0
  14. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/bi.py +0 -0
  15. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/credit.py +0 -0
  16. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/data.py +0 -0
  17. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/energy.py +0 -0
  18. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/performance.py +0 -0
  19. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/portfolios.py +0 -0
  20. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/preprocess_co.py +0 -0
  21. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/private_debt.py +0 -0
  22. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/product.py +0 -0
  23. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/returns.py +0 -0
  24. {pyquantimclient-2.0.52 → pyquantimclient-2.0.53}/src/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyQuantimClient
3
- Version: 2.0.52
3
+ Version: 2.0.53
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.4
2
2
  Name: PyQuantimClient
3
- Version: 2.0.52
3
+ Version: 2.0.53
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='2.0.52',
7
+ version='2.0.53',
8
8
  description='Python client to access quantIM services',
9
9
  author='Daniel Velasquez',
10
10
  author_email='daniel.velasquez@sura-im.com',
@@ -106,11 +106,11 @@ class quantim:
106
106
  resp = {'msg':'Check permissions!'}
107
107
  return resp['msg']
108
108
 
109
- def upload_with_presigned_url(self, local_file_path, bucket, key):
109
+ def upload_with_presigned_url(self, local_file_path, bucket, key, prefix=None):
110
110
  """
111
111
  Upload a local file to S3 using a presigned URL.
112
112
  """
113
- data = {'bucket':bucket, 'key':key}
113
+ data = {'bucket':bucket, 'key':key, 'prefix':prefix}
114
114
  try:
115
115
  presigned_url = self.api_call('link_data_s3', method="post", data=data, verify=False)
116
116
  except Exception as e:
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ import re
2
3
  import pandas as pd
3
4
  import numpy as np
4
5
  import datetime as dt
@@ -320,3 +321,26 @@ class risk_data(quantim):
320
321
  print("Archivo no disponible")
321
322
  return None
322
323
  return df
324
+
325
+ def load_positions(self, file_path):
326
+ '''
327
+ Load positions.
328
+ '''
329
+ # Load data
330
+ filename = file_path.split("/")[-1]
331
+ # validar el nombre del archivo
332
+ patron = r"^Positions_(\d{8})\.csv$"
333
+ match = re.match(patron, filename)
334
+ if not match:
335
+ raise ValueError('You can only update files named Positions_AAAAMMDD.csv. Please check.')
336
+ # validar que la fecha sea valida
337
+ fecha_str = match.group(1)
338
+ try:
339
+ dt.datetime.strptime(fecha_str, "%Y%m%d")
340
+ except ValueError:
341
+ raise ValueError('The date is not valid.')
342
+ prefix="inputs/portfolios/CO/Positions_"
343
+ key= f"inputs/portfolios/CO/{filename}"
344
+ bucket="condor-sura"
345
+ resp = self.upload_with_presigned_url(file_path, bucket, key, prefix)
346
+ return resp