PyQuantimClient 1.0.87__tar.gz → 1.0.91__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.87
3
+ Version: 1.0.91
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.87
3
+ Version: 1.0.91
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.87',
7
+ version='1.0.91',
8
8
  description='Python client to access quantIM services',
9
9
  author='Daniel Velasquez',
10
10
  author_email='daniel.velasquez@sura-im.com',
@@ -68,16 +68,18 @@ class portfolios(quantim):
68
68
  series_df = pd.concat([series_df, pd.DataFrame(resp['series'][k]).set_index('date')], axis=1)
69
69
  return absolute_risk, relative_risk, real_rets, series_df
70
70
 
71
- def series(self, country=None, funds=None, ref_date=None):
71
+ def series(self, country=None, funds=None, ref_date=None, keep_gross=False):
72
72
  '''
73
73
  port_series service
74
74
  '''
75
75
  if country is None and funds is None:
76
76
  raise ValueError("Both country and funds cannot be None")
77
- data = {'country':country, "funds":funds, 'ref_date':ref_date}
77
+ data = {'country':country, "funds":funds, 'ref_date':ref_date, 'keep_gross':keep_gross}
78
78
  resp = self.api_call('port_series', method="post", data=data, verify=False)
79
79
  series_df = pd.DataFrame(resp).set_index('Date')
80
80
  series_df.index = pd.to_datetime(series_df.index)
81
+ series_df = series_df.apply(pd.to_numeric, errors='coerce')
82
+
81
83
  return series_df
82
84
 
83
85
  def attribution(self, port_name, ref_curr, ref_date=None, subgroup=None, bench_name=None, port_to_index=True, per='monthly', ini_date=None, rebal_dates_db=False, rebal_period='quarterly', sync_rebal_dates=False, reset_weights=True, backtest_assets=None, vol_model={"name":"ewma", "alpha":0.01}, delta_w=0.01, quant=0.95, var_normal=True, counter_assets=None, filter_market_val=False, dur_contrib_field='Duration', retrieve_returns=False, lookthrough=False):
@@ -112,23 +112,8 @@ class risk_data(quantim):
112
112
  raise ValueError('Extension must be csv. Please check file.')
113
113
  if not np.any(np.in1d(filename.split('.')[-2], ['LIMITES_GEN', 'LIMITES_GEN_AGG', 'EMISIONES', 'Agregacion'])):
114
114
  raise ValueError('You can only load LIMITES_GEN.csv, LIMITES_GEN_AGG.csv, EMISIONES.csv or Agregacion.csv. Please check file name.')
115
-
116
- if get_csv_separator(file_path)!=";":
117
- raise ValueError('Separator must be semi-colon (;). Please check file.')
118
-
119
- # Read new file:
120
- try:
121
- df_new = pd.read_csv(file_path, sep=sep, encoding=encoding)
122
- except:
123
- raise ValueError("Cannot read file. Check path and encoding.")
124
115
 
125
- # Load data
126
- payload = df_new.to_dict(orient='records')
127
- data = {'bucket':'condor-sura', 'file_name':f'inputs/risk/static/{filename}', 'payload':payload, 'sep':sep, 'overwrite':True, 'encoding':encoding}
128
- try:
129
- resp = self.api_call('load_data_s3', method="post", data=data, verify=False)
130
- except:
131
- resp = {'success':False, 'message':'Check permissions!'}
116
+ resp = self.upload_with_presigned_url(file_path, "condor-sura", f"inputs/portfolios/nav/CO/{filename}")
132
117
  return resp
133
118
 
134
119
  def get_irl(self, ref_date=None, return_cfs=False):
@@ -170,6 +155,22 @@ class risk_data(quantim):
170
155
  resp = self.upload_with_presigned_url(file_path, "condor-sura", f"inputs/portfolios/buy_sell/CO/{filename}")
171
156
  return resp
172
157
 
158
+ def load_navs(self, file_path, country='CO'):
159
+ '''
160
+ Load fund series (NAVs).
161
+ '''
162
+ # Load data
163
+
164
+ if country=='CO':
165
+ filename = file_path.split("/")[-1]
166
+ if filename not in ['BD_PAS.csv']:
167
+ raise ValueError('file name not supported.')
168
+ else:
169
+ resp = self.upload_with_presigned_url(file_path, "condor-sura", f"inputs/portfolios/nav/CO/{filename}")
170
+ else:
171
+ raise ValueError("country not supported.")
172
+ return resp
173
+
173
174
  def port_contrib(self, start_date, end_date, names, groupers=["secType"], subgroup=False):
174
175
  '''
175
176
  Portfolio risk an return ex-post contribution.