Chapter 6
Transcription
Chapter 6
FactSet OnDemand Developer’s Toolkit Programmer’s Manual & Reference FactSet Research Systems Version 2.6 Updated February 2014 Table of Contents Chapter 1: Introduction ...................................................................................................... 4 1.1 Overview ................................................................................................................... 4 1.2 Server Technology .................................................................................................... 4 Chapter 2: Architecture ...................................................................................................... 5 2.1 Wrappers................................................................................................................... 5 2.2 Dynamic Link Libraries .............................................................................................. 5 2.3 Win32 API ................................................................................................................. 5 Chapter 3: Installation ........................................................................................................ 6 3.1 Accessing the Installer............................................................................................... 6 3.2 Running the Installer.................................................................................................. 6 3.3 Setup and Deployment .............................................................................................. 8 3.3.1 Setting up C++ Project in Visual Studio ........................................................... 9 3.3.2 C# .NET or VB .NET Project in Visual Studio................................................... 9 3.3.3 Java Project in Eclipse................................................................................... 10 3.3.4 Python Project ............................................................................................... 10 3.4 FactSetOnDemand Object Configuration................................................................. 11 3.4.1 SetConfigurationItem ..................................................................................... 11 3.4.2 GetConfigurationItem..................................................................................... 12 3.4.3 TestConnectivitySettings ............................................................................... 12 Chapter 4: Retrieving FactSet Data ................................................................................. 13 4.1 Single Threaded API ............................................................................................... 13 4.2 FactSet Data ........................................................................................................... 14 4.3 Extract Data from FactSet ....................................................................................... 15 4.3.1 FactSet Query Language (FQL): Time-Series Access ................................... 16 4.3.2 Screening Language: Cross- Sectional Access ............................................. 16 4.3.3 Date Format using FQL and Screening Codes .............................................. 17 4.3..1 Absolute Dates ......................................................................................... 17 4.3.3.2 Relative Dates ........................................................................................ 17 4.2 FactSet Functions to Extract Data ........................................................................... 19 4.2.1 ExtractFormulaHistory ................................................................................... 19 4.2.2 ExtractDataSnapshot ..................................................................................... 23 4.2.3 ExtractBenchmarkDetail ................................................................................ 26 4.2.4 ExtractEconData............................................................................................ 28 4.3 UploadToOFDB ....................................................................................................... 31 4.3.1 Requirements for UploadToOFDB ................................................................. 31 4.3.2 OFDB ............................................................................................................ 32 4.3.2.1 Creating a New OFDB ............................................................................ 32 4.3.2.2 Modifying an Existing OFDB ................................................................... 32 4.3.3 UploadToOFDB Syntax ................................................................................. 32 Chapter 5: Formula Lookup ............................................................................................. 34 5.1 Launching Formula Lookup ..................................................................................... 34 5.2 Searching for Data................................................................................................... 35 5.2.1 Identifier Lookup ............................................................................................ 35 5.2.2 Search for Data Formulas .............................................................................. 35 5.3 Sample Scripts ........................................................................................................ 37 Chapter 6: Factlet Object .................................................................................................. 40 Chapter 7: Create DataFrame ........................................................................................... 43 7.1 IsDataFrameComplete ............................................................................................ 45 2|Page 7.2 7.3 7.4 7.5 7.6 7.7 GetDataFrameErrorValue ........................................................................................ 45 GetDataFrameFactletRequest \ GetDataFrameFactletResult .................................. 45 GetDataFrameNumberOfRows \ GetDataFrameNumberOfCols .............................. 46 GetDataFrameColumnName \ GetDataFrameColumnType ..................................... 46 GetDataFrameColumnNative .................................................................................. 47 GetDataFrameValueAsString \ GetDataFrameValueAsInteger \ GetDataFrameValueAsDouble ............................................................................... 48 Chapter 8: Troubleshooting ............................................................................................. 49 8.1 IsDataFrameValueInvalid ........................................................................................ 49 8.2 TranslateErrorMessage \ GetFactSetErrorValue ..................................................... 49 8.3 GetListOfLivingDataFrames .................................................................................... 50 8.4 FactSet Event Logger .............................................................................................. 50 Chapter 9: Sample Code ................................................................................................... 52 9.1 C++ Sample Code ................................................................................................... 53 9.2 VB .NET Sample Code ............................................................................................ 66 9.3 Java Sample Code .................................................................................................. 72 9.4 Python Sample Code............................................................................................... 78 Appendix ........................................................................................................................... 84 Table 1: List of Configuration Items ..................................................................................... 84 Table 2: List of File Output Options ..................................................................................... 85 Table 3: Error Message Output ........................................................................................... 86 Table 4: Top 25 most commonly used FactSet Fundamentals formulas ............................. 94 Table 5: FactSet Economics Key Indicator Series for G-7 Countries ................................... 95 Table 6: UploadToOFDB Error Messages ......................................................................... 104 FactSet Glossary .............................................................................................................. 105 Contact FactSet Support: .................................................................................................. 107 3|Page Chapter 1: Introduction 1.1 Overview FactSet collects and integrates financial data and makes this data accessible via the Internet. FactSet currently provides integrations to applications such as R and MATLAB®. For clients needing to integrate data into their own system, FactSet provides an installation program that includes a toolkit of the supporting shared libraries, native bindings, also known as wrapper files, and individual methods called factlets for retrieving data. Upon installation, the installer is prompted for an individual user’s FactSet credentials. Once installed, clients can request and receive data in formats tailored for their particular application. The shared libraries provided in the Toolkit encapsulate common communication and data manipulation functions, and free developers from the details of the network connectivity tasks. This toolkit also provides debugging and troubleshooting tools. Users can access reports from FactSet called factlets to retrieve a variety of data sets. Factlets are functions that encapsulate business logic and data collection procedures. A factlet can be a simple data request or can invoke complex application logic. The technology is capable of cross referencing and dealing with time series for a large quantity of data, which can be returned in a variety of tagged or delimited formats. This document provides information on how to use the FactSet provided tools so that FactSet clients can build integrations into their own environments. FactSet allows for this integration to be built using a variety of programming languages such as Java, VB .NET, C#, C++ and Python. Sample code provided in Chapter 6. 1.2 Server Technology The collection of technologies used to respond to requests over the Internet are called DataDirect. FactSet maintains redundant data servers in its data centers accessbile via the public Internet. The Developer’s Toolkit contains technology to help generate requests to these DataDirect Servers. The requests will be in the form of an HTTPS request generated by a URL statement. When this request is received by FactSet, the DataDirect server will interpret the request and respond with the proper data. In addition to data requests, the DataDirect servers handle authentication of the user requests and the permissioning of data sets. Please refer to the FactSet DataDirect Summary Document for additional information. 4|Page Chapter 2: Architecture FactSet provides tools to build an application to extract FactSet data by utilizing programming languages such as Java, VB .NET, C#, C++ and Python. The main tool is Dynamic Link Libraries (DLL) – a Microsoft shared library technology. The main FactSet DLL is titled kratos.dll. 2.1 Wrappers Programming languages store and use data differently. To compensate for these differences, FactSet has conversion files called wrappers. These wrappers have four responsibilities: Locate the kratos.dll on the hard drive and load it. Make function calls into kratos.dll and convert between C data types and the native ones. Standardize the way functions\methods are called in the varying applications. Provide the FactSet integrated documentation. FactSet uses the Microsoft Windows Registry to store its configuration information and to store its location on the hard drive. Wrappers will search the Windows Registry for the kratos.dll location and then load it from the found directory. 2.2 Dynamic Link Libraries The utilized DLLs are statically linked as part of the FactSet integration. These DLLs are: cURL is an open source library\application that handles internet related communication protocols such as HTTP and FTP. FactSet uses one DLL from cURL called ‘libcurl.dll’. OpenSSL is another open source library which handles security protocols over the internet such as HTTPS. cURL and OpenSSL are often compiled together to perform HTTPS requests. FactSet uses three DLLs from OpenSSL called ‘libeay32.dll’, ‘libssl32.dll’, and ‘ssleay32.dll’. Note: The FactSet integration includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. 2.3 Win32 API The Microsoft Windows Application Programming Interface, or Win32API, is a set of functions that allow for the operating system to be utilized for accomplishing such tasks as drawing a Window on the screen for users. This Win32API exists on practically all Windows Platforms. The FactSet integration utilizes the Win32API for numerous elements such as task parallelization. 5|Page Chapter 3: Installation The FactSet OnDemand Developer’s Toolkit integration allows users to retrieve FactSet data by building their own integrations into their environment. FactSet allows for this integration to be built using a variety of programming languages such as Java, VB .NET, C#, C++ and Python. Note: The FactSet OnDemand Developer’s Toolkit Installer is retired 18 months after release. The Plugin will continue to work after 18 months, but from 15 months and on users are prompted to upgrade. 3.1 Accessing the Installer The FactSet OnDemand Developer’s Toolkit Installer can be accessed from: www.factset.com/download/statlink The installer is compressed in a folder named FactSet OnDemand Developers Toolkit. Depending on the computer architecture that a user is running, the user will choose the FactSetOnDemandDevelopersToolkitx86Installer.msi version if they are using a 32-bit machine and the FactSetOnDemandDevelopersToolkitx64Installer.msi for a 64-bit machine. Both versions are compatible with Windows XP, Windows Vista & Windows 7. Note: The .NET framework 2.0 is the minimal requirement necessary to install. 3.2 Running the Installer To begin the installation process, the user can double-click on the .msi file. The Windows Installer will then open the OnDemand Toolkit Setup Wizard. The user should select next to continue the install or cancel the install process. In the first step, enter the FactSet Username and Password credentials. To connect to the FactSet server, a username and password are required. These credentials are different than the FactSet workstation login. New credentials will be provided by a FactSet representative upon trial or purchase of the OnDemand Developer’s Toolkit integration. 6|Page In the second step, if applicable, enter the proxy server configuration information, otherwise, it may be left blank and a proxy server will not be used. In the next step, select the install location to apply this OnDemand Toolkit. The installer will suggest a location such as “C:\Program Files\FactSetOnDemand\”: The user may choose to specify a different location by selecting Browse. Once the install is completed, the installer will run startup scripts to finalize the installation. In order to upload and download data from FactSet, there is an OnDemand file created in a temp directory. The location of those files is automatically generated, but in some instances (such as running through a server) those generated files may be inaccessible at run time. If you suspect this to be a problem, it is possible to specify for the Plugin where to create its upload/download files by setting configuration item number 16: (pseudocode, changes according to language) FactSetOnDemand.setConfigurationItem(16, newDirectory) 7|Page 3.3 Setup and Deployment For including the FactSet integration into the client’s own system, there are two components to consider for most projects, the library and the native language bindings. These native language bindings are included as source files in the project. The FactSet dynamic library is typically included in one of three ways - on the load library search path, by using the registry to store its location or locally. The following table describes the details for including the dynamic library in all three specified ways. Method of Inclusion Locally Description This is the simplest method of including the dynamic library. The user simply places the kratos.dll in the same directory as the executable. When the library is initialized, it will be found in the local directory. Library Path This method involves placing the library in a directory where DLLs are commonly looked for when applications are loaded. One such example is the ‘C:\Windows\System’ directory. These directories are typically listed in the computers PATH environment variable. Registry This method is the most versatile. There is a Windows application Loading called regsvr32. This application is responsible for informing the windows registry of the location of the library on the hard disk. When this regsvr32 is called with the library’s location as an argument, it register’s it. The library’s CLSID is registered under: Computer\HKEY_CURRENT_USER\Software\FactSet\OnDemand\ CLSID The library’s location is then stored under: Computer\HKEY_CURRENT_USER\Software\Classes\CLSID\{CLS ID}\InprocServer64 Or Computer\HKEY_CURRENT_USER\Software\Classes\CLSID\{CLS ID}\InprocServer32 This is the first method that the wrapper class will attempt to use to load the library. The following sections detail the steps for setting up the FactSet integration using a number of different programming languages. 8|Page 3.3.1 Setting up C++ Project in Visual Studio 1. Create a new Visual Studio Project The project may be either 32 or 64 bit architecture. The project may use Win32, MFC or ATL libraries, if needed. The project may support Unicode or not, but note that the FactSet integration only supports ANSI C Strings. The project may have any calling convention as long as function calls to FactSet are set up as __cdecl function calls. The project may use precompiled headers, if needed. The project may use any of the four Microsoft Runtime Libraries. The project may support Common Language Runtime. 2. Include the header files for the FactSet integration FactSetOnDemand.h and FactSetOnDemand.cpp are compiled in the project. 3. To dynamically load the FactSet integration at runtime, simple call the FactSetOnDemand constructor as shown in the Main.cpp example file. Note: No static linking is required for the FactSet integration to be included 4. Compile the project and execute the application Kratos.dll must be either in the same directory as the calling application, on the library load path, or registered in the Windows Registry using regsvr32. The correct architecture version of the DLL must be included. 64-bit applications may not dynamically load 32-bit DLLs at runtime and vice versa. The static library included in the binary section of the integration, titled kratos.lib, can also be utilized. This static library allows the user to link against the project without using the FactSetOnDemand headers. The static function has a similar functionality as the headers, but will only allow the user to use the simple C interface that it provides. The C header is named FactSetOnDemandCAPI.h and is located in the header directory of the developer’s toolkit. 3.3.2 C# .NET or VB .NET Project in Visual Studio The FactSet integration uses the Java Native Interface to allow Java to call functions from FactSet. 1. Create a new Visual Studio Project (either C# or VB) 9|Page May use any version of the .NET framework. Does not need to allow ‘unsafe’ code. Project may be either Debug or Release configuration. 2. Add the source code file In VB, FactSetOnDemand.vb should be included In C#, FactSetOnDemand.cs should be included 3. To dynamically load Kratos at runtime, simply call the FactSetOnDemand constructor as shown in the Main.cs\Main.vb example file. 4. Compile the project and execute the application Ensure the appropriate version of Kratos.dll is available to be loaded. The architecture of the DLL required is the one that matches the installed version of the .NET runtime libraries. Most of the time, the architecture of .NET installed matches the operating system architecture. 3.3.3 Java Project in Eclipse The FactSet integration uses the Java Native Interface to allow Java to call functions from FactSet. 1. Create a new Java Project in Eclipse. 2. Import the source file binding for Java, FactSetOnDemand.java. 3. To dynamically load the integration at runtime, FactSetOnDemand constructor as shown in the Main.java example file. 4. Compile the Java Byte Code and execute the application Ensure that the appropriate version of Kratos.dll is available to be loaded. The architecture of the DLL required is the one that matches the installed version of the Java runtime libraries. In most casees, the architecture of the Java Runtime Libraries installed matches the operating system architecture. Note: Loading DLLs in the JVM requires the DLL to be on the JVM path. 3.3.4 Python Project In order to interface with FactSet, the integration uses the ctypes library from Python. Similarly to the other projects, the Kratos DLL is dynamically loaded at runtime by creating the FactSetOnDemand object. 10 | P a g e 3.4 FactSetOnDemand Object Configuration The FactSet OnDemand Object, typically with a class name ‘FactSetOnDemand’, is a wrapper class for using FactSet’s functions. Typically when this object is created or constructed, the software will locate the Kratos.DLL and dependencies and load them into memory for use. The software searches the Windows Registry for the location and then searches the local directory. Assuming that the DLL is located and loaded successfully, an initialization route is run to prepare the DLL: C++ FactSet::FactSetOnDemand* factSetOnDemand = new FactSet::FactSetOnDemand (); Java FactSetOnDemand factSetOnDemand = new FactSetOnDemand( ); VB Dim factSetOnDemand As FactSet.FactSetOnDemand = New FactSet.FactSetOnDemand() C# FactSet::FactSetOnDemand* factSetOnDemand = new FactSet::FactSetOnDemand (); 3.4.1 SetConfigurationItem There are several dozen configuration options stored in the Registry on behalf of FactSet. These items can be viewed in the Windows Registry using the Windows Registry Editor at the following location: “Computer\HKEY_CURRENT_USER\Software\FactSet\OnDemand” Configuration items are stored as strings in the Windows Registry. The user can access them as need be. The following are examples of commands to set configuration items: C++ factSetOnDemand->setConfigurationItem(FactSet::FactSetOnDemand::DATADIRECTUSERNAME, "EXAMPLE_001_SERVICES" ); Java factSetOnDemand.setConfigurationItem(FactSetOnDemand.DATADIRECTUSERNAME, "EXAMPLE_001_SERVICES"); VB factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.DATADIRECTUSERNAME, "EXAMPLE_001_SERVICES") 11 | P a g e C# factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.DATADIRECTUSERNAME, "EXAMPLE_001_SERVICES"); 3.4.2 GetConfigurationItem The GetConfirgurationItem method is the complement to SetConfigurationItem. This allows the user to get the configuration item as a character string. Note that these configuration items use ‘TRUE’ or ‘FALSE’ for Boolean logical configuration and standard integer only numbers for numerical items. Table 1 in Appendix lists the available configuration items. C++ std::string datadirectusername = factSetOnDemand->getConfigurationItem( FactSet::FactSetOnDemand::DATADIRECTUSERNAME); Java String datadirectusername = factSetOnDemand.setConfigurationItem( FactSetOnDemand.DATADIRECTUSERNAME); VB Dim datadirectusername As String = factSetOnDemand.getConfigurationItem( FactSet.FactSetOnDemand.DATADIRECTUSERNAME ) C# string datadirectusername = factSetOnDemand.getConfigurationItem( FactSet.FactSetOnDemand.DATADIRECTUSERNAME ); 3.4.3 TestConnectivitySettings The TestConnectivity method tests making a short query to DataDirect and attempts to extract the price of IBM. If the given configuration settings are correct, this will return a true Boolean, otherwise, it will return false. C++ bool isConnected = factSetOnDemand->testConnectivitySettings(); Java boolean isConnected = factSetOnDemand.testConnectivitySettings(); VB Dim isConnected As Boolean = factSetOnDemand.testConnectivitySettings() C# bool isConnected = factSetOnDemand.testConnectivitySettings(); 12 | P a g e Chapter 4: Retrieving FactSet Data 4.1 Single Threaded API The externally facing API for the OnDemand Developer’s Toolkit Integration is designed to be driven by a single thread. All function calls into the API will return as quickly as possible. The external facing function calls dispatch commands to FactSet’s internal objects that will handle processing and return data when requested. The externally facing API can be called by multiple threads but it is blocking in the event of multiple threads simultaneously attempting to access it. The API is designed to allow the user to leverage the power of parallel processing while only calling functions from a single threaded environment. Inherently single threaded environments can create up to 25 simultaneous HTTPS connections at once. The single threaded environment may then poll the API to see if the desired request is finished. The following diagram details the single threaded data request execution process. As depicted, the data requests are made via the Web. When a request is created from the client’s application, using the FactSet DataDirect technology a URL call is made, which goes to a FactSet OnDemand API. CreateDataFrame is the first method call used in fetching and parsing data. This method sends an HTTPS request, allocates memory to receive the data and parses the data. This method also checks the entire process for errors. Each CreateDataFrame spawns a new thread so that these actions can occur in parallel. The is DataFrameComplete method then polls and returns true if the given DataFrame response is complete. This processing includes fetching the data, parsing the response into a matrix and checking for errors. And the GetDataFrameFactletResult method gets the ASCII result string returned as a result of the Factlet String. These 3 steps are discussed in further detail in Chapter 6. The requests that are thus made are passed through the created DataFrame and are queued in the Thread Pool. These functions make up the Kratos DLL, a collection of common functions and data entities which a program may refer to at run time, without requiring the function code or data to be duplicated within the program file itself. The Kratos DLL is dynamically loaded at runtime by creating the FactSetOnDemand object. The client data request is thus sent over the internet as an HTTPS request to the FactSet OnDemand Webservers, and that is sent to the FactSet databases, which include the wide range of data, such as Fundamentals, Estimates, Ownership, Economics, or Ownership among other data. The fetched data is is then returned and parsed along the same path to the client’s application. 13 | P a g e Given that the FactSet integration allows for parallel processing, it must spawn multiple threads to complete the tasks at hand. Often, using many threads can be taxing on system resources. Therefore an artificial multiple request limit of 25 is imposed. An internal Thread Pool is available that increases the amount of threads as new requests are created. In response to the number of requests executing, the thread pool will release resources appropriately, as well. If there are more requests than resources available, the requests are queued in the order that they were submitted. 4.2 FactSet Data FactSet integrates over 200 databases to analyze markets, companies and industries. For a comprehensive list of databases available on FactSet go to: www.factset.com/data The available FactSet databases include the following: FactSet Fundamentals is updated intra-day and is a comprehensive global database with extensive coverage and data history. The database provides coverage of more than 66,000 public and private companies with annual 14 | P a g e history going back to 1980 in developed market and the early 1990s in emerging markets. FactSet Estimates is updated intra-day and provides consensus- and detaillevel estimates and statistics from leading investment banks and research firms. According to the Wall Street Journal’s “Best on the Street” Analysts Survey, a quantitative evaluation of analysts’ performance based on the accuracy of buy/sell recommendations, the top analysts evaluated for the survey are identified using broker recommendation data sourced from FactSet Estimates. FactSet clients have access to Equity and Fixed Income Benchmarks, which include Dow Jones, FTSE, MSCI, Russell, S&P, Barclays, and BofA Merrill Lynch, among a number of others. FactSet Market Aggregates (FMA), combines data from FactSet Fundamentals, Estimates and Prices to calculate ratios and per share values on an aggregate level. It provides access to over 50 metrics for more than 3,500 commercial and exchange indices. FactSet Economics database is updated intra-day and provides comprehensive global coverage. Database includes details such as economic information, exchange rates, commodities, and interest rates. 4.3 Extract Data from FactSet As outlined above, FactSet integrates a range of data sets - company accounts, security data such as price and return, consensus and detail broker estimates, and economic data are a few of the examples. FactSet stores all of the available data in proprietary database structures on FactSet computers. This allows FactSet to adjust, when necessary, the way data is stored, so that clients can access data as efficiently as possible. This range of data is stored on FactSet in such a way as to make powerful crosssectional and time-series analysis possible. FactSet provides two different data access methods. The FactSet Query Language is used for time-series requests and the FactSet Screening Language allows extraction of data for a large universe of securities as of a single date. The selected data access method depends on the type of data a user wants to get from FactSet, and what they want to do with that data. 15 | P a g e 4.3.1 FactSet Query Language (FQL): Time-Series Access The first access method is oriented around time-series data fetches using the FactSet Query Language (FQL). FQL is a proprietary data retrieval language used to access historical FactSet data. Given an entity (i.e. a security or an index) and a data item (i.e. market closing price) or macroeconomic data (i.e. the last 5 years of industrial production for the BRIC countries) the entire history can be fetched using FQL. For more information on FQL, see Online Assistant page 1961 in the FactSet workstation. Some advantages of FQL include: The ability to specify dates for any database using the same formats. With FQL, date formats are flexible. You can use a number of consistent date formats (defined by FQL) for all databases which makes using and combining data from different databases easier than ever. The ability to iterate items, formulas, and functions at any frequency. With FQL, you can iterate items, formulas, and functions at any frequency. For example, you can request a series of weekly price to earnings ratios. To request a time-series of data, a start date, end date and frequency needs to be specified. If a date is not specified, data is returned from the most recent time period. To request data for a time series, the start date is the first date of the requested time series of data. The end date is the last date of the time series. The dates can be designated as absolute dates or relative dates. 4.3.2 Screening Language: Cross- Sectional Access Alternatively, the extraction of multiple items for a list of ids for 1 date, both for equity and fixed income securities, is done using the Screening Language. The FactSet Screening Language is a way to efficiently facilitate quick access to a data item as of single time period for a universe of securities. By default, the Screening Language does not allow iteration and therefore cannot be used to return a time series of data with a single request code. To request data as of a single historical date, an absolute or relative date must be specified. 16 | P a g e 4.3.3 Date Format using FQL and Screening Codes 4.3.3.1 Absolute Dates Absolute dates indicate a specific day, month-end, fiscal quarter-end, calendar quarter-end, fiscal year-end, or calendar year-end as depicted in the examples below: Day: MM/DD/YYYY i.e. 7/11/1999 Note: DD/MM/YYYY is not a valid format. Month-end: MM/YYYY i.e. 6/1999 Fiscal quarter-end: YY/FQ or YYYY/FQ i.e. 1999/1F, 2000/3F, 2001/2F Calendar quarter-end: YY/CQ or YYYY/CQ i.e. 1999/1C, 00/3C, 2001/1C Fiscal year-end: YY or YYYY i.e. 2000, 01, 1999 4.3.3.2 Relative Dates Relative dates represent a date relative to the most recently updated period. For example, 0 (zero) represents the most recently updated period and -1 represents the time period prior to the most recently updated. The zero date is determined by the default time period or the natural frequency of the data being requested. Zero (0) when used with monthly data indicates the most recent month end. Negative one (-1) when used with annual data indicates one year prior to the most recently updated year. List of Relative Date Arguments: D 0D is the most recent trading day, -1D is one trading day prior. AW 0AW is the most recent trading day, -1AW is the one actual week (7 days) prior to the most recent trading day. W 0W is the last day of the most recent trading week (usually Friday), -1W is the last trading day of the prior week. AM 0AM is the most recent trading day, -1AM is the same day, one actual month ago. 17 | P a g e M 0M is the last trading day of the most recent month, -1M is the last trading day of the prior month. AQ 0AQ is the most recent trading day, -1AQ is the same day 3 months prior Q 0Q is the last trading day of the company’s most recent fiscal quarter, -1Q is the last day of the prior fiscal quarter. CQ 0CQ is the last trading day of the most recent calendar quarter (March, June, September, or December), -1CQ is the last trading day of the prior calendar quarter. AY 0AY is the most recent trading day, -1AY is one actual year (365 days) prior Y 0Y is the last trading day of the company’s most recent fiscal year, -1Y is the last trading day of the prior fiscal year. CY 0CY is the last trading day of the most recent calendar year (the last trading day in December), -1CY is the last trading day of the prior calendar year. 18 | P a g e 4.2 FactSet Functions to Extract Data FactSet has written a number of functions, called factlets that retrieve FactSet data using the FQL or Screening languages. These factlets are application components which encapsulate business logic and data collection procedures. The data items that are requested, along with an id (identifier) and date, are stored in a structure. Entities (Security, Index, etc.) and the time dimensions are stored in arrays. The factlets are used to create URL strings. The string specifies several key parameters by providing name-value pairs. Depending on the format of the factlet, date items may be returned in a variety of formats. Pipe format is the most commonly used format. If a DataFrame successfully parses in the PIPE format, it stores the date as an integer value in YYYYMMDD format. If the date value is returned as an integer or a float, the value is returned in YYMMDD format. If the date value is returned in string format, it will return in ‘DDMMM-YYYYY’ format such as ’12-Nov-2012’. The name-value pair “format=pipe” is added to the URL string by default if another format is not specified. The following examples highlight a number of the functions that allow for time series and point in time data extraction. For a comprehensive list of factlets that are available, refer to Online Assistant page 17337 in the FactSet workstation. 4.2.1 ExtractFormulaHistory The ExtractFormulaHistory function is used for extracting one or more items for one security, an index or a list of securities over time. The function is using FQL. The syntax for the ExtractFormulaHistory function is: factlet=ExtractFormulaHistory&ids=&items=&dates=¤cy=& where, ids CellString array with a list of one or more security identifiers. Item(s) CellString array with a list of one or more FactSet data items in FQL. Start date The start date for the data. End date The End date for the data. Frequency String with a valid FactSet frequency (e.g. ‘d’dates Alternate method of entering dates entered in start:end:freq format. Currency The currency in which the data is to be returned, using a string with the three character ISO code (e.g. ‘USD’ or ‘EUR’). 19 | P a g e For databases available on FactSet, there are a set of data items that represent the piece of information on the database, such as sales, EPS and market value. These FQL codes are used to specify the items parameter. Formulas that begin with FG_ are FactSet Global formulas and are some of the most commonly used formulas to retrieve prices, estimates, valuation, growth, and fundamentals. The formulas return data from multiple database sources, based on a client's FactSet subscription. In database specific codes, the database is specified in the FQL code, such as in P_PRICE where the P_ element of the code denotes the pricing database and FF_SALES denotes the FactSet Fundamentals database with the FF_ element of the code. Table 4 in the Appendix lists the top 25 mostly commonly used FactSet Fundamentals formulas. For links to more comprehensive lists of the items available from the FactSet Fundamentals database, refer to Online Assistant page 15099 in the FactSet workstation. FQL codes used in the item parameter may have their arguments in different positions of their respective codes, depending on if it’s a commonly used code, which will start with an FG_ or a database specific code. 20 | P a g e Example 1: In this example, extract the last 6 quarters EPS for Exxon Mobile (ticker XOM) using the FQL code FG_EPS. factlet=ExtractFormulaHistory&ids=XOM&items=fg_eps(0Q,-5Q,Q)&dates=0Q:5Q:Q& Here, the names of the parameters, such as ids and items, specify the name in the name value pair. The variable “ids” is given the value “XOM” and the name value pair “ids=XOM” is appended in the URL string. In this example, the date argument is using relative rather than absolute dates. To specify relative dates, enter the number of periods and a period code, such as D for days, W for weeks, or Q for quarters and Y for years. When using relative dates, "0" refers to the most recent time period. Therefore, 0Q refers to the most recent quarter end, while -1Q refers to two quarters ago. Example 2: In this example, extract the price for a number of securities, Microsoft and IBM, using the FQL code FG_PRICE. The date arguments used here are absolute dates. factlet=ExtractFormulaHistory&ids=MSFT,IBM&items=fg_price&dates=201012 15:20110115:D& Example 3: In this example, extract the last 6 periods of pricing and sales data for Statoil (ticker STL-NO) using the FQL code for price data P_PRICE from the Pricing database and the FQL code for sales data FF_SALES from the FactSet Fundamentals database. Both P_PRICE and FF_SALES in this example are used in the items parameter. Because these are database specific codes and not the most commonly used FG_ codes demonstrated in Examples 1 and 2, the arguments for elements such as currency are positioned differently in the code. For example, in the P_PRICE code, currency is the 4th argument and in the FF_SALES code, currency is the 6th argument. factlet=ExtractFormulaHistory&ids=stl-no&items=p_price(5,0,Q,USD),ff_sales(QTR,-5,0,Q,,USD)&dates=-5:0:Q& Note: When specifying the items in the request syntax, to ensure most effectively that that the dates for the items, such as price and sales, align correctly with the dates field, enter the dates in the items portion of the request syntax as specified above. For example p_price(-5,0,Q). 21 | P a g e Example 4: In this example, retrieve the last 6 quarters of EPS and price for the current constituents of the S&P 500 using the FQL codes FF_SALES and P_PRICE and the names of the companies using the FQL code PROPER_NAME. The universe code, which is specified as the S&P 500 and is based on the FQL code ISON_SP500, returns the current constituents of the S&P 500. factlet=ExtractFormulaHistory&ison=sp500&items=proper_name,ff_eps(qtr,0,5,Q),p_price(0,-5,q)& Example 5: In this example, extract for Microsoft as of most recent dividends pay date the date that is plus 1 actual quarter forward. The specified DATE function in this example returns the date requested as a string, formatted as MM/DD/YY. Non-trading days are not recognized by the DATE function. factlet=ExtractFormulaHistory&ids=MSFT&items= DATE(P_DIVS_PD(0,,,,EXDATE)%plus1AQ)& Note: When using a hex symbol in the request, such as +1AQ in this case, it is necessary to use %plus instead. 22 | P a g e 4.2.2 ExtractDataSnapshot The ExtractDataSnapshot function is used for efficiently extracting multiple items as of a single date, for a universe of both equity and fixed income securities. This function is using the FactSet Screening Language, to efficiently extract data for a large universe of securities as of a single date. The syntax for the ExtractDataSnapshot function is: factlet=ExtractDataSnapshot&ids=&item=&date=¤cy=& where, ids CellString array with a list of one or more security identifiers. Item(s) CellString array with a list of one or more FactSet data items in the Screening language. Date The date as of which the data is retrieved. If no date is specified, data is returned from the most recent time period. Currency The currency in which the data is to be returned, using a string with the three character ISO code (e.g. ‘USD’ or ‘EUR’). Table 4 in Appendix lists the top 25 most frequently used data items from the FactSet Fundamentals database using the Screening syntax. For links to more comprehensive lists of the items available from the FactSet Fundamentals database, refer to Online Assistant page 15099 in the FactSet workstation. 23 | P a g e Example 1: In this example, retrieve the quarterly sales value from the FactSet Fundamentals database for IBM as of 04/01/2011 using the FactSet Screening code FF_SALES(QTR,20110401). factlet=ExtractDataSnapshot&ids=ibm&items=ff_sales(QTR,20110401)& Example 2: In this example, retrieve the quarterly sales values in USD from the FactSet Fundamentals database for Exxon Mobile and Statoil as of 04/01/2011, using the FactSet Screening code FF_SALES(QTR,20110401). factlet=ExtractDataSnapshot&ids=xom,stlnos&items=ff_sales(QTR,20110401,,USD)& Note: All Screening codes used in the item parameter have their arguments in different positions depending on the source of the code. For example, the currency argument for the price code from the pricing database using P_PRICE has it in the 2ND position P_PRICE(-5D,USD) , while the sales code from FactSet Fundamentals using the code FF_SALES(QTR,-1,RP,USD) has it in the 4th position. Example 3: In this example, instead of specifying securities in the ids field, as was done in examples 1 and 2 above, an index universe is specified and the items, price and sales, are extracted for all of the constituents of the S&P 500. The syntax to extract the price from the Pricing database using the code P_PRICE(20110401) and sales from the FactSet Fundamentals database using the code FF_SALES(QTR,20110401) for the current constituents of the S&P 500 using the code ISON_SP500 is the following: factlet=ExtractDataSnapshot&ison=sp500&ff_sales(QTR,20110401),p_price(20 110401)& The universe is specified at the end of the code with the ison & sp500 arguments, which are broken down from the actual Screening syntax, which is ISON_SP500. In the output with this code, the ID field brings back the CUSIPs of the companies in the S&P 500. 24 | P a g e Example 4: In this example, extract the decile ranking of the S&P 500 companies based on the most recently reported quarterly earnings per share (EPS) using the FactSet Fundamentals formula FF_EPS as of the most recent quarter end. The FactSet DECILE function returns the decile rank (1-10) of the formula evaluated for each company in the specified universe of companies, in this case the S&P 500. factlet=ExtractDataSnapshot&ison=sp500&items=decile(ff_sales(QTR,0))& Example 5: In this example utilize the backtest functionality to retrieve the latest quarterly sales value and the corresponding fiscal period end date for a list of securities lagged by 45 days. To retrieve sales the FactSet Fundamentals code is FF_SALES and for retrieving the Fiscal Period End date in MM/YYYY format the FactSet Fundamentals code is FF_FP_END_DATE. When using the lag argument (lag options: specified number of days, weeks, months, quarters, or years), FactSet retrieves data as it was known at the time of the rebalance date. For example, if returns are calculated for the universe rebalanced in December 1990, a custom P/E formula can be set up using the price in December 1990, then lag the date of the earnings (to the most-recently reported quarter at that point in time), for example, to September. By lagging EPS, it is possible to use the P/E that was known to the public in December 1990. A lag argument does not need to be added to pricing and shares formulas to avoid look-ahead bias, because these are bits of information that would have been publicly known at the time of the backtest date. factlet=ExtractDataSnapshot&ids=hd,pg,fds,fit&items=FF_FP_END_DATE(QTR,0 L45D),FF_SALES(QTR,0 L45D)&date=20110131& 25 | P a g e 4.2.3 ExtractBenchmarkDetail The ExtractBenchmarkDetail function is used for extracting multiple data items for a benchmark. Benchmark data can be retrieved using other functions, such as with ExtractFormulaHistory, but the ExtractBenchmarkDetail function allows a user to retrieve a more comprehensive overview of the index constituent data, without additional codes or calculations. In the default output, identifiers are sorted in descending order by weight in the index and each row shows the index id, company id, date, ticker, and weight. Additional items are displayed at the end. FactSet clients have access to Equity and Fixed Income Benchmarks, which include Dow Jones, FTSE, MSCI, Russell, S&P, Barclays, and BofA Merrill Lynch, among a number of others. Access to benchmarks is based on client subscription to various benchmark providers. In addition, FactSet Market Aggregates (FMA), combines data from FactSet Fundamentals, Estimates and Prices to calculate ratios and per share values on an aggregate level. FMA comprises over 3,500 benchmarks including S&P, Russell, MSCI Global, FTSE, STOXX, TOPIX, and many local exchanges. Benchmarks also include specific sector and industry level indices. This number is constantly expanding based on client demand. The syntax for the ExtractBenchmarkDetail function is: factlet=ExtractBenchmarkDetail&ids=&item(s)=&dates=&cutoff=& where, ids CellString array with a list of the benchmark identifiers. Item(s) CellString array with a list of one or more FactSet data items in FQL. Dates The option argument dates can be entered in start:end:freq format. (e.g. ‘20101215:20110115:d’) Cutoff Optional number of holdings to display, based on Market Cap. Default displays to all holdings. 26 | P a g e Example 1: In this example, extract the securities that make up the S&P 500, and their corresponding Company Name using the code FG_COMPANY_NAME and Market Cap using the code FG_MKT_VALUE. factlet=ExtractBenchmarkDetail&ids=SP50&items=FG_COMPANY_NAME,FG_ MKT_VALUE& Example 2: In this example, extract the top 10 holdings for the S&P 500 and display the securities corresponding price using the pricing database with the code P_PRICE and the company name using the code PROPER_NAME. factlet=ExtractBenchmarkDetail&ids=SP50&items=p_price,proper_name&cuto ff=10& 27 | P a g e 4.2.4 ExtractEconData The ExtractEconData function is used to extract a broad array of macroeconomic content, interest rates and yields, country indices and various exchange rate measures from both the FactSet Economics and the Standardized Economic databases. FactSet Economics is a database of primary-sourced information on the global economy. The database includes specialty sources such as Eurostat, ICIS, IMF, LME, NYMEX, and OECD. For a comprehensive list of economic databases available on FactSet please refer to http://www.factset.com/data/data/economic. Each data series from the database has a mnemonic identifying that requested series. For example, GDP published by the National Bureau of Statistics of China Seasonally Adjusted, will have an id or mnemonic assigned to it that’s different from a mnemonic assigned for China’s GDP value that is not seasonally adjusted. To find the mnemonic for a series, use the Series Lookup. Note: Table 5 in Appendix lists the Key Indicator series from the FactSet Economics database for the G-7 Countries. For a comprehensive list of data series available from the FactSet Economics database, refer to the Series Lookup in the FactSet workstation. A Series Lookup overview is available in Online Assistant page 15694. The syntax for the ExtractEconData function is: factlet=ExtractEconData&item=DB_SOURCE_DATA(‘mnemonic’, start date, end date, frequency, conv, dist, nfb)& where, item String specifying the economic series. dbsource Pertains to the FactSet Economics database. Note: After specifying a database source, the syntax should be _ DATA for each. For example, FDS_ECON_DATA. FDS_ECON = FactSet Economics SPEC_ID = FactSet Commodities & Interest Rates FDS_COM = FactSet Commodities IMF_IFS = IMF OECD_MEI = OECD EURO_STAT = EuroStat TCB_CCI = Conference Board ONS_ECON = UK Office for National Statistics mnemonic String specifying the economic series mnemonic, i.e. US GDP the mnemonic BEANIPAA191RL1@US from series FDS_ECON[BEANIPAA191RL1@US] Note: Table 5 in Appendix lists the Key Indicator series for G-7. 28 | P a g e start date start date entered in mm/dd/yyyy format. Alternate method of entering dates entered in start:end:freq format. (i.e. ‘20101215:20110115:d’). end date end date entered in mm/dd/yyyy format. Alternate method of entering dates entered in start:end:freq format. (i.e. ‘20101215:20110115:d’). frequency String with a valid FactSet frequency (i.e. ‘d’,’w’,’m’,’q’,’y’). Note: For economic request codes a frequency argument is necessary to retrieve the data. conv The conversion technique for aggregating periods, when a data series of a higher frequency is converted to a lower frequency; for example, converting a quarterly series to an annual series. (i.e. ‘SUM’, ‘AVERAGE’, or ‘AVERAGENP’ which excludes NAs). dist The distribution technique for spreading over periods when a data series of a lower frequency is distributed to a higher frequency; for example, distributing an annual series to a quarterly series. (i.e. ‘STEP’, ‘EVEN’, ‘NONE’) nfb NFB is the optional "no feel back" argument in FQL codes. If you do not use the NFB argument, the returned data series will contain NAs where the data is not available (default is NFB=1). If you want the data to "feel back" over NAs to find the last actual data point and carry this data forward, set the NFB argument to either 0 or 2. 29 | P a g e Example 1: In this example, retrieve industrial production data for the United States using the FactSet Economics database as identified by the FDS_ECON argument in the code, starting 122 months ago (denoted with -121) until 2 months ago (denoted with -1). factlet=ExtractEconData&item=FDS_ECON_DATA(‘FRBIPSB50001’,-121,1,m,step,average)& Example 2: In this example, retrieve the last 30 days of WTI commodity data using the FactSet Economics series SPEC_ID[WTI-FDS:FG_PRICE]. factlet=ExtractEconData&item=SPEC_ID_DATA(‘WTI-FDS:FG_PRICE’,0,-30,d)& 30 | P a g e 4.3 UploadToOFDB The UploadToOFDB functionality allows clients to upload data into an OFDB file stored in Data Central in the FactSet workstation. OFDB, which stands for Open FactSet Database, is a high-performance multidimensional database system used to securely store proprietary numeric and textual data on FactSet and can be time-series or non-time series databases. OFDB is ideal for users who manage large portfolios or maintain extensive historical proprietary databases. OFDB optimizes large, multi-dimensional databases, giving FactSet users highly flexible, fast access to large volumes of complex data that can be used in many different applications. Note: The optimal use of the UploadToOFDB functionality is for ad-hoc and smaller scale data uploads and would not replace a client’s needs for FTP processes or production services, for larger scale or holdings uploads into FactSet. 4.3.1 Requirements for UploadToOFDB The following are the necessary requirements to upload data into an OFDB: Data set must have at least 1 ID, Date and Items field; o Fields uploaded can be iterated of any frequency or non-iterated; o Date types can be High Precision, Integer, or Text; o Dates need to be uploaded as integers in YYYYMMDD format. Data Central subscription in the FactSet workstation is necessary; o Basic data storage access available to all clients with a premium FactSet workstation in Data Central is 1GB of storage space. Additional data storage is available and should be discussed with a FactSet sales representative. o If attempting to upload data to a full OFDB file and thus exceeding data storage space access, there will be an error message after running an upload notifying that data storage access is full. The error message "Client Data Space is Full" will be displayed. o FactSet does not need to be launched when uploading data into an OFDB. Note: A Comprehensive list of error messages is available in Table 5 in the Appendix. 31 | P a g e 4.3.2 OFDB 4.3.2.1 Creating a New OFDB The following details are regarding the behavior of an OFDB file that is created through the Developer’s Toolkit: If the OFDB does not already exist, it will be created. If created by UploadToOFDB, all fields will be Iterated with Daily Frequency and data type High Precision for numbers and Text(32) for strings. OFDB schemas define the database. If another schema is required for the OFDB file, it should first be created in Data Central. For more details regarding creating or editing schemas refer to Online Assistant page 11502 within the FactSet workstation. Once an OFDB is created, no changes to the schema can be made through the UploadToOFDB functionality. A new OFDB would need to be created to make the necessary changes. 4.3.2.2 Modifying an Existing OFDB The following details are regarding modifying an OFDB file that is created through the Developer’s Toolkit, when adding additional dates or values to that file: Data for an additional date can be appended for existing securities in an OFDB file. Data for additional securities can be appended to an OFDB file for the existing dates in the file or for a new date range. New Data items cannot be appended to an existing OFDB through the UploadtoOFDB functionality. 4.3.3 UploadToOFDB Syntax In order to upload data into an OFDB, it is initially necessary to instantiate an upload factlet. The “UploadFactlet.MakeUploadFactlet” method takes an OFDB name, the column names separated by commas, and the column types separated by commas (so in this example, Id is an Id, Date is a Date, my_price is a Double, and my_volume is a Double). 32 | P a g e It is necessary to use the addDataPoint method in the uploadFactlet that is created to add points one at a time. The next step is to call the Upload method in the UploadFactlet to tell it to upload. Subsequently getErrorMessage or getErrorValue is called on to see if it was a success. “Successful” will be returned by getErrorMessage and getErrorValue will return 0 if nothing went wrong. C#: uFactlet = FactSet.UploadFactlet.MakeUploadFactlet("TestOFDB_CSharp", "Id,Date,my_price,my_volume", "Id,Date,Double,Double"); // Make an upload factlet string[] dates = { "04/10/2013", "04/11/2013", "04/12/2013" }; double[] fds_price = { 93.33, Double.NaN, 92.65 }; double[] fds_volume = { 388.205, Double.NaN, 359.396 }; double[] xom_price = { 88.68, Double.NaN, 89.22 }; double[] xom_volume = { 14826.0, Double.NaN, 14980.0 }; for (int i = 0; i < dates.Length; i++) { uFactlet.addDataPoint("FDS"); // Add one piece of data at a time, column by column uFactlet.addDataPoint(dates[i]); uFactlet.addDataPoint(fds_price[i]); uFactlet.addDataPoint(fds_volume[i]); } for (int i = 0; i < dates.Length; i++) { uFactlet.addDataPoint("XOM"); uFactlet.addDataPoint(dates[i]); uFactlet.addDataPoint(xom_price[i]); uFactlet.addDataPoint(xom_volume[i]); } uFactlet.upload(); // Upload Console.WriteLine(uFactlet.getErrorMessage()); // check success or failure 33 | P a g e Chapter 5: Formula Lookup Sidebar is a formula lookup that provides a robust way of searching for FactSet data formulas along with formula details and definitions. The integration of Sidebar into the Developer’s Toolkit provides a seamless way of finding FactSet Query Language (FQL) and Screening request codes. Upon launching the GUI, it is possible to search for identifiers and formulas. Note: Sidebar integration with the Developer’s Toolkit is for searching for codes, it cannot be used for inserting formulas into the necessary programming language. 5.1 Launching Formula Lookup Formula Lookup can be launched from the Sidebar - OnDemand icon, which gets created when installing the Developer’s Toolkit Plugin. Note: It is necessary to be logged into the FactSet workstation for Sidebar to load. If not already logged in, will be prompted to log into the FactSet workstation when selecting Sidebar - OnDemand. The following Sidebar GUI will launch: 34 | P a g e 5.2 Searching for Data FactSet’s formula lookup allows users to streamline the process of creating FactSet formulas. It features targeted search results, type-ahead search functionality for identifiers, and function-building capability. 5.2.1 Identifier Lookup The process of searching for and extracting data in Sidebar involves entering identifiers for equities, indices and yields, among other categories. The identifier can be entered directly in the Enter ID field which utilizes type-ahead functionality or searched for by launching the Identifier Lookup magnifying glass, as displayed in the screenshot below. 5.2.2 Search for Data Formulas Data Items are searched for by entering keywords in the Formula Lookup section. There is a thesaurus built in, so that the data item search is not a text search for the entered keyword. By default, the returned list of formulas will match all of the databases based on a user’s subscription. To limit search results to FactSet Recommended formulas only, click the FactSet Recommended button . To control which formula libraries are being searched, click the Filter button . The option is available to toggle between FQL and Screening codes. 35 | P a g e Once a formula is selected, a Formula Arguments section loads, in which it is possible to specify the report basis, date, frequency, currency, and other formula arguments that are specific to the data item selected, using the drop-down menus. A Definition section can also be expanded to view the formula name, data source, and description. Once an identifier and data item are selected, the Formula Workspace section can be expanded to add a function. 36 | P a g e 5.3 Sample Scripts The following examples detail selected data items in Sidebar and the corresponding script. C++ factSet::Factlet* factlet; // Create a factlet pointer variable to use factlet = FactSet::Factlet::ExtractFormulaHistory(<string representing ids>, <string that matches what is in sidebar formula workspace window>); Java Factlet factlet; // Create a factlet variable to use factlet = Factlet.ExtractFormulaHistory(<string representing ids>, <string that matches what is in sidebar formula workspace window>); VB Dim factlet As Factlet ' Create a factlet pointer variable to use factlet = FactSet.Factlet.ExtractFormulaHistory(<string representing ids>, <string that matches what is in sidebar formula workspace window>) C# FactSet.Factlet factlet; // Create a factlet pointer variable to use factlet = FactSet.Factlet.ExtractFormulaHistory(<string representing ids>, <string that matches what is in sidebar formula workspace window>); Python # creating a factlet variable is not necessary factlet = Factlet.ExtractFormulaHistory(<string representing ids>, <string that matches what is in sidebar formula workspace window>); 37 | P a g e Example 1: In this example, the selected security in Sidebar is Exxon Mobil, with identifier XOM. The selected item in the FQL mode is EPS from the FactSet Fundamentals database, with the formula arguments specifying 5 years of annual history. The Formula Workspace section previews the code as FF_EPS(ANN,0,-5AY,FY). C++ factlet = FactSet::Factlet::ExtractFormulaHistory("XOM_US", "FF_EPS(ANN,0,-5AY,FY)"); Java factlet = Factlet.ExtractFormulaHistory("XOM_US", "FF_EPS(ANN,0,5AY,FY)"); VB factlet = FactSet.Factlet.ExtractFormulaHistory("XOM_US", "FF_EPS(ANN,0,5AY,FY)") C# factlet = FactSet.Factlet.ExtractFormulaHistory("XOM_US", "FF_EPS(ANN,0,5AY,FY)"); Python factlet = Factlet.ExtractFormulaHistory("XOM_US", "FF_EPS(ANN,0,5AY,FY)"); 38 | P a g e Example 2: In this example, the selected index is the Russell 3000 and the selected item in the FQL code is price history, with the formula arguments specifying one year of daily history. The Formula Workspace section previews the code as FG_PRICE(0,1AY,D). C++ factlet = FactSet::Factlet::ExtractFormulaHistory("R_3000", "FG_PRICE(0,1AY,D)"); Java factlet = Factlet.ExtractFormulaHistory("R_3000", "FG_PRICE(0,-1AY,D)"); VB factlet = FactSet.Factlet.ExtractFormulaHistory("R_3000", "FG_PRICE(0,1AY,D)") C# factlet = FactSet.Factlet.ExtractFormulaHistory("R_3000", "FG_PRICE(0,1AY,D)"); Python factlet = Factlet.ExtractFormulaHistory("R_3000", "FG_PRICE(0,-1AY,D)"); 39 | P a g e Chapter 6: Factlet Object The fetching and execution of the factlet object requests discussed in section 4.2 is done using the FactSetOnDemand API. A user should create one FactSetOnDemandAPI, otherwise the FactSet shared libraries can become corrupted. The static method ‘GetInstance’ can be used in all of the FactSetOnDemand classes to provide access to the API. The following is a comprehensive list of available methods to access the fetched data once the factlet request is executed: isComplete This method returns a Boolean result indicating if the factlet has finished executing and parsing. The result true indicates that the factlet has terminated parsing and execution. This method returns instantly and does not wait for the Factlet to terminate execution. getFactletResult This method returns a string representation of the factlet report in ASCII text. This string can be very large, sometimes up to 15 megabytes or more. It is recommended that if the Factlet\DataFrame was created and parsed in pipe-delimited format, that data is accessed through the value assessors below. This method does wait for the factlet to terminate execution if it is called before completion. getFactletRequest This method returns a string representation of the factlet request in ASCII text. This string is the same string of name-value pairs that was created when the factlet object was instantiated. This method does wait for the factlet to terminate execution if it is called before completion. getNumberOfColumns This method returns an integer representation of the number of columns in the given factlet DataFrame. If the DataFrame does not parse or fails to parse due to an error, this result will be negative one (-1). Before accessing any information from a DataFrame, the user should check to see if the DataFrame has an error value associated with it. This method does wait for the factlet to terminate execution if it is called before completion. getNumberOfRows This method returns an integer representation of the number of rows in the given factlet DataFrame. If the DataFrame does not parse or fails to parse due to an error, this result will be negative one (-1). Before accessing any information from a DataFrame, the user should check to see if the DataFrame has an error value associated with it. This method does wait for the factlet to terminate execution if it is called before completion. 40 | P a g e getValueAsInteger This method returns the value of the data point at the given DataFrame index as an integer. If the data point is a native double, it is truncated. If the data point is a native date, it is usually returned in YYYYMMDD format as an integer. If the data point is a string, a conversion is attempted; in the event of failure, a non-signaling C++ NaN is returned. This method does wait for the factlet to terminate execution if it is called before completion. getValueAsDouble This method returns the value of the data point at the given DataFrame index as a double. If the data point is a native integer, it is casted to a double type and returned. If the data point is a native date, it is usually returned in YYYYMMDD format as an integer casted to double. If the data point is a string, a conversion is attempted; in the event of failure, a non-signaling C++ NaN is returned. This method does wait for the factlet to terminate execution if it is called before completion. getValueAsString This method returns the value of the data point at the given DataFrame index as a string. If the data point is a native integer or double, it is converted to an ASCII representation. If the data point is a native date, it is usually returned in an ASCII string in the format “DD-mmm-YYYY”. This method does wait for the factlet to terminate execution if it is called before completion. hasError This method returns a Boolean value that indicates if the factlet has encountered any type of error fetching or parsing. The method returns true if an error has been found. This method does wait for the factlet to terminate execution if it is called before completion. getErrorMessage This method returns an ASCII string which gives a short explanation of the error found in the DataFrame. This method does wait for the factlet to terminate execution if it is called before completion. getColumnName This method returns an ASCII string of the column name of the specified column in the DataFrame. This name is the name given by the factlet report. This method does wait for the factlet to terminate execution if it is called before completion. getColumnType This method returns an ASCII string of the column type of the specified column in the DataFrame. This name is the type given by the factlet report. This method does wait for the factlet to terminate execution if it is called before completion. 41 | P a g e getColumnNative This method returns an enumerated integer of the column native storage type of the specified column in the DataFrame. This name is the name given by the factlet report. See DataFrame native types for values. This method does wait for the factlet to terminate execution if it is called before completion. Cleanup This method is available in languages that do not have destructors such as VB and Java. This method will delete the factlet’s DataFrame from the FactSet OnDemand API. If the user attempts to access data from the DataFrame after this method is called, an exception will be thrown. This method does not wait for the factlet to terminate execution if it is called before completion. toString This method prints out an ASCII string of the DataFrame. This method prints out each value to string in a CSV format. This string can be extremely large if the DataFrame is large. It is not recommended to use this method on non-parsed and large factlets. The first two lines of the ASCII summary will be the column name and type, respectively. This method does wait for the factlet to terminate execution if it is called before completion. getSummary This method prints out an ASCII summary of the factlet. Each column will be briefly detailed for name, type and native storage, as can be seen in the output example below: Factlet with ID : 2 Known Error Code : 0 Number of Rows : 3 Number of Cols : 4 Col Name 0 Id 1 Date 2 p_price 3 p_volume 42 | P a g e Type Entity Date Float Float Native String Date Double Double Chapter 7: Create DataFrame CreateDataFrame is the first method call used in fetching and parsing data. This method sends an HTTPS request to DataDirect, allocates memory to receive the data and parses the data. This method also checks the entire process for errors. Each CreateDataFrame spawns a new thread so that these actions can occur in parallel. If the HTTPS throttle is set high enough, the user may use multiple threads for fetching and parsing. The first argument of the method is always the DataFrame Factlet Request. Other possible parameters are optional and include file output, data transformations and file path redirection. Once a DataFrame is created, it begins fetching and parsing and other DataFrames may be created. Some highlight properties of DataFrames are the following: Rectangular Form – DataFrames parse typically into rectangular matrices. Column Normal – DataFrame’s columns have a name, a type and a native storage type. Error Content - DataFrames report errors if they are detected. Zero Indexed – The DataFrame is indexed starting at zero and ending at its size minus one. Parse Independently – DataFrames may finish out of order depending on the request. Unique ID – DataFrames are assigned a unique ID at creation. Deleted by user – The user must call DELETEDATAFRAME to delete it. Can make files – DataFrames may output files during parsing time if requested. The parameters for CreateDataFrame are outlined below: Parameter Name factletString Parameter Type String dataFrameFileOutput Integer transformMode 43 | P a g e Integer Description This string is an ASCII string that describes a Factlet to be run. Note, at present time this string should contain a name-value pair of ‘format=pipe’ if the user desires it to be parsed. This is a field that allows the user to write the Factlet to a file. There are several types of outputs possible such as text files and Excel 2.0 format files. Table 2 in Appendix provides a comprehensive list of file output types. This is a reserved field for matrix transfers such as a matrix transpose if applicable. At this time, this is not implemented. fileName String This is a string for the desired filename output. This string should not have a file extension. If the user gives a file name with an absolute path and name the file will be written to the location with the chosen output type’s extension. If the file name is relative, the file will be written from the current working directory of the application. The following example uses an overloaded method that only uses the ‘factletString’ parameter. Note: In this example, the ExtractDataSnapshot factlet discussed in section 4.2.2 is used. If no format is requested in the Factlet string, the report is retuned as a XML text file. For FactSet to properly parse the file for the user, it must be specified as a ‘pipe’ format. This means the report is pipe-delimited. If the user desires to retrieve the XML format, they may simply not specify the pipe format and set the transform mode to NO_PARSE_NO_CHECK. The XML text can be retrieved by simply calling GetDataFrameFactletResult. C++ int dataFrameID = factSetOnDemand->createDataFrame( "factlet=extractdatasnapshot&ids=IBM&items=p_price&dates=&format=pipe&"); Java int dataFrameID = factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=IBM&items=p_price&dates=&format=pipe&"); VB Dim dataFrameID As Integer = factSetOnDemand.createDataFrame( "factlet=extractdatasnapshot&ids=ibm&items=p_price&dates=&format=pipe&") C# int dataFrameID = factSetOnDemand.createDataFrame( "factlet=extractdatasnapshot&ids=ibm&items=p_price&dates=&format=pipe&"); 44 | P a g e 7.1 IsDataFrameComplete This method returns true if the given DataFrame response is complete. This processing includes fetching the data over HTTPS, parsing the response into a matrix and checking for errors. If the DataFrame is still parsing or does not exist, this function returns false. This function could be used in a loop that sleeps while the DataFrame is not complete. If the user is running multiple Frames simultaneously, the method could check different frames and handle them as they complete. C++ bool isComplete = factSetOnDemand->isDataFrameComplete(dataFrameId); \ Java boolean isComplete = factSetOnDemand.isDataFrameComplete(dataFrameID); VB Dim isComplete As Boolean = factSetOnDemand.isDataFrameComplete(dataFrameID); C# bool isComplete = factSetOnDemand.isDataFrameComplete(dataFrameID); 7.2 GetDataFrameErrorValue Once the DataFrame has finished parsing, it should be checked for an error value. If there are no errors returned, the result will be zero. Table 3 in the Appendix provides a comprehensive list of error messages and what the error indicates. 7.3 GetDataFrameFactletRequest \ GetDataFrameFactletResult GetDataFrameFactletRequest method gets the specified DataFrame’s request string. This is the same string passed into the ‘factletString’ parameter in CreateDataFrame. GetDataFrameFactletResult method gets the ASCII result string returned as a result of the Factlet String. This result can vary widely in size from a few kilobytes to a few megabytes depending on the factlet request. This string may even be obtained if the DataFrame fails to parse. 45 | P a g e C++ std::string factletRequest= factSetOnDemand->getDataFrameFactletRequest(dataFrameID); std::string factletResult = factSetOnDemand->getDataFrameFactletResult(dataFrameID); Java String factletRequest = factSetOnDemand.getDataFrameFactletRequest(dataFrameID); String factletResult = factSetOnDemand.getDataFrameFactletResult(dataFrameID); VB Dim factletRequest As String = factSetOnDemand.getDataFrameFactletRequest(dataFrameID) Dim factletResult As String = factSetOnDemand.getDataFrameFactletResult(dataFrameID) C# string factletRequest = factSetOnDemand.getDataFrameFactletRequest(dataFrameID); string factletResult = factSetOnDemand.getDataFrameFactletResult(dataFrameID); 7.4 GetDataFrameNumberOfRows \ GetDataFrameNumberOfCols These methods return the dimensions of the DataFrames in terms of the number of Rows and Columns respectively. Note that in a column the data type is always the same. C++ int numRows = factSetOnDemand->getDataFrameNumberOfRows(dataFrameID); int numCols = factSetOnDemand->getDataFrameNumberOfCols(dataFrameID); Java int numRows = factSetOnDemand.getDataFrameNumberOfRows(dataFrameID); int numCols = factSetOnDemand.getDataFrameNumberOfCols(dataFrameID); VB Dim numRows As Integer = factSetOnDemand.getDataFrameNumberOfRows(dataFrameID) Dim numCols As Integer = factSetOnDemand.getDataFrameNumberOfCols(dataFrameID) C# int numRows = factSetOnDemand.getDataFrameNumberOfRows(dataFrameID); int numCols = factSetOnDemand.getDataFrameNumberOfCols(dataFrameID); 7.5 GetDataFrameColumnName \ GetDataFrameColumnType GetDataFrameColumnName and GetDataFrameColumnType both return string representatives of the column. The column name typically is a descriptor such as ‘Id’, ‘Date’ or ‘Price’. The column type is a representation of how the data should be interpreted such as ‘Date’, ‘String’, ‘Double’, or ‘Float’. 46 | P a g e C++ std::string colName = factSetOnDemand->getDataFrameColumnName(dataFrameID, col); std::string colType = factSetOnDemand->getDataFrameColumnType(dataFrameID, col); Java String colName = factSetOnDemand.getDataFrameColumnName(dataFrameID, col); String colType = factSetOnDemand.getDataFrameColumnType(dataFrameID, col); VB Dim colName As String = factSetOnDemand.getDataFrameColumnName(dataFrameID, col) Dim colType As String = factSetOnDemand.getDataFrameColumnType(dataFrameID, col) C# string colName = factSetOnDemand.getDataFrameColumnName(dataFrameID, col); string colType = factSetOnDemand.getDataFrameColumnType(dataFrameID, col); 7.6 GetDataFrameColumnNative This method gets the native storage type of the given column. This native storage type is one of three C data types, a double precision floating point value, an integer value or a character string. Requesting data in the native storage type for use is the fastest way to return it. Otherwise, conversions occur. C++ int colNative = factSetOnDemand->getDataFrameColumnNative(dataFrameID, col); Java int colNative = factSetOnDemand.getDataFrameColumnNative(dataFrameID, col); VB Dim colNative As Integer = factSetOnDemand.getDataFrameColumnNative(dataFrameID, col) C# int colNative = factSetOnDemand.getDataFrameColumnNative(dataFrameID, col); The following is the list of native storage types that can occur: Type Name UNKNOWN STRINGVALUE DOUBLEVALUE INTEGERVALUE DATEVALUE 47 | P a g e Type Index 0 3 1 2 4 7.7 GetDataFrameValueAsString \ GetDataFrameValueAsInteger \ GetDataFrameValueAsDouble These three methods are used to get the values of particular cells in a DataFrame. It is advised that the corresponding method is called based on the native column type. Despite this advice, the user may attempt to convert any value into any type but there will be a performance penalty depending on the cast. Larger performance penalties occur in string to numeric and numeric to string conversions. C++ std::string strVal=factSetOnDemand->getDataFrameValueAsString(dataFrameID, col, row); int integerVal =factSetOnDemand->getDataFrameValueAsInteger(dataFrameID, col, row); double doubleVal = factSetOnDemand->getDataFrameValueAsDouble(dataFrameID, col, row); Java std::string strVal=factSetOnDemand.getDataFrameValueAsString(dataFrameID, col, row); int integerVal =factSetOnDemand.getDataFrameValueAsInteger(dataFrameID, col, row); double doubleVal = factSetOnDemand.getDataFrameValueAsDouble(dataFrameID, col, row); VB Dim strVal As String=factSetOnDemand.getDataFrameValueAsString(dataFrameID, col, row) Dim intValAs Integer=factSetOnDemand.getDataFrameValueAsInteger(dataFrameID,col, row) Dim doblValAs Double=factSetOnDemand.getDataFrameValueAsDouble(dataFrameID, col, row) C# string strVal = factSetOnDemand.getDataFrameValueAsString (dataFrameID, col, row); int integerVal = factSetOnDemand.getDataFrameValueAsInteger(dataFrameID, col, row); double doubleVal= factSetOnDemand.getDataFrameValueAsDouble (dataFrameID, col, row); 48 | P a g e Chapter 8: Troubleshooting 8.1 IsDataFrameValueInvalid This method returns if the specified DataFrame value is invalid. Invalid can mean that the value does not exist in FactSet’s database. An example of this would be Apple’s dividends before 2012. Also, an invalid value could mean that the data was unable to be parsed properly. For example, if the library tried to convert the string ‘q’ into an integer. C++ bool isInvalid = factSetOnDemand->isDataFrameValueInvalid(dataFrameId,col,row); Java boolean isInvalid = factSetOnDemand.isDataFrameValueInvalid(dataFrameID,col,row); VB Dim isInvalid As Boolean = factSetOnDemand.isDataFrameInvalid(dataFrameID, col, row) C# bool isInvalid = factSetOnDemand.isDataFrameValueInvalid(dataFrameID, col, row ); 8.2 TranslateErrorMessage \ GetFactSetErrorValue Both of these methods are meant to be used together to help the user identify errors and resolve them quickly. GetFactSetErrorValue returns a general error message that would not be typically associated with any one DataFrame. An example of this would be a system resources allocation error. When a user gets an error message from either GetFactSetErrorValue or GetDataFrameErrorValue, they may translate it into a string type error message using TranslateErrorMessage, the preferred method for translating. C++ int errorVal = factSetOnDemand->getFactSetErrorValue( ); std::string errorMsg = factSetOnDemand->translateErrorMessage(errorVal); Java int errorVal = factSetOnDemand.getFactSetErrorValue( ); String errorMsg = factSetOnDemand.translateErrorMessage(errorVal); VB Dim errorVal As Integer = factSetOnDemand.getFactSetErrorValue( ) Dim errorMsg As String = factSetOnDemand.translateErrorMessage(errorVal) C# int errorVal = factSetOnDemand.getFactSetErrorValue( ); string errorMsg = factSetOnDemand.translateErrorMessage(errorVal); Table 3 in Appendix has a comprehensive list of error codes. 49 | P a g e 8.3 GetListOfLivingDataFrames This method returns a list of all the DataFrames that have not been deleted. This method is useful for obtaining a list of DataFrame IDs and parsing them in order of completion. C++ std::vector<int> listOfDataFrameIDs = factSetOnDemand->getListOfLivingDataFrames( ); Java int[] listOfDataFrameIDs = factSetOnDemand.getListOfLivingDataFrames(); VB Dim listOfDataFrameIDs As Integer() = factSetOnDemand.getListOfLivingDataFrames() C# int[] listOfDataFrameIDs = factSetOnDemand.getListOfLivingDataFrames(); 8.4 FactSet Event Logger The FactSet Event Logger (FFEL) is installed as a part of the FactSet OnDemand Developers Toolkit. This feature provides reporting services that will allow FactSet to troubleshoot more efficiently errors in requests for FactSet data. The EventLogger binds references to all major objects in the code base and can be exposed for additional trouble-shooting information. The EventLogger is generated as a HTML report and typically is opened with the client’s web browser automatically when generated. The EventLogger has three key functions: 1. Inventories – Lists of items\events a) Object Inventory – This is a list of all the central objects in the FactSet integration. b) Thread Registry – This is a list of all the threads created in the FactSet integration along with statistics. c) HTTPS Inventory – This is a list of all HTTPS request made along with statistics. d) DataFrame Inventory – This is a list of all the DataFrames and performance statistics. 2. Report Manager – A collection of operating information and configuration information a) Screen Shot – A bitmap image of the clients PC at time of report creating the event log. 50 | P a g e b) Configuration – A list of configuration variables and current values. c) Directory Listings – Lists of files in various important directories. d) Environment Analysis – A brief exploration of environment settings and hardware. 3. EventLogger – A collection of events and errors at runtime. a) External – Any events that occurred outside the Kratos.DLL b) Internal – Any events that occurred at the system call level (Win32API calls). c) Object – Any events that occurred in the Kratos.DLL organized by object The EventLogger report is generated in the location prescribed by the TEMP_DIRECTORY configuration setting. When the FactSet OnDemand Toolkit is installed, by default, this temporary directory is set in the user’s application data. This may be set to any writable location such as the desktop. This method dispatches a thread to create a report. If the Kratos library is dynamically unloaded while the EventLogger report is running, the report will be canceled. There are two options available with the EventLogger report. The first option is to display the report and second is to change the report’s path. By default, the display option is enabled. Note: Even if the EVENTLOGGERON configuration setting is set to false, the EventLogger Report will still get generated, but any events during the EVENTLOGGERON setting being false are not recorded. In order to generate the EventLogger Report: C++ factSetOnDemand->generateEventLoggerReport( true, “” ); Java factSetOnDemand.generateEventLoggerReport( true, “”); VB factSetOnDemand.generateEventLoggerReport( TRUE, “”) C# factSetOnDemand.generateEventLoggerReport( true, “” ); 51 | P a g e Chapter 9: Sample Code The following sample code examples across several languages show the steps from creating a new FactSet OnDemand Object until the data is requested and the old DataFrame is deleted once the data is accessed. The first step entails creating a new FactSet OnDemand Object, which goes into the registry and checks where this library is located and attempts to load it. If the library is not found, it will load it locally and put it into memory. The FactSet credentials can then be stored and any other configuration information that is necessary, such as timeout or throttle details. In the second step, a factlet object is created, as a pointer variable to use. Various factlets are run to examine the unique Ids and Dates in the returned data. In the third step, the createDataFrame should be run before running a factlet. Note, the specified format should be set to pipe for FactSet to properly parse the file for the user. The createDataFrame portion the code sends a request to DataDirect and queues the requests, depending on the specified throttle setting. In this example, multi-threading is used. In the getListOfLivingDataFrames portion of the code, a number is returned for all of the created data frames. Subsequently, listOfDataFrames specifies that, when the data request runs and is completed, check the data for an error, parse it, and then delete it from memory. isDataframe complete > if it’s complete, then it’s ready for data to be accessed and deleted. getDataFrameErrorValue > error is checked if it’s an error TranslateErrorMessage > shows what the error issue is, such as no company ids were entered in the factlet request code. In the fourth step, the getDataFrameFactletRequest allows a user to see a raw text file of data without parsing. In the fifth step, to display the data it is printed to screen and then deleteDataFrame ensures that the old DataFrame is deleted when accessing the data is completed. 52 | P a g e 9.1 C++ Sample Code #ifndef FACTSETONDEMAND_H_ #include "FactSetOnDemand.h" #endif #ifndef WIN32 #include <unistd.h> #endif int main(int argc, char** argv) { // First, we get a handle to the FactSet OnDemand API. // This handle creation loads FactSet's DLL into memory FactSet::FactSetOnDemand* factSetOnDemand = FactSet::FactSetOnDemand::GetInstance(); //***********************************************************************// // CONFIGURATION DEMO USE // //***********************************************************************// if( argc > 1 ){ factSetOnDemand->setConfigurationItem( FactSet::FactSetOnDemand::DATADIRECTUSERNAME, argv[1]); } if( argc > 2 ){ factSetOnDemand->setConfigurationItem( FactSet::FactSetOnDemand::DATADIRECTPASSWORD, argv[2]); } if( argc > 3 ){ factSetOnDemand->setConfigurationItem( FactSet::FactSetOnDemand::PROXYSERVER, argv[3] ); } if( argc > 4 ){ factSetOnDemand->setConfigurationItem( FactSet::FactSetOnDemand::PROXYPORT, argv[4] ); } if( argc > 5 ){ factSetOnDemand->setConfigurationItem( FactSet::FactSetOnDemand::PROXYUSERNAME, argv[5] ); } if( argc > 6 ){ factSetOnDemand->setConfigurationItem( FactSet::FactSetOnDemand::PROXYPASSWORD, argv[6] ); } //***********************************************************************// // FACTLET OBJECT DEMO USE // //***********************************************************************// FactSet::Factlet* factlet; // Create a factlet pointer variable to use // In this example, we will run ExtractFormulaHistory and examine the unique // IDs and Dates in the returned data factlet = FactSet::Factlet::ExtractFormulaHistory("xom,stl-no,fds,ibm,efc,appl,goog", "fg_eps(0,-1m,d)"); printf("%s\n", factlet->getSummary().c_str() ); std::vector<std::string> uniqueIDs = factlet->getUniqueIDs(); printf("%s\n","Printing list of unique IDs:\n"); for( unsigned int i = 0; i < uniqueIDs.size(); i++ ) { printf("\t%s\n",uniqueIDs[i].c_str() ); } std::vector<int> uniqueDates = factlet->getUniqueDates(); printf("%s\n","Printing list of unique dates:\n"); for( unsigned int i = 0; i < uniqueDates.size(); i++ ) { printf("\t%d\n",uniqueDates[i] ); } 53 | P a g e delete factlet; // Note that we must delete the factlet after we are done to prevent memory leaks // Extract Alpha Testing Snapshot factlet = FactSet::Factlet::ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","ALL","M"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","5,7","M"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","Weight,Market_Capitalization","M"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","all","M","","08865810"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractAlphaTestingSnapshot("Y","N","Factset:Calculation Example Model","PERIODS","ALL","M","","","RS","DEFAULT","A","1"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Extract Benchmark Detail factlet = FactSet::Factlet::ExtractBenchmarkDetail("SP50","items","FG_COMPANY_NAME,FG_MKT_VALUE"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractBenchmarkDetail("SP50","items","p_price,proper_name","cutoff","10"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractBenchmarkDetail("SP50","items","p_price","dates","20110115:20110120:d"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Extract Data Snapshot factlet = FactSet::Factlet::ExtractDataSnapshot("ibm","ff_sales(QTR,20110401,RF,EUR)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractDataSnapshot("xom,stl-no","ff_sales(QTR,20110401,,USD)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractDataSnapshot("","ff_sales(QTR,20110401),p_price(20110401)", "ison","sp500"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractDataSnapshot("","ff_sales(QTR,0)","ison","msci_eafe","isonParams","0,1"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractDataSnapshot("","decile(ff_sales(QTR,0))", "ison","sp500"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; 54 | P a g e factlet = FactSet::Factlet::ExtractDataSnapshot("ibm,hd,pg,fds,f-it","FF_FP_END_DATE(QTR,0 L45D),FF_SALES(QTR,0 L45D)","date","20110131"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Extract Econ Data factlet = FactSet::Factlet::ExtractEconData("","","FDS_ECON_DATA('FRBIPSB50001',-121,1,m,step,average)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","","SPEC_ID_DATA('WTI-FDS:FG_PRICE',0,-30,d)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","","IMF_IFS_DATA('11199Z_F',0,9,y),IMF_IFS_DATA('11299Z_F',0,-9,y)","dataitemname",",,US,UK","heading",",,US,UK"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","","EURO_STAT_DATA('CONSCONFBAL@EUZ',0,11,M),TCB_CCI_DATA('CCI',0,-11,M)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","","ECON_EXPR_DATA('ZSCORE(FDS_ECON[GRLM0347861])',10,0,m,step,average)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","","ECON_EXPR_DATA('RETURNS(FDS_ECON[BLSCUSR0000SA0L1E], 1AY)',0,0/0/-10,M)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","","ECON_EXPR_DATA('RETURNS(EURO_STAT[GDPEURNS@GR], 1AY)',0,0/0/-10,Y)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","CC_GB","FDS_ECON_BOPCURR_Y","dates","-10:1:Y"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractEconData("","CC_US,CC_GR","FDS_ECON_GDP_USD_Y","dates","10:-1:Y"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Extract Formula History factlet = FactSet::Factlet::ExtractFormulaHistory("xom","fg_eps(0Q,-5Q,Q)","dates","0Q:5Q:Q"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractFormulaHistory("goog","fg_price","dates","20101215:20110115:D"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractFormulaHistory("stl-no","p_price(-5,0,Q,USD),ff_sales(QTR,5,0,Q,,USD)","dates","-5:0:Q"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; 55 | P a g e factlet = FactSet::Factlet::ExtractFormulaHistory("XOM","BETA('SP50',0,-59M,M)"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractFormulaHistory("GE","AVG(FF_EPS(QTR,0,5,Q)),MAX(FF_EPS(QTR,0,-5,Q)),MIN(FF_EPS(QTR,0,-5,Q)),STD(FF_EPS(QTR,0,-5,Q))"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractFormulaHistory("","proper_name,ff_eps(qtr,0,5,Q),p_price(0,-5,q)","ison","sp500"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Extract Options Snapshot factlet = FactSet::Factlet::ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE","","P_OPT_UNDERLYING_SECURITY=","IBM ","","","",""); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE,P_OPT_CLOSE_PRICE","","P_OPT_UNDERLYI NG_SECURITY=","GE","","","",""); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE","","P_OPT_UNDERLYING_SECURITY=","GE" ,"","20100513","",""); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Extract Estimates Actuals factlet = FactSet::Factlet::FactSetEstimatesActuals("msft","eps,sales","NOW","fiscalperiod","1,0","periodtype","annual"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesActuals("msft,ibm","eps,sales","NOW","fiscalperiod","1,0","periodtype","annual"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesActuals("xom","eps,sales","12/31/2010","fiscalperiod","1,0","periodtype","quarterly_roll"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesActuals("xom","eps,sales","12/31/2010","fiscalperiod","1,0","periodtype","quarterly","fields","fe_actual"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Estimates Broker Detail factlet = FactSet::Factlet::FactSetEstimatesBrokerDetail("msft","eps","0D","1AY","fiscalperiod","1"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesBrokerDetail("msft,ibm","eps","0D","1AY","fiscalperiod","1"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; 56 | P a g e factlet = FactSet::Factlet::FactSetEstimatesBrokerDetail("xom","sales","0Y","0Y2Q","fiscalperiod","2","periodtype","quarterly"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesBrokerDetail("xom,stl-no,cvx","eps","0D","2Q","fiscalPeriod","1","periodtype","quarterly","fields","FE_ANALYSTNAME,FE_BROKERNAME,FE_ESTIMATE,FE_ EST_REV_VAL_ARROW"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesBrokerDetail("xom","sales","0Y","0Y2Q","fiscalperiod","2","periodtype","quarterly","display","histo"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Estimates Consensus factlet = FactSet::Factlet::FactSetEstimatesConsensus("msft","eps,capex","NOW","fiscalperiod","1,2","periodtype" ,"annual"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesConsensus("msft,ibm","eps,capex","12/31/2011","fiscalperiod","1,2"," periodtype","quarterly"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesConsensus("msft","eps,bvps","NOW","fiscalperiod","1","periodtype","a nnual","fields","fe_mean"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesConsensus("aapl","eps,capex","NOW","fiscalperiod","1","periodtype"," annual","previousDates","-30","fields","prev"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Estimates Guidance factlet = FactSet::Factlet::FactSetEstimatesGuidance("FTI","EPS","NOW","fiscalperiod","1,2","periodtype","annual "); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesGuidance("fti,oii","eps","NOW","fiscalperiod","1","periodtype","annu al"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesGuidance("oii","eps","12/31/2011","fiscalperiod","1","periodtype","a nnual"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesGuidance("FTI","eps","NOW","fiscalperiod","1","periodtype","annual", "fields","fe_mean,Guidance Mean"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; // Estimates Suprise 57 | P a g e factlet = FactSet::Factlet::FactSetEstimatesSurprise("IBM","eps","1/19/2012","fiscalperiod","0","periodtype","an nual","statistic","mean"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesSurprise("blk,bac","eps","1/18/2012","fiscalperiod","0","periodtype" ,"quarterly","statistic","mean"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; factlet = FactSet::Factlet::FactSetEstimatesSurprise("IBM","eps","1/19/2012","fiscalperiod","0","periodtype","an nual","statistic","mean","fields","Surprise_Before,Surprise_After"); printf("%s\n", factlet->getSummary().c_str() ); delete factlet; //***********************************************************************// // FACTSET ONDEMAND API OBJECT DEMO USE // //***********************************************************************// // Demo fetching a Factlet using the OnDemand API - simply print out the report text FactSet::DataFrameID firstDataFrame = factSetOnDemand->createDataFrame( "factlet=extractdatasnapshot&ids=fds&items=p_price&dates=&format=pipe&"); while (!factSetOnDemand->isDataFrameComplete(firstDataFrame)){ #ifdef WIN32 Sleep( 10 ); #else usleep( 10*1000 ); #endif } std::string firstFactletString = factSetOnDemand->getDataFrameFactletResult(firstDataFrame); factSetOnDemand->deleteDataFrame( firstDataFrame ); // Delete DataFrame when done printf("Got first factlet result \n\"%s\"\n", firstFactletString.c_str() ); // Create many factlets and parse - allow them to queue - mutlithreaded approach factSetOnDemand>createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&format=pipe&"); factSetOnDemand>createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&format=pipe&"); factSetOnDemand>createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft&items=p_price&dates=&format=pipe&"); factSetOnDemand>createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft,efc&items=p_price,ff_sales,p_volume,fg_eps& dates=&format=pipe&"); factSetOnDemand>createDataFrame("factlet=ExtractDataSnapshot&ids=&items=p_price,ff_sales,p_volume,fg_eps&dates=&forma t=pipe&"); factSetOnDemand>createDataFrame("factlet=ExtractDataSnapshot&ids=imb&items=&dates=&format=pipe&"); // Process the frames and print to console std::vector<FactSet::DataFrameID> listOfDataFrames = factSetOnDemand>getListOfLivingDataFrames(); FactSet::DataFrameID dataFrameID; for( unsigned int i = 0; i < listOfDataFrames.size(); i++ ) { dataFrameID = listOfDataFrames.at(i); printf("\n\n\nGetting Data Frame with ID = %d\n", dataFrameID ); while (!factSetOnDemand->isDataFrameComplete(dataFrameID)) { #ifdef WIN32 Sleep( 100 ); #else usleep( 100*1000 ); #endif } 58 | P a g e printf("%s\n", factSetOnDemand->getDataFramePropertyValue(dataFrameID, FactSet::FactSetOnDemand::DATAFRAME_SUMMARY ).c_str() ); factSetOnDemand->deleteDataFrame( dataFrameID ); } // Demo XML fetch - Do not use DataFrame parsing // Note: for XML, there is no FORMAT=PIPE argument dataFrameID = factSetOnDemand->createDataFrame( "factlet=ExtractFormulaHistory&ids=ibm,efc&items=p_price(0,-5d,d)&dates=&", FactSet::FactSetOnDemand::NONE, FactSet::FactSetOnDemand::NO_PARSE_NO_CHECK); while( !factSetOnDemand->isDataFrameComplete( dataFrameID ) ){ #ifdef WIN32 Sleep( 10 ); #else usleep( 10*1000 ); #endif } int errorCode = factSetOnDemand->getDataFrameErrorValue(dataFrameID); if(errorCode != 0) { std::string errorCodeTranslation = factSetOnDemand->translateErrorMessage( errorCode ); printf("Detected Error Code = %d = '%s'\n",errorCode, errorCodeTranslation.c_str() ); } std::string XMLResult = factSetOnDemand->getDataFrameFactletResult( dataFrameID ); factSetOnDemand->deleteDataFrame( dataFrameID ); printf("XML Demo \n\n%s", XMLResult.c_str()); // Unload library FactSet::FactSetOnDemand::CleanUp(); return 0; } C# Sample Clode using System; using System.Collections.Generic; using System.Text; using FactSet; namespace KratosCSharpTest { class Program { static int Main(string[] args) { // First, we get a handle to the FactSet OnDemand API. // This handle creation loads FactSet's DLL into memory FactSet.FactSetOnDemand factSetOnDemand = FactSet.FactSetOnDemand.GetInstance(); //***********************************************************************// // CONFIGURATION DEMO USE // //***********************************************************************// if (args.Length > 0) { factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.DATADIRECTUSERNAME,args[0]); } if (args.Length > 1) { factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.DATADIRECTPASSWORD, args[1]); } if (args.Length > 2) { factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYSERVER, args[2]); } if (args.Length > 3) { factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYPORT, args[3]); } if (args.Length > 4) { factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYUSERNAME, args[4]); } if (args.Length > 5) { factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYPASSWORD, args[5]); } //***********************************************************************// 59 | P a g e // FACTLET OBJECT DEMO USE // //***********************************************************************// FactSet.Factlet factlet; // Create a factlet pointer variable to use // In this example, we will run ExtractFormulaHistory and examine the unique // IDs and Dates in the returned data factlet = FactSet.Factlet.ExtractFormulaHistory("xom,stl-no,fds,ibm,efc,appl,goog", "fg_eps(0,-1m,d)"); System.Console.Write(factlet.getSummary()); String[] uniqueIDs = factlet.getUniqueIDs(); System.Console.Write("Printing list of unique IDs:\n"); foreach (string ID in uniqueIDs) { System.Console.Write("\t" + ID + "\n"); } int[] uniqueDates = factlet.getUniqueDates(); System.Console.Write("Printing list of unique dates:\n"); foreach (int date in uniqueDates) { System.Console.Write("\t" + Convert.ToString(date) + "\n"); } factlet.cleanUp(); // Note that we must clean up in C# because it is garbage collected // Extract Alpha Testing Snapshot factlet = FactSet.Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","ALL","M"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","5,7","M"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","Weight,Market_Capitalization","M"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","all","M","","08865810"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractAlphaTestingSnapshot("Y","N","Factset:Calculation Example Model","PERIODS","ALL","M","","","RS","DEFAULT","A","1"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Extract Benchmark Detail factlet = FactSet.Factlet.ExtractBenchmarkDetail("SP50","items","FG_COMPANY_NAME,FG_MKT_VALUE"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractBenchmarkDetail("SP50","items","p_price,proper_name",new string[]{"cutoff","10"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractBenchmarkDetail("SP50","items","p_price",new string[]{"dates","20110115:20110120:d"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Extract Data Snapshot factlet = FactSet.Factlet.ExtractDataSnapshot("ibm","ff_sales(QTR,20110401,RF,EUR)"); 60 | P a g e System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractDataSnapshot("xom,stlno,fds,ibm,efc,appl,goog","ff_sales(QTR,20110401,,USD)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractDataSnapshot("","ff_sales(QTR,20110401),p_price(20110401)", new string[]{"ison","sp500"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractDataSnapshot("","ff_sales(QTR,0)",new string[]{"ison","msci_eafe","isonParams","0,1"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractDataSnapshot("","decile(ff_sales(QTR,0))", new string[]{"ison","sp500"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractDataSnapshot("ibm,hd,pg,fds,fit","FF_FP_END_DATE(QTR,0 L45D),FF_SALES(QTR,0 L45D)",new string[]{"date","20110131"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Extract Econ Data factlet = FactSet.Factlet.ExtractEconData("","","FDS_ECON_DATA('FRBIPSB50001',-121,1,m,step,average)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","","SPEC_ID_DATA('WTI-FDS:FG_PRICE',0,30,d)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","","IMF_IFS_DATA('11199Z_F',0,9,y),IMF_IFS_DATA('11299Z_F',0,-9,y)",new string[]{"dataitemname",",,US,UK","heading",",,US,UK"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","","EURO_STAT_DATA('CONSCONFBAL@EUZ',0,11,M),TCB_CCI_DATA('CCI',0,-11,M)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","","ECON_EXPR_DATA('ZSCORE(FDS_ECON[GRLM0347861])',10,0,m,step,average)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","","ECON_EXPR_DATA('RETURNS(FDS_ECON[BLSCUSR0000SA0L1E], 1AY)',0,0/0/-10,M)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","","ECON_EXPR_DATA('RETURNS(EURO_STAT[GDPEURNS@GR], -1AY)',0,0/0/10,Y)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); 61 | P a g e factlet = FactSet.Factlet.ExtractEconData("","CC_GB","FDS_ECON_BOPCURR_Y",new string[]{"dates","-10:-1:Y"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractEconData("","CC_US,CC_GR","FDS_ECON_GDP_USD_Y",new string[]{"dates","-10:-1:Y"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Extract Formula History factlet = FactSet.Factlet.ExtractFormulaHistory("xom","fg_eps(0Q,-5Q,Q)",new string[]{"dates","0Q:-5Q:Q"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractFormulaHistory("goog","fg_price",new string[]{"dates","20101215:20110115:D"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractFormulaHistory("stl-no","p_price(5,0,Q,USD),ff_sales(QTR,-5,0,Q,,USD)",new string[]{"dates","-5:0:Q"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractFormulaHistory("XOM","BETA('SP50',0,-59M,M)"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractFormulaHistory("GE","AVG(FF_EPS(QTR,0,5,Q)),MAX(FF_EPS(QTR,0,-5,Q)),MIN(FF_EPS(QTR,0,-5,Q)),STD(FF_EPS(QTR,0,-5,Q))"); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractFormulaHistory("","proper_name,ff_eps(qtr,0,5,Q),p_price(0,-5,q)",new string[]{"ison","sp500"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Extract Options Snapshot factlet = FactSet.Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE","","P_OPT_UNDERLYING_SECURITY=","IBM", "","","",""); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE,P_OPT_CLOSE_PRICE","","P_OPT_UNDERLYING _SECURITY=","GE","","","",""); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE","","P_OPT_UNDERLYING_SECURITY=","GE"," ","20100513","",""); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Extract Estimates Actuals factlet = FactSet.Factlet.FactSetEstimatesActuals("msft","eps,sales","NOW",new string[]{"fiscalperiod","-1,0","periodtype","annual"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesActuals("msft,ibm","eps,sales","NOW",new string[]{"fiscalperiod","-1,0","periodtype","annual"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); 62 | P a g e factlet = FactSet.Factlet.FactSetEstimatesActuals("xom","eps,sales","12/31/2010",new string[]{"fiscalperiod","-1,0","periodtype","quarterly_roll"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesActuals("xom","eps,sales","12/31/2010",new string[]{"fiscalperiod","-1,0","periodtype","quarterly","fields","fe_actual"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Estimates Broker Detail factlet = FactSet.Factlet.FactSetEstimatesBrokerDetail("msft","eps","0D","-1AY",new string[]{"fiscalperiod","1"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesBrokerDetail("msft,ibm","eps","0D","1AY",new string[]{"fiscalperiod","1"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesBrokerDetail("xom","sales","0Y","0Y-2Q",new string[]{"fiscalperiod","2","periodtype","quarterly"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesBrokerDetail("xom,stl-no,cvx","eps","0D","2Q",new string[]{"fiscalPeriod","1","periodtype","quarterly","fields","FE_ANALYSTNAME,FE_BROKERNAME,FE_ESTIMAT E,FE_EST_REV_VAL_ARROW"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesBrokerDetail("xom","sales","0Y","0Y-2Q",new string[]{"fiscalperiod","2","periodtype","quarterly","display","histo"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Estimates Consensus factlet = FactSet.Factlet.FactSetEstimatesConsensus("msft","eps,capex","NOW",new string[]{"fiscalperiod","1,2","periodtype","annual"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesConsensus("msft,ibm","eps,capex","12/31/2011",new string[]{"fiscalperiod","1,2","periodtype","quarterly"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesConsensus("msft","eps,bvps","NOW",new string[]{"fiscalperiod","1","periodtype","annual","fields","fe_mean"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesConsensus("aapl","eps,capex","NOW",new string[]{"fiscalperiod","1","periodtype","annual","previousDates","-30","fields","prev"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Estimates Guidance factlet = FactSet.Factlet.FactSetEstimatesGuidance("FTI","EPS","NOW",new string[]{"fiscalperiod","1,2","periodtype","annual"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesGuidance("fti,oii","eps","NOW",new string[]{"fiscalperiod","1","periodtype","annual"}); 63 | P a g e System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesGuidance("oii","eps","12/31/2011",new string[]{"fiscalperiod","1","periodtype","annual"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesGuidance("FTI","eps","NOW",new string[]{"fiscalperiod","1","periodtype","annual", "fields","fe_mean,Guidance Mean"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); // Estimates Suprise factlet = FactSet.Factlet.FactSetEstimatesSurprise("IBM","eps","1/19/2012",new string[]{"fiscalperiod","0","periodtype","annual","statistic","mean"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesSurprise("blk,bac","eps","1/18/2012",new string[]{"fiscalperiod","0","periodtype","quarterly","statistic","mean"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); factlet = FactSet.Factlet.FactSetEstimatesSurprise("IBM","eps","1/19/2012",new string[]{"fiscalperiod","0","periodtype","annual","statistic","mean","fields","Surprise_Before,Surpris e_After"}); System.Console.Write(factlet.getSummary()); factlet.cleanUp(); //***********************************************************************// // FACTSET ONDEMAND API OBJECT DEMO USE // //***********************************************************************// // Demo fetching a Factlet using the OnDemand API - simply print out the report text int firstDataFrame = factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=fds&items=p_price&dates=&format=pipe&"); while (!factSetOnDemand.isDataFrameComplete(firstDataFrame)){ System.Threading.Thread.Sleep(100); } String firstFactletString = factSetOnDemand.getDataFrameFactletResult(firstDataFrame); factSetOnDemand.deleteDataFrame( firstDataFrame ); // Delete DataFrame when done System.Console.Write("Got first factlet result \n" + firstFactletString + "\n" ); // Create many factlets and parse - allow them to queue - mutlithreaded approach factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&form at=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&form at=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft&items=p_price&dates= &format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft,efc&items=p_price,ff _sales,p_volume,fg_eps&dates=&format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=&items=p_price,ff_sales,p_vol ume,fg_eps&dates=&format=pipe&"); 64 | P a g e factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=imb&items=&dates=&format=pipe &"); // Process the frames and print to console int[] listOfDataFrameIDs = factSetOnDemand.getListOfLivingDataFrames(); int dataFrameID; for( int i = 0; i < listOfDataFrameIDs.Length; i++ ) { dataFrameID = listOfDataFrameIDs[i]; System.Console.Write("\n\n\nGetting Data Frame with ID = " + dataFrameID ); while (!factSetOnDemand.isDataFrameComplete(dataFrameID)) { System.Threading.Thread.Sleep(100); } System.Console.Write(factSetOnDemand.getDataFramePropertyValue(dataFrameID, FactSetOnDemand.DATAFRAME_SUMMARY) + "\n"); factSetOnDemand.deleteDataFrame( dataFrameID ); } // Demo XML fetch - Do not use DataFrame parsing // Note: for XML, there is no FORMAT=PIPE argument dataFrameID = factSetOnDemand.createDataFrame( "factlet=ExtractFormulaHistory&ids=ibm,efc&items=p_price(0,5d,d)&dates=&", FactSetOnDemand.NO_FILE, FactSetOnDemand.NO_PARSE_NO_CHECK, null); while( !factSetOnDemand.isDataFrameComplete( dataFrameID ) ){ System.Threading.Thread.Sleep(100); } int errorCode = factSetOnDemand.getDataFrameErrorValue(dataFrameID); if(errorCode != 0) { string errorCodeTranslation = factSetOnDemand.translateErrorMessage( errorCode ); System.Console.Write("Detected Error Code = " + errorCode + " = " + errorCodeTranslation ); } String XMLResult = factSetOnDemand.getDataFrameFactletResult( dataFrameID ); factSetOnDemand.deleteDataFrame( dataFrameID ); System.Console.Write("XML Demo \n\n" + XMLResult ); // Unload library FactSet.FactSetOnDemand.CleanUp(); return 0; } } } 65 | P a g e 9.2 VB .NET Sample Code Module Main Sub Main(ByVal cmdArgs() As String) ' First, we get a handle to the FactSet OnDemand API. ' This handle creation loads FactSet's DLL into memory Dim factSetOnDemand As FactSet.FactSetOnDemand = factSetOnDemand.GetInstance() '***********************************************************************// ' CONFIGURATION DEMO USE // '***********************************************************************// If cmdArgs.Length > 0 Then factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.DATADIRECTUSERNAME, cmdArgs.ElementAt(0)) End If If cmdArgs.Length > 1 Then factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.DATADIRECTPASSWORD, cmdArgs.ElementAt(1)) End If If cmdArgs.Length > 2 Then factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYSERVER, cmdArgs.ElementAt(2)) End If If cmdArgs.Length > 3 Then factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYPORT, cmdArgs.ElementAt(3)) End If If cmdArgs.Length > 4 Then factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYUSERNAME, cmdArgs.ElementAt(4)) End If If cmdArgs.Length > 5 Then factSetOnDemand.setConfigurationItem(FactSet.FactSetOnDemand.PROXYPASSWORD, cmdArgs.ElementAt(5)) End If '***********************************************************************// ' FACTLET OBJECT DEMO USE // '***********************************************************************// Dim factlet As Factlet ' Create a factlet pointer variable to use ' In this example, we will run ExtractFormulaHistory and examine the unique ' IDs and Dates in the returned data factlet = FactSet.Factlet.ExtractFormulaHistory("xom,stl-no,fds,ibm,efc,appl,goog", "fg_eps(0,-1m,d)") System.Console.Write(factlet.getSummary()) Dim uniqueIDs As String() = factlet.getUniqueIDs() Dim uniqueDates As Integer() = factlet.getUniqueDates() System.Console.Write("Printing list of unique IDs:\n") For Each ID As String In uniqueIDs System.Console.Write(ControlChars.Tab + ID + ControlChars.NewLine) Next System.Console.Write("Printing list of unique dates:\n") For Each dateInt As Integer In uniqueDates System.Console.Write(ControlChars.Tab + Convert.ToString(dateInt) + ControlChars.NewLine) Next factlet.CleanUp() ' Extract Alpha Testing Snapshot factlet = factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "ALL", "M") System.Console.Write(factlet.getSummary()) factlet.CleanUp() 66 | P a g e factlet = factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "5,7", "M") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "Weight,Market_Capitalization", "M") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "all", "M", "", "08865810") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractAlphaTestingSnapshot("Y", "N", "Factset:Calculation Example Model", "PERIODS", "ALL", "M", "", "", "RS", "DEFAULT", "A", "1") System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Extract Benchmark Detail factlet = factlet.ExtractBenchmarkDetail("SP50", "items", "FG_COMPANY_NAME,FG_MKT_VALUE") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractBenchmarkDetail("SP50", "items", "p_price,proper_name", New String() {"cutoff", "10"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractBenchmarkDetail("SP50", "items", "p_price", New String() {"dates", "20110115:20110120:d"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Extract Data Snapshot factlet = factlet.ExtractDataSnapshot("ibm", "ff_sales(QTR,20110401,RF,EUR)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractDataSnapshot("xom,stl-no", "ff_sales(QTR,20110401,,USD)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractDataSnapshot("", "ff_sales(QTR,20110401),p_price(20110401)", New String() {"ison", "sp500"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractDataSnapshot("", "ff_sales(QTR,0)", New String() {"ison", "msci_eafe", "isonParams", "0,1"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractDataSnapshot("", "decile(ff_sales(QTR,0))", New String() {"ison", "sp500"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractDataSnapshot("ibm,hd,pg,fds,f-it", "FF_FP_END_DATE(QTR,0 L45D),FF_SALES(QTR,0 L45D)", New String() {"date", "20110131"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Extract Econ Data factlet = factlet.ExtractEconData("", "", "FDS_ECON_DATA('FRBIPSB50001',-121,1,m,step,average)") System.Console.Write(factlet.getSummary()) 67 | P a g e factlet.CleanUp() factlet = factlet.ExtractEconData("", "", "SPEC_ID_DATA('WTI-FDS:FG_PRICE',0,-30,d)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "", "IMF_IFS_DATA('11199Z_F',0,9,y),IMF_IFS_DATA('11299Z_F',0,-9,y)", New String() {"dataitemname", ",,US,UK", "heading", ",,US,UK"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "", "EURO_STAT_DATA('CONSCONFBAL@EUZ',0,11,M),TCB_CCI_DATA('CCI',0,-11,M)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "", "ECON_EXPR_DATA('ZSCORE(FDS_ECON[GRLM0347861])',10,0,m,step,average)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "", "ECON_EXPR_DATA('RETURNS(FDS_ECON[BLSCUSR0000SA0L1E], -1AY)',0,0/0/-10,M)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "", "ECON_EXPR_DATA('RETURNS(EURO_STAT[GDPEURNS@GR], 1AY)',0,0/0/-10,Y)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "CC_GB", "FDS_ECON_BOPCURR_Y", New String() {"dates", "10:-1:Y"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractEconData("", "CC_US,CC_GR", "FDS_ECON_GDP_USD_Y", New String() {"dates", "-10:-1:Y"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Extract Formula History factlet = factlet.ExtractFormulaHistory("xom", "fg_eps(0Q,-5Q,Q)", New String() {"dates", "0Q:-5Q:Q"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractFormulaHistory("goog", "fg_price", New String() {"dates", "20101215:20110115:D"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractFormulaHistory("stl-no", "p_price(-5,0,Q,USD),ff_sales(QTR,5,0,Q,,USD)", New String() {"dates", "-5:0:Q"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractFormulaHistory("XOM", "BETA('SP50',0,-59M,M)") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractFormulaHistory("GE", "AVG(FF_EPS(QTR,0,-5,Q)),MAX(FF_EPS(QTR,0,5,Q)),MIN(FF_EPS(QTR,0,-5,Q)),STD(FF_EPS(QTR,0,-5,Q))") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractFormulaHistory("", "proper_name,ff_eps(qtr,0,-5,Q),p_price(0,-5,q)", New String() {"ison", "sp500"}) System.Console.Write(factlet.getSummary()) 68 | P a g e factlet.CleanUp() ' Extract Options Snapshot factlet = factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE", "", "P_OPT_UNDERLYING_SECURITY=", "IBM", "", "", "", "") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE,P_OPT_CLOSE_PRICE", "", "P_OPT_UNDERLYING_SECURITY=", "GE", "", "", "", "") System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE", "", "P_OPT_UNDERLYING_SECURITY=", "GE", "", "20100513", "", "") System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Extract Estimates Actuals factlet = factlet.FactSetEstimatesActuals("msft", "eps,sales", "NOW", New String() {"fiscalperiod", "-1,0", "periodtype", "annual"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesActuals("msft,ibm", "eps,sales", "NOW", New String() {"fiscalperiod", "-1,0", "periodtype", "annual"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesActuals("xom", "eps,sales", "12/31/2010", New String() {"fiscalperiod", "-1,0", "periodtype", "quarterly_roll"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesActuals("xom", "eps,sales", "12/31/2010", New String() {"fiscalperiod", "-1,0", "periodtype", "quarterly", "fields", "fe_actual"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Estimates Broker Detail factlet = factlet.FactSetEstimatesBrokerDetail("msft", "eps", "0D", "-1AY", New String() {"fiscalperiod", "1"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesBrokerDetail("msft,ibm", "eps", "0D", "-1AY", New String() {"fiscalperiod", "1"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesBrokerDetail("xom", "sales", "0Y", "0Y-2Q", New String() {"fiscalperiod", "2", "periodtype", "quarterly"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesBrokerDetail("xom,stl-no,cvx", "eps", "0D", "-2Q", New String() {"fiscalPeriod", "1", "periodtype", "quarterly", "fields", "FE_ANALYSTNAME,FE_BROKERNAME,FE_ESTIMATE,FE_EST_REV_VAL_ARROW"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesBrokerDetail("xom", "sales", "0Y", "0Y-2Q", New String() {"fiscalperiod", "2", "periodtype", "quarterly", "display", "histo"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Estimates Consensus factlet = factlet.FactSetEstimatesConsensus("msft", "eps,capex", "NOW", New String() {"fiscalperiod", "1,2", "periodtype", "annual"}) 69 | P a g e System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesConsensus("msft,ibm", "eps,capex", "12/31/2011", New String() {"fiscalperiod", "1,2", "periodtype", "quarterly"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesConsensus("msft", "eps,bvps", "NOW", New String() {"fiscalperiod", "1", "periodtype", "annual", "fields", "fe_mean"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesConsensus("aapl", "eps,capex", "NOW", New String() {"fiscalperiod", "1", "periodtype", "annual", "previousDates", "-30", "fields", "prev"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Estimates Guidance factlet = factlet.FactSetEstimatesGuidance("FTI", "EPS", "NOW", New String() {"fiscalperiod", "1,2", "periodtype", "annual"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesGuidance("fti,oii", "eps", "NOW", New String() {"fiscalperiod", "1", "periodtype", "annual"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesGuidance("oii", "eps", "12/31/2011", New String() {"fiscalperiod", "1", "periodtype", "annual"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesGuidance("FTI", "eps", "NOW", New String() {"fiscalperiod", "1", "periodtype", "annual", "fields", "fe_mean,Guidance Mean"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() ' Estimates Suprise factlet = factlet.FactSetEstimatesSurprise("IBM", "eps", "1/19/2012", New String() {"fiscalperiod", "0", "periodtype", "annual", "statistic", "mean"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesSurprise("blk,bac", "eps", "1/18/2012", New String() {"fiscalperiod", "0", "periodtype", "quarterly", "statistic", "mean"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() factlet = factlet.FactSetEstimatesSurprise("IBM", "eps", "1/19/2012", New String() {"fiscalperiod", "0", "periodtype", "annual", "statistic", "mean", "fields", "Surprise_Before,Surprise_After"}) System.Console.Write(factlet.getSummary()) factlet.CleanUp() '***********************************************************************// ' FACTSET ONDEMAND API OBJECT DEMO USE // '***********************************************************************// ' Demo fetching a Factlet using the OnDemand API - simply print out the report text Dim firstDataFrame As Integer = factSetOnDemand.createDataFrame( _ "factlet=ExtractDataSnapshot&ids=fds&items=p_price&dates=&format=pipe&") While Not (factSetOnDemand.isDataFrameComplete(firstDataFrame)) System.Threading.Thread.Sleep(10) End While Console.Out.WriteLine(factSetOnDemand.getDataFrameFactletResult(firstDataFrame)) factSetOnDemand.deleteDataFrame(firstDataFrame) 70 | P a g e ' Create many factlets and parse - allow them to queue - mutlithreaded approach factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&format=pipe&") factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&format=pipe&") factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=ibm,msft&items=p_price&dates=&format=pipe&") factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=ibm,msft,efc&items=p_price,ff_sales,p_volume,fg_eps&dates=&format=pip e&") factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=&items=p_price,ff_sales,p_volume,fg_eps&dates=&format=pipe&") factSetOnDemand.createDataFrame( "factlet=ExtractDataSnapshot&ids=ibm&items=&dates=&format=pipe&") ' Process the frames and print to console Dim listOfLivingFrames As Integer() = factSetOnDemand.getListOfLivingDataFrames() ' Process the frames and print to console For Each dataFrameID As Integer In listOfLivingFrames While Not (factSetOnDemand.isDataFrameComplete(dataFrameID)) System.Threading.Thread.Sleep(10) End While Console.Out.WriteLine(factSetOnDemand.getDataFramePropertyValue(dataFrameID, FactSet.FactSetOnDemand.DATAFRAME_SUMMARY)) factSetOnDemand.deleteDataFrame(dataFrameID) Next ' Demo XML fetch - Do not use DataFrame parsing ' Note: for XML, there is no FORMAT=PIPE argument Dim dataFrameXML = factSetOnDemand.createDataFrame( _ "factlet=ExtractFormulaHistory&ids=ibm,efc&items=p_price(0,-5d,d)&dates=&", _ FactSet.FactSetOnDemand.NO_FILE, _ FactSet.FactSetOnDemand.NO_PARSE_NO_CHECK) While Not (factSetOnDemand.isDataFrameComplete(dataFrameXML)) System.Threading.Thread.Sleep(10) End While Dim errorCode = factSetOnDemand.getDataFrameErrorValue(dataFrameXML) If (errorCode <> 0) Then Dim errorCodeTranslation = factSetOnDemand.translateErrorMessage(errorCode) Console.Out.WriteLine("Detected Error Code = " + errorCode.ToString() + " = " + errorCodeTranslation) End If Dim XMLResult = factSetOnDemand.getDataFrameFactletResult(dataFrameXML) factSetOnDemand.deleteDataFrame(dataFrameXML) Console.Out.WriteLine("XML Demo " + ControlChars.NewLine + XMLResult) ' Unload library Console.Out.WriteLine("Exiting successfully") End Sub End Module 71 | P a g e 9.3 Java Sample Code import FactSet.FactSetOnDemand; import FactSet.Factlet; public class Main { public static void main(String[] args) throws Exception { // First, we get a handle to the FactSet OnDemand API. // This handle creation loads FactSet's DLL into memory FactSetOnDemand factSetOnDemand = FactSetOnDemand.GetInstance(); //***********************************************************************// // CONFIGURATION DEMO USE // //***********************************************************************// if( args.length > 0 ){ factSetOnDemand.setConfigurationItem(FactSetOnDemand.DATADIRECTUSERNAME, args[0]); } if( args.length > 1 ){ factSetOnDemand.setConfigurationItem(FactSetOnDemand.DATADIRECTPASSWORD, args[1]); } if( args.length > 2 ){ factSetOnDemand.setConfigurationItem(FactSetOnDemand.PROXYSERVER, args[2]); } if( args.length > 3 ){ factSetOnDemand.setConfigurationItem(FactSetOnDemand.PROXYPORT, args[3]); } if( args.length > 4 ){ factSetOnDemand.setConfigurationItem(FactSetOnDemand.PROXYUSERNAME, args[4]); } if( args.length > 5 ){ factSetOnDemand.setConfigurationItem(FactSetOnDemand.PROXYPASSWORD, args[5]); } //***********************************************************************// // FACTLET OBJECT DEMO USE // //***********************************************************************// Factlet factlet; // Create a factlet variable to use // In this example, we will run ExtractFormulaHistory and examine the unique // IDs and Dates in the returned data factlet = Factlet.ExtractFormulaHistory("xom,stl-no,fds,ibm,efc,appl,goog", "fg_eps(0,1m,d)"); System.out.print(factlet.getSummary()); String[] uniqueIDs = factlet.getUniqueIDs(); System.out.print("Printing list of unique IDs:\n"); for( int i = 0; i < uniqueIDs.length; i++) { System.out.print("\t" + uniqueIDs[i] + "\n"); } Integer[] uniqueDates = factlet.getUniqueDates(); System.out.print("Printing list of unique dates:\n"); for( int i = 0; i < uniqueDates.length; i++) { System.out.print("\t" + uniqueDates[i] + "\n"); } factlet.cleanUp(); // Note that we must clean up in Java because it is garbage collected // Extract Alpha Testing Snapshot factlet = Factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "ALL", "M"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "5,7", "M"); 72 | P a g e System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "Weight,Market_Capitalization", "M"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractAlphaTestingSnapshot("N", "N", "Factset:Calculation Example Model", "CONSTITUENTS", "all", "M", "", "08865810"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractAlphaTestingSnapshot("Y", "N", "Factset:Calculation Example Model", "PERIODS", "ALL", "M", "", "", "RS", "DEFAULT", "A", "1"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Extract Benchmark Detil factlet = Factlet.ExtractBenchmarkDetail("SP50", "items", "FG_COMPANY_NAME,FG_MKT_VALUE"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractBenchmarkDetail("SP50", "items", "p_price,proper_name", new String[] {"cutoff", "10"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractBenchmarkDetail("SP50", "items", "p_price", new String[] {"dates", "20110115:20110120:d"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Extract Data Snapshot factlet = Factlet.ExtractDataSnapshot("ibm", "ff_sales(QTR,20110401,RF,EUR)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractDataSnapshot("xom,stl-no", "ff_sales(QTR,20110401,,USD)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractDataSnapshot("", "ff_sales(QTR,20110401),p_price(20110401)", new String[] {"ison", "sp500"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractDataSnapshot("", "ff_sales(QTR,0)", new String[] {"ison", "msci_eafe", "isonParams", "0,1"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractDataSnapshot("", "decile(ff_sales(QTR,0))", new String[] {"ison", "sp500"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractDataSnapshot("ibm,hd,pg,fds,f-it", "FF_FP_END_DATE(QTR,0 L45D),FF_SALES(QTR,0 L45D)", new String[] {"date", "20110131"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Extract Econ Data factlet = Factlet.ExtractEconData("", "", "FDS_ECON_DATA('FRBIPSB50001',-121,-1,m,step,average)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "", "SPEC_ID_DATA('WTI-FDS:FG_PRICE',0,-30,d)"); System.out.print(factlet.getSummary() + "\n"); 73 | P a g e factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "", "IMF_IFS_DATA('11199Z_F',0,9,y),IMF_IFS_DATA('11299Z_F',0,-9,y)", new String[] {"dataitemname", ",,US,UK", "heading", ",,US,UK"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "", "EURO_STAT_DATA('CONSCONFBAL@EUZ',0,11,M),TCB_CCI_DATA('CCI',0,-11,M)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "", "ECON_EXPR_DATA('ZSCORE(FDS_ECON[GRLM0347861])',10,0,m,step,average)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "", "ECON_EXPR_DATA('RETURNS(FDS_ECON[BLSCUSR0000SA0L1E], 1AY)',0,0/0/-10,M)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "", "ECON_EXPR_DATA('RETURNS(EURO_STAT[GDPEURNS@GR], 1AY)',0,0/0/-10,Y)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "CC_GB", "FDS_ECON_BOPCURR_Y", new String[] {"dates", "-10:1:Y"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractEconData("", "CC_US,CC_GR", "FDS_ECON_GDP_USD_Y", new String[] {"dates", "-10:-1:Y"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Extract Formula History factlet = Factlet.ExtractFormulaHistory("xom", "fg_eps(0Q,-5Q,Q)", new String[] {"dates", "0Q:5Q:Q"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractFormulaHistory("goog", "fg_price", new String[] {"dates", "20101215:20110115:D"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractFormulaHistory("stl-no", "p_price(-5,0,Q,USD),ff_sales(QTR,-5,0,Q,,USD)", new String[] {"dates", "-5:0:Q"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractFormulaHistory("XOM", "BETA('SP50',0,-59M,M)"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractFormulaHistory("GE", "AVG(FF_EPS(QTR,0,-5,Q)),MAX(FF_EPS(QTR,0,5,Q)),MIN(FF_EPS(QTR,0,-5,Q)),STD(FF_EPS(QTR,0,-5,Q))"); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractFormulaHistory("", "proper_name,ff_eps(qtr,0,-5,Q),p_price(0,-5,q)", new String[] {"ison", "sp500"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Extract Options Snapshot 74 | P a g e factlet = Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE", "", "P_OPT_UNDERLYING_SECURITY=", "IBM", "", "", "", ""); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE,P_OPT_CLOSE_PRICE", "", "P_OPT_UNDERLYING_SECURITY=", "GE", "", "", "", ""); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE", "", "P_OPT_UNDERLYING_SECURITY=", "GE", "", "20100513", "", ""); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Extract Estimates Actuals factlet = Factlet.FactSetEstimatesActuals("msft", "eps,sales", "NOW", new String[] {"fiscalperiod", "-1,0", "periodtype", "annual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesActuals("msft,ibm", "eps,sales", "NOW", new String[] {"fiscalperiod", "-1,0", "periodtype", "annual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesActuals("xom", "eps,sales", "12/31/2010", new String[] {"fiscalperiod", "-1,0", "periodtype", "quarterly_roll"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesActuals("xom", "eps,sales", "12/31/2010", new String[] {"fiscalperiod", "-1,0", "periodtype", "quarterly", "fields", "fe_actual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Estimates Broker Detail factlet = Factlet.FactSetEstimatesBrokerDetail("msft", "eps", "0D", "-1AY", new String[] {"fiscalperiod", "1"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesBrokerDetail("msft,ibm", "eps", "0D", "-1AY", new String[] {"fiscalperiod", "1"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesBrokerDetail("xom", "sales", "0Y", "0Y-2Q", new String[] {"fiscalperiod", "2", "periodtype", "quarterly"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesBrokerDetail("xom,stl-no,cvx", "eps", "0D", "-2Q", new String[] {"fiscalPeriod", "1", "periodtype", "quarterly", "fields", "FE_ANALYSTNAME,FE_BROKERNAME,FE_ESTIMATE,FE_EST_REV_VAL_ARROW"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesBrokerDetail("xom", "sales", "0Y", "0Y-2Q", new String[] {"fiscalperiod", "2", "periodtype", "quarterly", "display", "histo"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Estimates Consensus factlet = Factlet.FactSetEstimatesConsensus("msft", "eps,capex", "NOW", new String[] {"fiscalperiod", "1,2", "periodtype", "annual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); 75 | P a g e factlet = Factlet.FactSetEstimatesConsensus("msft,ibm", "eps,capex", "12/31/2011", new String[] {"fiscalperiod", "1,2", "periodtype", "quarterly"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesConsensus("msft", "eps,bvps", "NOW", new String[] {"fiscalperiod", "1", "periodtype", "annual", "fields", "fe_mean"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesConsensus("aapl", "eps,capex", "NOW", new String[] {"fiscalperiod", "1", "periodtype", "annual", "previousDates", "-30", "fields", "prev"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Estimates Guidance factlet = Factlet.FactSetEstimatesGuidance("FTI", "EPS", "NOW", new String[] {"fiscalperiod", "1,2", "periodtype", "annual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesGuidance("fti,oii", "eps", "NOW", new String[] {"fiscalperiod", "1", "periodtype", "annual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesGuidance("oii", "eps", "12/31/2011", new String[] {"fiscalperiod", "1", "periodtype", "annual"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesGuidance("FTI", "eps", "NOW", new String[] {"fiscalperiod", "1", "periodtype", "annual", "fields", "fe_mean,Guidance Mean"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); // Estimates Suprise factlet = Factlet.FactSetEstimatesSurprise("IBM", "eps", "1/19/2012", new String[] {"fiscalperiod", "0", "periodtype", "annual", "statistic", "mean"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesSurprise("blk,bac", "eps", "1/18/2012", new String[] {"fiscalperiod", "0", "periodtype", "quarterly", "statistic", "mean"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); factlet = Factlet.FactSetEstimatesSurprise("IBM", "eps", "1/19/2012", new String[] {"fiscalperiod", "0", "periodtype", "annual", "statistic", "mean", "fields", "Surprise_Before,Surprise_After"}); System.out.print(factlet.getSummary() + "\n"); factlet.cleanUp(); //***********************************************************************// // FACTSET ONDEMAND API OBJECT DEMO USE // //***********************************************************************// // Demo fetching a Factlet using the OnDemand API - simply print out the report text int firstDataFrame = factSetOnDemand.createDataFrame( "factlet=extractdatasnapshot&ids=fds&items=p_price&dates=&format=pipe&"); while (!factSetOnDemand.isDataFrameComplete(firstDataFrame)){ // Wait until complete Thread.sleep(100);; } String firstFactletString = factSetOnDemand.getDataFrameFactletResult(firstDataFrame); factSetOnDemand.deleteDataFrame( firstDataFrame ); // Delete DataFrame when done System.out.print("Got first factlet result \n" + firstFactletString + "\n" ); // Create many factlets and parse - allow them to queue - mutlithreaded approach 76 | P a g e factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&format=pipe& "); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&format=pipe& "); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft&items=p_price&dates=&format= pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft,efc&items=p_price,ff_sales,p _volume,fg_eps&dates=&format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=&items=p_price,ff_sales,p_volume,fg_e ps&dates=&format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=imb&items=&dates=&format=pipe&"); // Process the frames and print to console int[] listOfDataFrameIDs = factSetOnDemand.getListOfLivingDataFrames(); int dataFrameID; for( int i = 0; i < listOfDataFrameIDs.length; i++ ) { dataFrameID = listOfDataFrameIDs[i]; System.out.print("\n\nGetting Data Frame with ID = " + String.valueOf(dataFrameID) + "\n"); while (!factSetOnDemand.isDataFrameComplete(dataFrameID)) { Thread.sleep(100); } System.out.print(factSetOnDemand.getDataFramePropertyValue(dataFrameID, FactSetOnDemand.DATAFRAME_SUMMARY) + "\n"); factSetOnDemand.deleteDataFrame(dataFrameID); } // Demo XML fetch - do not use DataFrame parsing // Note: for XML, there is no FORMAT=PIPE argument dataFrameID = factSetOnDemand.createDataFrame( "factlet=ExtractFormulaHistory&ids=ibm,efc&items=p_price(0,-5d,d)&dates=&", FactSetOnDemand.NO_FILE, FactSetOnDemand.NO_PARSE_NO_CHECK, null); while( !factSetOnDemand.isDataFrameComplete( dataFrameID ) ) { Thread.sleep(100); } int errorCode = factSetOnDemand.getDataFrameErrorValue(dataFrameID); if(errorCode != 0) { String errorCodeTranslation = factSetOnDemand.translateErrorMessage( errorCode ); System.out.print("Detected Error Code = " + errorCode + " = " + errorCodeTranslation ); } String XMLResult = factSetOnDemand.getDataFrameFactletResult( dataFrameID ); factSetOnDemand.deleteDataFrame( dataFrameID ); System.out.print("XML Demo \n\n%s" + XMLResult); // Unload library FactSetOnDemand.CleanUp(); return; } } 77 | P a g e 9.4 Python Sample Code from FactSetOnDemand import FactSetOnDemand, DataFrame, Factlet import os import time import sys try: # First, we get a handle to the FactSet OnDemand API. # This handle creation loads FactSet's DLL into memory factSetOnDemand = FactSetOnDemand.GetInstance() #***********************************************************************// # CONFIGURATION DEMO USE // #***********************************************************************// if( len(sys.argv) > 1 ): factSetOnDemand.setConfigurationItem( factSetOnDemand.DATADIRECTUSERNAME, sys.argv[1]); if( len(sys.argv) > 2 ): factSetOnDemand.setConfigurationItem( factSetOnDemand.DATADIRECTPASSWORD, sys.argv[2]); if( len(sys.argv) > 3 ): factSetOnDemand.setConfigurationItem( factSetOnDemand.PROXYSERVER, sys.argv[3] ); if( len(sys.argv) > 4 ): factSetOnDemand.setConfigurationItem( factSetOnDemand.PROXYPORT, sys.argv[4] ); if( len(sys.argv) > 5 ): factSetOnDemand.setConfigurationItem( factSetOnDemand.PROXYUSERNAME, sys.argv[5] ); if( len(sys.argv) > 6 ): factSetOnDemand.setConfigurationItem( factSetOnDemand.PROXYPASSWORD, sys.argv[6] ); #***********************************************************************// # FACTLET OBJECT DEMO USE // #***********************************************************************// factlet = [] # Create a factlet pointer variable to use # In this example, we will run ExtractFormulaHistory and examine the unique # IDs and Dates in the returned data factlet = Factlet.ExtractFormulaHistory("xom,stl-no,fds,ibm,efc,appl,goog", "fg_eps(0,1m,d)"); print factlet.getSummary() + "\n" uniqueIDs = factlet.getUniqueIDs(); print "Printing list of unique IDs:\n" for i in xrange(len(uniqueIDs)): print "\t" + uniqueIDs[i] uniqueDates = factlet.getUniqueDates(); print "Printing list of unique dates:\n" for i in xrange(len(uniqueDates)): print "\t" + str(uniqueDates[i]) del factlet # Note that we must delete the factlet after we are done to prevent memory leaks # Extract Alpha Testing Snapshot factlet = Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","ALL","M") print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","5,7","M") print factlet.getSummary() + "\n" 78 | P a g e del factlet factlet = Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","Weight,Market_Capitalization","M"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractAlphaTestingSnapshot("N","N","Factset:Calculation Example Model","CONSTITUENTS","all","M","","08865810"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractAlphaTestingSnapshot("Y","N","Factset:Calculation Example Model","PERIODS","ALL","M","","","RS","DEFAULT","A","1"); print factlet.getSummary() + "\n" del factlet # Extract Benchmark Detil factlet = Factlet.ExtractBenchmarkDetail("SP50",["items","FG_COMPANY_NAME,FG_MKT_VALUE"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractBenchmarkDetail("SP50",["items","p_price,proper_name","cutoff","10"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractBenchmarkDetail("SP50",["items","p_price","dates","20110115:20110120:d"]); print factlet.getSummary() + "\n" del factlet # Extract Data Snapshot factlet = Factlet.ExtractDataSnapshot("ibm","ff_sales(QTR,20110401,RF,EUR)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractDataSnapshot("xom,stl-no","ff_sales(QTR,20110401,,USD)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractDataSnapshot("","ff_sales(QTR,20110401),p_price(20110401)", ["ison","sp500"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractDataSnapshot("","ff_sales(QTR,0)",["ison","msci_eafe","isonParams","0,1"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractDataSnapshot("","decile(ff_sales(QTR,0))", ["ison","sp500"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractDataSnapshot("ibm,hd,pg,fds,f-it","FF_FP_END_DATE(QTR,0 L45D),FF_SALES(QTR,0 L45D)",["date","20110131"]); print factlet.getSummary() + "\n" del factlet # Extract Econ Data factlet = Factlet.ExtractEconData("","","FDS_ECON_DATA('FRBIPSB50001',-121,1,m,step,average)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","","SPEC_ID_DATA('WTI-FDS:FG_PRICE',0,-30,d)"); print factlet.getSummary() + "\n" del factlet 79 | P a g e factlet = Factlet.ExtractEconData("","","IMF_IFS_DATA('11199Z_F',0,9,y),IMF_IFS_DATA('11299Z_F',0,-9,y)",["dataitemname",",,US,UK","heading",",,US,UK"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","","EURO_STAT_DATA('CONSCONFBAL@EUZ',0,11,M),TCB_CCI_DATA('CCI',0,-11,M)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","","ECON_EXPR_DATA('ZSCORE(FDS_ECON[GRLM0347861])',10,0,m,step,average)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","","ECON_EXPR_DATA('RETURNS(FDS_ECON[BLSCUSR0000SA0L1E], -1AY)',0,0/0/-10,M)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","","ECON_EXPR_DATA('RETURNS(EURO_STAT[GDPEURNS@GR], 1AY)',0,0/0/-10,Y)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","CC_GB","FDS_ECON_BOPCURR_Y",["dates","-10:-1:Y"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractEconData("","CC_US,CC_GR","FDS_ECON_GDP_USD_Y",["dates","-10:-1:Y"]); print factlet.getSummary() + "\n" del factlet # Extract Formula History factlet = Factlet.ExtractFormulaHistory("xom","fg_eps(0Q,-5Q,Q)",["dates","0Q:-5Q:Q"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractFormulaHistory("goog","fg_price",["dates","20101215:20110115:D"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractFormulaHistory("stl-no","p_price(-5,0,Q,USD),ff_sales(QTR,5,0,Q,,USD)",["dates","-5:0:Q"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractFormulaHistory("XOM","BETA('SP50',0,-59M,M)"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractFormulaHistory("GE","AVG(FF_EPS(QTR,0,-5,Q)),MAX(FF_EPS(QTR,0,5,Q)),MIN(FF_EPS(QTR,0,-5,Q)),STD(FF_EPS(QTR,0,-5,Q))"); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractFormulaHistory("","proper_name,ff_eps(qtr,0,-5,Q),p_price(0,5,q)",["ison","sp500"]); print factlet.getSummary() + "\n" del factlet # Extract Options Snapshot factlet = Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE","","P_OPT_UNDERLYING_SECURITY=","IBM","","","" ,""); print factlet.getSummary() + "\n" del factlet 80 | P a g e factlet = Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE,P_OPT_CLOSE_PRICE","","P_OPT_UNDERLYING_SECURIT Y=","GE","","","",""); print factlet.getSummary() + "\n" del factlet factlet = Factlet.ExtractOptionsSnapshot("P_OPT_UNDERLYING_PRICE","","P_OPT_UNDERLYING_SECURITY=","GE","","20100 513","",""); print factlet.getSummary() + "\n" del factlet # Extract Estimates Actuals factlet = Factlet.FactSetEstimatesActuals("msft","eps,sales","NOW",["fiscalperiod","1,0","periodtype","annual"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesActuals("msft,ibm","eps,sales","NOW",["fiscalperiod","1,0","periodtype","annual"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesActuals("xom","eps,sales","12/31/2010",["fiscalperiod","1,0","periodtype","quarterly_roll"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesActuals("xom","eps,sales","12/31/2010",["fiscalperiod","1,0","periodtype","quarterly","fields","fe_actual"]); print factlet.getSummary() + "\n" del factlet # Estimates Broker Detail factlet = Factlet.FactSetEstimatesBrokerDetail("msft","eps","0D","-1AY",["fiscalperiod","1"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesBrokerDetail("msft,ibm","eps","0D","1AY",["fiscalperiod","1"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesBrokerDetail("xom","sales","0Y","0Y2Q",["fiscalperiod","2","periodtype","quarterly"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesBrokerDetail("xom,stl-no,cvx","eps","0D","2Q",["fiscalPeriod","1","periodtype","quarterly","fields","FE_ANALYSTNAME,FE_BROKERNAME,FE_ESTIMATE,FE _EST_REV_VAL_ARROW"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesBrokerDetail("xom","sales","0Y","0Y2Q",["fiscalperiod","2","periodtype","quarterly","display","histo"]); print factlet.getSummary() + "\n" del factlet # Estimates Consensus factlet = Factlet.FactSetEstimatesConsensus("msft","eps,capex","NOW",["fiscalperiod","1,2","periodtype","annual" ]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesConsensus("msft,ibm","eps,capex","12/31/2011",["fiscalperiod","1,2","periodtyp e","quarterly"]); 81 | P a g e print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesConsensus("msft","eps,bvps","NOW",["fiscalperiod","1","periodtype","annual","f ields","fe_mean"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesConsensus("aapl","eps,capex","NOW",["fiscalperiod","1","periodtype","annual"," previousDates","-30","fields","prev"]); print factlet.getSummary() + "\n" del factlet # Estimates Guidance factlet = Factlet.FactSetEstimatesGuidance("FTI","EPS","NOW",["fiscalperiod","1,2","periodtype","annual"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesGuidance("fti,oii","eps","NOW",["fiscalperiod","1","periodtype","annual"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesGuidance("oii","eps","12/31/2011",["fiscalperiod","1","periodtype","annual"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesGuidance("FTI","eps","NOW",["fiscalperiod","1","periodtype","annual", "fields","fe_mean,Guidance Mean"]); print factlet.getSummary() + "\n" del factlet # Estimates Suprise factlet = Factlet.FactSetEstimatesSurprise("IBM","eps","1/19/2012",["fiscalperiod","0","periodtype","annual","st atistic","mean"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesSurprise("blk,bac","eps","1/18/2012",["fiscalperiod","0","periodtype","quarter ly","statistic","mean"]); print factlet.getSummary() + "\n" del factlet factlet = Factlet.FactSetEstimatesSurprise("IBM","eps","1/19/2012",["fiscalperiod","0","periodtype","annual","st atistic","mean","fields","Surprise_Before,Surprise_After"]); print factlet.getSummary() + "\n" del factlet #***********************************************************************// # FACTSET ONDEMAND API OBJECT DEMO USE // #***********************************************************************// # Demo fetching a Factlet using the OnDemand API - simply print out the report text firstDataFrame = factSetOnDemand.createDataFrame( "factlet=extractdatasnapshot&ids=fds&items=p_price&dates=&format=pipe&"); while( not( factSetOnDemand.isDataFrameComplete(firstDataFrame) ) ): time.sleep(1) firstFactletString = factSetOnDemand.getDataFrameFactletResult(firstDataFrame); factSetOnDemand.deleteDataFrame( firstDataFrame ); # Delete DataFrame when done print "Got first factlet result \n" + firstFactletString + "\n" 82 | P a g e # Create many factlets and parse - allow them to queue - mutlithreaded approach factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&form at=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm&items=p_price&dates=&form at=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft&items=p_price&dates= &format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=ibm,msft,efc&items=p_price,ff _sales,p_volume,fg_eps&dates=&format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=&items=p_price,ff_sales,p_vol ume,fg_eps&dates=&format=pipe&"); factSetOnDemand.createDataFrame("factlet=ExtractDataSnapshot&ids=imb&items=&dates=&format=pipe &"); # Process the frames and print to console listOfLivingFrames = factSetOnDemand.getListOfLivingDataFrames() dataFrameID = [] for i in xrange(len(listOfLivingFrames)): dataFrameID = listOfLivingFrames[i] print "\n\n\nGetting Data Frame with ID = " + str( dataFrameID ) + "\n" while( not( factSetOnDemand.isDataFrameComplete(dataFrameID) ) ): time.sleep(1) print factSetOnDemand.getDataFramePropertyValue(dataFrameID, factSetOnDemand.DATAFRAME_SUMMARY ) factSetOnDemand.deleteDataFrame( dataFrameID ); # Demo XML fetch - Do not use DataFrame parsing # Note: for XML, there is no FORMAT=PIPE argument dataFrameID = factSetOnDemand.createDataFrame( \ "factlet=ExtractFormulaHistory&ids=ibm,efc&items=p_price(0,-5d,d)&dates=&", \ factSetOnDemand.NONE, \ factSetOnDemand.NO_PARSE_NO_CHECK); while( not( factSetOnDemand.isDataFrameComplete(dataFrameID) ) ): time.sleep(1) errorCode = factSetOnDemand.getDataFrameErrorValue(dataFrameID); if(errorCode != 0): errorCodeTranslation = factSetOnDemand.translateErrorMessage( errorCode ); print "Detected Error Code = " + str(errorCode) + errorCodeTranslation XMLResult = factSetOnDemand.getDataFrameFactletResult( dataFrameID ); factSetOnDemand.deleteDataFrame( dataFrameID ); print "XML Demo \n\n" + XMLResult factSetOnDemand = None finally: FactSetOnDemand.CleanUp() exit(0) 83 | P a g e Appendix Table 1: List of Configuration Items Item Name DATADIRECTUSERNAME DATADIRECTPASSWORD DATADIRECTURL PROXYSERVER PROXYPORT PROXYUSERNAME PROXYPASSWORD NTLM TIMEOUT THROTTLE EVENTLOGGERON EVENTLOGGERVERBOSE EVENTLOGGERMAXLOGS EVENTLOGGERREDUCTION APPDATA_DIRECTORY TEMP_DIRECTORY OUTPUT_DIRECTORY ROOT_DIRECTORY IMAGES_DIRECTORY REFERENCES_DIRECTORY BINARY_DIRECTORY GUIACTIVE 84 | P a g e Item Index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 Item Type String String String String Integer String String NA Integer Integer Boolean Boolean Integer Integer String String String String String String String Boolean Table 2: List of File Output Options Output Name NONE PLAINTEXT_OPEN_NODELETE Output Index 0 1 PLAINTEXT_NOOPEN_NODELETE 2 PLAINTEXT_NOOPEN_DELETE 3 PLAINTEXT_NOOPEN_DELETE_OPEN_EXCEL 4 EXCEL_OPEN_NODELETE 5 EXCEL_NOOPEN_NODELETE 6 85 | P a g e Output Description No file output is made. A plain text file of the Factlet result is created and then opened in the default text editor. The file is not deleted. A plain text file of the Factlet result is created and is not deleted. A plain text file of the Factlet result is created and is deleted when the DataFrame is called for deletion. A plain text file of the Factlet result is created and is deleted when the DataFrame is called for deletion. Also, an excel file is created and opened and not deleted. An excel file of the Factlet result is created and not deleted. The file is opened in the default excel application. An excel file of the Factlet result is created and not deleted. Table 3: Error Message Output Error Message Error Value Error Description SUCCESS 0 Successful FACTLET_ERROR_DNE -1 FACTLET_ERROR_IDS -2 FACTLET_ERROR_ITEMS -3 FACTLET_ERROR_DATES -4 FACTLET_ERROR_CREDENTIALS -5 FACTLET_ERROR_APPLICATION -6 FACTLET_ERROR_CONNECTION -7 FACTLET_ERROR_PARSE_FAILURE -8 FACTLET_ERROR_UNKNOWN -9 DATAFRAME_ERROR_UNABLE_TO_TRANSFORM -10 DATAFRAME_ERROR_INSUFFICIENT_ROWS -11 DATAFRAME_ERROR_BAD_COL_INDEX -12 DATAFRAME_ERROR_BAD_ROW_INDEX -13 DATAFRAME_ERROR_BAD_VALUE_INDEX -14 DATAFRAMECOL_ERROR_BAD_INDEX -15 DATAFRAMECOL_ERROR_BAD_ASSIGNMENT -16 DATAFRAMEMAN_ERROR_NO_FRAME -17 CURL_ERROR_LIBRARY_LOAD -18 CURL_ERROR_LIBRARY_FUNCTION -19 CURL_RESULT_UNSET -22 DATA_TABLE_NOT_RECTANGULAR -23 DATA_TABLE_NOT_ENOUGH_ROWS -24 DATA_TABLE_PARSE_EXCEPTION -25 FACTLET_ERROR_NO_DATA -26 86 | P a g e Programatic Error : Item Does Not Exist FactSet Query Error : No Ids were selected. FactSet Query Error : No Items were selected. FactSet Query Error : Date Range is invald. FactSet Query Error : Invalid Credentials. FactSet Query Error : No Application Access or Does Not Exist. Connection Error : HTTPS Connection Failed. Check configuration FactSet Query Error : Unable To Parse. Check Factlet. Unknown Error Data Frame Error : Unable to transform FactSet Data Frame Error : Unable to parse factlet result. FactSet Data Frame Error : Bad column index. FactSet Data Frame Error : Bad row index. FactSet Data Frame Error : Bad value index. FactSet Data Frame Column Error : Bad value index. FactSet Data Frame Column Error : Bad value assignment. FactSet Data Frame Manager Error : Attempted to spawn non-existent frame. FactSet Library Error : Failed to load cURL library. FactSet Library Error : cURL Library Function failed. Connection Error : Unknown HTTPS Error. FactSet Data Frame Error : Unable to parse factlet result - result not tabular. FactSet Data Frame Error : Unable to parse factlet result - not enough rows. FactSet Data Frame Error : Unable to parse factlet result - unknown parse error. FactSet Query Error : No Data Exists. DATA_TABLE_MALLOC_VALUE_ERROR -27 DATA_TABLE_MALLOC_COLUMN_ERROR -28 DATA_TABLE_COLUMN_RESERVE_ERROR -29 DATA_TABLE_COLUMN_ITERATOR_OFLOW -30 DATA_TABLE_DELETE_EXCEPTION -31 JOB_EXECUTION_NULL_JOB -32 JOB_ASSIGNEMENT_BAD -33 JOB_EXECUTION_BUSY_THREAD -34 EXECUTIONER_THREAD_NOT_IN_SERVICE -35 EXECUTIONER_CANNOT_SPAWN -36 EXECUTIONER_CANNOT_ADD_NEW_THREAD -37 EXECUTIONER_DELETE_THREAD_FAILURE -38 EXECUTIONER_THREAD_NOT_FOUND -39 EXECUTIONER_THREAD_COUNT_WRONG -41 EXECUTIONER_JOB_COUNT_WRONG -42 EXECUTIONER_NO_FREE_THREADS -43 EXECUTIONER_NO_JOBS_TO_EXECUTE -44 EXECUTIONER_THREAD_HAS_JOB -45 EXECUTIONER_FAILED_TO_ASSIGN -46 EXECUTIONER_THREAD_ALREADY_REG -47 EXECUTIONER_CANNOT_FIND_EXEC -48 EXECUTIONER_WASTEFUL_CALL -49 DATAFRAMEMANAGER_FRAME_EXISTS -50 DATAFRAMEMANAGER_FRAME_DNE -51 DATAFRAMEMANAGER_ASK_FAILURE -52 DATATABLE_COLUMN_DNE -53 87 | P a g e FactSet Data Frame Error : Value unable to be created. FactSet Data Frame Error : Column unable to be created. FactSet Data Frame Error : Column unable to be reserved. FactSet Data Frame Error : Column unable to be deleted due to iterator overflow. FactSet Data Frame Error : Column delete exception. FactSet Job Execute Error : Null Job Created. FactSet Job Assign Error : Job assigned to null thread. FactSet Job Assign Error : Job assigned to busy thread. FactSet Executioner Error : Attempted to assign job to out of service thread. FactSet Executioner Error : Failed to spawn thread. FactSet Executioner Error : Failed to add new thread. FactSet Executioner Error : Failed to delete thread. FactSet Executioner Error : Failed to find thread record. FactSet Executioner Error : Thread count is wrong. FactSet Executioner Error : Job count is wrong. FactSet Executioner Error : Failed to find free thread. FactSet Executioner Error : Attempted to execute jobs when none exist. FactSet Executioner Error : Attempted to assign job to busy thread. FactSet Executioner Error : Failed to assign job. FactSet Executioner Error : Thread already marked free. FactSet Executioner Error : Cannot find executable. FactSet Executioner Error : Wasteful call. FactSet DataFrameManager Error : DataFrame already exists. FactSet DataFrameManager Error : DataFrame does not exist. FactSet DataFrameManager Error : Unable to inquire to service needed. FactSet Data Frame Table Error : Column does not exist. FACTSET_DATE_RANGE -54 FACTSET_DATE_CONVERSION_FAILED -55 FACTSET_DONT_KNOW_DATE_FORMAT -56 DATACOLUMN_ABSTRACT_COLUMN -57 DATATABLE_BAD_COLUMN_INDEX -59 DATATABLE_UNABLE_TO_DETERMINE_TYPE -60 CONFIGURATION_THROTTLE_VALUE -61 CONFIGURATION_TIMEOUT_VALUE -62 Configuration Setting Error : Timeout must be in range 1 to 3600. -63 Configuration Setting Error : Event Logger must be set 'TRUE' or 'FALSE'. -64 Configuration Setting Error : Event Logger settings must be in range 20 to 1000. -65 Configuration Setting Error : GUI must be set 'TRUE' or 'FALSE'. -66 Configuration Setting Error : Directory does not exist. -67 Configuration Setting Error : This item must be four characters or longer. -68 Configuration Setting Error : DataDirect Username is too short. -69 Configuration Setting Error : DataDirect Password is too short. -70 Configuration Setting Error : Proxy Server Username is too short. -71 Configuration Setting Error : Proxy Server Password is too short. -72 Configuration Setting Error : Proxy Server Port is too short. -73 Configuration Settinsg Error : Proxy Server Name is too short. -74 Data Frame Error : Cannot make Excel file without parse. Check Tranform mode. CONFIGURATION_EVENT_LOGGER_VALUE CONFIGURATION_EVENT_RANGE CONFIGURATION_GUI_ON CONFIGURATION_DIRECTORY_DNE CONFIGURATION_ITEM_MUST_BE_FOUR_CHAR CONFIGURATION_DD_USER_LENGTH CONFIGURATION_DD_PASS_LENGTH CONFIGURATION_P_USER_LENGTH CONFIGURATION_P_PASS_LENGTH CONFIGURATION_P_PORT_LENGTH CONFIGURATION_P_SERV_LENGTH DATAFRAME_CANNOT_MAKE_EXCEL_WO_PARS E 88 | P a g e FactSet Date Range Error : Date out of range. FactSet Date Range Error : Date conversion failed. FactSet Date Range Error : Date conversion format not known. FactSet DataColumn Error : Abstract column. FactSet Data Frame Table Error : Bad column index. FactSet Data Frame Table Error : Unable to determine type. Configuration Setting Error : Throttle must be in range 1 to 25. EXECUTABLE_ABORTED -75 Executable Job Error : Aborted. KRATOS_NOT_INITIALIZED -76 Kratos Error : Kratos not initialized. Please Run InitializeFactSetOnDemand. -77 Matrix Builder : First item not entity. -78 Matrix Builder : Second item not date. -79 Matrix Builder : Too many items selected for this transform. -80 Configuration Setting Error : NTLM not supported in this version. -81 FactSet Data Frame Table Error : Unable to determine factlet type. -82 FactSet DataFrame Inspector : Cannot find Id Column. -83 FactSet DataFrame Inspector : Cannot find Date Column. -84 FactSet DataFrame Inspector : Cannot find Requested Column. -85 Configuration Setting Error : SIDEBAR must be set 'TRUE' or 'FALSE'. -86 Process Creation Error : Pipes Failed. -87 Process Creation Error : Process Creation Failed. -88 IP Message Error : Unable to process message -89 IP Message Error : Process no longer alive. -90 Calling Application Error : This function is not supported in this application. -91 Calling Application Error : External Application Error. -93 Calling Application Error : Unable to load library. -94 Calling Application Error : Unable to locate library symbol. -95 Configuration Setting Error : Usage Data must be set 'TRUE' or 'FALSE'. MATRIX_BUILDER_FIRST_ITEM_NOT_ENTITY MATRIX_BUILDER_SECOND_ITEM_NOT_DATE MATRIX_BUILDER_TOO_MANY_ITEMS CONFIGURATION_NTLM_VALUE DATAFRAME_UNABLE_TO_DETERMINE_FACTLE T DF_INSPECTOR_ID_COL DF_INSPECTOR_DATE_COL DF_INSPECTOR_FIND_COL CONFIGURATION_SIDEBAR_OFF PIPE_CREATION_FAILED PROCESS_CREATION_FAILED UNABLE_TO_PARSE_IPMESSAGE PROCESS_NO_LONGER_ALIVE FUNCTION_NOT_SUPPORTED EXTERNAL_APPLICATION_ERROR UNABLE_TO_LOCATE_LIBRARY UNABLE_TO_LOCATE_LIBRARY_EXTERNAL CONFIGURATION_USAGE_DATA_VALUE 89 | P a g e CONFIGURATION_HTTPSRETRY_DATA_VALUE CANNOT_SEND_EMPTY_MESSAGE -96 Configuration Setting Error : HTTPS Retries must be in range 0 to 10. -98 Inventory Error : Inventory Item Not Found. -99 Configuration Setting Error : Extention must be set 'TRUE' or 'FALSE'. -100 Configuration Setting Error : Last Update must be set a positive integer. -101 Configuration Setting Error : Master Slave must be set 'TRUE' or 'FALSE'. -102 Master Message Executor Error : Bad message format. -103 Resource Tracker Error : Attempted to add duplicate pID'. -104 Resource Tracker Error : Attempted to remove bad pID'. -105 Configuration Setting Error : Check in period must be in range 20 to 300. -106 Configuration Setting Error : Usage Data Upload is disabled in this configuration. -107 Configuration Setting Error : Master Collection must be set 'TRUE' or 'FALSE'. -108 Warning : Master is not collecting. -109 Cannot send empty message. MESSAGE_FORMAT_BAD -110 Message Format Bad. INTERPROCESSMESSAGE_NOT_FOUND -111 Interprocess message not found. SIDEBAR_EXECUTABLE_NOT_LOCATED -112 Sidebar Executable Not Located. SIDEBAR_NOT_SUPPORTED_THIS_PLATFROM -113 Sidebar is not supported on this platform. -114 Sidebar is not enabled presently. INVENTORY_ITEM_NOT_FOUND CONFIGURATION_EXTENTION_OFF CONFIGRATIONLASTUPDATE_VALUE CONFIGURATION_MASTERSLAVE_OFF MME_FAILED_TO_DECYPHER_TYPE RT_ADD_DUPLICATE_PID RT_REM_BAD_PID CHECKINPERIOD_EVENT_RANGE USAGEDATA_UPLOAD_DISABLED CONFIGURATION_MASTERCOLLECTION_OFF MASTER_NO_COLLECTING SIDEBAR_NOT_ENABLED CONFIGURATION_IPMESSAGE_VALUE CONFIGURATION_FILEDELETIONWINDOW 90 | P a g e -115 Configuration Setting Error : IP Message format must be in range 1 to 1. -116 Configuration Setting Error : Temp file deletion window must be 1 to 30 days. CONFIGURATION_DEVELOPERSMODE_VALUE CONFIGURATION_CONSOLE_LOAD CONFIGURATION_SIDEBAR_COPY_TO_CLIPBOAR D CONFIGURATION_SIDEBAR_COPY_TO_CONSOLE CONFIGURATION_SIDEBAR_SIMULATE_TYPE NOT_IN_DEVELOPERS_MODE FACTLET_SERVER_ERROR FILE_POINTER_IS_INVALID FACTLETPARSER_NO_FORMULAS FACTLETPARSER_NO_MATCH CONFIGURATION_SUPPLIMENTAL_CODE_ENABL ED CONFIGURATION_ITEM_DOES_NOT_EXIST OFDB_UPLOAD_CONFIG_INVALID PARAMETER_TYPE_CHECKING_VALUE AUTO_ESCAPE_FOR_DATADIRECT_VALUE MENU_KEEP_OPEN_VALUE OFDB_ALLOWED_FIELD_CHARS_VALUE OFDB_ALLOWED_FIELD_LENGTH_VALUE 91 | P a g e -117 Configuration Setting Error : Developer Mode must be set 'TRUE' or 'FALSE'. -118 Configuration Setting Error : Console Load must be set 'TRUE' or 'FALSE'. -119 Configuration Setting Error : SideBarCopyToClipboard must be set 'TRUE' or 'FALSE'. -120 Configuration Setting Error : SideBarCopyToConsole must be set 'TRUE' or 'FALSE'. -121 Configuration Setting Error : SideBarSimulateType must be set 'TRUE' or 'FALSE'. -122 Function is only available in developer's mode. -123 Connection Error : FactSet internal server error. -124 File I/O Error : File Pointer is Invalid. -125 FQL\\Screening Error : No formula provided. -126 FQL\\Screening Error : Unable to match Factlet. -127 Configuration Setting Error : SupplementalCodeEnabled must be set 'TRUE' or 'FALSE'. -128 Configuration Setting Error : Item does not exist. -133 Invalid value for OFDB Upload Threshold. -134 Invalid value for Parameter Type Checking - must be 'TRUE' or 'FALSE'. -135 Invalid value for Auto Escape must be 'TRUE' or 'FALSE'. -138 Configuration Setting Error : OFDB Column Limit must be in range 3 to 600. -139 Configuration Setting Error : OFDB Character Limit must be in range 25 to 252. -140 Configuration Setting Error : Keep Menu Open must be set 'TRUE' or 'FALSE'. DATADIRECTTESTURL_VALUE FAILED_CREATING_FILE -141 outString=Configuration Setting Error : More characters required. -142 outString=Configuration Setting Error : OFDB Character Limit must be in range 10 to 128. -143 outString=Configuration Setting Error : Invalid URL String. -144 outString=Configuration Setting Error : Using Test URL must be set 'TRUE' or 'FALSE'. -1000004 Library error : Serious Application Error. Unable to locate libcurl.dll, libeay32.dll and/or ssleay32.lib. Check that these files are the correct architecture and in the C:\\Windows\\System32 folder. -1000005 Connection Error : Failed to resolve proxy. Check Proxy Server Name. -1000006 Connection Error : Failed to resolve host. Check DataDirect URL. -1000007 Connection Error : Failed to connect. Check Proxy Server Settings. -1000028 Connection Error : Connection Timeout. Adjust timeout setting or decompose query into smaller queries. -1000056 Connection Error : Failed to receive data from network. Check Proxy Authentication and Connection. -2000009 Windows API Registry Failure : Failed to write string. -2000010 Windows API Registry Failure : Strings don't match. -2000036 Failed creating file. FAILED_LOCKING_FILE -2000037 Failed locking file. FAILED_WRITING_FILE -2000038 Failed writing file. FAILED_READING_FILE -2000039 Failed reading file. FAILED_UNLOCKING_FILE -2000040 Failed unlocking file. FAILED_CLOSING_HANDLE -2000041 Failed closing file handle. USING_DATADIRECT_TEST_URL_VALUE USING_POST_BUILDER_VALUE POST_BUILDER_CHAR_LIMIT_VALUE CURL_ERROR_NOT_BUILT_IN CURL_ERROR_RESOLVEPROXY CURL_ERROR_RESOLVEHOST CURL_ERROR_CONNECTIONFAILURE CURL_ERROR_QUERYTIMEOUT CURL_ERROR_FAILEDTORECIEVE OS_WRITE_REG_VAL_FAIL OS_WRITE_STRINGS_DONT_MATCH 92 | P a g e FAILED_SETTING_FILE_POINTER -2000042 Failed setting file pointer. FAILED_SETTING_END_OF_FILE -2000043 Failed setting end of file. COM_COINITIALIZED_FAILED -2000045 COM Error : COM CoInitialize Failed. -2000046 COM Error : COM CoCreate Failed. -2000047 COM Error : FDS API Fetch Failed. COM_COCREATE_FAILED COM_FETCH_FAILED COM_VARIANT_TYPE_UNKNOWN KEYBOARD_INSERT_TOO_SOON -2000048 COM Error : Variant type not known. -2000049 Simulated type too soon. THREAD_NOT_RETURNED -4000000 Thread still executing. 93 | P a g e Table 4: Top 25 most commonly used FactSet Fundamentals formulas Description ExtractDataSnapshot Syntax ExtractFormulaHistory Syntax Acquisition of Business (Cash Flow) Capital Expenditures (Fixed Assets) Capital Expenditures (Other Assets) Cash Dividends Paid FF_ACQ_BUS_CF(QTR,0) FF_ACQ_BUS_CF(QTR,0,-4,,,USD) FF_CAPEX_FIX(ANN,0) FF_CAPEX_FIX(ANN,0,-5AY,,,USD) FF_CAPEX_OTH(ANN,0) FF_CAPEX_OTH(ANN,0,-5AY,,,USD) FF_DIV_CF(ANN,0) FF_DIV_CF(ANN,0,-5AY,,,USD) Cash Flow from Financing Activity - Net (Cash Flow) Cash Flow from Investing Activity - Net (Cash Flow) Cash Flow from Operating Activity - Net (Cash Flow) Changes in Working Capital Common Equity (Total) FF_FIN_CF(ANN,0) FF_FIN_CF(ANN,0,-5AY,,,JPY) FF_INVEST_CF(ANN,0) FF_INVEST_CF(ANN,0,-5AY,,,USD) FF_FUNDS_OPER_GROSS(ANN,0) FF_FUNDS_OPER_GROSS(ANN,0,5AY,,,USD) FF_WKCAP_CHG(ANN,0) FF_WKCAP_CHG(ANN,0,-5AY,,,USD) FF_COM_EQ(QTR,0) FF_COM_EQ(QTR,-10,0,,,EUR) Cost of Goods Sold Excluding Depreciation & Amortization Depreciation & Amortization (Cash Flow) Extraordinary Items (Cash Flow) Funds from Operations FF_COGS_XDEP(ANN,0) FF_COGS_XDEP(ANN,0,-5AY,,,JPY) FF_DEP_EXP_CF(ANN,0) FF_DEP_EXP_CF(ANN,0,-5AY,,,USD) FF_XORD_CF(ANN,0) FF_XORD_CF(ANN,0,-5AY,,,CAD) FF_FUNDS_OPER_GROSS(ANN,0) Issuance of LT Debt FF_DEBT_LT_ISS_CF(ANN,0) FF_FUNDS_OPER_GROSS(ANN,0,5AY,,,USD) FF_DEBT_LT_ISS_CF(ANN,0,-5AY,,,USD) Long Term Debt excluding Capital Lease Obligations Minority Interest Accumulated Preferred Stock Carrying Value Price - Close for Calendar Period End Purchase of Investments Reduction of LT Debt FF_DEBT_LT_XCAP(ANN,0) FF_DEBT_LT_XCAP(ANN,0,-5AY,,,USD) FF_MIN_INT_ACCUM(ANN,0) FF_MIN_INT_ACCUM(ANN,0,-5AY,,,USD) FF_PFD_STK(QTR,0) FF_PFD_STK(QTR,0,-10,,,USD) FF_PRICE_CLOSE_CP(ANN,0) Repurchase of Common & Pref Stock Sale of Common & Pref Stock Sales or Revenues Net Short-Term Debt (incl. Current Portion of LTD) FF_STK_PURCH_CF(ANN,0) FF_PRICE_CLOSE_CP(ANN,0,5AY,,,USD) FF_INVEST_PURCH_CF(ANN,0,5AY,,,USD) FF_DEBT_LT_REDUCT_CF(ANN,0,5AY,,,USD) FF_STK_PURCH_CF(ANN,0,-5AY,,,USD) FF_STK_SALE_CF(ANN,0) FF_STK_SALE_CF(ANN,0,-5AY,,,USD) FF_SALES(ANN,0) FF_SALES(ANN,0,-5AY,,,USD) FF_DEBT_ST(ANN,0) FF_DEBT_ST(ANN,0,-5AY,,,USD) 94 | P a g e FF_INVEST_PURCH_CF(ANN,0) FF_DEBT_LT_REDUCT_CF(ANN,0) Table 5: FactSet Economics Key Indicator Series for G-7 Countries DBSOURCE ITEM-MNEMONIC COUNTRY DESCRIPTION Average hourly wage rate, Total employees, CAD - Canada Average Weekly Earnings, Industrial aggregate excl. unclassified, CAD, SA Canada BOP, Current Account, Balance, CAD, SA - Canada Building Permits, Total, CAD, SA Canada Business leading indicators, Composite index of 10 indicators, 1992=100, Smoothed - Canada Capacity Utilization, Total industrial, Percent - Canada Core CPI (All items excl. the 8 most volatile components), 2002=100, NSA Canada Corporation profits after taxes, CAD, SAAR - Canada CPI, All items, 2002=100, NSA - Canada FDS_CANSIM V2415197 Canada FDS_CANSIM V1597104 Canada FDS_CANSIM V114421 Canada FDS_CANSIM V4667 Canada FDS_CANSIM V7688 Canada FDS_CANSIM V4331081 Canada FDS_CANSIM V41692942 Canada FDS_CANSIM V499681 Canada FDS_CANSIM V41690973 Canada FDS_CANSIM V2062811 Canada FDS_CANSIM V41590956 Canada FDS_CANSIM V41881175 Canada FDS_CANSIM V499722 Canada FDS_CANSIM V498086 Canada FDS_CMHC CMHCDT00001@CA Canada FDS_CANSIM V41590548 Canada FDS_CANSIM V53384992 Canada FDS_CANSIM V1409153 Canada FDS_CANSIM V803227 Canada FDS_CANSIM V800913 Canada FDS_CANSIM V800450 Canada FDS_CANSIM V800450 Canada FDS_CANSIM V191490 Canada FDS_CANSIM V183406 Canada 95 | P a g e Employment, Total, Persons, SA Canada Export Price Index, Total, Paasche current weighted, 2002=100, NSA Canada GDP by Industry, All industries, Chained 2002 dollars, SAAR - Canada Gross domestic product (GDP) at market prices, CAD, NSA - Canada Gross domestic product (GDP) at market prices, CAD, SAAR - Canada Housing Starts, Total Dwelling Units, All Areas, Canada, Thousands of Units, SAAR - Canada Import Price Index, Total, Paasche current weighted, 2002=100, NSA Canada Industrial Product Prices, Total, All Commodities, 2002=100 - Canada Labour Productivity, Business Sector, Labour productivity, 2002=100, SA Canada Manufacturers' Inventories, All Manufacturing Industries, CAD, SA Canada Manufacturers' New Orders, All Manufacturing Industries, CAD, SA Canada Manufacturers' Shipments, All Manufacturing Industries, CAD, SA Canada Manufacturers' Shipments, All Manufacturing Industries, CAD, SA Canada Merchandise Exports, Total, CAD, SA Canada Merchandise Imports, Total, CAD, SA - Canada FDS_CANSIM V41552786 Canada Money Supply, M2, CAD - Canada FDS_CANSIM V53600422 Canada FDS_CANSIM V42169912 Canada FDS_CANSIM V53434748 Canada FDS_CANSIM V52367097 Canada FDS_CANSIM V52367119 Canada FDS_CANSIM V2062815 Canada FDS_ECON FRBP0013337 France EURO_STAT ECONSENTNR2@FR France FDS_ECON FRSU0013609 France FDS_ECON FRSU0013621 France FDS_ECON FRSU0111884 France FDS_ECON FRSU1335083 France FDS_ECON FRPR0403230 France FDS_ECON FRPR0067552 France FDS_ECON FRLM0066761 France FDS_ECB ECBGGDEF%GDP@FR France EURO_STAT GDS13%GDP@FR France FDS_ECON FRPR1172435 France New housing price index, Total (house and land), 2007=100 - Canada New motor vehicle sales, Total, Units, SA - Canada Raw Material Prices, Total, 2002=100 Canada Retail sales, All trade groups, NAICS, CAD, SA - Canada Retail sales, Motor vehicle and parts dealers, NAICS, CAD, SA - Canada Unemployment Rate, Total, Percent, SA - Canada Balance of Payments, Current Account, Net, Mil Eur Business Survey, Economic sentiment indicator, Nace R2, SA - France Business Survey, Industry, Total, Business sentiment indicator, SA,% France Business Survey, Industry, Total, Capacity utilisation rate, SA,% - France Business Survey, Manufacturing industry, Synthetic Index - France Consumer Confidence Survey, Consumer prices, Synthetic index, Balance, WDA/SA, % - France CPI, Total excluding energy, 1998=100, Index - France CPI, Total, NSA, 1998=100, Index France Employment, Total (excluding agriculture), SA - France General govt deficit/surplus, incl. UMTS proceeds, Non-financial flows, Current Prices (ESA95, % of GDP) - France Government Consolidated Gross Debt, General Government, % of GDP France Harmonized CPI, Index - France FDS_ECON FRIN0066438 France FDS_ECON FRFT0414480 France FDS_ECON FRNA0062321 France FDS_ECON FRNA0061958 France FDS_ECON FRNA0061974 France FDS_ECON FRNA0988432 France FDS_ECON FRSA0312432 France 96 | P a g e Industrial Production, Industry, SA/WDA (2005=100) - France International Trade, Balance, Total FOB/FOB (including military equipment), Million EUR, SA/WDA - France NA, Household consumption expenditure, Total, chain-linked volumes, Bil. EUR, TD/SA - France National Accounts, Gross Domestic Product, Chained Prices, WDA/SA, Bil EUR - France National Accounts, Gross Domestic Product, Current Prices, WDA/SA, Bil EUR - France National Accounts, Households consumption expenditures, Manufactured goods, Base 2005, EUR France New Passenger Cars Registration, Total, Numbers - France FDS_ECON FRSA0111775 France FDS_ECON FRPR0111776 France FDS_ECON FRSU0013519 France FDS_ECON FRLM0111772 France FDS_ECON FRLM0988436 France FDS_ECON FRLM0111773 France FDS_ECON DEBP0386292 Germany FDS_ECON DEBP0386292 Germany FDS_ECON DEBP0386308 Germany FDS_ECON DEBP0386310 Germany FDS_ECON DEBP0386263 Germany EURO_STAT UCAP@DE Germany EURO_STAT ECONSENTNR2@DE Germany FDS_ECON DESU0083141 Germany FDS_ECON DESU0933978 Germany EURO_STAT CONSCONF@DE Germany FDS_ECON DEPR0988455 Germany FDS_ECON DEPR0422832 Germany FDS_ECON DELM0987186 Germany FDS_ECB ECBGGDEF%GDP@DE Germany EURO_STAT GDS13%GDP@DE Germany FDS_ECON DEPR0422980 Germany FDS_ECON DENA0436208 Germany FDS_ECON WDSA0161561 Germany FDS_ECON DENA0435181 Germany FDS_ECON DEPR0992887 Germany FDS_ECON DEIN0992522 Germany FDS_ECON DEIN0992528 Germany 97 | P a g e New vehicles registrations, SA/WDA, Thous EUR - France PPI, Total Industry , 2005=100 - France Retail Trade Survey, Total Trade, Value, SA, Index - France Unemployment Rate by Sex and Age, Total, SA, % - France Unemployment Rate, Total, Metropolitan and DOM, Percent - France Unemployment, Total Population, SA, Thous of Persons - France BOP, Balance On Current Account, Mil. EUR - Germany BOP, Balance On Current Account, Mil. EUR - Germany BOP, Exports, Total, Thou. EUR Germany BOP, Imports, Total, Thou. EUR Germany BOP, Trade In Goods, External Trade, Balance, Mil. EUR - Germany Business Survey - Industry, Current level of capacity utilization (%), Balance, SA Germany Business Survey, Economic sentiment indicator, Nace R2, SA - Germany Business Surveys, IFO, Main Index, Business Climate, Trade and Industry (2005=100), Index, SA - Germany Business Surveys, ZEW, Economic Expectations, Germany (ZEW Indicator), Balance, % - Germany Consumer Survey - Consumer confidence indicator, Balance, SA Germany CPI, All Items excluding fuel, NSA, Index 2005=100 - Germany CPI, Total (2005=100) - Germany Employment, Overall, SA, Thous Germany General govt deficit/surplus, incl. UMTS proceeds, Non-financial flows, Current Prices (ESA95, % of GDP) - Germany Government Consolidated Gross Debt, General Government, % of GDP Germany HICP, Total, 2005=100 - Germany NA, Real, Consumption & Investment, Private Consumption Expenditure Households, SA/CA, X-12-ARIMA, Chain Index, 2000=100 - Germany New Passenger Car Registrations, Germany - World Nominal GDP, Total, NSA, Bil EUR, 2005=100 - Germany PPI, Total Industry, 2005=100 Germany Production, Industry, SA/CA, 2005=100 Germany Production, Manufacturing Excluding Construction, SA/CA, 2005=100 - Germany FDS_ECON DENA0435202 Germany FDS_ECON DEPR1422754 Germany FDS_ECON DESA0988452 Germany FDS_ECON DELM0987184 Germany FDS_ECON ITBP0062460 Italy EURO_STAT UCAP@IT Italy EURO_STAT ECONSENTNR2@IT Italy FDS_ECON ITSU1026964 Italy EURO_STAT CONSCONFBAL@IT Italy FDS_ECON ITPR0027835 Italy FDS_ECON ITPR0027834 Italy FDS_ECON ITLM0073816 Italy FDS_ECON ITFT0069219 Italy FDS_ECON ITFT0069225 Italy FDS_ECON ITFT0069229 Italy FDS_ECB ECBGGDEF%GDP@IT Italy EURO_STAT GDS13%GDP@IT Italy FDS_ECON ITLM0069240 Italy FDS_ECON ITIN0069198 Italy FDS_ECON ITIN0036245 Italy FDS_ECON ITNA0027276 Italy FDS_ECON ITNA0027318 Italy FDS_ECON ITNA0027318 Italy FDS_ECON WDSA0161564 Italy FDS_ECON ITPR0069203 Italy FDS_ECON ITPR1294953 Italy 98 | P a g e Real GDP, Total, SA/CA X12-ARIMA, 2005=100 - Germany Retail Prices, Retail and Motor Trade, Including VAT, 2005=100, Index Germany Retail Sales, Total Excluding Motor Vehicles, Real, NSA, Index 2005=100 Germany Unemployment Rate, Overall, SA, % Germany BOP, Current Account Balance, Mil EUR - Italy Business Survey - Industry, Current level of capacity utilization (%), Balance, SA Italy Business Survey, Economic sentiment indicator, Nace R2, SA - Italy Business Surveys, Manufacturing, Total, Confidence Indicator (2005=100), SA Italy Consumer Survey - Consumer confidence indicator, Balance, SA - Italy CPI, Total (excl. tobacco) (2010=100) Italy CPI, Total (including tobacco) (2010=100) - Italy Employment, by Geographical Area & Sex, Total, Thousands - Italy Foreign trade, Balances, Total balance, Total, Millions of Eur - Italy Foreign trade, Exports, Total exports, Total, Millions of Eur - Italy Foreign trade, Imports, Total imports, Total, Millions of Eur - Italy General govt deficit/surplus, incl. UMTS proceeds, Non-financial flows, Current Prices (ESA95, % of GDP) - Italy Government Consolidated Gross Debt, General Government, % of GDP - Italy Hourly wages, per employee, Total - Italy Industrial new orders, Total new orders index, Total industry excluding Construction (2005=100) - Italy Industrial production, Total industry excluding construction, SA (2005=100) Italy National Accounts, Chained Volumes, Gross domestic product at market prices, Eur, SA - Italy National Accounts, Current Prices, Gross domestic product at market prices, Eur, SA - Italy National Accounts, Current Prices, Gross domestic product at market prices, Eur, SA - Italy New Passenger Car Registrations, Italy World PPI, Total industry excluding Construction (2005=100) - Italy Prices, HICP, Base 2005=100, Index - Italy FDS_ECON ITSA0069242 Italy FDS_ECON ITLM0074794 Italy FDS_ECON JPBP0577771 Japan FDS_ECON JPSU0311674 Japan FDS_ECON JPSU0087044 Japan FDS_ECON JPSU0590365 Japan FDS_ECON JPSU0590299 Japan FDS_ECON JPPR0582659 Japan FDS_ECON JPPR0988546 Japan FDS_ECON JPPR0988545 Japan FDS_ECON JPPR0382789 Japan FDS_ECON JPPR0382786 Japan FDS_ECON JPNA0068561 Japan FDS_ECON JPIN0590229 Japan FDS_ECON JPIN0322658 Japan FDS_ECON JPIN0943453 Japan FDS_ECON JPFT0558218 Japan FDS_ECON JPFT0558219 Japan FDS_ECON JPLI0420280 Japan FDS_ECON JPLI0087084 Japan FDS_ECON JPLM0988459 Japan FDS_ECON JPLM0938143 Japan FDS_ECON JPLM0938144 Japan FDS_ECON JPMA0337151 Japan BOP, Current Account, Current AccountSa - Japan Business Sentiment, Small And MediumSized Companies, All Industries, Index Japan Consumer Confidence Survey, Total, SA, Index - Japan Consumer Surveys, Family Income & Expenditures, Workers HHs, Average Propensity to Consume, % - Japan Consumer Surveys, Real Family Income & Expenditures, Workers HHs, Consumption, 2005=100, SA - Japan Corporate Goods Price Index, Domestic, All commodities, 2005=100 - Japan CPI, Tokyo, Total Ex. Fresh Food, 2010=100, Index - Japan CPI, Tokyo, Total, 2010=100, Index Japan CPI, Total Ex. Fresh Food, 2010=100, Index - Japan CPI, Total, NSA, 2010=100, Index Japan GDP Deflator, GDP Total, 2000=100 Japan Industrial Orders, Machinery, Total Ex. Volatile Orders - Japan Industrial Production Index(IPI), Production, By Goods, Mining & manufacturing, (2005=100), Sa - Japan Industry Activity Indices, Indices of All Industry Activity (except Agriculture,Forestry and Fisheries), SA, 2005=100 - Japan International Trade, Exports, Total, NSA, JPY - Japan International Trade, Imports, Total, NSA, JPY - Japan Leading Index, Total Composite, 2005=100 - Japan Leading Indicators, Sales Forecast D.I. of Small Businesses, % - Japan LFS, Unemployment Rate, %, SA, Percent - Japan LM, Active Job Opening, Persons Japan LM, New Job Openings. Number Of Japan Money Stock, M1, Average - Japan FDS_ECON JPMA0337149 Japan Money Stock, M2, Average - Japan FDS_ECON JPNA0067856 Japan FDS_ECON JPNA0068194 Japan FDS_ECON JPBC0587691 Japan Nominal GDP, Expenditure Approach, Total - Japan Nominal GDP, Expenditure Approach, Total, SA - Japan Outstanding of Deposits and Loans, Loans and Discounts, Total of Banks 99 | P a g e Retail Sales, Total, NSA (2005=100) Italy Unemployment Rate, Total SA - Italy and Shinkin Banks - Japan FDS_ECON JPGV0341530 Japan FDS_ECON JPGV0341530 Japan FDS_ECON JPNA0068239 Japan FDS_ECON JPNA0068239 Japan FDS_ECON JPSU0353978 Japan FDS_ECON JPSU0354014 Japan ONS_ECON IKBL United Kingdom ONS_ECON HBOP United Kingdom FDS_BOE BOELPVTVJ United Kingdom ONS_ECON D7BT United Kingdom ONS_ECON DKC9 United Kingdom ONS_ECON NMRY United Kingdom ONS_ECON YBGB United Kingdom ONS_ECON YBHA United Kingdom ONS_ECON YBHA United Kingdom ONS_ECON ABJR United Kingdom ONS_ECON NRJS United Kingdom FDS_ECON GBHC1137972 United Kingdom ONS_ECON CGBZ United Kingdom ONS_ECON BEAO United Kingdom ONS_ECON MGRZ United Kingdom ONS_ECON MGSX United Kingdom ONS_ECON LRYC United Kingdom 100 | P a g e Public Finance, National Government Debt, Total - Japan Public Finance, National Government Debt, Total - Japan Real GDP, Expenditure Approach, Total, SA - Japan Real GDP, Expenditure Approach, Total, SA - Japan Tankan Business Conditions Diffusion Index, Large Enterprises, Manufacturing, Actual result - Japan Tankan Business Conditions Diffusion Index, Large Enterprises, Nonmanufacturing, Actual result - Japan Balance of Payments: Imports: Total Trade in Goods & Services: CVM SA United Kingdom BoP Current Account Balance SA Mil. of GBP - United Kingdom Changes of Total Sterling Net Secured Lending to Individuals & Housing Associations, Mil. GBP, SA - United Kingdom CPI INDEX 00, ALL ITEMS- estimated pre-97 2005=100 - United Kingdom CPI INDEX: Excluding energy & seasonal food (SP) 2005=100 - United Kingdom General Government: Final consumption expenditure: P3: CVM SA - United Kingdom Gross Domestic Product (Expenditure) at market prices deflator: SA - United Kingdom Gross Domestic Product at market prices: Current price: Seasonally adjusted - United Kingdom Gross Domestic Product at market prices: Current price: Seasonally adjusted - United Kingdom Household final consumption expenditure, National concept CVM NAYear SA - United Kingdom Households & NPISH: Households saving ratio: CP SA - United Kingdom Housing and Construction, Construction Output, Total output, Total, 2005 Prices, SA, Mil GBP - United Kingdom Income based: Gross operating surplus of corporations, Total: CP SA - United Kingdom LFS: ILO redundancy level: UK: All: SA United Kingdom LFS: In employment: UK: All: Aged 16&: 000s: SA: Annual = Spring qtr (Mar to May) - United Kingdom LFS: Unemployment rate: UK: All: Aged 16 and over: %: SA - United Kingdom Manufacturing PNFCs net rate of return (%) - United Kingdom FDS_ECON GBSA0313873 United Kingdom FDS_BOE BOELPVTVX United Kingdom ONS_ECON LRWM United Kingdom ONS_ECON K646 United Kingdom ONS_ECON J5C4 United Kingdom ONS_ECON LRYQ United Kingdom ONS_ECON BCJD United Kingdom ONS_ECON RLMH United Kingdom ONS_ECON AP2Y United Kingdom ONS_ECON DYDC United Kingdom ONS_ECON LNNK United Kingdom FDS_ECON BLSCES0000000001 United States FDS_ECON BLSCES0500000008 United States FDS_ECON FFFL152090005 United States FDS_BEA BEABOPT1L76@US United States FDS_FRB FRBUTLB50001 United States FDS_BEA BEANIPADPCCRG3@US United States FDS_BEA BEANIPADPCERG3@US United States TCB_BCI G0M910 United States FDS_FRB CRED@US United States FDS_BLS BLSCUSR0000SA0L1E United States FDS_BLS BLSCUSR0000SA0 United States FDS_BLS BLSCUSR0000SA0 United States FDS_ECON BLSCIS1010000000000I United States FDS_ECON FFLA314104005 United States FDS_BEA BEANIPAA191RV1@US United States 101 | P a g e New Car Registrations, Total - United Kingdom Number of Total Sterling Approvals for House Purchase to Individuals (Thous), SA - United Kingdom PNFCs net operating surplus in Mil. of GBPillion - United Kingdom PPI: 6207000050: All mfg (materials & fuel purchased) (Net sector input prices) - United Kingdom RSI: Value Seasonally Adjusted: All Retailers inc fuel: All Business Index United Kingdom Service sector PNFCs net rate of return (%) - United Kingdom Total Claimant count SA (UK) thousands - United Kingdom Total consumer credit: Net lending: SA United Kingdom UK Vacancy Survey C-O - avg 3 month level - United Kingdom UK Workforce jobs (SA), Total thousands (LMT table B11) - United Kingdom Unit Wage Costs, whole economy SA: Index 2002=100: UK - United Kingdom All Employees, Total Nonfarm Payroll, Thousands of Persons, SA - United States Average Hourly Earnings Of Production And Nonsupervisory Employees Total Private SA - United States Balance sheet of households & nonprofit organizations - Net worth, B.100 - United States BOP Current Account balance, SA United States Capacity Utilization, Total index, NSA United States Chain-Type Price Index for PCE, Excl. Food & Energy, Price Index, 2005=100, SA - United States Chain-Type Price Index for PCE, Price Index, 2005=100, SA - United States Composite index of 10 leading indicators (2004=100) Consumer Credit Outstanding, Total, SA (Bil. Dollars) - United States CPI-U All Items Less Food And Energy U.s. City Average SA 1982-84=100 United States CPI-U All Items U.s. City Average SA 1982-84=100 - United States CPI-U All Items U.s. City Average SA 1982-84=100 - United States Employment Cost Index Total Compensation All Civilian All Workers SA Dec. 2005=100 - United States Federal government - Credit market instruments, D.3 - United States Gross Domestic Product, %Chg P/P in Price Index, SAAR - United States FDS_BEA BEANIPAA191RC1@US United States FDS_BEA BEANIPAA191RL1@US United States FDS_CENSUS CENHAUTHBP@US United States FDS_CENSUS CENSTARTS@US United States FDS_FRB FRBIPSB50001 United States FDS_ISM ISMPMI@M United States FDS_ISM ISMNMI@NM United States FDS_FRB FRBM2@US United States FDS_BEA BEANIPAA051RC1@US United States FDS_CENSUS CENAMTMNO United States FDS_CENSUS CENHSOLDTOT@US United States FDS_FRB FRBJXRATEM@US United States FDS_BEA BEANIPAA466RC1@US United States FDS_ECON BLSPRS85006092 United States FDS_BEA BEANIPADPCERC1@US United States FDS_BEA BEANIPADPCERL1@US United States FDS_BEA BEANIPAA065RC1@US United States FDS_BEA BEANIPAA072RC1@US United States TCB_BCI G0M940 United States FDS_FRB FRBJXRATEMR@US United States FDS_CENSUS CENRETAIL@US United States FDS_CENSUS CENRETAIL&FS@US United States FDS_CENSUS CEN10010 United States FDS_CENSUS CENAMTMTI United States FDS_CENSUS CENTRBT@US United States FDS_CENSUS CENTRXT@US United States FDS_ECON BLSLNS14000000 United States 102 | P a g e Gross Domestic Product, Bil. $, SAAR United States Gross Domestic Product, Real %Chg P/P - United States Housing Units Authorized by Building Permits, Total, SA - United States Housing Units Started, Total, SA - United States Industrial Production, Total index, SA United States ISM (NAPM) Manufacturing, Purchasing Managers Index - United States ISM (NAPM) Non-Manufacturing Index United States M2 Money Supply, SA - United States National Income, Corporate Profits with IVA & CCAdj, Bil. $, SAAR - United States New Orders, NAICS, Total Manufacturing, SA - United States New Residential Sales, New Houses Sold, Total, SA - United States Nominal Trade-Weighted Exchange Rate Index, Major Currencies, 3/1973=100 - United States Nonfinancial Corporate Business, Profits After Tax (Without IVA & CCAdj), Bil. $, SAAR - United States Output Per Hour Nonfarm Business All Persons % Change Quarter Ago, At Annual Rate SA - United States Personal Consumption Expenditures, Bil. $, SAAR - United States Personal Consumption Expenditures, Real %Chg P/P - United States Personal Income, Bil. $ - United States Personal Income, Personal Saving As A Percentage Of Disposable Personal Income, Bil. $, SAAR - United States Ratio, coincident index to lagging index (1996=100) Real Trade-Weighted Exchange Rate Index, Major Currencies, 3/1973=100 United States Retail Sales, NAICS, Total, SA (Incl. in Advance Release) - United States Retail Sales, Retail & Food Service Sales, NAICS, SA (Incl. in Advance Release) - United States Total Construction Put in Place, Mil. USD, SA - United States Total Inventories, NAICS, Total Manufacturing, SA - United States U.S. International Trade - Balance Total G&S, BOP Basis, Mil. USD, SA - United States U.S. International Trade - Exports Total G&S, BOP Basis, Mil. USD, SA - United States Unemployment Rate - Percent, SA United States FDS_ECON BLSLNS14000000 United States FDS_BEA BEADETSAARD3@US United States FDS_BEA BEADETSAARF3@US United States FDS_ECON BLSPRS85006112 United States FDS_BEA BEADETTEMG3@US United States FDS_CENSUS CENAMTMVS United States FDS_BLS BLSWPSSOP3520 United States FDS_BLS BLSWPSSOP3000 United States 103 | P a g e Unemployment Rate - Percent, SA United States Unit Auto Sales, Domestic, Millions of Vehicles, SAAR - United States Unit Auto Sales, Foreign, Millions of Vehicles, SAAR - United States Unit Labor Costs Nonfarm Business All Persons % Change Quarter Ago, At Annual Rate SA - United States Unit Truck Sales, Light Trucks (14,000 Lbs. GVW & Under), Imports, Millions of Vehicles, SAAR - United States Value of Shipments, NAICS, Total Manufacturing, SA - United States WPI Stage Of Processing, Finished Goods Less Energy SA 1982=100 United States WPI Stage Of Processing, Finished Goods SA 1982=100 - United States Table 6: UploadToOFDB Error Messages "One or more required parameters are not set" "First column must be labeled 'Id' and be type 'Id'" "Second column must be labeled 'Date' and be type 'Date'" "Client Data Space is Full" "Invalid data type in column #: <TYPE>" "Invalid dates (#) starting on row #: '<VALUE>'" "Invalid field names for this OFDB starting with: <FIELDNAME>" 104 | P a g e FactSet Glossary Factlet = A factlet is a FactSet report that retrieves a raw table of data. These reports or functions are application components that encapsulate business logic and data collection procedures. Factlets consist of built in multiple result formats that a user can choose from (i.e. XML, Delimited, Excel). The data can then be cleaned up (i.e. converted to data set). FactSet DataDirect = DataDirect provides synchronous access to FactSet data via the standard HTTPS protocol. Data can be returned in a number of formats, such as XML or CSV file. There are many reports and services available. A user can make custom requests by changing the request URL to contain the needed parameters. DataDirect uses HTTP basic authentication over Secure Sockets Layer (SSL). FactSet Economics = FactSet database of primary-sourced information on the global economy. Includes specialty sources such as Eurostat, ICIS, IMF, LME, NYMEX, and OECD. Data from this database can be retrieved most effectively using the ExtractEconData function. FactSet Fundamentals = FactSet database includes coverage of more than 66,600 companies from over 70 countries, 20 years of historical data and up to 2,000 data elements on each company record. Comprised of annual and interim/quarterly data, detailed historical financial statement content, per share data, calculated ratios, and pricing. Data from this database can be retrieved most effectively using the ExtractFormulaHistory function for a time-series of data request and using the ExtractDataSnapshot function for a single date data request. FQL (FactSet Query Language) = FQL is a proprietary data retrieval language used to access FactSet data. Requesting data with FQL is powerful, flexible, and versatile. Some advantages of FQL include: The ability to specify dates for any database using the same formats. With FQL, date formats are flexible. You can use a number of consistent date formats (defined by FQL) for all databases which makes using and combining data from different databases easier than ever. 105 | P a g e The ability to iterate items, formulas, and functions at any frequency. With FQL, you can iterate items, formulas, and functions at any frequency. For example, you can request a series of weekly price to earnings ratios To download the Introduction to FQL manual see the FactSet Online Assistant page 1961. FactSet Workstation = FactSet platform that is installed on a client’s desktop and provides an interface to access content and analytical tools to easily examine a range of data, including prices, financials, estimates, research reports, news, and a client’s proprietary data. The data accessible in a workstation can be extracted using the factlet reports. Analytical tools include an interface for performing company analysis, viewing market data in real time, generating investment ideas, and managing portfolios. Online Assistant = Online Assistant is a utility available in the FactSet workstation and is a rich information network designed to provide a one-stop source for comprehensive documentation on all of FactSet's applications and databases. Screening Language = The FactSet Screening syntax is way to efficiently extract data for a large universe of securities. By default, the Screening syntax does not allow iteration and therefore cannot be used to return a time series of data with a single request code. To request data as of a single historical date, a date must be specified. If a date is not specified, data is returned from the most recent time period. 106 | P a g e Contact FactSet Support: United States and Canada +1.877.FACTSET support@factset.com India 000.800.440.1703 support@factset.com Spain 900.811.921 support@factset.com United Kingdom 0800.169.5954 support@factset.com Italy 800.510.858 support@factset.com South Africa 0800 166 509 support@factset.com Australia 1800.33.28.33 support@factset.com Japan 0120.779.465 support@factset.com South Korea 080.411.0880 support@factset.com Belgium 080094108 support@factset.com Mexico +1.888.542.9899 support@factset.com Sweden 0200.110.263 support@factset.com Brazil 0800 8917850 support@factset.com Middle Eastern +44.(0)20.7374.4445 support@factset.com Switzerland 0800.881.720 support@factset.com Denmark 8060 1698 support@factset.com Netherlands 0800.228.8024 support@factset.com United Arab Emirates 80004440014 support@factset.com France 0800.484.414 support@factset.com Norway 800.30365 support@factset.com Other Asian Countries +852.3011.4888 support@factset.com Germany 0800.200.0320 support@factset.com Republic of Ireland 1800.409.937 support@factset.com Other European + Russia +44.(0)20.7374.4445 support@factset.com Hong Kong 3011.4888 support@factset.com Singapore 800.61.61.724 support@factset.com 107 | P a g e