Model Portfolio API

Overview

Through the Model Portfolio API, you can accomplish what-if analysis by uploading a paper portfolio to test out a new strategy or prospective opportunity...<

API Definition

swagger_file_format

API Documentation

SDK Library

Code Snippet

Create model account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to create
        ModelAccountParameters parameters = new ModelAccountParameters(); // ModelAccountParameters | The object containing the input values

        ApiResponse<Void> result = null;
        try {
            result = apiInstance.createModelAccountWithHttpInfo(name, parameters);
            System.out.println(result.getStatusCode());

        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#createModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class CreateModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to create
            var parameters = new ModelAccountParameters(); // ModelAccountParameters | The object containing the input values (optional) 
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Create account endpoint, takes a date and list of holdings (symbols -&gt; quantities).
                ApiResponse<Object> result =  apiInstance.CreateModelAccountWithHttpInfo(name, parameters);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.CreateModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to create
parameters =  fds.analyticsapi.modelaccountsapi.v2.models.ModelAccountParameters()  # ModelAccountParameters | The object containing the input values (optional)

try:
    # Create account endpoint, takes a date and list of holdings (symbols -&gt; quantities).
    api_response = api_instance.create_model_account_with_http_info(name, parameters=parameters)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> create_model_account_with_http_info")
    print("%s" % e)

 

Get Model Account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to get

        ApiResponse<com.factset.protobuf.stach.PackageProto.Package> result = null;
        try {
            result = apiInstance.getModelAccountWithHttpInfo(name);
            System.out.println(result.getStatusCode());
            System.out.println(result.getData());
        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#getModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class GetModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to get
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Get account endpoint, takes an account path and name and returns the list of dates and holdings under each one (symbols -&gt; quantities).
                ApiResponse<FactSet.Protobuf.Stach.Package> result =  apiInstance.GetModelAccountWithHttpInfo(name);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine(result.Data);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.GetModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to get

try:
    # Get account endpoint, takes an account path and name and returns the list of dates and holdings under each one (symbols -&gt; quantities).
    api_response = api_instance.get_model_account_with_http_info(name)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
    print('Response Data')
    #pprint(MessageToJson(api_response[0])) # To print the response object as a JSON
    pprint(MessageToDict(api_response[0])) # To print the response object as a Dictionary
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> get_model_account_with_http_info")
    print("%s" % e)

 

Delete model account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to delete

        ApiResponse<Void> result = null;
        try {
            result = apiInstance.deleteModelAccountWithHttpInfo(name);
            System.out.println(result.getStatusCode());

        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#deleteModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class DeleteModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to delete
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Delete account endpoint, takes an account path and name and deletes it.
                ApiResponse<Object> result =  apiInstance.DeleteModelAccountWithHttpInfo(name);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.DeleteModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to delete

try:
    # Delete account endpoint, takes an account path and name and deletes it.
    api_response = api_instance.delete_model_account_with_http_info(name)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> delete_model_account_with_http_info")
    print("%s" % e)

 

Create model account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to create
        ModelAccountParameters parameters = new ModelAccountParameters(); // ModelAccountParameters | The object containing the input values

        ApiResponse<Void> result = null;
        try {
            result = apiInstance.createModelAccountWithHttpInfo(name, parameters);
            System.out.println(result.getStatusCode());

        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#createModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class CreateModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to create
            var parameters = new ModelAccountParameters(); // ModelAccountParameters | The object containing the input values (optional) 
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Create account endpoint, takes a date and list of holdings (symbols -&gt; quantities).
                ApiResponse<Object> result =  apiInstance.CreateModelAccountWithHttpInfo(name, parameters);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.CreateModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to create
parameters =  fds.analyticsapi.modelaccountsapi.v2.models.ModelAccountParameters()  # ModelAccountParameters | The object containing the input values (optional)

try:
    # Create account endpoint, takes a date and list of holdings (symbols -&gt; quantities).
    api_response = api_instance.create_model_account_with_http_info(name, parameters=parameters)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> create_model_account_with_http_info")
    print("%s" % e)

 

Get Model Account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to get

        ApiResponse<com.factset.protobuf.stach.PackageProto.Package> result = null;
        try {
            result = apiInstance.getModelAccountWithHttpInfo(name);
            System.out.println(result.getStatusCode());
            System.out.println(result.getData());
        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#getModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class GetModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to get
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Get account endpoint, takes an account path and name and returns the list of dates and holdings under each one (symbols -&gt; quantities).
                ApiResponse<FactSet.Protobuf.Stach.Package> result =  apiInstance.GetModelAccountWithHttpInfo(name);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine(result.Data);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.GetModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to get

try:
    # Get account endpoint, takes an account path and name and returns the list of dates and holdings under each one (symbols -&gt; quantities).
    api_response = api_instance.get_model_account_with_http_info(name)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
    print('Response Data')
    #pprint(MessageToJson(api_response[0])) # To print the response object as a JSON
    pprint(MessageToDict(api_response[0])) # To print the response object as a Dictionary
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> get_model_account_with_http_info")
    print("%s" % e)

 

Delete model account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to delete

        ApiResponse<Void> result = null;
        try {
            result = apiInstance.deleteModelAccountWithHttpInfo(name);
            System.out.println(result.getStatusCode());

        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#deleteModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class DeleteModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to delete
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Delete account endpoint, takes an account path and name and deletes it.
                ApiResponse<Object> result =  apiInstance.DeleteModelAccountWithHttpInfo(name);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.DeleteModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to delete

try:
    # Delete account endpoint, takes an account path and name and deletes it.
    api_response = api_instance.delete_model_account_with_http_info(name)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> delete_model_account_with_http_info")
    print("%s" % e)

 

Create model account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to create
        ModelAccountParameters parameters = new ModelAccountParameters(); // ModelAccountParameters | The object containing the input values

        ApiResponse<Void> result = null;
        try {
            result = apiInstance.createModelAccountWithHttpInfo(name, parameters);
            System.out.println(result.getStatusCode());

        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#createModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class CreateModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to create
            var parameters = new ModelAccountParameters(); // ModelAccountParameters | The object containing the input values (optional) 
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Create account endpoint, takes a date and list of holdings (symbols -&gt; quantities).
                ApiResponse<Object> result =  apiInstance.CreateModelAccountWithHttpInfo(name, parameters);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.CreateModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to create
parameters =  fds.analyticsapi.modelaccountsapi.v2.models.ModelAccountParameters()  # ModelAccountParameters | The object containing the input values (optional)

try:
    # Create account endpoint, takes a date and list of holdings (symbols -&gt; quantities).
    api_response = api_instance.create_model_account_with_http_info(name, parameters=parameters)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> create_model_account_with_http_info")
    print("%s" % e)

 

Get Model Account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to get

        ApiResponse<com.factset.protobuf.stach.PackageProto.Package> result = null;
        try {
            result = apiInstance.getModelAccountWithHttpInfo(name);
            System.out.println(result.getStatusCode());
            System.out.println(result.getData());
        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#getModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class GetModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to get
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Get account endpoint, takes an account path and name and returns the list of dates and holdings under each one (symbols -&gt; quantities).
                ApiResponse<FactSet.Protobuf.Stach.Package> result =  apiInstance.GetModelAccountWithHttpInfo(name);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine(result.Data);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.GetModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to get

try:
    # Get account endpoint, takes an account path and name and returns the list of dates and holdings under each one (symbols -&gt; quantities).
    api_response = api_instance.get_model_account_with_http_info(name)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
    print('Response Data')
    #pprint(MessageToJson(api_response[0])) # To print the response object as a JSON
    pprint(MessageToDict(api_response[0])) # To print the response object as a Dictionary
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> get_model_account_with_http_info")
    print("%s" % e)

 

Delete model account
import factset.analyticsapi.modelaccountsapi.v2.ApiClient;
import factset.analyticsapi.modelaccountsapi.v2.ApiException;
import factset.analyticsapi.modelaccountsapi.v2.ApiResponse;
import factset.analyticsapi.modelaccountsapi.v2.api.ModelAccountsApi;
import factset.analyticsapi.modelaccountsapi.v2.models.*;

public class Example {

    public static void main(String[] args) {

        ApiClient apiClient = new ApiClient();
        apiClient.setBasePath("https://api.factset.com");
        apiClient.setUsername("username-12345");
        apiClient.setPassword("apiKey");

        // To enable ssl verification
        // apiClient.setVerifyingSsl(true);
        // apiClient.setSslCaCert(certificate_inputstream);

        ModelAccountsApi apiInstance = new ModelAccountsApi(apiClient);
        String name = "name_example"; // String | The path and filename of the account to delete

        ApiResponse<Void> result = null;
        try {
            result = apiInstance.deleteModelAccountWithHttpInfo(name);
            System.out.println(result.getStatusCode());

        } catch (ApiException e) {
            System.err.println("Exception when calling ModelAccountsApi#deleteModelAccountWithHttpInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response body: " + e.getResponseBody());
            if (e.getResponseHeaders() != null && e.getResponseHeaders().containsKey("X-DataDirect-Request-Key")){
                System.err.println("X-DataDirect-Request-Key: " + e.getResponseHeaders().get("X-DataDirect-Request-Key").get(0));
            }
            e.printStackTrace();
        }
    }
}

 

using System;
using System.Net;
using System.Collections.Generic;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Api;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Client;
using FactSet.AnalyticsAPI.AccountsAPI.v2.Model;

namespace Example
{
    public class DeleteModelAccountWithHttpInfoExample
    {
        public static void Main()
        {
            var configuration = new Configuration
            {
              BasePath = "https://api.factset.com",
              Username = "userName", // username-serial combination
              Password = "password" // api key
            };
            var apiInstance = new ModelAccountsApi(configuration);
            var name = name_example;  // string | The path and filename of the account to delete
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            try
            {
                // Delete account endpoint, takes an account path and name and deletes it.
                ApiResponse<Object> result =  apiInstance.DeleteModelAccountWithHttpInfo(name);
                Console.WriteLine("--------------------------------------------------------");
                Console.WriteLine("Response Code : "+result.StatusCode);
                Console.WriteLine("--------------------------------------------------------");
                Console.ReadKey();
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ModelAccountsApi.DeleteModelAccount: " + e.Message );
            }
        }
    }
}

 

from fds.analyticsapi.modelaccountsapi.v2.api import ModelAccountsApi 
from fds.analyticsapi.modelaccountsapi.v2.rest import ApiException
from fds.analyticsapi.modelaccountsapi.v2.api_client import ApiClient
from fds.analyticsapi.modelaccountsapi.v2.configuration import Configuration
from pprint import pprint

# create an instance of API configuration
config = Configuration()
config.host = "https://api.factset.com"
config.username = "YOUR_USERNAME" # username-serial combination
config.password = "YOUR_PASSWORD" # api key

# if verify_ssl parameter set as True then add the ssl certificate path
config.verify_ssl = False

# uncomment the line below and provide the ssl certificate path
# config.ssl_ca_cert= "path//to//certificate//file"

# create an instance of API client
api_client = ApiClient(config)

# create an instance of the API class
api_instance = ModelAccountsApi(api_client)
name =  'name_example'  # str | The path and filename of the account to delete

try:
    # Delete account endpoint, takes an account path and name and deletes it.
    api_response = api_instance.delete_model_account_with_http_info(name)
    print('----------------------------------------------------------')
    print('Response Code : '+ str(api_response[1]))
    print('----------------------------------------------------------')
     
except ApiException as e:
    print("Exception when calling ModelAccountsApi -> delete_model_account_with_http_info")
    print("%s" % e)

 

Change Logs

v2
Summary
  • v2.1.0 - Released on 09/26/19
  • v2.0.2 - Released on 07/11/19
  • v2.0.1 - Released on 01/29/19
  • v2.0.0 - Released on 11/29/18
Functionality Additions
  • Added support for price, currencyisocode and weight properties for a holding when using ‘Create Account’ endpoint [v2.1.0]
  • Added support for Accept request header to all HTTP GET endpoints [v2.0.0]
Changes
  • HTTP GET endpoint to fetch model accounts now returns data in FactSet's JSON format [v2.0.0]
  • Renamed "shares" property to "quantity" in HTTP POST and GET endpoints [v2.0.0]
Bug Fixes
  • Fixed crash when duplicate symbols were entered for the same date while using Create Account endpoint [v2.0.2]