PyQuantimClient 1.0.68__tar.gz → 1.0.70__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.
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/PKG-INFO +1 -1
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/PyQuantimClient.egg-info/PKG-INFO +1 -1
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/setup.py +1 -1
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/bi.py +1 -2
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/portfolios.py +41 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/PyQuantimClient.egg-info/SOURCES.txt +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/PyQuantimClient.egg-info/dependency_links.txt +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/PyQuantimClient.egg-info/top_level.txt +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/README.md +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/setup.cfg +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/__init__.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/api.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/benchmarks.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/data.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/energy.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/preprocess_co.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/risk.py +0 -0
- {PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/src/utils.py +0 -0
|
@@ -4,7 +4,7 @@ setup(
|
|
|
4
4
|
name='PyQuantimClient',
|
|
5
5
|
packages=['PyQuantimClient'],
|
|
6
6
|
package_dir={'PyQuantimClient': 'src'},
|
|
7
|
-
version='1.0.
|
|
7
|
+
version='1.0.70',
|
|
8
8
|
description='Python client to access quantIM services',
|
|
9
9
|
author='Daniel Velasquez',
|
|
10
10
|
author_email='daniel.velasquez@sura-im.com',
|
|
@@ -34,7 +34,6 @@ class bi_data(quantim):
|
|
|
34
34
|
asset_class_df['index'] = [k.replace('tipofondo -', '').strip() for k in asset_class_df['index'].values]
|
|
35
35
|
asset_class_df = asset_class_df.loc[np.in1d(asset_class_df['index'], ['A', 'B', 'C', 'D', 'E'])]
|
|
36
36
|
|
|
37
|
-
asset_class_df.index.unique()
|
|
38
37
|
consol_df = pd.DataFrame()
|
|
39
38
|
acc_map = [{'id':'SUBTOTAL RENTA VARIABLE', 'label':'Renta Variable'},
|
|
40
39
|
{'id':'SUBTOTAL RENTA FIJA', 'label':'Renta Fija'},
|
|
@@ -67,4 +66,4 @@ class bi_data(quantim):
|
|
|
67
66
|
asset_detail_df = asset_detail_df.loc[np.in1d(asset_detail_df['index'], ['A', 'B', 'C', 'D', 'E'])]
|
|
68
67
|
asset_detail_df = asset_detail_df.groupby(['index', 'nemo', 'glosa']).sum().reset_index(level='index').pivot(columns='index', values='monto_dolares').reset_index()
|
|
69
68
|
|
|
70
|
-
return
|
|
69
|
+
return consol_df, asset_detail_df
|
|
@@ -137,4 +137,45 @@ class portfolios(quantim):
|
|
|
137
137
|
port_rets = pd.DataFrame(resp['port_rets']).set_index('date') if resp.get('port_rets', None) is not None else None
|
|
138
138
|
return port_date, ref_dates, tr_contrib, tra_asset, tra_assetclass, port_risk_contrib, bench_risk_contrib, risk_attrib, port_rets
|
|
139
139
|
|
|
140
|
+
def backtest(self, port_name, ref_curr, ref_date=None, bench_name=None, ini_date=None, rebal_dates_db=False, rebal_period='quarterly', sync_rebal_dates=False):
|
|
141
|
+
'''
|
|
142
|
+
Portfolio risk and return attribution and contribution.
|
|
143
|
+
|
|
144
|
+
Parameters:
|
|
145
|
+
----------
|
|
146
|
+
port_name : str
|
|
147
|
+
Portfolio name
|
|
148
|
+
ref_curr : str
|
|
149
|
+
Currency code
|
|
150
|
+
ref_date : str
|
|
151
|
+
Portfolio date in format %Y-%m-%d (default None)
|
|
152
|
+
bench_name : str
|
|
153
|
+
Benchmark name (default None)
|
|
154
|
+
ini_date : str
|
|
155
|
+
Initial backtest date in format %Y-%m-%d (default 2013-01-01)
|
|
156
|
+
rebal_date_db : bool
|
|
157
|
+
Indicates if benchmarks must be retrieved from database (default False)
|
|
158
|
+
rebal_period : str
|
|
159
|
+
Rebalancing period (default quarterly)
|
|
160
|
+
sync_rebal_dates : bool
|
|
161
|
+
Indicates if rebalancing dates need to be syncronized (default False)
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
-------
|
|
165
|
+
ref_dates : Array
|
|
166
|
+
Reference dates
|
|
167
|
+
tr_contrib : pd.DataFrame
|
|
168
|
+
Portolio and benchmark total return contribution
|
|
169
|
+
tra_asset : pd.DataFrame
|
|
170
|
+
Total return attribution per asset
|
|
171
|
+
tra_assetclass : pd.DataFrame
|
|
172
|
+
Total return attribution per asset class
|
|
173
|
+
series: pd.DataFrame
|
|
174
|
+
Simulated series
|
|
175
|
+
'''
|
|
140
176
|
|
|
177
|
+
data = {"port_name":port_name, "date":ref_date, "bench_name":bench_name, "ref_curr": ref_curr, "ini_date":ini_date,"rebal_dates_db": rebal_dates_db,"rebal_period":rebal_period,"sync_rebal_dates":sync_rebal_dates,"reset_weights": True}
|
|
178
|
+
resp = self.api_call('port_backtest', method="post", data=data, verify=False)
|
|
179
|
+
ref_dates, port_date, bench_date, tr_contrib, tra_asset, tra_assetclass, series = resp['dates'], resp['port_date'], resp['bench_date'], pd.DataFrame(resp['tr_contrib']), pd.DataFrame(resp['tra_asset']) if resp['tra_asset'] is not None else None, pd.DataFrame(resp['tra_assetclass']) if resp['tra_assetclass'] is not None else None, pd.DataFrame(resp['series']).set_index('fecha')
|
|
180
|
+
series.index = pd.to_datetime(series.index)
|
|
181
|
+
return ref_dates, port_date, tr_contrib, tra_asset, tra_assetclass, series
|
|
File without changes
|
{PyQuantimClient-1.0.68 → PyQuantimClient-1.0.70}/PyQuantimClient.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|