fds.analyticsapi.engines.FPOOptimizerApi
All URIs are relative to https://api.factset.com
| Method | HTTP request | Description |
|---|---|---|
| cancel_optimization_by_id | DELETE /analytics/engines/fpo/v3/optimizations/{id} | Cancel FPO optimization by id |
| get_optimization_parameters | GET /analytics/engines/fpo/v3/optimizations/{id} | Get FPO optimization parameters by id |
| get_optimization_result | GET /analytics/engines/fpo/v3/optimizations/{id}/result | Get FPO optimization result by id |
| get_optimization_status_by_id | GET /analytics/engines/fpo/v3/optimizations/{id}/status | Get FPO optimization status by id |
| post_and_optimize | POST /analytics/engines/fpo/v3/optimizations | Create and Run FPO optimization |
| put_and_optimize | PUT /analytics/engines/fpo/v3/optimizations/{id} | Create or Update FPO optimization and run it. |
cancel_optimization_by_id
cancel_optimization_by_id(id)
Cancel FPO optimization by id
This is the endpoint to cancel a previously submitted optimization.
Example
- Basic Authentication (Basic):
- Bearer Authentication (Bearer):
```python
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import fpo_optimizer_api
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
Defining the host is optional and defaults to https://api.factset.com
See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration( host = “https://api.factset.com” )
The client must configure the authentication and authorization parameters
in accordance with the API server security policy.
Examples for each auth method are provided below, use the example that
satisfies your auth use case.
Configure HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration( access_token = ‘YOUR_BEARER_TOKEN’ )
Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = fpo_optimizer_api.FPOOptimizerApi(api_client) id = “id_example” # str | from url, provided from the location header in the Create and Run FPO optimization endpoint
# example passing only required values which don't have defaults set
try:
# Cancel FPO optimization by id
api_instance.cancel_optimization_by_id(id)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->cancel_optimization_by_id: %s\n" % e) ```
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | str | from url, provided from the location header in the Create and Run FPO optimization endpoint |
Return type
- A tuple with response data, HTTP status code and response headers.
- Response datatype: None (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: text/plain, application/json, text/json
HTTP response details
| Status code | Description | Response headers |
|————-|————-|——————|
204 | Expected response, optimization was canceled successfully. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
400 | Invalid identifier provided. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
404 | There was no request for the optimization identifier provided, or the request was already canceled for the provided identifier. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
401 | Missing or invalid authentication. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
403 | User is forbidden with current credentials | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
500 | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
503 | Request timed out. Retry the request in sometime. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
[Back to top] [Back to API list] [Back to Model list] [Back to README]
get_optimization_parameters
FPOOptimizationParametersRoot get_optimization_parameters(id)
Get FPO optimization parameters by id
This is the endpoint that returns the optimization parameters passed for an optimization.
Example
- Basic Authentication (Basic):
- Bearer Authentication (Bearer):
```python
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import fpo_optimizer_api
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from fds.analyticsapi.engines.model.fpo_optimization_parameters_root import FPOOptimizationParametersRoot
from pprint import pprint
Defining the host is optional and defaults to https://api.factset.com
See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration( host = “https://api.factset.com” )
The client must configure the authentication and authorization parameters
in accordance with the API server security policy.
Examples for each auth method are provided below, use the example that
satisfies your auth use case.
Configure HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration( access_token = ‘YOUR_BEARER_TOKEN’ )
Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = fpo_optimizer_api.FPOOptimizerApi(api_client) id = “id_example” # str | from url, provided from the location header in the Create and Run FPO optimization endpoint
# example passing only required values which don't have defaults set
try:
# Get FPO optimization parameters by id
api_response = api_instance.get_optimization_parameters(id)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->get_optimization_parameters: %s\n" % e) ```
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | str | from url, provided from the location header in the Create and Run FPO optimization endpoint |
Return type
- A tuple with response data, HTTP status code and response headers.
- Response datatype: FPOOptimizationParametersRoot
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|————-|————-|——————|
200 | Expected response, returns the FPO optimization parameters. | * Content-Encoding - Standard HTTP header. Header value based on Accept-Encoding Request header.
* Content-Type - Standard HTTP header.
* Transfer-Encoding - Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
400 | Invalid identifier provided. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
404 | Optimization id not found | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
401 | Missing or invalid authentication. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
403 | User is forbidden with current credentials | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
500 | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
503 | Request timed out. Retry the request in sometime. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
[Back to top] [Back to API list] [Back to Model list] [Back to README]
get_optimization_result
ObjectRoot get_optimization_result(id)
Get FPO optimization result by id
This is the endpoint to get the result of a previously requested optimization. If the optimization has finished computing, the body of the response will contain result in JSON.
Example
- Basic Authentication (Basic):
- Bearer Authentication (Bearer):
```python
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import fpo_optimizer_api
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
Defining the host is optional and defaults to https://api.factset.com
See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration( host = “https://api.factset.com” )
The client must configure the authentication and authorization parameters
in accordance with the API server security policy.
Examples for each auth method are provided below, use the example that
satisfies your auth use case.
Configure HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration( access_token = ‘YOUR_BEARER_TOKEN’ )
Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = fpo_optimizer_api.FPOOptimizerApi(api_client) id = “id_example” # str | from url, provided from the location header in the Get FPO optimization status by id endpoint accept = “Accept_example” # str | Standard HTTP header. Value can be gzip, compress, deflate, br, identity and/or * (optional)
# example passing only required values which don't have defaults set
try:
# Get FPO optimization result by id
api_response = api_instance.get_optimization_result(id)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->get_optimization_result: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get FPO optimization result by id
api_response = api_instance.get_optimization_result(id, accept=accept)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->get_optimization_result: %s\n" % e) ```
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | str | from url, provided from the location header in the Get FPO optimization status by id endpoint | |
| accept | str | Standard HTTP header. Value can be gzip, compress, deflate, br, identity and/or * | [optional] |
Return type
- A tuple with response data, HTTP status code and response headers.
- Response datatype: ObjectRoot
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|————-|————-|——————|
200 | Expected response once optimization is completed, returns JSON. | * Content-Encoding - Standard HTTP header. Header value based on Accept-Encoding Request header.
* Content-Type - Standard HTTP header.
* Transfer-Encoding - Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
400 | Invalid identifier provided. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
404 | Optimization result was already returned, provided id was not a requested optimization, or the optimization was cancelled | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
401 | Missing or invalid authentication. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
403 | User is forbidden with current credentials | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
500 | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
503 | Request timed out. Retry the request in sometime. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
[Back to top] [Back to API list] [Back to Model list] [Back to README]
get_optimization_status_by_id
ObjectRoot get_optimization_status_by_id(id)
Get FPO optimization status by id
This is the endpoint to check on the progress of a previously requested optimization. If the optimization has finished computing, the body of the response will contain result in JSON. Otherwise, the optimization is still running and the X-FactSet-Api-PickUp-Progress header will contain a progress percentage.
Example
- Basic Authentication (Basic):
- Bearer Authentication (Bearer):
```python
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import fpo_optimizer_api
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
Defining the host is optional and defaults to https://api.factset.com
See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration( host = “https://api.factset.com” )
The client must configure the authentication and authorization parameters
in accordance with the API server security policy.
Examples for each auth method are provided below, use the example that
satisfies your auth use case.
Configure HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration( access_token = ‘YOUR_BEARER_TOKEN’ )
Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = fpo_optimizer_api.FPOOptimizerApi(api_client) id = “id_example” # str | from url, provided from the location header in the Create and Run FPO optimization endpoint
# example passing only required values which don't have defaults set
try:
# Get FPO optimization status by id
api_response = api_instance.get_optimization_status_by_id(id)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->get_optimization_status_by_id: %s\n" % e) ```
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | str | from url, provided from the location header in the Create and Run FPO optimization endpoint |
Return type
- A tuple with response data, HTTP status code and response headers.
- Response datatype: (For 201 status - ObjectRoot)(For 202 status - None (empty response body) )
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|————-|————-|——————|
201 | Expected response once optimization is completed, returns JSON. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
202 | Expected response returned if the optimization is not yet completed, should contain X-FactSet-Api-PickUp-Progress header. | * X-FactSet-Api-PickUp-Progress - FactSet's progress header.
* Cache-Control - Standard HTTP header. Header will specify max-age in seconds. Polling can be adjusted based on the max-age value.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
400 | Invalid identifier provided. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
404 | Optimization result was already returned, provided id was not a requested optimization, or the optimization was cancelled | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
401 | Missing or invalid authentication. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
403 | User is forbidden with current credentials | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
500 | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
503 | Request timed out. Retry the request in sometime. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
[Back to top] [Back to API list] [Back to Model list] [Back to README]
post_and_optimize
ObjectRoot post_and_optimize()
Create and Run FPO optimization
This endpoint runs FPO optimization specified in the POST body parameters. Remarks: * Any settings in POST body will act as a one-time override over the settings saved in the strategy document.
Example
- Basic Authentication (Basic):
- Bearer Authentication (Bearer):
```python
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import fpo_optimizer_api
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.calculation_info_root import CalculationInfoRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from fds.analyticsapi.engines.model.fpo_optimization_parameters_root import FPOOptimizationParametersRoot
from pprint import pprint
Defining the host is optional and defaults to https://api.factset.com
See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration( host = “https://api.factset.com” )
The client must configure the authentication and authorization parameters
in accordance with the API server security policy.
Examples for each auth method are provided below, use the example that
satisfies your auth use case.
Configure HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration( access_token = ‘YOUR_BEARER_TOKEN’ )
Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = fpo_optimizer_api.FPOOptimizerApi(api_client) x_fact_set_api_long_running_deadline = 10 # int | Long running deadline in seconds. Example value is set to 10s. Please update it as per requirement before triggering a calculation. (optional) cache_control = “Cache-Control_example” # str | Standard HTTP header. Accepts max-stale. (optional) fpo_optimization_parameters_root = FPOOptimizationParametersRoot( data=FPOOptimizationParameters( account=FPOAccount( pa_document=PaDoc( id=”id_example”, ), id=”id_example”, overrides=OptimizerAccountOverrides( portfolio=”portfolio_example”, benchmark=”benchmark_example”, risk_model_id=”risk_model_id_example”, currency=”currency_example”, ), ), strategy=FPOOptimizerStrategy( overrides=FPOOptimizerStrategyOverrides( objective=FPOObjective( active=”active_example”, terms={ “Disable”: “Disable”, }, ), constraints={ “Disable”: “Disable”, }, alpha=”alpha_example”, transaction_cost=”transaction_cost_example”, ), id=”id_example”, ), optimization=Optimization( risk_model_date=”risk_model_date_example”, backtest_date=”backtest_date_example”, cashflow=”cashflow_example”, ), output_types=OptimizerOutputTypes( trades=OptimizerTradesList( identifier_type=”Asset”, include_cash=True, ), optimal=OptimizerOptimalHoldings( identifier_type=”Asset”, include_cash=True, exclude_zero=True, ), account=OptimalPortfolio( acct_name=”acct_name_example”, exclude_zero=True, archive_date=”archive_date_example”, if_acct_exists=”abort”, if_ofdb_date_exists=”abort”, ), stats={}, ), ), meta={}, ) # FPOOptimizationParametersRoot | Optimization Parameters (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Create and Run FPO optimization
api_response = api_instance.post_and_optimize(x_fact_set_api_long_running_deadline=x_fact_set_api_long_running_deadline, cache_control=cache_control, fpo_optimization_parameters_root=fpo_optimization_parameters_root)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->post_and_optimize: %s\n" % e) ```
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| x_fact_set_api_long_running_deadline | int | Long running deadline in seconds. Example value is set to 10s. Please update it as per requirement before triggering a calculation. | [optional] |
| cache_control | str | Standard HTTP header. Accepts max-stale. | [optional] |
| fpo_optimization_parameters_root | FPOOptimizationParametersRoot | Optimization Parameters | [optional] |
Return type
- A tuple with response data, HTTP status code and response headers.
- Response datatype: (For 202 status - CalculationInfoRoot)(For 201 status - ObjectRoot)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|————-|————-|——————|
202 | Expected response, contains the poll URL in the Location header. | * Location - URL to poll for the resulting optimization
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
201 | Expected response, returns json if optimization is completed in a short span. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
400 | Invalid optimization parameters. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
404 | One or more optimization settings were unavailable. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
401 | Missing or invalid authentication. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
403 | User is forbidden with current credentials | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
415 | Missing/Invalid Content-Type header. Header needs to be set to application/json. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
429 | Rate limit reached. Cancel older requests using Cancel optimization endpoint or wait for older requests to finish/expire. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
* Retry-After - Time to wait in seconds before making a new request as the rate limit has reached.
|
500 | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
503 | Request timed out. Retry the request in sometime. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
[Back to top] [Back to API list] [Back to Model list] [Back to README]
put_and_optimize
ObjectRoot put_and_optimize(id)
Create or Update FPO optimization and run it.
This endpoint updates and run the FPO optimization specified in the PUT body parameters. It also allows the creation of new FPO optimization with custom id.
Example
- Basic Authentication (Basic):
- Bearer Authentication (Bearer):
```python
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import fpo_optimizer_api
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.calculation_info_root import CalculationInfoRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from fds.analyticsapi.engines.model.fpo_optimization_parameters_root import FPOOptimizationParametersRoot
from pprint import pprint
Defining the host is optional and defaults to https://api.factset.com
See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration( host = “https://api.factset.com” )
The client must configure the authentication and authorization parameters
in accordance with the API server security policy.
Examples for each auth method are provided below, use the example that
satisfies your auth use case.
Configure HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration( access_token = ‘YOUR_BEARER_TOKEN’ )
Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = fpo_optimizer_api.FPOOptimizerApi(api_client) id = “id_example” # str | from url, provided from the location header in the Create and Run FPO optimization endpoint x_fact_set_api_long_running_deadline = 10 # int | Long running deadline in seconds. Example value is set to 10s. Please update it as per requirement before triggering a calculation. (optional) cache_control = “Cache-Control_example” # str | Standard HTTP header. Accepts max-stale. (optional) fpo_optimization_parameters_root = FPOOptimizationParametersRoot( data=FPOOptimizationParameters( account=FPOAccount( pa_document=PaDoc( id=”id_example”, ), id=”id_example”, overrides=OptimizerAccountOverrides( portfolio=”portfolio_example”, benchmark=”benchmark_example”, risk_model_id=”risk_model_id_example”, currency=”currency_example”, ), ), strategy=FPOOptimizerStrategy( overrides=FPOOptimizerStrategyOverrides( objective=FPOObjective( active=”active_example”, terms={ “Disable”: “Disable”, }, ), constraints={ “Disable”: “Disable”, }, alpha=”alpha_example”, transaction_cost=”transaction_cost_example”, ), id=”id_example”, ), optimization=Optimization( risk_model_date=”risk_model_date_example”, backtest_date=”backtest_date_example”, cashflow=”cashflow_example”, ), output_types=OptimizerOutputTypes( trades=OptimizerTradesList( identifier_type=”Asset”, include_cash=True, ), optimal=OptimizerOptimalHoldings( identifier_type=”Asset”, include_cash=True, exclude_zero=True, ), account=OptimalPortfolio( acct_name=”acct_name_example”, exclude_zero=True, archive_date=”archive_date_example”, if_acct_exists=”abort”, if_ofdb_date_exists=”abort”, ), stats={}, ), ), meta={}, ) # FPOOptimizationParametersRoot | Optimization Parameters (optional)
# example passing only required values which don't have defaults set
try:
# Create or Update FPO optimization and run it.
api_response = api_instance.put_and_optimize(id)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->put_and_optimize: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Create or Update FPO optimization and run it.
api_response = api_instance.put_and_optimize(id, x_fact_set_api_long_running_deadline=x_fact_set_api_long_running_deadline, cache_control=cache_control, fpo_optimization_parameters_root=fpo_optimization_parameters_root)
pprint(api_response)
except fds.analyticsapi.engines.ApiException as e:
print("Exception when calling FPOOptimizerApi->put_and_optimize: %s\n" % e) ```
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| id | str | from url, provided from the location header in the Create and Run FPO optimization endpoint | |
| x_fact_set_api_long_running_deadline | int | Long running deadline in seconds. Example value is set to 10s. Please update it as per requirement before triggering a calculation. | [optional] |
| cache_control | str | Standard HTTP header. Accepts max-stale. | [optional] |
| fpo_optimization_parameters_root | FPOOptimizationParametersRoot | Optimization Parameters | [optional] |
Return type
- A tuple with response data, HTTP status code and response headers.
- Response datatype: (For 202 status - CalculationInfoRoot)(For 201 status - ObjectRoot)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|————-|————-|——————|
202 | Expected response, contains the poll URL in the Location header. | * Location - URL to poll for the resulting optimization
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
201 | Expected response, returns json if optimization is completed in a short span. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
400 | Invalid Optimization Parameters. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
404 | One or more optimization settings were unavailable. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
409 | Duplicate optimization exists with same parameters. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
401 | Missing or invalid authentication. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
403 | User is forbidden with current credentials | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
415 | Missing/Invalid Content-Type header. Header needs to be set to application/json. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
|
429 | Rate limit reached. Cancel older requests using Cancel optimization endpoint or wait for older requests to finish/expire. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
* Retry-After - Time to wait in seconds before making a new request as the rate limit has reached.
|
500 | Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
503 | Request timed out. Retry the request in sometime. | * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
|
[Back to top] [Back to API list] [Back to Model list] [Back to README]