everysk-lib 1.10.2__cp312-cp312-win_amd64.whl
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.
- everysk/__init__.py +30 -0
- everysk/_version.py +683 -0
- everysk/api/__init__.py +61 -0
- everysk/api/api_requestor.py +167 -0
- everysk/api/api_resources/__init__.py +23 -0
- everysk/api/api_resources/api_resource.py +371 -0
- everysk/api/api_resources/calculation.py +779 -0
- everysk/api/api_resources/custom_index.py +42 -0
- everysk/api/api_resources/datastore.py +81 -0
- everysk/api/api_resources/file.py +42 -0
- everysk/api/api_resources/market_data.py +223 -0
- everysk/api/api_resources/parser.py +66 -0
- everysk/api/api_resources/portfolio.py +43 -0
- everysk/api/api_resources/private_security.py +42 -0
- everysk/api/api_resources/report.py +65 -0
- everysk/api/api_resources/report_template.py +39 -0
- everysk/api/api_resources/tests.py +115 -0
- everysk/api/api_resources/worker_execution.py +64 -0
- everysk/api/api_resources/workflow.py +65 -0
- everysk/api/api_resources/workflow_execution.py +93 -0
- everysk/api/api_resources/workspace.py +42 -0
- everysk/api/http_client.py +63 -0
- everysk/api/tests.py +32 -0
- everysk/api/utils.py +262 -0
- everysk/config.py +451 -0
- everysk/core/_tests/serialize/test_json.py +336 -0
- everysk/core/_tests/serialize/test_orjson.py +295 -0
- everysk/core/_tests/serialize/test_pickle.py +48 -0
- everysk/core/cloud_function/main.py +78 -0
- everysk/core/cloud_function/tests.py +86 -0
- everysk/core/compress.py +245 -0
- everysk/core/datetime/__init__.py +12 -0
- everysk/core/datetime/calendar.py +144 -0
- everysk/core/datetime/date.py +424 -0
- everysk/core/datetime/date_expression.py +299 -0
- everysk/core/datetime/date_mixin.py +1475 -0
- everysk/core/datetime/date_settings.py +30 -0
- everysk/core/datetime/datetime.py +713 -0
- everysk/core/exceptions.py +435 -0
- everysk/core/fields.py +1176 -0
- everysk/core/firestore.py +555 -0
- everysk/core/fixtures/_settings.py +29 -0
- everysk/core/fixtures/other/_settings.py +18 -0
- everysk/core/fixtures/user_agents.json +88 -0
- everysk/core/http.py +691 -0
- everysk/core/lists.py +92 -0
- everysk/core/log.py +709 -0
- everysk/core/number.py +37 -0
- everysk/core/object.py +1469 -0
- everysk/core/redis.py +1021 -0
- everysk/core/retry.py +51 -0
- everysk/core/serialize.py +674 -0
- everysk/core/sftp.py +414 -0
- everysk/core/signing.py +53 -0
- everysk/core/slack.py +127 -0
- everysk/core/string.py +199 -0
- everysk/core/tests.py +240 -0
- everysk/core/threads.py +199 -0
- everysk/core/undefined.py +70 -0
- everysk/core/unittests.py +73 -0
- everysk/core/workers.py +241 -0
- everysk/sdk/__init__.py +23 -0
- everysk/sdk/base.py +98 -0
- everysk/sdk/brutils/cnpj.py +391 -0
- everysk/sdk/brutils/cnpj_pd.py +129 -0
- everysk/sdk/engines/__init__.py +26 -0
- everysk/sdk/engines/cache.py +185 -0
- everysk/sdk/engines/compliance.py +37 -0
- everysk/sdk/engines/cryptography.py +69 -0
- everysk/sdk/engines/expression.cp312-win_amd64.pyd +0 -0
- everysk/sdk/engines/expression.pyi +55 -0
- everysk/sdk/engines/helpers.cp312-win_amd64.pyd +0 -0
- everysk/sdk/engines/helpers.pyi +26 -0
- everysk/sdk/engines/lock.py +120 -0
- everysk/sdk/engines/market_data.py +244 -0
- everysk/sdk/engines/settings.py +19 -0
- everysk/sdk/entities/__init__.py +23 -0
- everysk/sdk/entities/base.py +784 -0
- everysk/sdk/entities/base_list.py +131 -0
- everysk/sdk/entities/custom_index/base.py +209 -0
- everysk/sdk/entities/custom_index/settings.py +29 -0
- everysk/sdk/entities/datastore/base.py +160 -0
- everysk/sdk/entities/datastore/settings.py +17 -0
- everysk/sdk/entities/fields.py +375 -0
- everysk/sdk/entities/file/base.py +215 -0
- everysk/sdk/entities/file/settings.py +63 -0
- everysk/sdk/entities/portfolio/base.py +248 -0
- everysk/sdk/entities/portfolio/securities.py +241 -0
- everysk/sdk/entities/portfolio/security.py +580 -0
- everysk/sdk/entities/portfolio/settings.py +97 -0
- everysk/sdk/entities/private_security/base.py +226 -0
- everysk/sdk/entities/private_security/settings.py +17 -0
- everysk/sdk/entities/query.py +603 -0
- everysk/sdk/entities/report/base.py +214 -0
- everysk/sdk/entities/report/settings.py +23 -0
- everysk/sdk/entities/script.py +310 -0
- everysk/sdk/entities/secrets/base.py +128 -0
- everysk/sdk/entities/secrets/script.py +119 -0
- everysk/sdk/entities/secrets/settings.py +17 -0
- everysk/sdk/entities/settings.py +48 -0
- everysk/sdk/entities/tags.py +174 -0
- everysk/sdk/entities/worker_execution/base.py +307 -0
- everysk/sdk/entities/worker_execution/settings.py +63 -0
- everysk/sdk/entities/workflow_execution/base.py +113 -0
- everysk/sdk/entities/workflow_execution/settings.py +32 -0
- everysk/sdk/entities/workspace/base.py +99 -0
- everysk/sdk/entities/workspace/settings.py +27 -0
- everysk/sdk/settings.py +67 -0
- everysk/sdk/tests.py +105 -0
- everysk/sdk/worker_base.py +47 -0
- everysk/server/__init__.py +9 -0
- everysk/server/applications.py +63 -0
- everysk/server/endpoints.py +516 -0
- everysk/server/example_api.py +69 -0
- everysk/server/middlewares.py +80 -0
- everysk/server/requests.py +62 -0
- everysk/server/responses.py +119 -0
- everysk/server/routing.py +64 -0
- everysk/server/settings.py +36 -0
- everysk/server/tests.py +36 -0
- everysk/settings.py +98 -0
- everysk/sql/__init__.py +9 -0
- everysk/sql/connection.py +232 -0
- everysk/sql/model.py +376 -0
- everysk/sql/query.py +417 -0
- everysk/sql/row_factory.py +63 -0
- everysk/sql/settings.py +49 -0
- everysk/sql/utils.py +129 -0
- everysk/tests.py +23 -0
- everysk/utils.py +81 -0
- everysk/version.py +15 -0
- everysk_lib-1.10.2.dist-info/.gitignore +5 -0
- everysk_lib-1.10.2.dist-info/METADATA +326 -0
- everysk_lib-1.10.2.dist-info/RECORD +137 -0
- everysk_lib-1.10.2.dist-info/WHEEL +5 -0
- everysk_lib-1.10.2.dist-info/licenses/LICENSE.txt +9 -0
- everysk_lib-1.10.2.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# (C) Copyright 2025 EVERYSK TECHNOLOGIES
|
|
4
|
+
#
|
|
5
|
+
# This is an unpublished work containing confidential and proprietary
|
|
6
|
+
# information of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction
|
|
7
|
+
# without authorization of EVERYSK TECHNOLOGIES is prohibited.
|
|
8
|
+
#
|
|
9
|
+
###############################################################################
|
|
10
|
+
|
|
11
|
+
###############################################################################
|
|
12
|
+
# Imports
|
|
13
|
+
###############################################################################
|
|
14
|
+
from everysk.api import utils
|
|
15
|
+
from everysk.api.api_resources.api_resource import APIResource
|
|
16
|
+
|
|
17
|
+
###############################################################################
|
|
18
|
+
# Calculation Implementation
|
|
19
|
+
###############################################################################
|
|
20
|
+
class Calculation(APIResource):
|
|
21
|
+
"""
|
|
22
|
+
A class representing calculations for financial analysis.
|
|
23
|
+
|
|
24
|
+
This class inherits from APIResource and provides methods for executing various financial calculations and analyses.
|
|
25
|
+
"""
|
|
26
|
+
def refresh(self): # pylint: disable=arguments-differ
|
|
27
|
+
"""
|
|
28
|
+
Refreshes the calculation instance.
|
|
29
|
+
This method refreshes the calculation instance by performing any necessary updates or recalculations.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
Calculation: The refreshed calculation instance.
|
|
33
|
+
|
|
34
|
+
Example:
|
|
35
|
+
>>> from everysk.api.api_resources.calculation import Calculation
|
|
36
|
+
>>> data = {'param1', 'param2'}
|
|
37
|
+
>>> retrieve_params = {'some': 'data'}
|
|
38
|
+
>>> calculation = Calculation(retrieve_params, data)
|
|
39
|
+
>>> calculation.refresh()
|
|
40
|
+
"""
|
|
41
|
+
return self
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def class_name(cls) -> str:
|
|
45
|
+
"""
|
|
46
|
+
This method returns the class name 'calculations'.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
str: 'calculations'
|
|
50
|
+
|
|
51
|
+
Example:
|
|
52
|
+
>>> from everysk.api.api_resources.calculation import Calculation
|
|
53
|
+
>>> Calculation.class_name()
|
|
54
|
+
>>> 'calculations'
|
|
55
|
+
"""
|
|
56
|
+
return 'calculations'
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def class_url(cls) -> str:
|
|
60
|
+
"""
|
|
61
|
+
This method returns the class URL in the following format: '/calculations'.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
str: '/calculations'
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
>>> from everysk.api.api_resources.calculation import Calculation
|
|
68
|
+
>>> url = Calculation.class_url()
|
|
69
|
+
>>> print(url)
|
|
70
|
+
>>> '/calculations'
|
|
71
|
+
"""
|
|
72
|
+
return f'/{cls.class_name()}'
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def __call_method(cls, method, **kwargs):
|
|
76
|
+
"""
|
|
77
|
+
Generic helper method to call various calculation methods on the API. This method acts as a central
|
|
78
|
+
dispatcher that sends requests to different calculation endpoints based on the 'method' argument. The
|
|
79
|
+
specific parameters for each calculation should be passed as keyword arguments, which will vary depending
|
|
80
|
+
on the calculation method being called.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
method:
|
|
84
|
+
The calculation method to call. This should match one of the API's available endpoints.
|
|
85
|
+
|
|
86
|
+
**kwargs:
|
|
87
|
+
Additional keyword arguments. The contents and requirements of kwargs will depend on the specific API method being invoked.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
dict: The response from the API
|
|
91
|
+
"""
|
|
92
|
+
api_req = utils.create_api_requestor(kwargs)
|
|
93
|
+
url = f'{cls.class_url()}/{method}'
|
|
94
|
+
response = api_req.post(url, kwargs)
|
|
95
|
+
return response
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def riskAttribution(cls, **kwargs): # pylint: disable=invalid-name
|
|
99
|
+
"""
|
|
100
|
+
Performs a risk attribution analysis on a specified portfolio or a set of securities. This method calculates and
|
|
101
|
+
attributes the portfolio's risk based on the following parameters
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
portfolio_id (str, optional):
|
|
105
|
+
ID of an existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency, and nlv.
|
|
106
|
+
|
|
107
|
+
securities (list):
|
|
108
|
+
Array of objects to describe the securities in the portfolio. Each object, represents a security with a unique id, symbol, quantity and label.
|
|
109
|
+
`securities` is not required if `portfolio_id` is being provided, check https://everysk.com/api/docs/#-a-name-securities-a-securities for more info.
|
|
110
|
+
|
|
111
|
+
date (str date, optional):
|
|
112
|
+
Date in the following format: `YYYYMMDD`. The date instructs the API to use the market conditions and security prices prevailing on that date.
|
|
113
|
+
|
|
114
|
+
base_currency (str, optional):
|
|
115
|
+
3-letter ISO 4217 code for currency, check https://support.everysk.com/hc/en-us/articles/115005366147-Supported-Currencies to see all the available currencies.
|
|
116
|
+
|
|
117
|
+
nlv (float, optional):
|
|
118
|
+
The net liquidating value of the portfolio (also known as NAV).
|
|
119
|
+
|
|
120
|
+
horizon (int, optional):
|
|
121
|
+
Simulates the behavior of each security via their underlying risk factors. It accepts 1, 5 20, or 60.
|
|
122
|
+
For more information, check https://support.everysk.com/hc/en-us/articles/360016288574-Simulation-Horizon
|
|
123
|
+
|
|
124
|
+
sampling (int, optional):
|
|
125
|
+
refers to the collection frequency of historical prices and rates to calculate invariant risk factors. Use 1 for daily sampling and 5 for weekly (non-overlapping) sampling.
|
|
126
|
+
Accepted values are 1 or 5. Click here for different horizon and sampling combinations.
|
|
127
|
+
|
|
128
|
+
aggregation (str, optional):
|
|
129
|
+
Computes individual security MCTR's and aggregates them according to a supported criteria.
|
|
130
|
+
Check https://support.everysk.com/hc/en-us/sections/360003156634-Risk-Aggregations for more information
|
|
131
|
+
|
|
132
|
+
projection (list, optional):
|
|
133
|
+
User supplied array of securities to be used as a top-down factor model. Maximum number of elements in the projection list is 15
|
|
134
|
+
|
|
135
|
+
volatility_half_life (int, optional):
|
|
136
|
+
Half life of volatility information in the following months: 0 (no decay), 2, 6, 12, 24, or 48.
|
|
137
|
+
|
|
138
|
+
correlation_half_life (int, optional):
|
|
139
|
+
Half life of correlation information in months: 0 (no decay), 2, 6, 12, 24 or 48.
|
|
140
|
+
|
|
141
|
+
risk_measure (str, optional):
|
|
142
|
+
MCTR measures forward-looking portfolio risk properties: vol (annualized portfolio P&L volatility), var (portfolio P&L Value-at-Risk), and cvar (portfolio P&L Conditional Value-at-Risk).
|
|
143
|
+
|
|
144
|
+
filter (str, optional):
|
|
145
|
+
Selects portfolio identifiers meeting specific criteria, like isolating fixed income securities. It computes across the entire portfolio but displays results only for the filtered subset
|
|
146
|
+
For additional information, click here: https://everysk.com/api/docs/#-a-name-filters-a-filter-expression
|
|
147
|
+
|
|
148
|
+
**kwargs: Additional keyword arguments
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
dict: The risk attribution result
|
|
152
|
+
"""
|
|
153
|
+
return cls.__call_method('risk_attribution', **kwargs)
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
def parametricRiskAttribution(cls, **kwargs): # pylint: disable=invalid-name
|
|
157
|
+
"""
|
|
158
|
+
Calculates the magnitude of a security's reaction to changes in underlying factors, most often in terms of its price to other factors.
|
|
159
|
+
`securities` is not required if `portfolio_id` is being provided.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
id (str):
|
|
163
|
+
string used to identify the portfolio
|
|
164
|
+
|
|
165
|
+
projection (list):
|
|
166
|
+
User supplied array of securities to be used as a top-down factor model. Maximum number of elements in the projection array is 15.
|
|
167
|
+
|
|
168
|
+
portfolio_id (str, optional):
|
|
169
|
+
It is the ID of and existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency and nlv.
|
|
170
|
+
|
|
171
|
+
securities (list):
|
|
172
|
+
Array of objects used to describe the securities in the portfolio. Each object has its own ID, symbol, quantity, and label.
|
|
173
|
+
|
|
174
|
+
use_cashflow (boolean, optional):
|
|
175
|
+
For fixed income securities, setting the flag to True maps each cash flow event (like interest or principal payments) to specific points on the interest rate curve.
|
|
176
|
+
If False, it uses Macaulay duration to link bond price to adjacent points on the curve.
|
|
177
|
+
|
|
178
|
+
sampling (int, optional):
|
|
179
|
+
refers to the collection frequency of historical prices and rates to calculate invariant risk factors. Use 1 for daily sampling and 5 for weekly (non-overlapping) sampling.
|
|
180
|
+
Accepted values are 1 or 5. Click here for different horizon and sampling combinations.
|
|
181
|
+
|
|
182
|
+
confidence (str, optional):
|
|
183
|
+
Determines the confidence level for calculation VaR and CVaR. Values accepted: `1sigma`, `2sigma`, `3sigma`, `85%`, `90%`, `95%`, `97%`, or `99%`.
|
|
184
|
+
For additional information click here: https://everysk.com/api/docs/#-a-name-confidence-a-confidence
|
|
185
|
+
|
|
186
|
+
historical_days (str, optional):
|
|
187
|
+
Number of business days used to calculate the covariance for the primitive risk factors: `0 (no decay)`, `2`, `6`, `12`, `24` or `48`.
|
|
188
|
+
|
|
189
|
+
exponential_decay (float, optional):
|
|
190
|
+
Factor used in the exponentially weighted moving average (ewma): 0 (no decay); it accepts float values from 0 to 1.
|
|
191
|
+
|
|
192
|
+
**kwargs (dict): Additional keyword arguments.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
dict: The parametric risk attribution result.
|
|
196
|
+
"""
|
|
197
|
+
return cls.__call_method('parametric_risk_attribution', **kwargs)
|
|
198
|
+
|
|
199
|
+
@classmethod
|
|
200
|
+
def stressTest(cls, **kwargs): # pylint: disable=invalid-name
|
|
201
|
+
"""
|
|
202
|
+
Stress Test calculates the expected behavior of the portfolio under different scenarios, including extreme events.
|
|
203
|
+
For instance, it takes into account that correlations and volatility tend to increase in periods of market distress.
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
portfolio_id (str, optional):
|
|
207
|
+
ID of an existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency, and nlv.
|
|
208
|
+
|
|
209
|
+
securities (list):
|
|
210
|
+
Array of objects to describe the securities in the portfolio. Each object, represents a security with a unique id, symbol, quantity and label
|
|
211
|
+
|
|
212
|
+
date (str date, optional):
|
|
213
|
+
Date in the following format: `YYYYMMDD`. The date instructs the API to use the market conditions and security prices prevailing on that date.
|
|
214
|
+
|
|
215
|
+
base_currency (str, optional):
|
|
216
|
+
3-letter ISO 4217 code for currency.
|
|
217
|
+
|
|
218
|
+
nlv (float, optional):
|
|
219
|
+
The net liquidating value of the portfolio (also known as NAV).
|
|
220
|
+
|
|
221
|
+
horizon (int, optional):
|
|
222
|
+
Simulates the behavior of each security via their underlying risk factors. It accepts 1, 5 20, or 60.
|
|
223
|
+
|
|
224
|
+
sampling (int, optional):
|
|
225
|
+
refers to the collection frequency of historical prices and rates to calculate invariant risk factors. Use 1 for daily sampling and 5 for weekly (non-overlapping) sampling.
|
|
226
|
+
Accepted values are 1 or 5. Click here for different horizon and sampling combinations.
|
|
227
|
+
|
|
228
|
+
aggregation (str, optional):
|
|
229
|
+
Computes individual security MCTR's and aggregates them according to a supported criteria.
|
|
230
|
+
Check https://support.everysk.com/hc/en-us/sections/360003156634-Risk-Aggregations for more information
|
|
231
|
+
|
|
232
|
+
projection (list, optional):
|
|
233
|
+
User supplied array of securities to be used as a top-down factor model. Maximum number of elements in the projection list is 15
|
|
234
|
+
|
|
235
|
+
volatility_half_life (int, optional):
|
|
236
|
+
Half life of volatility information in the following months: 0 (no decay), 2, 6, 12, 24, or 48.
|
|
237
|
+
|
|
238
|
+
correlation_half_life (int, optional):
|
|
239
|
+
Half life of correlation information in months: 0 (no decay), 2, 6, 12, 24 or 48.
|
|
240
|
+
|
|
241
|
+
shock (str, optional):
|
|
242
|
+
The security being used for the stress test.
|
|
243
|
+
|
|
244
|
+
magnitude (file):
|
|
245
|
+
The magnitude of the shock. For more details click here: https://everysk.com/api/docs/#-a-name-magnitude-a-magnitude
|
|
246
|
+
|
|
247
|
+
confidence (str, optional):
|
|
248
|
+
Determines the confidence level for calculation VaR and CVaR. Values accepted: `1sigma`, `2sigma`, `3sigma`, `85%`, `90%`, `95%`, `97%`, or `99%`.
|
|
249
|
+
For additional information click here: https://everysk.com/api/docs/#-a-name-confidence-a-confidence
|
|
250
|
+
|
|
251
|
+
filter (str, optional):
|
|
252
|
+
Selects portfolio identifiers meeting specific criteria, like isolating fixed income securities. It computes across the entire portfolio but displays results only for the filtered subset
|
|
253
|
+
For additional information, click here: https://everysk.com/api/docs/#-a-name-filters-a-filter-expression
|
|
254
|
+
|
|
255
|
+
**kwargs (dict):
|
|
256
|
+
Additional keyword arguments.
|
|
257
|
+
|
|
258
|
+
Returns:
|
|
259
|
+
dict: The stress test result.
|
|
260
|
+
"""
|
|
261
|
+
return cls.__call_method('stress_test', **kwargs)
|
|
262
|
+
|
|
263
|
+
@classmethod
|
|
264
|
+
def exposure(cls, **kwargs):
|
|
265
|
+
"""
|
|
266
|
+
Calculates the delta-adjusted notional exposure of each security, converted to the base currency of the portfolio.
|
|
267
|
+
To compute the exposures for a portfolio, make an HTTP POST to your calculation resource URI: `POST /calculations/exposure`
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
portfolio_id (str, optional):
|
|
271
|
+
ID of an existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency, and nlv.
|
|
272
|
+
|
|
273
|
+
securities (list):
|
|
274
|
+
Array of objects to describe the securities in the portfolio. Each object, represents a security with a unique id, symbol, quantity and label
|
|
275
|
+
|
|
276
|
+
date (str date, optional):
|
|
277
|
+
Date in the following format: `YYYYMMDD`. The date instructs the API to use the market conditions and security prices prevailing on that date.
|
|
278
|
+
|
|
279
|
+
base_currency (str, optional):
|
|
280
|
+
3-letter ISO 4217 code for currency.
|
|
281
|
+
|
|
282
|
+
nlv (float, optional):
|
|
283
|
+
The net liquidating value of the portfolio (also known as NAV).
|
|
284
|
+
|
|
285
|
+
sampling (int, optional):
|
|
286
|
+
refers to the collection frequency of historical prices and rates to calculate invariant risk factors. Use 1 for daily sampling and 5 for weekly (non-overlapping) sampling.
|
|
287
|
+
Accepted values are 1 or 5. Click here for different horizon and sampling combinations.
|
|
288
|
+
|
|
289
|
+
aggregation (str, optional):
|
|
290
|
+
Computes individual security MCTR's and aggregates them according to a supported criteria.
|
|
291
|
+
Check https://support.everysk.com/hc/en-us/sections/360003156634-Risk-Aggregations for more information
|
|
292
|
+
|
|
293
|
+
filter (str, optional):
|
|
294
|
+
Selects portfolio identifiers meeting specific criteria, like isolating fixed income securities. It computes across the entire portfolio but displays results only for the filtered subset
|
|
295
|
+
For additional information, click here: https://everysk.com/api/docs/#-a-name-filters-a-filter-expression
|
|
296
|
+
|
|
297
|
+
**kwargs (dict): Additional keyword arguments.
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
dict: The exposure calculation result.
|
|
301
|
+
"""
|
|
302
|
+
return cls.__call_method('exposure', **kwargs)
|
|
303
|
+
|
|
304
|
+
@classmethod
|
|
305
|
+
def properties(cls, **kwargs):
|
|
306
|
+
"""
|
|
307
|
+
Calculates the overall portfolio properties with a single API call.
|
|
308
|
+
Sensitivities, exposures and risk are aggregated from individual securities to a portfolio level.
|
|
309
|
+
|
|
310
|
+
Args:
|
|
311
|
+
portfolio_id (str, optional):
|
|
312
|
+
ID of an existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency, and nlv.
|
|
313
|
+
|
|
314
|
+
securities (list):
|
|
315
|
+
Array of objects to describe the securities in the portfolio. Each object, represents a security with a unique id, symbol, quantity and label
|
|
316
|
+
|
|
317
|
+
date (str date, optional):
|
|
318
|
+
Date in the following format: `YYYYMMDD`. The date instructs the API to use the market conditions and security prices prevailing on that date.
|
|
319
|
+
|
|
320
|
+
base_currency (str, optional):
|
|
321
|
+
3-letter ISO 4217 code for currency.
|
|
322
|
+
|
|
323
|
+
nlv (float, optional):
|
|
324
|
+
The net liquidating value of the portfolio (also known as NAV).
|
|
325
|
+
|
|
326
|
+
horizon (int, optional):
|
|
327
|
+
Simulates the behavior of each security via their underlying risk factors. It accepts 1, 5 20, or 60.
|
|
328
|
+
|
|
329
|
+
sampling (int, optional):
|
|
330
|
+
refers to the collection frequency of historical prices and rates to calculate invariant risk factors. Use 1 for daily sampling and 5 for weekly (non-overlapping) sampling.
|
|
331
|
+
Accepted values are 1 or 5. Click here for different horizon and sampling combinations.
|
|
332
|
+
|
|
333
|
+
aggregation (str, optional):
|
|
334
|
+
Computes individual security MCTR's and aggregates them according to a supported criteria.
|
|
335
|
+
Check https://support.everysk.com/hc/en-us/sections/360003156634-Risk-Aggregations for more information
|
|
336
|
+
|
|
337
|
+
projection (list, optional):
|
|
338
|
+
User supplied array of securities to be used as a top-down factor model. Maximum number of elements in the projection list is 10.
|
|
339
|
+
|
|
340
|
+
volatility_half_life (int, optional):
|
|
341
|
+
Half life of volatility information in the following months: 0 (no decay), 2, 6, 12, 24, or 48.
|
|
342
|
+
|
|
343
|
+
correlation_half_life (int, optional):
|
|
344
|
+
Half life of correlation information in months: 0 (no decay), 2, 6, 12, 24 or 48.
|
|
345
|
+
|
|
346
|
+
confidence (str, optional):
|
|
347
|
+
Determines the confidence level for calculation VaR and CVaR. Values accepted: `1sigma`, `2sigma`, `3sigma`, `85%`, `90%`, `95%`, `97%`, or `99%`.
|
|
348
|
+
For additional information click here: https://everysk.com/api/docs/#-a-name-confidence-a-confidence
|
|
349
|
+
|
|
350
|
+
**kwargs (dict):
|
|
351
|
+
Additional keyword arguments.
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
dict: The calculation properties.
|
|
355
|
+
"""
|
|
356
|
+
return cls.__call_method('properties', **kwargs)
|
|
357
|
+
|
|
358
|
+
@classmethod
|
|
359
|
+
def backtest(cls, **kwargs):
|
|
360
|
+
"""
|
|
361
|
+
Performs a backtest on the provided portfolio using specified parameters.
|
|
362
|
+
|
|
363
|
+
Args:
|
|
364
|
+
user_id (int):
|
|
365
|
+
The ID of the user performing the backtest.
|
|
366
|
+
|
|
367
|
+
user_role (str):
|
|
368
|
+
The role of the user, which can influence the backtest computation based on access rights.
|
|
369
|
+
|
|
370
|
+
time_zone (str):
|
|
371
|
+
User's time zone, used for aligning the timestamps in the backtest results.
|
|
372
|
+
|
|
373
|
+
backtest_date1 (str):
|
|
374
|
+
The start date for the backtest period.
|
|
375
|
+
|
|
376
|
+
backtest_date2 (str):
|
|
377
|
+
The end date for the backtest period.
|
|
378
|
+
|
|
379
|
+
backtest_periodicity (str):
|
|
380
|
+
The periodicity of the backtest calculations (e.g., daily, weekly, monthly).
|
|
381
|
+
|
|
382
|
+
backtest_benchmark_ticker (str):
|
|
383
|
+
The ticker symbol of the benchmark against which to compare the portfolio's performance.
|
|
384
|
+
|
|
385
|
+
backtest_rfrate_ticker (str):
|
|
386
|
+
The ticker symbol for the risk-free rate used in the backtest.
|
|
387
|
+
|
|
388
|
+
projection_tickers (list):
|
|
389
|
+
A list of tickers used for projections in the backtest.
|
|
390
|
+
|
|
391
|
+
output_type (str):
|
|
392
|
+
The type of output expected from the backtest (e.g., full, summary).
|
|
393
|
+
|
|
394
|
+
**kwargs (dict):
|
|
395
|
+
Additional keyword arguments that can be passed to the backtest function.
|
|
396
|
+
|
|
397
|
+
Returns:
|
|
398
|
+
dict: The backtest result.
|
|
399
|
+
|
|
400
|
+
Example:
|
|
401
|
+
>>> backtest_results = ClassName.backtest(
|
|
402
|
+
>>> ... user_id=123,
|
|
403
|
+
>>> ... user_role='analyst',
|
|
404
|
+
>>> ... time_zone='EST',
|
|
405
|
+
>>> ... backtest_date1='2020-01-01',
|
|
406
|
+
>>> ... backtest_date2='2020-12-31',
|
|
407
|
+
>>> ... backtest_periodicity='monthly',
|
|
408
|
+
>>> ... backtest_benchmark_ticker='SPY',
|
|
409
|
+
>>> ... backtest_rfrate_ticker='US10Y',
|
|
410
|
+
>>> ... output_type='summary'
|
|
411
|
+
>>> )
|
|
412
|
+
>>> print(backtest_results)
|
|
413
|
+
"""
|
|
414
|
+
return cls.__call_method('backtest', **kwargs)
|
|
415
|
+
|
|
416
|
+
@classmethod
|
|
417
|
+
def backtestStatistics(cls, **kwargs): # pylint: disable=invalid-name
|
|
418
|
+
"""
|
|
419
|
+
Retrieves backtest statistics by executing a backtest based on the provided parameters.
|
|
420
|
+
This method internally calls a function to compute backtest statistics and returns a detailed result dict.
|
|
421
|
+
|
|
422
|
+
Args:
|
|
423
|
+
user_id (int):
|
|
424
|
+
The ID of the user performing the backtest. This is essential for accessing and
|
|
425
|
+
manipulating the user's data securely.
|
|
426
|
+
|
|
427
|
+
user_role (str):
|
|
428
|
+
The role of the user which can influence the level of detail and data accessible in the backtest results.
|
|
429
|
+
|
|
430
|
+
time_zone (str):
|
|
431
|
+
The user's time zone, which is crucial for aligning the time-sensitive data in the backtest.
|
|
432
|
+
|
|
433
|
+
backtest_date1 (str):
|
|
434
|
+
The starting date for the backtest period, used to delineate the time range for the analysis.
|
|
435
|
+
|
|
436
|
+
backtest_date2 (str):
|
|
437
|
+
The ending date for the backtest period, defining the closure of the analysis interval.
|
|
438
|
+
|
|
439
|
+
backtest_periodicity (str):
|
|
440
|
+
Specifies the frequency of data points (e.g., daily, weekly, monthly) used in the backtest.
|
|
441
|
+
|
|
442
|
+
backtest_benchmark_ticker (str):
|
|
443
|
+
Ticker symbol for the benchmark index against which the portfolio is evaluated.
|
|
444
|
+
|
|
445
|
+
backtest_rfrate_ticker (str):
|
|
446
|
+
Ticker symbol for the risk-free rate, used in certain financial metrics and calculations.
|
|
447
|
+
|
|
448
|
+
projection_tickers (list):
|
|
449
|
+
List of ticker symbols used for projecting the portfolio's performance.
|
|
450
|
+
|
|
451
|
+
output_type (str):
|
|
452
|
+
Determines the format of the output (e.g., 'full', 'summary', 'detailed').
|
|
453
|
+
|
|
454
|
+
**kwargs (dict):
|
|
455
|
+
Additional keyword arguments that can influence the backtest computation and its results.
|
|
456
|
+
|
|
457
|
+
Returns:
|
|
458
|
+
dict: The backtest statistics.
|
|
459
|
+
|
|
460
|
+
Example:
|
|
461
|
+
>>> backtest_results = ClassName.backtestStatistics(
|
|
462
|
+
>>> ... user_id=12345,
|
|
463
|
+
>>> ... user_role='analyst',
|
|
464
|
+
>>> ... time_zone='GMT',
|
|
465
|
+
>>> ... backtest_date1='2021-01-01',
|
|
466
|
+
>>> ... backtest_date2='2021-12-31',
|
|
467
|
+
>>> ... backtest_periodicity='monthly',
|
|
468
|
+
>>> ... backtest_benchmark_ticker='SPY',
|
|
469
|
+
>>> ... backtest_rfrate_ticker='US10Y',
|
|
470
|
+
>>> ... output_type='summary'
|
|
471
|
+
>>> ... )
|
|
472
|
+
>>> print(backtest_results)
|
|
473
|
+
"""
|
|
474
|
+
return cls.__call_method('backtest_statistics', **kwargs)
|
|
475
|
+
|
|
476
|
+
@classmethod
|
|
477
|
+
def aggregations(cls, **kwargs):
|
|
478
|
+
"""
|
|
479
|
+
Performs financial aggregations on a user's portfolio to generatea summary statistics and insights.
|
|
480
|
+
This method calculates aggregated data points based on the provided portfolio.
|
|
481
|
+
|
|
482
|
+
Args:
|
|
483
|
+
user_id (int):
|
|
484
|
+
The ID of the user for whom the aggregation is being performed. Essential for identifying
|
|
485
|
+
the user's data and ensuring data security.
|
|
486
|
+
|
|
487
|
+
user_role (str):
|
|
488
|
+
The role of the user, which can define access levels and influence the aggregation results.
|
|
489
|
+
|
|
490
|
+
user_settings (dict):
|
|
491
|
+
User-specific settings that can affect the aggregation, such as preferences or configurations.
|
|
492
|
+
|
|
493
|
+
portfolio (Portfolio):
|
|
494
|
+
The user's portfolio object on which the aggregation is to be performed.
|
|
495
|
+
|
|
496
|
+
output_type (str):
|
|
497
|
+
Specifies the format in which the output is generated, e.g., 'summary', 'detailed'.
|
|
498
|
+
|
|
499
|
+
**kwargs (dict):
|
|
500
|
+
Additional keyword arguments that can be used to pass extra parameters necessary for
|
|
501
|
+
the aggregation process.
|
|
502
|
+
|
|
503
|
+
Returns:
|
|
504
|
+
dict: The aggregation result.
|
|
505
|
+
|
|
506
|
+
Example:
|
|
507
|
+
>>> aggregation_results = ClassName.aggregations(
|
|
508
|
+
>>> ... user_id=12345,
|
|
509
|
+
>>> ... user_role='manager',
|
|
510
|
+
>>> ... user_settings={'setting1': 'value1', 'setting2': 'value2'},
|
|
511
|
+
>>> ... portfolio=portfolio_object,
|
|
512
|
+
>>> ... output_type='detailed'
|
|
513
|
+
>>> )
|
|
514
|
+
>>> print(aggregation_results)
|
|
515
|
+
"""
|
|
516
|
+
return cls.__call_method('aggregations', **kwargs)
|
|
517
|
+
|
|
518
|
+
@classmethod
|
|
519
|
+
def fundamentals(cls, **kwargs):
|
|
520
|
+
"""
|
|
521
|
+
Retrieves fundamental data.
|
|
522
|
+
|
|
523
|
+
Args:
|
|
524
|
+
user_id (int):
|
|
525
|
+
The ID of the user for whom the fundamental data is being retrieved. It ensures the
|
|
526
|
+
personalized and secure access to the necessary data.
|
|
527
|
+
|
|
528
|
+
user_role (str):
|
|
529
|
+
The role of the user, which may influence the scope of the retrieved fundamental data.
|
|
530
|
+
|
|
531
|
+
user_settings (dict):
|
|
532
|
+
Settings that provide context on user preferences or configurations, impacting
|
|
533
|
+
how fundamental data is calculated and presented.
|
|
534
|
+
|
|
535
|
+
portfolio (Portfolio):
|
|
536
|
+
The portfolio object for which fundamentals are being calculated.
|
|
537
|
+
|
|
538
|
+
projection_tickers (list):
|
|
539
|
+
List of tickers for which the user seeks to project fundamental data.
|
|
540
|
+
|
|
541
|
+
output_type (str):
|
|
542
|
+
Determines the format and detail level of the output, such as 'summary' or 'detailed'.
|
|
543
|
+
|
|
544
|
+
**kwargs (dict):
|
|
545
|
+
Additional keyword arguments allowing for further customization of the fundamental data retrieval.
|
|
546
|
+
|
|
547
|
+
Returns:
|
|
548
|
+
dict: The fundamental data.
|
|
549
|
+
|
|
550
|
+
Example:
|
|
551
|
+
>>> fundamental_data = ClassName.fundamentals(
|
|
552
|
+
>>> ... user_id=12345,
|
|
553
|
+
>>> ... user_role='analyst',
|
|
554
|
+
>>> ... user_settings={'currency': 'USD', 'fiscal_period': 'Q1'},
|
|
555
|
+
>>> ... portfolio=portfolio_object,
|
|
556
|
+
>>> ... output_type='detailed'
|
|
557
|
+
>>> )
|
|
558
|
+
>>> print(fundamental_data)
|
|
559
|
+
"""
|
|
560
|
+
return cls.__call_method('fundamentals', **kwargs)
|
|
561
|
+
|
|
562
|
+
@classmethod
|
|
563
|
+
def daysToUnwind(cls, **kwargs): # pylint: disable=invalid-name
|
|
564
|
+
"""
|
|
565
|
+
Calculates the number of days required to unwind a position in the portfolio, considering the liquidity of each
|
|
566
|
+
asset. This calculation can help in assessing the market risk associated with the portfolio's current composition.
|
|
567
|
+
|
|
568
|
+
Args:
|
|
569
|
+
user_id (int):
|
|
570
|
+
The ID of the user for whom the calculation is performed. Ensures that the computation is
|
|
571
|
+
personalized and secure.
|
|
572
|
+
|
|
573
|
+
user_role (str):
|
|
574
|
+
The role of the user, impacting the level of detail and type of data accessible in the results.
|
|
575
|
+
|
|
576
|
+
user_settings (dict):
|
|
577
|
+
Settings that influence the computation, such as risk preferences or market assumptions.
|
|
578
|
+
|
|
579
|
+
portfolio (Portfolio):
|
|
580
|
+
The portfolio object for which the days to unwind are being calculated.
|
|
581
|
+
|
|
582
|
+
days (list):
|
|
583
|
+
A list of days over which the unwind period is considered. Must be provided explicitly.
|
|
584
|
+
|
|
585
|
+
liquidity_terms (object, optional):
|
|
586
|
+
An object defining the terms for liquidity calculation, such as market impact.
|
|
587
|
+
If not provided, a default set of terms is used.
|
|
588
|
+
|
|
589
|
+
**kwargs (dict): Additional keyword arguments to fine-tune the calculation or provide extra context.
|
|
590
|
+
|
|
591
|
+
Returns:
|
|
592
|
+
dict: The days to unwind calculation result.
|
|
593
|
+
|
|
594
|
+
Example:
|
|
595
|
+
>>> unwind_data = ClassName.daysToUnwind(
|
|
596
|
+
>>> ... user_id=12345,
|
|
597
|
+
>>> ... user_role='analyst',
|
|
598
|
+
>>> ... user_settings={'market_conditions': 'normal'},
|
|
599
|
+
>>> ... portfolio=portfolio_object,
|
|
600
|
+
>>> ... days=[10, 20, 30],
|
|
601
|
+
>>> ... liquidity_terms={'market_impact': 0.5}
|
|
602
|
+
)
|
|
603
|
+
>>> print(unwind_data)
|
|
604
|
+
"""
|
|
605
|
+
return cls.__call_method('days_to_unwind', **kwargs)
|
|
606
|
+
|
|
607
|
+
@classmethod
|
|
608
|
+
def sensitivity(cls, **kwargs):
|
|
609
|
+
"""
|
|
610
|
+
Calculates sensitivity. `securities` parameter is not required if `portfolio_id` is being provided.
|
|
611
|
+
Click here for more info https://everysk.com/api/docs/#-a-name-securities-a-securities
|
|
612
|
+
|
|
613
|
+
Args:
|
|
614
|
+
securities (list):
|
|
615
|
+
Array of objects to describe the securities in the portfolio. Each object, represents a security with a unique id, symbol, quantity and label
|
|
616
|
+
|
|
617
|
+
portfolio_id (str, optional):
|
|
618
|
+
ID of an existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency, and nlv.
|
|
619
|
+
|
|
620
|
+
date (str date, optional):
|
|
621
|
+
Date in the following format: `YYYYMMDD`. The date instructs the API to use the market conditions and security prices prevailing on that date.
|
|
622
|
+
|
|
623
|
+
base_currency (str, optional):
|
|
624
|
+
3-letter ISO 4217 code for currency. To see all supported currencies click here => https://support.everysk.com/hc/en-us/articles/115005366147-Supported-Currencies
|
|
625
|
+
|
|
626
|
+
sensitivity_type (str, optional):
|
|
627
|
+
The sensitivity type. Check https://everysk.com/api/docs/#sensitivity for the accepted values.
|
|
628
|
+
|
|
629
|
+
compute_notional (boolean, optional):
|
|
630
|
+
Determines whether sensitivities should be weighted by the notional exposure or unitized.
|
|
631
|
+
|
|
632
|
+
**kwargs (dict): Additional keyword arguments.
|
|
633
|
+
|
|
634
|
+
Returns:
|
|
635
|
+
dict: The sensitivity calculation result.
|
|
636
|
+
"""
|
|
637
|
+
return cls.__call_method('sensitivity', **kwargs)
|
|
638
|
+
|
|
639
|
+
@classmethod
|
|
640
|
+
def underlying_stress_sensitivity(cls, **kwargs):
|
|
641
|
+
"""
|
|
642
|
+
Calculates sensitivity for each underlying stress scenario.
|
|
643
|
+
`securities` parameter is not required if `portfolio_id` is being provided.
|
|
644
|
+
Click here for more info https://everysk.com/api/docs/#-a-name-securities-a-securities
|
|
645
|
+
|
|
646
|
+
Args:
|
|
647
|
+
securities (list):
|
|
648
|
+
Array of objects to describe the securities in the portfolio. Each object, represents a security with a unique id, symbol, quantity and label
|
|
649
|
+
|
|
650
|
+
stress_values (list[float]):
|
|
651
|
+
How much should the underlying values be stressed by in percentages. (0.01, 0, 0.05)
|
|
652
|
+
|
|
653
|
+
portfolio_id (str, optional):
|
|
654
|
+
ID of an existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency, and nlv.
|
|
655
|
+
|
|
656
|
+
date (str date, optional):
|
|
657
|
+
Date in the following format: `YYYYMMDD`. The date instructs the API to use the market conditions and security prices prevailing on that date.
|
|
658
|
+
|
|
659
|
+
base_currency (str, optional):
|
|
660
|
+
3-letter ISO 4217 code for currency. To see all supported currencies click here => https://support.everysk.com/hc/en-us/articles/115005366147-Supported-Currencies
|
|
661
|
+
|
|
662
|
+
sensitivity_type (str, optional):
|
|
663
|
+
The sensitivity type. Check https://everysk.com/api/docs/#sensitivity for the accepted values.
|
|
664
|
+
|
|
665
|
+
compute_notional (boolean, optional):
|
|
666
|
+
Determines whether sensitivities should be weighted by the notional exposure or unitized.
|
|
667
|
+
|
|
668
|
+
**kwargs (dict): Additional keyword arguments.
|
|
669
|
+
|
|
670
|
+
Returns:
|
|
671
|
+
dict: The sensitivity calculation result.
|
|
672
|
+
"""
|
|
673
|
+
return cls.__call_method('underlying_stress_sensitivity', **kwargs)
|
|
674
|
+
|
|
675
|
+
@classmethod
|
|
676
|
+
def optimize(cls, **kwargs):
|
|
677
|
+
"""
|
|
678
|
+
Executes an optimization calculation for a given portfolio, applying specified user settings and constraints.
|
|
679
|
+
|
|
680
|
+
Args:
|
|
681
|
+
user_id (int):
|
|
682
|
+
The ID of the user for whom the optimization is being performed, ensuring personalized
|
|
683
|
+
and secure processing.
|
|
684
|
+
|
|
685
|
+
user_role (str):
|
|
686
|
+
The role of the user, which may affect the optimization process and results.
|
|
687
|
+
|
|
688
|
+
user_settings (dict):
|
|
689
|
+
Configuration settings specific to the user that can influence the optimization.
|
|
690
|
+
|
|
691
|
+
portfolio (Portfolio):
|
|
692
|
+
The portfolio object to be optimized.
|
|
693
|
+
|
|
694
|
+
optimization_model (str):
|
|
695
|
+
The model used for optimization. The default model is specified if not provided.
|
|
696
|
+
|
|
697
|
+
optimization_date (str):
|
|
698
|
+
The target date for the optimization. The date affects the data used in the optimization process.
|
|
699
|
+
|
|
700
|
+
constraints (object):
|
|
701
|
+
An object defining the constraints to be applied during the optimization.
|
|
702
|
+
|
|
703
|
+
to_model_portfolio (bool, optional):
|
|
704
|
+
Flag indicating whether the output should be a model portfolio.
|
|
705
|
+
|
|
706
|
+
**kwargs (dict):
|
|
707
|
+
Additional keyword arguments allowing for further customization and specification of the optimization process.
|
|
708
|
+
|
|
709
|
+
Returns:
|
|
710
|
+
dict: The optimization result.
|
|
711
|
+
|
|
712
|
+
Example:
|
|
713
|
+
>>> optimization_result = ClassName.optimize(
|
|
714
|
+
>>> ... user_id=12345,
|
|
715
|
+
>>> ... user_role='analyst',
|
|
716
|
+
>>> ... user_settings={'risk_tolerance': 'medium', 'objective': 'minimize_risk'},
|
|
717
|
+
>>> ... portfolio=portfolio_object,
|
|
718
|
+
>>> ... optimization_model='mean_variance',
|
|
719
|
+
>>> ... optimization_date='2023-01-01',
|
|
720
|
+
>>> ... constraints={'max_weight': 0.1}
|
|
721
|
+
>>> )
|
|
722
|
+
>>> print(optimization_result)
|
|
723
|
+
"""
|
|
724
|
+
return cls.__call_method('optimize', **kwargs)
|
|
725
|
+
|
|
726
|
+
@classmethod
|
|
727
|
+
def bondPricer(cls, **kwargs): # pylint: disable=invalid-name
|
|
728
|
+
"""
|
|
729
|
+
Calculate the price of a bond based on its bond-specific parameters.
|
|
730
|
+
|
|
731
|
+
Args:
|
|
732
|
+
portfolio (str):
|
|
733
|
+
The portfolio that is going to be analyzed.
|
|
734
|
+
|
|
735
|
+
m2m_spreads (object):
|
|
736
|
+
Mark to market spreads mapping for each fixed income security in the form: {"symbol": fee, ...}
|
|
737
|
+
|
|
738
|
+
**kwargs (dict): Additional keyword arguments.
|
|
739
|
+
|
|
740
|
+
Returns:
|
|
741
|
+
dict: The dictionary with the pricing (PU) for each fixed income security.
|
|
742
|
+
"""
|
|
743
|
+
return cls.__call_method('bond_pricer', **kwargs)
|
|
744
|
+
|
|
745
|
+
@classmethod
|
|
746
|
+
def marginalTrackingError(cls, **kwargs): # pylint: disable=invalid-name
|
|
747
|
+
"""
|
|
748
|
+
Tracking error is the divergence between the price behavior of a position or a portfolio and the price behavior fo a benchmark.
|
|
749
|
+
|
|
750
|
+
Args:
|
|
751
|
+
portfolio1 (str):
|
|
752
|
+
The portfolio that is going to be analyzed.
|
|
753
|
+
|
|
754
|
+
portfolio2 (str):
|
|
755
|
+
The portfolio that is going the be used as a benchmark to calculate the deviation of differences.
|
|
756
|
+
|
|
757
|
+
weekly (boolean, optional):
|
|
758
|
+
The Calculation API will use weekly return to calculate the tracking error.
|
|
759
|
+
|
|
760
|
+
EWMA (boolean, optional):
|
|
761
|
+
The default is False, if `True`, the exponentially weighted moving average will be applied to volatilities.
|
|
762
|
+
|
|
763
|
+
exponential_decay (float, optional):
|
|
764
|
+
Weighting factor determining the rate at which "older" data enter into the calculation of the `EWMA`.
|
|
765
|
+
It accepts float values from 0 to 1.
|
|
766
|
+
This parameter is only used when `EWMA` is True
|
|
767
|
+
|
|
768
|
+
nDays (int, optional):
|
|
769
|
+
Number of historical business days used in calculation when `weekly` is False
|
|
770
|
+
|
|
771
|
+
nWeeks (int, optional):
|
|
772
|
+
Number of historical weeks used in calculation when `weekly` is True
|
|
773
|
+
|
|
774
|
+
**kwargs (dict): Additional keyword arguments.
|
|
775
|
+
|
|
776
|
+
Returns:
|
|
777
|
+
dict: The marginal tracking error calculation result.
|
|
778
|
+
"""
|
|
779
|
+
return cls.__call_method('marginal_tracking_error', **kwargs)
|