MATLABRUser Guide
MATLABRUser Guide
MATLAB and R
Version 3.3 A
1.1 Overview
FactSet supports the major tasks frequently undertaken in a Statistical Package data mining project, such as
data acquisition, data preparation, modeling, and model execution with reporting/graphing. The integration of
data from FactSet into the Third party program allows users to interact with Statistical Package directly to
retrieve company, portfolio, index, market aggregates, ownership and economic data from FactSet.
The integration into a statistical package provides access to FactSet databases through a connection to the
FactSet OnDemand servers via an https request over the Internet.
R and MATLAB users can access functions 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 processing
time-series for a high amount of data, which can be returned in a variety of tagged or delimited formats.
FactSet Market Aggregates (FMA), combines data from FactSet Fundamentals, Estimates and Prices to
calculate ratios and per share values on an aggregate level. FMA provides access to over 50 metrics for more
than 3,500 commercial and exchange indices.
1.3.1 Technology
The FactSet OnDemand integration generates a URL that creates an https request. The data request will be
transmitted over the internet to FactSet OnDemand Servers. FactSet OnDemand uses HTTP basic
authentication over Secure Sockets Layer (SSL). The OnDemand servers handle authentication of the user and
the permissioning of data sets. The OnDemand integration is designed to provide simple access to FactSet data
in reasonably sized blocks through a web service.
There are numerous ways to do build a permanent data structure. One large streaming download may not be
the answer, because there are limitations at both FactSet and the end usernd in between delivery system. If
there is a relatively inflexible query, streaming may work, but large flexible queries require time to build and
may need to be broken up for efficiency. With a steady stream of data, the receiving application would have to
stop and write it permanently to the database once in a while. Also, with a large transfer, there is the risk of
failure.
Sample scripts are provided in the Appendix with examples of how to break down a request, with comments
added to explain each line of the script.
System Requirements:
Note: The FactSet MATLAB/R Plugin 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.
1. Creates a directory under the MATLAB/R root directory called ‘FactSet3’ where the required files for
the plugin are stored.
2. Adds instructions to or creates the startup.m/Rprofile.site files.
3. Adds required information to the path to support the plugin.
4. If .NET 4.0 is not installed it will be installed
5. In R the library rClr is installed
The plugin is available for 32bit and 64bit architecture, ensure to select the installer that corresponds to the
software version the plugin should be used, i.e. if for a 32bit MATLAB version the FactSet plugin installer for
MATLAB 32bit should be used (regardless of the PC’s architecture).
Note: if the program does not detect a proper root, it will not install.
2.3.1 Documentation
For extensive and up-to-date documentation refer to the Configuration Window – Available Documents. A
current Internet connection is required as these documents are stored centrally by FactSet.
F.DumpEventLog()
This will save the EventLog.txt file to the default folder. For MATLAB, the default folder is Documents/MATLAB.
For R, the default folder is Documents.
MATLAB: F.DumpEventLogTo('C:\Users\xxxxxx\Desktop\Test.txt')
R: F.DumpEventLogTo('C:\\Users\\dsheldon\\Desktop\\Test2.txt')
To request a time-series of data; a start date, end date and frequency need to be specified. If a date is not
specified, data is returned from the most recent time period. The dates can be either absolute dates or relative
dates.
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 simple.
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 can be specified.
Overall, FQL syntax should be used to retrieve data for many data items, or to download time series data.
Screening syntax should be used to retrieve data for a large universe for a single point in time.
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 fiscal year prior to the most recently updated year.
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.
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.
The Standard Factlets below are used for Screening data, Economics data and FQL data. For the exact input
syntax, the FactSet Sidebar dialog box can be used.
Function is used for extracting one or more items for a list of ids for 1 date, both for equity or
fixed income securities. Should be used to efficiently extract data for a large universe of securities
as of a single date.
The data can also be retrieved using a backtest date to avoid look-ahead bias in the analysis. The
backtest functionality is available to clients subscribing to one of FactSet’s quantitative
applications in the workstation, such as Alpha Testing or Portfolio Simulation.
ExtractEconData FQL
Function provides access to 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.
ExtractFormulaHistory FQL
Function is used for extracting one or more items for one security, an index or a list of securities
over time.
CorporateActionsSplits FQL
EstimatesOnDemand FQL
Function provides access to FactSet sourced company level estimates data. The data is accessed
through the following reports that are available with this function: Actuals, BrokerDetail,
BrokerSnapshot, Consensus, Guidance, Surprise, Detailed Recommendations and Consensus
Recommendations.
ExtractAlphaTestingSnapshot FQL
ExtractBenchmarkDetail Screening
Function is used for extracting multiple data items for a benchmark. Benchmark data can be Note: The Extract-
retrieved using other functions, such as with ExtractFormulaHistory, but the BenchmarkDetail
ExtractBenchmarkDetail function allows a user to retrieve a more comprehensive overview of the function by default
index constituent data, without additional codes or calculations. In the default output, identifiers uses Screening codes
are sorted in descending order by weight in the index and each row shows the index id, company entered in the items
id, date, ticker, and weight. Additional items are displayed at the end. argument of the
syntax. If using an
FQL code, enter an _
before the FQL items
code.
ExtractOFDBItem Screening
ExtractOFDBUniverse FQL
Function provides access to a list of securities belonging to a single Open FactSet Database
(OFDB) file as of a single date.
ExtractScreenUniverse Screening
Function used for extracting a list of Identifiers stored in a single FactSet screen. In the FactSet
workstation, a user can screen for securities based on specified criteria and store the result using
FactSet Universal Screening for equity or debt securities.
ExtractOptionsSnapshot FQL
Function is used for extracting options data for one or more conditions from the FactSet-Options
Derived Values database.
ExtractSPARData FQL
Function is used for displaying SPAR data for specified funds from databases that includes S&P,
Lipper, Morningstar, Russell, eVestment, Nelson, Rogerscasey, and PSN. A subscription to SPAR in
FactSet is necessary to be able to extract this data in statisical packages.
ExtractVectorFormula FQL
ExtractVectorFormula function is used for extracting FactSet data that is stored in a vector data
format, where the data array does not have a predefined size and is organized by the vector
position. A vector can be thought of as a list that has one dimension, a row of data. A vector
position allows for a particular element of the array to be accessed.
ExtractVectorFormula handles non-sequential data with support for matrix or vector output. The
LSD_Ownership FQL
FactSet Ownership database collects global equity ownership data for institutions, mutual fund
portfolios, and insiders/stake holders. Detailed ownership data can be extracted by company or
by holder (institution, mutual fund, and insider/stake). The LSD_Ownership function is used for
extracting one or more data items from the FactSet Ownership database for one or multiple
securities or holders.
TickHistory is used for extracting real-time trading details for a specific security. The
data comes from FactSet’s Time and Sales database, which provides history of quotes
and trades for a trailing 60 days, or up to 1 year with an additional subscription.
The realtime function is used to stream realtime exchange data and will update with
each trade.
Documents FQL
Requires an additional subscription and FactSet plugin version 3.1+
The Documents service provides access for the retrieval of news stories, investment
research reports, filings, and transcripts. When requested, summary information of the
documents will be returned, including an http URL to access the resulting documents.
Snapshot FQL
Requires an additional subscription and FactSet plugin version 3.1+
The Snapshot service provides access to streaming exchange data and allows the
“snap” of real-time prices at the user’s request. When the command is run, a list of all
available exchange data items will be returned by default.
F.Cancel()
Requires FactSet plugin version 3.2+
Using the new F.Cancel() function will now cancel a user’s request from the backend,
allowing another request to be made.
3.3.5.1 F.ExtractDataSnapshot
where,
Optional arguments,
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’).
cal Calendar setting, arguments include:
FIVEDAY: Displays Monday through Friday, regardless of whether there were trading holidays.
FIVEDAYEOM: Displays Monday through Friday including a weekend date if it falls on the last day of
the month. Where the month-end does not fall on a weekend, the calendar will act just as the
standard five-day calendar.
SEVENDAY: Displays Monday through Sunday.
AAM: For Exchange code uses the calendar of a specific exchange, represented by the exchange
code. If there is no calendar available for a specific exchange, the calendar will default to FIVEDAY.
universe Screening expression to limit the universe
ison Ison-codes can be used to limit the universe ISON_MSCI_WORLD(0,1) is written as
‘ison’,’msci_world’,’isonParams’,’0,1’
isonParams The arguments within brackets in the ison-code
OFDB Universe is the constituents of an OFDB file, default directory is Client, if the OFDB is stored in
another location the path must be included
OFDBDate Specific date for the constituents of the OFDB
universeGroup Specifies what mode of screening to use. The default screening mode is Equity. For Fund screening
and Debt screening the universeGroup argument has to be used with either FUND or DEBT
respectively.
decimals Positionally set according to the items in the selection, ie ‘decimals’,’,,3,4,3’
Example
This example is using the standard Screening syntax to retrieve the quarterly sales value from the FactSet
Fundamentals database for IBM using the Screening code FF_SALES (QTR,20110401,RF,EUR). The data is
retrieved in currency set to Euro, as of 04/01/2011. The RP default argument in the FactSet Fundamentals
database codes reflects that the data is the Latest Preliminary for the Reported Period (alternative arguments
could be for example RF, for the Latest Fully Reported Period, among others).
Id Date ff.sales
1 IBM 2011-04-01 17982.83
MATLAB:
Id: 'IBM'
Date: 734594
ff_sales: 1.7983e+04
3.3.5.2 F.ExtractFormulaHistory
where,
Optional arguments,
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’).
cal Calendar setting, arguments include:
LOCAL: Uses the local trading calendar for each security. Local exchange holidays will be skipped
FIVEDAY: Displays Monday through Friday, regardless of whether there were trading holidays.
FIVEDAYEOM: Displays Monday through Friday including a weekend date if it falls on the last day of
the month. Where the month-end does not fall on a weekend, the calendar will act just as the
standard five-day calendar.
SEVENDAY: Displays Monday through Sunday.
AAM: For Exchange code uses the calendar of a specific exchange, represented by the exchange
code. If there is no calendar available for a specific exchange, the calendar will default to FIVEDAY.
universe Screening expression to limit the universe
ison Ison-codes can be used to limit the universe ISON_MSCI_WORLD(0,1) is written as
‘ison’,’msci_world’,’isonParams’,’0,1’
isonParams The arguments within brackets in the ison-code
OFDB Universe is the constituents of an OFDB file, default directory is Client, if the OFDB is stored in
another location the path must be included
OFDBDate Specific date for the constituents of the OFDB
decimals Positionally set according to the items in the selection, ie ‘decimals’,’,,3,4,3’
dataType The optional argument allows users to define a data type for a data item column that is NA for the
entire column. This option must be defined for every column/data item requested in the command if
it is used at all.
feelback Setting to control data is not falling forward and display NAs instead of carrying forward values, for
those databases that do so (using ‘feelback’,’n’).
refresh This will refresh the connection to FactSet servers to capture the latest database updates. This only
needs to be used when a refresh is necessary. It is not recommended to leave this argument in every
request made. To use this, the refresh argument should be paired with the value “Y”.
Example
data = F.ExtractFormulaHistory('XOM','FG_EPS(0Q,-5Q,Q)','0Q:-5Q:Q');
R:
Id Date fg.eps
1 xom 2012-12-31 9.47
2 xom 2013-03-31 9.70
3 xom 2013-06-30 9.82
4 xom 2013-09-30 7.96
5 xom 2013-12-31 7.66
6 xom 2014-03-31 7.37
MATLAB:
Id: 'xom'
Date: [735234 735324 735415 735507 735599 735689]
fg_eps: [9.4700 9.7000 9.8200 7.9600 7.6600 7.3700]
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.
3.3.5.3 F.CorporateActionsDividends
where,
Optional arguments,
splitadj Allows for split adjustment to be specified. This argument must be entered as: 'splitadj','9' to retrieve
unadjusted dividends.
ngflag Specify 'ngflag ','y ' to return a flag that indicate whether the dividend rate returned is a net or gross. The
output would be a G or N flag.
symbol Argument allows for the CUSIP to be retrieved as the last column (by default SecId is the first field that is
retrieved when running a CorporateActionsDividends function). This argument must be entered as
'symbol', 'y'.
curr The optional currency argument to specify the currency in which the stock dividend data is returned.
universe Screening expression to limit the universe
ison Ison-codes can be used to limit the universe ISON_MSCI_WORLD(0,1) is written as
‘ison’,’msci_world’,’isonParams’,’0,1’
isonParams The arguments within brackets in the ison-code
secId Currently, the stat packages display the ticker by default in the first column but will now display whatever
values are entered in the ids= argument. The secId=Y parameter will now be used to display whatever is
Example
In this example, extract the stock dividend information for Volkswagen from 1/1/2011 up to 1 day from today.
data = F.CorporateActionsDividends('VOW-DE','1/1/2011','1');
R:
SecId Date Currency P.DIVS P.DIVS.TYPED P.DIVS.PAYDATE P.DIVS.RECDATE
1 VOW-DE 2011-05-04 Euro 2.2 Yearly payment 2011-05-04 2011-05-03
2 VOW-DE 2012-04-20 Euro 3.0 Yearly payment 2012-04-20 2012-04-19
3 VOW-DE 2013-04-26 Euro 3.5 Yearly payment 2013-04-26 2013-04-25
4 VOW-DE 2014-05-14 Euro 4.0 Yearly payment 2014-05-14 2014-05-13
MATLAB:
SecId: 'VOW-DE'
Date: [734627 734979 735350 735733]
Currency: {'Euro' 'Euro' 'Euro' 'Euro'}
P_DIVS: [2.2000 3 3.5000 4]
P_DIVS_TYPED: {'Yearly payment' 'Yearly payment' 'Yearly payment' 'Yearly payment'}
P_DIVS_PAYDATE: [734627 734979 735350 735733]
P_DIVS_RECDATE: [734626 734978 735349 735732]
3.3.5.4 F.CorporateActionsSplits
where,
Optional arguments,
symbol Argument allows for the CUSIP to be retrieved as the last column (by default SecId is the first field that is
retrieved when running a CorporateActionsSplits function). This argument must be entered as 'symbol', 'y'.
universe Screening expression to limit the universe
ison Ison-codes can be used to limit the universe ISON_MSCI_WORLD(0,1) is written as
‘ison’,’msci_world’,’isonParams’,’0,1’
Example
In this example, extract the stock split information for Exxon Mobil from 1/1/1990 up to 1 day later from
today.
data = F.CorporateActionsSplits('xom','1/1/1990','1');
R:
SecId Date P.SPLIT.FACTOR P.SPLIT.RATIO P.SPLIT.COMMENT
1 XOM-US 1997-04-14 0.5 2:1
2 XOM-US 2001-07-19 0.5 2:1 Split: 2 for 1
MATLAB:
SecId: 'XOM-US'
Date: [729494 731051]
P_SPLIT_FACTOR: [0.5000 0.5000]
P_SPLIT_RATIO: {'2:1' '2:1'}
P_SPLIT_COMMENT: {'' 'Split: 2 for 1'}
Note: The retrieved items with this function are the split factor, the split ratio and any available split
comments.
3.3.5.5 F.ExtractBenchmarkDetail
where,
Example
data = F.ExtractBenchmarkDetail('SP50','','')
R:
MATLAB:
BENCHMARK_ID: 'SP50'
DATE: [1x501 double]
SECURITY_ID: {1x501 cell}
Weight: [1x501 double]
3.3.5.6 F.ExtractOFDBItem
where,
Optional arguments,
datesOnly Displays only the dates that are in an OFDB with the parameter ‘datesOnly’,’Y’
idsOnly Displays the unique Ids that are in an OFDB with the parameter ’idsOnly’,’Y’
itemsOnly Displays the items that are in an OFDB with the parameter ’itemsOnly’,’Y’
universe Screening expression to limit the universe
feelback If the feelback argument is not used, the returned data series will "feel back" over NAs to find the last
actual data point and carry this data forward over the NAs. For the data not to carry forward, use
'feelback', 'N'. The data is then returned as it is in the database.
fqlflag Optional argument that is necessary because by default, the ExtractOFDBItem factlet goes through
screening, but when there are _S in the Identifier or spaces between the identifiers, it is necessary to
extract the data through FQL to get the values. Need to specify 'fqlflag','y'.
cal Calendar setting, arguments include:
FIVEDAY: Displays Monday through Friday, regardless of whether there were trading holidays.
Example
In this example, retrieve the price and shares data uploaded into the OFDB file titled MyPortfolio for Microsoft
and IBM as of 4 trading days ago, denoted with the date argument -3D.
data = F.ExtractOFDBItem('MyPortfolio','MSFT,IBM','PRICE,SHARES','-3D');
R:
Id Date ofdb.price ofdb.shares
1 MSFT 2014-07-28 46 6000
2 IBM 2014-07-28 180 1500
MATLAB:
1x2 struct array with fields:
Id
Date
ofdb_price
ofdb_shares
Note: If there is an error in the name of the OFDB file or the user does not have access, the data will
be returned as NAs.
3.3.5.7 F.ExtractOFDBUniverse
The syntax for the ExtractOFDBUniverse function is: (Date and fqlflag are optional)
data = F.ExtractOFDBUniverse('OFDB','date','DateArgument','fqlflag','Y/N');
where,
Example
In this example, retrieve the securities stored as of the end of the most recent trading day in the OFDB file
titled MyOFDB.
3.3.5.8 F.ExtractScreenUniverse
where,
Example 1
In this example, retrieve the securities stored in the screen titled MyScreen. The output displays the CUSIPS for
each security.
data = F.ExtractScreenUniverse('MyScreen');
Example 2
In this example, retrieve all of the securities and parameters saved in the screen. Also, set a backtest date to
6/30/2014.
Data=F.ExtractScreenUniverse('Personal:MyScreen','All','Y','Backtestdate','20140630')
Example 3
In this example, retrieve all of the securities returned by the screen, as well as only the first 3 parameters.
Data=F.ExtractScreenUniverse('Personal:MyScreen','All','Y','includeColumns','1,2,3,5,7')
3.3.5.9 F.ExtractOptionsSnapshot
where,
Example
In this example a put or call flag, closing price, expiry date and delta is extracted for the options passing the
screening conditions that FactSet (FDS) is the underlying security and the expiration date is before 20151231.
Please note that the date used in the following example needs to be a future date.
Data=F.ExtractOptionsSnapshot('P_OPT_CALL_OR_PUT,P_OPT_CLOSE_PRICE,P_OPT_EXP_DATEN,P_OPT_DE
LTA','','P_OPT_UNDERLYING_SECURITY','FDS','P_OPT_EXP_DATEN<','20151231','','');
MATLAB:
Id
Date
P_OPT_CALL_OR_PUT
P_OPT_CLOSE_PRICE
P_OPT_EXP_DATEN
P_OPT_DELTA
3.3.5.10 F.ExtractSPARData
where,
Example
In this example, for the two specified Morningstar funds retrieve the fund family name and the benchmark
name.
R:
MATLAB:
Id
Date
spar_fund_family
spar_meur_bm_name1
3.3.5.11 F.ExtractVectorFormula
where,
Optional arguments,
Example
In this example, extract the business segment sales breakdown, with labels, as of the most recent fiscal year
end for IBM and GE using the FactSet Fundamentals database. The ExtractVectorFormula function is used to
extract this data because the output is a row of data, and it is not indexed by Id, data item and date. Rather it
is a list where IBM has 5 business segments and GE has 8 segments.
R: data = F.ExtractVectorFormula('IBM,GE','FF_SEGMENT_RPT_DATA(ANN,0,,,,
\'SALES\',,BUS,\'SEG\'),FF_SEGMENT_RPT_LABELS(ANN,0,,,,,BUS,\'SEG\')');
R:
Id ff.segment.rpt.data ff.segment.rpt.labels
1 IBM 20131231
2 IBM 38551 Global Technology Services
3 IBM 25932 Software
4 IBM 18396 Global Business Services
5 IBM 14371 Systems & Technology
6 IBM 2022 Global Financing
7 GE 20131231
8 GE 42917 General Electric Capital
9 GE 23777 Power & Water
10 GE 21411 Aviation
11 GE 18186 Healthcare
12 GE 16615 Oil & Gas
13 GE 8313 Appliances & Lighting
14 GE 6721 Energy Management
15 GE 5873 Transportation
MATLAB:
1x2 struct array with fields:
Id
ff_segment_rpt_data
ff_segment_rpt_labels
Note: Single quotes in an FQL formula needs to be escaped by a backslash (R) or single quote
(MATLAB).
3.3.5.12 F.ExtractEconData
where,
Optional arguments,
date One or more dates; Dates should be entered in start:end:freq format. (e.g.
'20101215:20110115:d')
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.
TSName Used to display the time series value of the item in the label of the column where the
data is being displayed. Ie SPEC_ID_DATA('WTI-FDS:FG_PRICE',-121,-1,M) is displayed
in the column label as WTI-FDS. Specified as 'TSName','Y'
decimals Positionally set according to the items in the selection, ie ‘decimals’,’,,3,4,3’
Example
This example retrieves industrial production data for the United States using the FactSet Economics database,
starting 122 months ago (denoted with -121) until two months ago (denoted with -1).
R: data = F.ExtractEconData('','FDS_ECON_DATA(\'FRBIPSB50001\',-121,-1,M,STEP,AVERAGE,1)');
R:
Id Date F.econ.data
1 fds_econ_data 2004-06-30 91.7493
2 fds_econ_data 2004-07-30 92.4549
3 fds_econ_data 2004-08-31 92.4832
4 fds_econ_data 2004-09-30 92.5476
5 fds_econ_data 2004-10-29 93.4371
…
121 fds_econ_data 2014-06-30 103.9152
MATLAB:
Id: 'fds_econ_data'
Date: [1x121 double]
fds_econ_data: [1x121 double]
3.3.5.13 F.ExtractAlphaTestingSnapshot
data = F.ExtractAlphaTestingSnapshot(useStat,headers,model,report,
items,security,date,resultType,sortOrder,sortCol,reportSettingName);
Note: The ExtractAlphaTestingSnapshot function is used for extracting model results that use the
Alpha Testing codes AT3_RESULT_DATA or AT3_RESULT_STAT.
where,
Example
In this example, extract column 6 and 7 from the Constituents report sorted by column 6 of the Alpha Testing
model titled Calculation Example Model.
R:
MATLAB:
Identifier
Company_Name
Periods
Weight
Market_Capitalization
3.3.5.14 F.LSD_Ownership
where,
Optional arguments,
combinedOutputTypes Required argument when matrix and vector output formats are requested in the same
call.
Example
In this example, extract the names in English of the top 3 institutional (signified by the F in the request code)
holders (signified by the H in the request code) for Apple using the code LSD_NAME_TOP_HLDR.
R:
Id lsd.name.top.hldr
1 aapl The Vanguard Group, Inc.
2 aapl SSgA Funds Management, Inc.
3 aapl BlackRock Fund Advisors
MATLAB:
Id: 'aapl'
lsd_name_top_hldr: {'The Vanguard Group, Inc.' 'SSgA Funds Management, Inc.' 'BlackRock Fund Advisors'}
3.3.5.15 F.EstimatesOnDemand
where,
Optional arguments,
R:
SecId CURRENCY FE.ITEM FE.PER.REL FE.REPORT.FY PUBDATE DATE FE.ACTUAL FE.ACTUAL.FLAG
1 MSFT USD EPS -1 2013-07-19 2013-07-18 2013-06-30 2.58 1
2 MSFT USD EPS 0 2014-07-23 2014-07-22 2014-06-30 2.63 1
3 MSFT USD SALES -1 2013-07-19 2013-07-18 2013-06-30 77849.00 1
4 MSFT USD SALES 0 2014-07-23 2014-07-22 2014-06-30 86833.00 1
MATLAB:
SecId: 'MSFT'
CURRENCY: {'USD' 'USD' 'USD' 'USD'}
FE_ITEM: {'EPS' 'EPS' 'SALES' 'SALES'}
FE_PER_REL: [-1 0 -1 0]
FE_REPORT_FY: [735434 735803 735434 735803]
PUBDATE: [735433 735802 735433 735802]
DATE: [735415 735780 735415 735780]
FE_ACTUAL: [2.5800 2.6300 77849 86833]
FE_ACTUAL_FLAG: [1 1 1 1]
3.3.5.16 F.TickHistory
Data=F.TickHistory(‘IDs’,’StartDate’,’StartTime’,’EndDate’,’EndTime’,’Interval’,’fields’,’OptionalFields’)
Where,
Optional Fields
Intervals
Example
In this example, retrieve the Last Price, Last Time and Last Date for IBM every minute for the day of 9/25/2014.
Data=F.TickHistory('IBM','20140925','093000','20140925','160000','1M','fields','LAST_1,LAST_TIME_1,LAST_DATE_1')
MATLAB:
LAST_1: [1x390 double]
LAST_TIME_1: [1x390 double]
LAST_DATE_1: [1x390 double]
3.3.5.17 F.RealTime
The realtime function allows users to stream realtime exchange data. Multiple securities can be streamed at
once and the streaming data can be referenced through the variables that are created. The FactSet
Workstation must be running for this function to work and the FactSet Datafeed Toolkit must be installed
when using MATLAB.
Note: Requires an additional subscription and FactSet plugin version 3.0+ for MATLAB and 3.1+ for
R/Developer’s Toolkit
http://www.factset.com/download/statlink/Docs%203.0/Streaming
Note: There is no streaming interface in R. Results must be pulled by re-running the F.RealTime command.
3.3.5.17 F.Snapshot
The Snapshot service provides access to streaming exchange data and allows the “snap” of real-time prices at
the user’s request. When the command is run, a list of all available exchange data items will be returned by
default.
Syntax:
Data=F.Snapshot('Ticker')
Requests can be made for multiple tickers as well in a comma delimited format.
Data=F.Snapshot('Ticker1,Ticker2,Ticker3')
Data=F.Snapshot('Ticker','Fields','Fields Requested')
Data=F.Snapshot('FDS')
Data=F.Snapshot('FDS','Fields','PREV_CLOSE,VWAP,HIGH_1,LOW_1')
Data =
REQ_SYM: {'FDS'}
KEY: {'FDS-USA:D'}
PREV_CLOSE: 154.0400
VWAP: 154.8709
HIGH_1: 155.7000
LOW_1: 153.0102
3.3.5.17 F.Documents
The Documents service provides access for the retrieval of news stories, investment research reports, filings,
and transcripts. When requested, summary information of the documents will be returned, including an http
URL to access the resulting documents.
Function Description
F.DocumentsSearch() This function returns headlines and http URL’s, linking to the documents
returned by the search.
F.DocumentsCount() This function returns the count of headlines returned by the search, grouped
by source.
F.DocumentsSources() This request returns a list of possible sources that can be used as arguments in
the “Search” function.
F.DocumentsCategories() This request returns a list of possible categories that can be used as arguments
in the “Search” function.
F.DocumentsTimezones() This request returns a list of possible time zones that can be used as
arguments in the “Search” function.
Note: The only functions above that require arguments are the “Search” and “Count” reports. They both
accept the same arguments and the syntax can be seen below:
Specialized Arguments
Argument Description
StreetAccount Specific sa_categories Code for StreetAccount specific categories to include. This is a comma-
separated list.
e.g. sa_categories=98,106
Default = ALL
Investment Research Specific industries One or more FactSet industry codes separated by commas. For
company reports, the industry code represents the industry of the
company that the report is about. For industry reports, the industry
code represents the industry that the report is about. Industry codes
are not particularly relevant for other types of documents (e.g.,
economic reports).
Investment Research Specific contributors One or more contributor codes. A list of contributors can be obtained
via downloading a file from an FTP site at FactSet. This process will be
outlined at the time of account setup. See section 2.3 for more
information.
Investment Research Specific authors One or more analyst codes of authors who were the primary or
secondary authors of the documents.
Sample Requests
Data=F.DocumentsSources()
Data=F.DocumentsCategories()
Data=F.DocumentsTimezones()
Data=F.DocumentsSearch('SD','0','ED','-2','IDS','FDS','N','5','sources','EDG')
Data=F.DocumentsSearch('SD','0','ED','-2','IDS','FDS','N','5','sources','EDG','categories','CN:US')
Data=F.DocumentsCount('SD','0','ED','-2','IDS','FDS','N','5','categories','CN:US')
OFDB, which stands for Open FactSet Database, is a high-performance multi-dimensional database system
used to securely store proprietary numeric and textual data on FactSet. 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 from MATLAB or R 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.
The following details are regarding the behavior of an OFDB file that is created through UploadToOFDB:
+ 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.
+ The headers of the data uploaded must match the existing column names.
+ New Data items cannot be appended to an existing OFDB through the UploadtoOFDB functionality.
F.UploadToOFDB Syntax
Before uploading data into an OFDB file, it is necessary to first create a structure, similar to the structure of the
results returned by a factlet request.
F.UploadToOFDB(OFDB, data)
where,
OFDB The name of the OFDB file to which the data is getting uploaded (default directory is Personal,
for other locations the path must be specified).
data The Data structure that is uploaded to the OFDB.
MATLAB Example:
In this example a MATLAB data structure is created, using price and volume projections for the securities FDS
and XOM, for the dates 4/10/2014-4/12/2014.
data_up(1).Id = 'FDS';
data_up(1).Date = [datenum('4/10/13') datenum('4/11/13') datenum('4/12/13')];
data_up(1).my_price = [93.23 nan 92.65];
Once the MATLAB structure is created, using the UploadToOFDB syntax, the data structure titled data_up is
uploaded to an OFDB file titled Analyst Forecast, saved in the Personal directory.
F.UploadToOFDB('Analyst_Forecast',data_up);
R Example:
In this example an R data frame is created, using price and volume projections for the securities FDS and XOM,
for the dates 4/10/2014-4/12/2014.
dates = c('4/10/14','4/11/14','4/12/14')
my_price = c(93.23,NA,92.65)
my_volume = c(388.205,0,359.396)
fds_data = data.frame(Id='FDS',Date=dates,my_price=my_price,my_volume=my_volume)
my_price = c(88.68,NA,89.22)
my_volume = c(14826.0,0,14989.0)
xom_data = data.frame(Id='XOM',Date=dates,my_price=my_price,my_volume=my_volume)
data_up = rbind(fds_data,xom_data)
F.UploadToOFDB('Analyst_Forecast',data_up)
A subscription to FactSet Supply Chain data is required to retrieve company relationship data.
To access this data through ExtractVectorFormula, the FQL code FF_COMPANY_RELATIONSHIP is used. This
returns relationship companies and related information for a given company based on your selections.
Note: FactSet’s Supply Chain data requires an additional subscription. Please contact your local support team
to gain access.
Syntax:
FF_COMPANY_RELATIONSHIP(relationship_type,company_type,identifier_output,data_output,relationship_di
rection)
Where:
+ Competitors (COMP)
+ Suppliers (SUPL)
+ Clients/Customers (CUST)
+ Partners (PRTR)
Company_Type can be specified as:
+ All (ALL)
+ Direct (CDEF)
+ Reverse (ODEF)
Note: Competitor and Partner relationships are the same type of stated relationship for any direction. “Other”
Customer relationships are when the other company mentions the source company as a distinct supplier.
"Other" Supplier relationships are when the other company mentions the source company as a distinct
customer
Example 1:
In this example the below earnings statement from Mattel is investigated through the
FF_COMPANY_RELATIONSHIP code.
“On Thursday July 17th, Mattel is scheduled to report its earnings. Mattel's relationship with Walmart
accounts for 18% of its total Barbie doll and Hot Wheels toy car sales.”
To extract this data the Supplier (SUPL) report for Walmart (WMT) is retrieved.
Output:
This is considered a REVERSE relationship – Mattel has determined this relationship although the search is
from WMT .
Output:
From the MATTEL perspective, their relationship to TGT and WMT is as a customer (CUST).
data = F.ExtractVectorFormula('000PK1-E','FF_COMPANY_RELATIONSHIP(CUST,ALL,FEID,ALL,ALL)');
Output:
Example 2:
In this example the Partners of Facebook is extracted, the symbol type here is set as Ticker.
Output:
Example 3:
In this example the Private companies that are Competitors to Microsoft are extracted.
Output:
Geographic revenue represents the percent of geographic revenue derived from customer locations of a
company. This data is further accompanied by confidence scores to provide additional insight on the estimates
of revenue percentage.
Empowered by a normalized data set mapped to a hierarchical structure, FactSet Revere Geographic Revenue
Exposure algorithms have been built to allocate geographic revenues to regions and countries that companies
did not explicitly disclose. These estimates are accompanied by a confidence score, which is a ranking score
gauging the trustworthiness of the estimates.
Note: FactSet’s Geo Rev data requires an additional subscription. Please contact your local support team to
gain access.
Formulas:
Super-Regions
+ FF_GEOREV_SUPER_REGION_PCT: Returns the percentage of estimated revenue for a super-region.
+ FF_GEOREV_SUPER_REGION_REV: Returns the amount of estimated revenue for a super-region. This is
calculated as the percentage of estimated revenue for a super-region
(FF_GEOREV_SUPER_REGION_PCT) multiplied by the FactSet Fundamentals sales value (FF_SALES) for
the corresponding fiscal year.
+ FF_GEOREV_SUPER_REGION_CONF: Represents the confidence score for revenue percentage for a
super-region.
Countries
+ FF_GEOREV_COUNTRY_PCT: Returns the percentage of estimated revenue for a country.
+ FF_GEOREV_COUNTRY_REV: Returns the amount of estimated revenue for a country. This is calculated
as the percentage of estimated revenue for a country (FF_GEOREV_COUNTRY_PCT) multiplied by the
FactSet Fundamentals sales value (FF_SALES) for the corresponding fiscal year.
+ FF_GEOREV_COUNTRY_CONF: Represents the confidence score for revenue percentage for a country.
The following table outlines the geographic classification system with region levels, examples, and codes for
each:
Formula Syntax:
The following section lists the formula syntax and an example for the _PCT and _CONF formulas available from
the FactSet Revere Geographic Revenue Exposure database.
Sample for IBM’s Geographic Revenue (%) in Africa and the Middle East Super-Region for the last 4 fiscal years
+ data = F.ExtractFormulaHistory('IBM-US', 'FF_GEOREV_SUPER_REGION_PCT(\"R1\",ANN,0,-3Y,FY,RF)', '0:-
3Y:FY')
--------------------------------------------------------------------------------------------------------------------------------------
Full Global Sample – Country GDP Domestic Firms – Country GDP Domestic Firms – Alternative
Growth Growth Country Factor
16.8% 22.2% 14.2%
Annual Excess Return Annual Excess Return Annual Excess Return
0.93 0.93 N/A
Sharpe Sharpe Sharpe
Hypothesis: Stock prices do not efficiently incorporate fundamental information related to country level
exposures and expectations of country level performance.
MACROt = Sum Product of firm’s geographic revenue exposure and GDP Growth
3) Calculate Sum Product of GDP growth forecast to geographic revenue exposure, then rank from
highest to lowest.
4) Based on MACROt ranking, break companies into quintile, then long top quintile (cap-weighted) &
short bottom quintile (cap-weighted)
5) Repeat steps 2-4 on a monthly basis, adjusting for any changes in GDP growth forecasts and
geographic revenue exposure.
R Script
# Pull Geographic GRE Data by Country for the MSCI World Index
USCountryGREPctRaw = F.ExtractFormulaHistory('',
'FF_GEOREV_COUNTRY_PCT(\\"840\\",ANN,0,,,RF)',
'0','universe','ISON_MSCI_REGION(990100,0,CLOSE,OFF)=1')
USCountryGREPct = USCountryGREPctRaw[3]/100
ChinaCountryGREPctRaw = F.ExtractFormulaHistory('',
'FF_GEOREV_COUNTRY_PCT(\\"156\\",ANN,0,,,RF)',
'0','universe','ISON_MSCI_REGION(990100,0,CLOSE,OFF)=1')
ChinaCountryGREPct = ChinaCountryGREPctRaw[3]/100
OtherCountryGREPct = 1-USCountryGREPct-ChinaCountryGREPct
# Pull Geographic GGF Forecast Data by Country for the MSCI World Index
USGREGGF = USCountryGREPct*USCountryGGF[1,1]
ChinaGREGGF = ChinaCountryGREPct*ChinaCountryGGF[1,1]
OtherGREGGF = OtherCountryGREPct*OtherCountryGGF
SUMGREGGF = USGREGGF+ChinaGREGGF+OtherGREGGF
FullAnalysis =
data.frame(IDS,Date,CompanyName,USCountryGREPct,ChinaCountryGREPct,OtherCountryGREPct,USCoun
tryGGF,ChinaCountryGGF,OtherCountryGGF,USGREGGF,ChinaGREGGF,OtherGREGGF,SUMGREGGF,st
ringsAsFactors = FALSE)
names(FullAnalysis)[1]<-paste("Id")
names(FullAnalysis)[3]<-paste("Company_Name")
names(FullAnalysis)[4]<-paste("United_States_Exposure")
names(FullAnalysis)[5]<-paste("China_Exposure")
names(FullAnalysis)[6]<-paste("Rest_of_World_Exposure")
names(FullAnalysis)[7]<-paste("US_GDP_Forecast")
names(FullAnalysis)[8]<-paste("China_GDP_Forecast")
names(FullAnalysis)[9]<-paste("Rest_of_World_GDP_Forecast")
names(FullAnalysis)[10]<-paste("United_States_GRE_GGF_Calc")
names(FullAnalysis)[11]<-paste("China_GRE_GGF_Calc")
names(FullAnalysis)[12]<-paste("Rest_of_World_GRE_GGF_Calc")
names(FullAnalysis)[13]<-paste("MACROt_Sum_Product")
# Sort Data by MACROt (Sum Product of firm's geographic revenue exposure and GDP growth)
FullAnalysis=FullAnalysis[order(FullAnalysis$MACROt_Sum_Product),]
# Based on MACROt ranking, break companies into quintile, then long top quintile (cap-weighted) &
short bottom quintile (cap-weighted)
QuintileFullAnalysis=quantile(FullAnalysis$MACROt_Sum_Product,probs=seq(0,1,0.20),na.rm=TRUE)
#-----------------------------------------------------------------------------
i=1
Fractiles=NULL
for (i in i:NROW(FullAnalysis)) {
if(is.nan(FullAnalysis[i,13])) {
Fractile=NaN
} else {
if (FullAnalysis[i,13]>=QuintileFullAnalysis[1] && FullAnalysis[i,13]<QuintileFullAnalysis[2]) {
Fractile=1
} else {
if (FullAnalysis[i,13]>=QuintileFullAnalysis[2] && FullAnalysis[i,13]<QuintileFullAnalysis[3]) {
#-----------------------------------------------------------------------------
FullAnalysis = cbind(FullAnalysis,Fractiles)
F.UploadToOFDB('GeoRev_R_FullAnalysis',FullAnalysis)
# Pull Quintile 1
i=1
Quintile1=NULL
for (i in i:NROW(FullAnalysis)) {
if(is.nan(FullAnalysis[i,14])) {
} else {
if (FullAnalysis[i,14]==1){
Quintile1=rbind(Quintile1,FullAnalysis[i,])
} else {
}
}
}
F.UploadToOFDB('GeoRev_R_Sample_Quintile1',Quintile1)
i=1
Quintile5=NULL
for (i in i:NROW(FullAnalysis)) {
if(is.nan(FullAnalysis[i,14])) {
} else {
if (FullAnalysis[i,14]==5){
Quintile5=rbind(Quintile5,FullAnalysis[i,])
} else {
}
}
}
F.UploadToOFDB('GeoRev_R_Sample_Quintile5',Quintile5)
MATLAB Script
% Pull Geographic GRE Data by Country for the MSCI World Index
disp('% Pull Geographic GRE Data by Country for the MSCI World Index')
USCountryGREPctRaw = F.ExtractFormulaHistory('',
'ZAV(FF_GEOREV_COUNTRY_PCT(\"840\",ANN,0,,,RF)/100)',
'0','universe','ISON_MSCI_REGION(990100,-1,CLOSE,OFF)=1');
USCountryGREPct = [USCountryGREPctRaw.zav];
ChinaCountryGREPctRaw = F.ExtractFormulaHistory('',
'ZAV(FF_GEOREV_COUNTRY_PCT(\"156\",ANN,0,,,RF)/100)',
'0','universe','ISON_MSCI_REGION(990100,-1,CLOSE,OFF)=1');
ChinaCountryGREPct = [ChinaCountryGREPctRaw.zav];
OtherCountryGREPct = 1-USCountryGREPct-ChinaCountryGREPct;
USCountryGGFRaw =
F.ExtractEconData('','CNS_ECON_DATA(''RGDPRCY1@US'',0M,0M,M,STEP,AVERAGE,1)/100');
USCountryGGFPct = USCountryGGFRaw.cns_econ_data;
ChinaCountryGGFRaw =
F.ExtractEconData('','CNS_ECON_DATA(''RGDPRCY1@CN'',0M,0M,M,STEP,AVERAGE,1)/100');
ChinaCountryGGFPct = ChinaCountryGGFRaw.cns_econ_data;
OtherCountryGGFPct = .015;
USCountryGGF(1:length(IDs))=USCountryGGFPct;
ChinaCountryGGF(1:length(IDs))=ChinaCountryGGFPct;
OtherCountryGGF(1:length(IDs))=OtherCountryGGFPct;
USGREGGF=USCountryGREPct.*USCountryGGF;
ChinaGREGGF=ChinaCountryGREPct.*ChinaCountryGGF;
OtherGREGGF=OtherCountryGREPct.*OtherCountryGGF;
SumGREGGF = USGREGGF+ChinaGREGGF+OtherGREGGF;
FullAnalysis.Id = IDs;
FullAnalysis.Date = Date;
FullAnalysis.Company_Name = CompanyName;
FullAnalysis.UnitedStatesExposure = USCountryGREPct;
FullAnalysis.China_Exposure=ChinaCountryGREPct;
FullAnalysis.Rest_of_World_Exposure=OtherCountryGREPct;
FullAnalysis.US_GDP_Forecast=USCountryGGF;
FullAnalysis.China_GDP_Forecast=ChinaCountryGGF;
FullAnalysis.Rest_of_World_GDP_Forecast=OtherCountryGGF;
FullAnalysis.United_States_GRE_GGF_Calc=USGREGGF;
FullAnalysis.China_GRE_GGF_Calc=ChinaGREGGF;
FullAnalysis.Rest_of_World_GRE_GGF_Calc=OtherGREGGF;
FullAnalysis.MACROt_Sum_Product=SumGREGGF;
% Based on MACROt ranking, break companies into quintile, then long top quintile (cap-weighted) &
short bottom quintile (cap-weighted)
disp('% Based on MACROt ranking, break companies into quintile, then long top quintile (cap-weighted) &
short bottom quintile (cap-weighted)')
Quintile=quantile(FullAnalysis.MACROt_Sum_Product,5);
i=1;
for i = 1:length(FullAnalysis.Id)
if ((FullAnalysis.MACROt_Sum_Product(i)>=Quintile(1)) &&
((FullAnalysis.MACROt_Sum_Product(i)<Quintile(2))));
Fractile(i)=1;
else
if ((FullAnalysis.MACROt_Sum_Product(i)>=Quintile(2)) &&
((FullAnalysis.MACROt_Sum_Product(i)<Quintile(3))));
end
FullAnalysis.Quintile=Fractile;
Quintile1 = [];
Quintile5 = [];
i=1;
for i = 1:length(FullAnalysis.Id)
if (isnan(FullAnalysis.Quintile(i)))
continue
else
if (FullAnalysis.Quintile(i)==1)
tempQuintile.Id = FullAnalysis.Id(i);
tempQuintile.Date = FullAnalysis.Date(i);
tempQuintile.Company_Name = FullAnalysis.Company_Name(i);
tempQuintile.UnitedStatesExposure = FullAnalysis.UnitedStatesExposure(i);
tempQuintile.China_Exposure=FullAnalysis.China_Exposure(i);
tempQuintile.Rest_of_World_Exposure=FullAnalysis.Rest_of_World_Exposure(i);
tempQuintile.US_GDP_Forecast=FullAnalysis.US_GDP_Forecast(i);
tempQuintile.China_GDP_Forecast=FullAnalysis.China_GDP_Forecast(i);
tempQuintile.Rest_of_World_GDP_Forecast=FullAnalysis.Rest_of_World_GDP_Forecast(i);
tempQuintile.United_States_GRE_GGF_Calc=FullAnalysis.United_States_GRE_GGF_Calc(i);
tempQuintile.China_GRE_GGF_Calc=FullAnalysis.China_GRE_GGF_Calc(i);
tempQuintile.Rest_of_World_GRE_GGF_Calc=FullAnalysis.Rest_of_World_GRE_GGF_Calc(i);
tempQuintile.MACROt_Sum_Product=FullAnalysis.MACROt_Sum_Product(i);
tempQuintile.Quintile=FullAnalysis.Quintile(i);
Quintile1 = [Quintile1 tempQuintile];
else
tempQuintile.Id = FullAnalysis.Id(i);
tempQuintile.Date = FullAnalysis.Date(i);
tempQuintile.Company_Name = FullAnalysis.Company_Name(i);
tempQuintile.UnitedStatesExposure = FullAnalysis.UnitedStatesExposure(i);
tempQuintile.China_Exposure=FullAnalysis.China_Exposure(i);
tempQuintile.Rest_of_World_Exposure=FullAnalysis.Rest_of_World_Exposure(i);
tempQuintile.US_GDP_Forecast=FullAnalysis.US_GDP_Forecast(i);
tempQuintile.China_GDP_Forecast=FullAnalysis.China_GDP_Forecast(i);
tempQuintile.Rest_of_World_GDP_Forecast=FullAnalysis.Rest_of_World_GDP_Forecast(i);
tempQuintile.United_States_GRE_GGF_Calc=FullAnalysis.United_States_GRE_GGF_Calc(i);
tempQuintile.China_GRE_GGF_Calc=FullAnalysis.China_GRE_GGF_Calc(i);
tempQuintile.Rest_of_World_GRE_GGF_Calc=FullAnalysis.Rest_of_World_GRE_GGF_Calc(i);
tempQuintile.MACROt_Sum_Product=FullAnalysis.MACROt_Sum_Product(i);
tempQuintile.Quintile=FullAnalysis.Quintile(i);
Quintile5 = [Quintile5 tempQuintile];
else
continue
end
end
end
end
% Calculations Complete
disp('% Calculations Complete')
Note: Minimum FactSet workstation version 2013.A is required to be able to access the SideBar
through the Statistical packages.
F.SideBar()
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 running the F.SideBar()
command.
To limit the search results it is possible to control which formula libraries are being searched, click the Sources
button. To toggle between screening and FQL mode use the button “To Screening/FQL Mode”
Note: The economic data has not yet been integrated into Sidebar and the Series Lookup in the workstation
still needs to be used to search for this data and set up the F.ExtractEconData function. Additionally, multiple
identifiers but one data item only can be selected and inserted at one time.
The following are some possible errors when accessing FactSet data in MATLAB.
An error stating that the Function or Class cannot be found usually indicates that the plugin is not properly
installed.
+ Ensure that the subfolder FactSet3 was created under the root directory of the MATLAB/R version the
plugin will be used with.
+ For MATLAB only. Ensure that the paths below are included in the MATLAB paths:
+ C:\Program Files\MATLAB\R20xxx\FactSet3
5.1.2. Unauthorized error
The unauthorized error can either be due to
+ Not access to the add-on product that is required for OnDemand access1.
1
For access related issues please contact your FactSet Sales representative.
Error Description
Not enough input arguments. If any of the required arguments as per Chapter 3
is not defined
Argument named <name of arg> does not have a value. If a Name - Value pair is not valid
Data downloaded does not contain full header The data cannot be parsed, check the request code
Types and Column name lines do not match in number of columns. The data cannot be parsed, check the request code
FactSetQueryError|<error message> Check the request code
All the settings available from the Configuration Window can also be set programmatically.
F.SetConfigurationItem(F.ConfigOptions.ITEM, 'item')
F.GetConfigurationItem(F.ConfigOptions.ITEM)
+ DataDirectUserName
+ DataDirectPassword
+ Timeout
+ HTTPSRetries
+ ProxyUserName
+ ProxyPassword
+ ProxyServer
+ UseManualProxy
+ SideBarDataName
+ ProxyPort
+ UseBeta
Example:
F.SetConfigurationItem(F.ConfigOptions.DataDirectUserName, 'username')
F.GetConfigurationItem(F.ConfigOptions.DataDirectUserName)