PyQuantimClient 1.0.62__tar.gz → 1.0.63__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.62
3
+ Version: 1.0.63
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.62
3
+ Version: 1.0.63
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.62',
7
+ version='1.0.63',
8
8
  description='Python client to access quantIM services',
9
9
  author='Daniel Velasquez',
10
10
  author_email='daniel.velasquez@sura-im.com',
@@ -47,7 +47,12 @@ class quantim:
47
47
  else:
48
48
  print("Method not supported!")
49
49
  return None
50
- return json.loads(api_call_response.text)
50
+
51
+ try:
52
+ resp = json.loads(api_call_response.text)
53
+ except:
54
+ resp = api_call_response.text
55
+ return resp
51
56
 
52
57
  def retrieve_s3_df(self, bucket, key, sep=','):
53
58
  '''
@@ -138,3 +138,36 @@ class risk_data(quantim):
138
138
  cfs = pd.read_csv(resp['cf_url']) if return_cfs else None
139
139
 
140
140
  return irl_report, cfs
141
+
142
+ def load_fund_series_cl(self, file_path, sep=";", encoding='utf-8', blocks=1):
143
+ '''
144
+ Load series Chile to s3.
145
+ '''
146
+ # Validate filename:
147
+ filename = file_path.split('/')[-1]
148
+ label = filename.split('.')[-2]
149
+ if filename.split('.')[-1]!='csv':
150
+ raise ValueError('Extension must be csv. Please check file.')
151
+ if not np.any(np.in1d(label, ['series_performance'])):
152
+ raise ValueError('You can only load series_performance.csv')
153
+
154
+ if get_csv_separator(file_path)!=sep:
155
+ raise ValueError(f'Separator must be ({sep}). Please check file.')
156
+
157
+ # Read new file:
158
+ try:
159
+ df_new = pd.read_csv(file_path, sep=sep, encoding=encoding)
160
+ except:
161
+ raise ValueError("Cannot read file. Check path and encoding.")
162
+
163
+ # Load data
164
+ li = int(np.ceil(len(df_new)/blocks))
165
+ for i in range(blocks):
166
+ payload = df_new.iloc[(i*li):(i+1)*li, :].to_dict(orient='records')
167
+ data = {'bucket':'condor-sura', 'file_name':f"inputs/benchmarks/performance/cl/{label}{i if i>0 else ''}.csv", 'payload':payload, 'sep':sep, 'overwrite':True, 'encoding':encoding}
168
+ try:
169
+ resp = self.api_call('load_data_s3', method="post", data=data, verify=False)
170
+ except:
171
+ resp = {'success':False, 'message':'Check permissions or file size!'}
172
+ return resp
173
+ return resp