Mathworks DATAFEED TOOLBOX 3 user guide

Datafeed Toolbox™ 3
User’s Guide
How to Contact The MathWorks
www.mathworks. comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_TS.html Technical Support
com
rks.com
rks.com
Web
Bug reports
Sales, prici
ng, and general information
508-647-7000 (Phone)
508-647-7001 (Fax)
The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
Datafeed Toolbox™ User’s Guide
© COPYRIGHT 1999–20 10 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathW orks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern theuse,modification,reproduction,release,performance,display,anddisclosureoftheProgramand Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government’s needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Docu mentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
December 1999 First printing New for MATLAB®5.3 (Release 11) June 2000 Online only Revised for Version 1.2 December 2000 Online only Revised for Version 1.3 February 2003 Online only Revised for Version 1.4 June 2004 Online only Revised for Version 1.5 (Release 14) August 2004 Online only Revised for Version 1.6 (Release 14+) September 2005 Second printing Revised for Version 1.7 (Release 14SP3) March 2006 Online only Revised for Version 1.8 (Release 2006a) September 2006 Online only Revised for Version 1.9 (Release 2006b) March 2007 Third printing Revised for Version 2.0 (Release 2007a) September 2007 Online only Revised for Version 3.0 (Release 2007b) March 2008 Online only Revised for Version 3.1 (Release 2008a) October 2008 Online only Revised for Version 3.2 (Release 2008b) March 2009 Online only Revised for Version 3.3 (Release 2009a) September 2009 Online only Revised for Version 3.4 (Release 2009b) March 2010 Online only Revised for Version 3.5 (Release 2010a)
Getting Started
1
Product Overview ................................. 1-2
Contents
About Data Servers and Data Service Providers
Supported Data Service Providers Data Server Connection Requirements
.................... 1-3
................ 1-3
...... 1-3
Communicating with Financial Data Servers
2
Communication Management ....................... 2-2
Communicating with Data Servers Core Functions Connecting to the Bloomberg Data Server
Connection Object Properties
How to Retrieve Connection Properties Example: Retrieving Data on a Security
Disconnecting from Data Servers
................................... 2-2
................... 2-2
............. 2-3
...................... 2-4
................ 2-4
............... 2-5
................... 2-7
Example: Retrieving Bloomberg Data
3
Using blp Methods ................................. 3-2
About This Example Retrieving Field Data Retrieving Time Series Data
............................... 3-2
.............................. 3-2
........................ 3-3
v
Retrieving Historical Data .......................... 3-3
Datafeed Toolbox Graphical User Interface
4
Introduction ...................................... 4-2
Using the Datafeed Dialog Box
About the Datafeed Dialog Box Connecting to Data Servers Retrieving Data Using the Datafeed Securities Lookup Dialog Box Setting Overrides
................................... 4-5
................................. 4-8
...................... 4-3
...................... 4-3
......................... 4-4
....... 4-6
Function Reference
5
Bloomberg ........................................ 5-2
Datastream
FactSet
FRED
Haver Analytics
............................................. 5-5
....................................... 5-3
........................................... 5-4
................................... 5-6
vi Contents
Interactive Data Pricing and RemotePlus
Kx Systems
Reuters
........................................ 5-8
........................................... 5-9
............ 5-7
Reuters Datascope Tick History .................... 5-10
Reuters Knowledge Direct
Reuters Newscope
Yahoo!
........................................... 5-13
................................. 5-12
.......................... 5-11
Functions — Alphabetical List
6
Examples
A
Communicating with Financial Data Servers ........ A-2
Retrieving Connection Properties
................... A-2
Retrieving Data
................................... A-2
Index
vii
viii Contents
Getting Started
“Product Overview” on page 1-2
“About Data Servers and Da ta Service Providers” on page 1-3
1
1 Getting Started
Product Overview
This toolbox, used with the MATLAB®product, effectively turns your MATLAB workstation into a financial data acquisition terminal. T he toolbox enables you to:
Retrieve and analyze a wide variety of security data from financial data
Access market, time-series, and historical market data in MATLAB.
Monitor the status and history of each connection to a supported data
Fetch data fields for multiple securities in a single call.
Look up security ticker symbols from the toolbox GUI or the MATLAB
servers in MATLAB.
service provider.
command line.
1-2
About Data Servers and Data Service Providers
AboutDataServersandDataServiceProviders
In this section...
“Supported Data Service Providers” on page 1-3
“Data Server Connection Requirements” on page 1-3
Supported Data Service Providers
This toolbox supports connections to financial data servers that the following corporations provide:
Bloomberg L.P. (
FactSet Research Systems, Inc. (
Federal Reserve Economic Data (FRED)
(
http://research.stlouisfed.org/fred2/)
Haver Analytics (
Interactive Data Pricing and Reference Data
(
http://www.interactivedata-prd.com/)
Kx Systems, Inc. (
Thomson Reuters (
Yahoo!, Inc. (
http://www.bloomberg.com)
http://www.factset.com)
http://www.haver.com)
http://www.kx.com)
http://www.thomsonreuters.com/)
http://finance.yahoo.com)
Data Server Connection Requirements
To connect to some of these data servers, additional requirements apply.
Additional Software Requirements
The following data service p roviders require you to install proprietary software on your PC:
Bloomberg
1-3
1 Getting Started
Note You must have a Bloomberg®software licens e for the host on which
the D atafeed Toolbox™ and MATLAB software are running.
Interactive Data Pricing and Reference Data’s R emote Plus™
Haver Analytics
Kx Systems. Inc.
Reuters
You must have a valid license for required client software on your machine. If you do not, the following error message appears when you try to connect toadataserver:
Invalid MEX-file
For more information about how to obtain required software, contact your data server sales representative.
1-4
Proxy Information Requirements
The following data service providers may require you to specify a proxy host and proxy port plus a username and password if the user’s site requires proxy authentication:
FactSet
Federal Reserve Economic Data
Thomson Datastream
Yahoo!
For information on how to specify these settings, see “Specifying Proxy Server Settings” in the MATLAB documentation.
FactSet Data Service Requirements
You need a license to use FactSet®FAST technology. For more information, see the FactSet Web site at
http://www.factset.com.
About Data Servers and Data Service Providers
Reuters Data Service Requirements
Configuring Reuters®Connections Using the Reuters Configuration Editor software. You must use the Reuters Configuration Editor to
configure your connections as follows:
1 In a DOS prompt, set your CLASSPATH environment variable :
set CLASSPATH=%CLASSPATH%; ... $MATLAB/toolbox/datafeed/datafeed/config_editor.jar
2 Navigate to the Datafeed Toolbox folder:
cd %MATLAB%\toolbox\datafeed\datafeed
3 Enter the followin g command to run the Reuters Configuration Editor:
starteditor
4 Load the sample configuration file.
a Click File > Import > File.
b Select the file
%MATLAB%\toolbox\datafeed\datafeed\sampleconfig.xml.
5 Modify sampleconfig.xml based o n the site-specific settings that you
obtain from Reuters.
6 Define a namespace, a connection, and a session associated with the
connection. The following example adds the session
remoteSession
with the namespace MyNS to the connection list for the connection
remoteConnection.
1-5
1 Getting Started
1-6
7 If you are not DACS enabled, disable DACS.
About Data Servers and Data Service Providers
a Add the following to your connection configuration:
dacs_CbeEnabled=false dacs_SbePubEnabled=false dacs_SbeSubEnabled=false
b If you are running an SSL connection, add the following to your
connection configuration:
dacs_GenerateLocks=false
For more information, see the reuters function reference page.
Troubleshooting Issues with Reuters Configuration Editor. These errors occur when you attempt to use the Reuters Configuration Editor to configure connections on a machine on which an XML Parser is not installed.
java com.reuters.rfa.tools.config.editor.ConfigEditor org.xml.sax.SAXException: System property org.xml.sax.driver not specified at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(U nknown Source) at com.reuters.rfa.tools.config.editor.rfaConfigRuleDB.rf aConfi gRuleDB.java:56) at com.reuters.rfa.tools.config.editor.ConfigEditor.init (ConfigEditor.java:86) at (com.reuters.rfa.tools.config.editor.ConfigEditor. (ConfigEditor.java:61) at com.reuters.rfa.tools.config.editor.ConfigEditor.main (ConfigEditor.java:1303)
To address this problem, download an XML parser file, and then include a path to this file in your
The following example shows how to set your variable to include the XML parser file
http://xerces.apache.org/xerces-j/index.html):
set CLASSPATH=%CLASSPATH%;...
matlabroot\toolbox\datafeed\datafeed\config_editor.jar;... c:\xerces.jar
CLASSPATH environment variable.
CLASSPATH environment
C:\xerces.jar (downloaded from
1-7
1 Getting Started
Thomson Data Service Requirements
You need the following to connect to Thomson®data servers:
AlicenseforThomson
To connect to the Thomson
®
DataWorks®.
®
Datastream®API from the Web, you need a
user name, password, and URL provided by Thomson.
For more information, see the Thomson Web site at
http://www.thomsonreuters.com.
1-8
Communicating with Financial Data S ervers
“Communication Management” on page 2-2
“Connection Object Properties” on page 2-4
“Disconnecting from Data Servers” on page 2-7
2
2 Communicating with Financial Data Servers
Communication Management
In this section...
“Communicating with Data Servers” on page 2-2
“Core Functions” on page 2-2
“Connecting to the Bloomberg Data Server” on page 2-3
Communicating with Data Servers
This section uses the Bloomberg financial data server as an example of how to retrieve data with the Datafeed Toolbox software. You can communicate with other supported data servers using a similar set of toolbox functions.
Core Functions
The following set of core functions manage communication with each supported financial data server.
2-2
To establish a connection to the appropriate data server, use:
- blp
- datastream
- factset
- fred
- haver
- idc
- kx
- reuters
- yahoo
To retrieve connection properties, use get.
To terminate a connection, use
close.
Communication Management
Connecting to th
This example sho data server.
Note If you hav
blpapi3.
file function or ed
ws how to u se the
e not used the
jar
to the MATLAB java classpath. Use the javaaddpath
it your
classpath.txt file.
e Bloomberg Data Server
blp function to connect to the Bloomberg
blp function before you will need to add the
2-3
2 Communicating with Financial Data Servers
Connection Object Properties
In this section...
“How to Retrieve Connection Properties” on page 2-4
“Example: Retriev ing Data on a Security” o n page 2-5
The syntax for the Bloomberg V3 connection object constructor is:
b = blp;
How to Retrieve Connection Properties
To retrieve the properties of a connection object, use the get function. This function returns different values depending upon which data server you are using.
get(b)
b=
2-4
session: [1x1 com.bloomberglp.blpapi.Session]
ipaddress: 'localhost'
port: 8194.00
You can get the values of the individual properties by using the property names:
get(b,{'port','session'})
ans =
port: 8194.00
session: [1x1 com.bloomberglp.blpapi.Session]
For example, return just the connection handle with the ipaddress arg u m ent:
ip = get(b,{'ipaddress'}) ip =
localhost
Connection Object Properties
Note A single property is not returned as a structure.
Example: Retrieving Data on a Security
Establish a connection, b, to a Bloomberg data server:
b = blp;
Use the blp.timeseries method to return data on a security:
d = timeseries(b,'IBM US Equity','11/16/2009'); d(1:10,:) ans =
'TRADE' [73409 3.40 ] [127.17] [2802.00] 'TRADE' [73409 3.40 ] [127.05] [ 100.00] 'TRADE' [73409 3.40 ] [127.05] [ 110.00] 'TRADE' [73409 3.40 ] [127.04] [ 100.00] 'TRADE' [73409 3.40 ] [127.04] [ 100.00] 'TRADE' [73409 3.40 ] [127.09] [ 100.00] 'TRADE' [73409 3.40 ] [127.09] [ 100.00] 'TRADE' [73409 3.40 ] [127.09] [ 125.00] 'TRADE' [73409 3.40 ] [127.05] [ 100.00] 'TRADE' [73409 3.40 ] [127.05] [ 200.00]
If the final input argument is not a ran g e it must be a whole date value, i.e.
'11/16/2009' but not '11/16/2009 12:30:00' or 730316 but not 730316.5.
The code
timeseries(b,'IBM US Equity', now) will error. Use one of
MATLAB’s rounding functions to ensure a whole date value:
d = timeseries(b,'IBM US Equity',fl
oor(now));
To return data on a particular field for a range of dates, use the blp.history method:
data = history(b,'IBM US Equity','Last_Price','07/15/99','08/02/99') data =
730316.00 122.33
730317.00 122.27
2-5
2 Communicating with Financial Data Servers
730320.00 120.81
730321.00 115.09
730322.00 115.77
730323.00 111.17
730324.00 112.01
730327.00 110.38
730328.00 113.30
730329.00 115.21
730330.00 112.51
730331.00 112.79
730334.00 109.71
2-6
Disconnecting from Data Servers
To close a data server connection and disconnect, use the close function with the format:
close(b)
You must have previously created the connection object with one of the connection functions.
Disconnecting from Data Servers
2-7
2 Communicating with Financial Data Servers
2-8
Example: Retrieving Bloomberg Data
3
3 Example: Retrieving Bloomberg
Using blp Methods
In this section...
“About This Example” on page 3-2
“Retrieving Field Data” on page 3 -2
“Retrieving Time Series Data” on page 3-3
“Retrieving Historical Data” on page 3-3
About This Example
Thefollowingexampleillustratestheuseoftheblp methods to retrieve data from a B loomberg data server.
Note If you have not used the blp function before you will need to add the file
blpapi3.jar to the MATL AB java classpath. Use the javaaddpath
function or edit your classpath.txt file.
®
Data
3-2
Retrieving Field Data
The getdata method obtains Bloombe rg field data. Theentiresetoffielddata provides statistics for all possible securities, but it does not apply universally to any one security.
Obtaining Data
To obtain data for specific fields of a given security, use the getdata function with the following syntax:
d = getdata(Connect, Security, Fields)
For example, use the Bloomberg conne ction object c to retrieve the values of the fields
d = getdata(c,'IBM US Equ ity' , {'Open';'Last_Price'}) d=
Open and Last_Price:
Open: 126.2500 Last_Price: 125.1250
Using blp Methods
Retrieving Time Series Data
The timeseries method returns price and volumedataforaparticular security on a specified date. Use the following command to return time-series data for a given security and a specific date:
data = timeseries(Connection, Security, Date)
Date
can be a MATLAB date string or serial date number. If the final input argumentisnotarangeitmustbeawholedatevalue,i.e. but not '11/16/2009 12:30:00' or 730316 but not 730316.5.Thecode
timeseries(b,'IBM US Equity', now) will error. Use one of MATLAB’s
rounding functions to ensure a whole date value.
To obtain time-series data for the current day, use the alternate form of the function:
data = timeseries(Connection, Security, floor(now))
'11/16/2009'
To obtain time-series data for IBM using an existing connection c1,enter the function:
data = timeseries(c1, 'IBM US Equity ', floor(now));
Retrieving Historical Data
Use the history method to obtain historical data for a specific security.
To obtain historical data for a specified field of a particular security, run:
d = history(Connect,Security,Field,FromDate,ToDate)
history
For instructions on determining valid field names, see .
For example, to obtain the closing price for to August 2, 1999 using the connection
returns data for the date range from FromDate to ToDate.
IBM for the dates July 15, 1999
c1,enter:
data = history(c1, 'IBM U S Equity', 'Last_Price',... '07/15/99', '08/02/99');
3-3
3 Example: Retrieving Bloomberg
®
Data
3-4
4
Datafeed Toolbox Graphical User Interface
“Introduction” on page 4-2
“Using the Datafeed Dialog Box” on page 4-3
4 Datafeed Toolbox™ Graphical User Interface
Introduction
You can use the Datafeed Toolbox Graphical User Interface (GUI) to connect to and retrieve information from some supported data service providers.
This GUI consists of two dialog boxes:
The Datafeed dialog box. U se this dialog box to connect to and retrieve data
from the following service providers:
- Bloomberg
- Interactive Data Pricing and Reference Data’s RemotePlus
- Yahoo!
For more information on how to use this dialog box, see “Using the Datafeed Dialog Box” on page 4-3.
The Securities Lookup dial og box. You can use this dialog box to find the
ticker symbol for a security when you know part of the security name. Use this d i al og box with connections to the following service providers:
®
4-2
- Bloomberg
- Interactive Data Pricing and Reference Data’s RemotePlus
For more information on how to use this dialog box, see “Using the Datafeed Securities Lookup Dialog Box” on page 4-6.
Using the Datafeed Dialog Box
In this section...
“About the Datafeed Dialog Box” on page 4-3
“Connecting to Data Servers” on p age 4-4
“Retrieving Data” on page 4-5
“Using the Datafeed Securities Lookup Dialog Box” on page 4-6
“Setting Overrides” on page 4-8
About the Datafeed Dialog Box
The Datafeed dialog box establishes the connection with the data server and manages data retrieva l. To display this dialog b ox , enter the command in the MATLAB Command Window.
The Datafeed dialog box consists of two tabs:
Using the Datafeed Dialog Box
dftool
The Connection tab establishes communicationwithadataserver. For
more information, see “Connecting to Data Servers” on page 4-4.
The Data tab specifies the data request. For more information, see
“Retrieving Data” on page 4-5.
You can also set overrides for the data you retrieve. For more information,
see “Setting Overrides” on page 4-8.
The following figure summarizes how to connect to data servers and retrieve data using the Datafeed dialog box.
4-3
4 Datafeed Toolbox™ Graphical User Interface
4. After the connection is made, click the Data tab to begin data retrieval.
3. Click to establish a connection to the data server.
1. Enter port number on data server (Bloomberg data servers only).
The Datafeed Dialog Box
4-4
5. Click to close the highlighted connection.
2. Enter IP address of data server or use the default values (Bloomberg data servers only).
Connecting to Data Servers
1 Click the Connect button to establish a connection.
Using the Datafeed Dialog Box
2 When the Connected message appears in the Status field, click the Data
tab to begin the process of retrieving data from the data server. For more information, see “Retrieving Data” on page 4-5.
3 Click the Disconnect button to terminate the session highlighted in the
Current Connections box.
For Bloomberg data servers, you must also specify the port number and IP address of the server:
1 Enter the port number on the data server in the Port Number field.
2 Enter the IP address of the data server in the IP Address field .
3 To establish a connection to the Bloomberg data server, follow steps 1
through 3 above.
Tip You can also connect to the Bloomberg data server by selecting the Connect button and accepting the default values.
Retrieving Data
The Data tab allows you to retrieve data from the data server as follows:
1 Enter the security symbol in the Enter Security field.
2 IndicatethetypeofdatatoretrieveintheData Selection field.
3 Specify whether you want the default set of data, or the full set:
Select the Default fields button for the default set of data.
Select the All fields button for the full set of data.
4 Click the Get Data button to retrieve the data from the data server.
5 (Optional) Click the Override button if you want to set overrides on the
data you request from the data server. For more information, see “Setting Overrides” on page 4-8.
The following figure summarizes these steps.
4-5
4 Datafeed Toolbox™ Graphical User Interface
2. Enter security symbol if known, or click Add button to add security to Selected Securities list.
2a. Use to find security symbol, if unknown. (For Bloomberg and Interactive Data Pricing and Reference Data data servers only)
Security fields.
4-6
Variable in MATLAB workspace.
Using the Datafeed Securities Lookup Dialog Box
When requesting data from Bloomberg or Interactive Data Pricing and Reference Data’s RemotePlus servers, you can use the Datafee d Securities
Data retrieved from the connection.
1. Click to retrieve data.
Using the Datafeed Dialog Box
Lookup dialog box to obtain the ticker symbol for a given security if you know only part of the security name.
1 Click the Lookup button on the Datafeed dialog box Data tab. The
Securities Lookup dialog box opens.
2 Specify your choice of market in the Choose Market field.
3 Enter the known part of the security name in the Lookup field.
4 Click Submit. All possible values o f the company name and ticker symbol
corresponding to the security name you sp ecif ied display in the Security and Symbol list.
5 Select one or more securit ie s from the list, and then click Select.
The s elected securities are added to the Selected Securities list o n the Data tab.
The following figure summarizes these steps.
4-7
4 Datafeed Toolbox™ Graphical User Interface
2. Enter lookup search string.
4. Search results returned from data server. This field displays all possible values of company name and ticker symbol. Select desired securities from list.
4-8
1. Indicate choice of market.
3. Click to send request to data server.
5. Enter selected securities on Data tab.
Setting Overrides
To set overrides on retrieved data:
1 Click the Override button. The Override values dialog box opens.
2 Select the field to override from the Override fields selection list.
3 Enter the desired override value in the Override value field.
4 Click Add to add the field to override to the Override field settings list.
5 Click Apply to apply overrides to the current session and keep the Override
values dialog box open, or click OK to apply the overrides and close the dialog box.
The following figure summarizes these steps.
Using the Datafeed Dialog Box
2. Enter desired override value.
3. Click Add to add the field to the Override field settings list.
Lists data to override.
1. Select field to override.
4a. Apply overrides and close dialog. Return to previous dialog box.
4. Apply overrides to current session.
4-9
4 Datafeed Toolbox™ Graphical User Interface
4-10
Function Reference
Bloomberg (p. 5-2) Get Bloomberg financial data
Datastream (p. 5-3) Get Thomson Datastream financial
data
FactSet (p. 5-4) Get FactSet financial data
5
FRED (p. 5-5) Get F ederal Reserve Economic Data
(FRED
Haver Analytics (p. 5-6) Get Haver Analytics financial data
Interactive Data Pricing and RemotePlus (p. 5-7)
Kx Systems (p. 5-8) Get Kx Systems
Reuters (p. 5-9) Get Reuters financial data
Reuters Datascope Tick History (p. 5-10)
Reuters Knowledge Direct (p. 5-11)
Reuters Newscope (p. 5-12) Retrieve d ata from Reuters
Yahoo! (p. 5-13) Get Yahoo! financial data
Get Interactive Data Pricing and Reference Data’s RemotePlus financial data
data
Retrieve data from Reuters Datascope Tick History file
Establish Reuters Knowledge D irect connection
Newscope sentiment archive file
®
) financial data
®
, Inc. kdb+ financial
5 Function Reference
Bloomberg
blp
blp.close
blp.display
blp.get
blp.getda
blp.hist
blp.realtime
blp.stop
blp.timeseries
ta
ory
Bloomberg V3 communications server connection
Close connection to Bloomberg V3 data server
Display Bloo object
Get Bloombe properties
Current Bl
Bloomberg V3 historical data
Bloomberg V3 realtime data retrieval
Unsubscribe real time requests for Bloomberg V3
Bloom
mberg V3 connection
rg V3 connection
oomberg V3 data
berg V3 intraday tick data
5-2
Datastream
Datastream
®
datastream
datastream.close
datastream.fetch
datastream.get
datastream.isconnection
Establish connections to Thomson Datastream API
Close connections to Thomson Datastream data servers
Request data from Thomson Datastream data servers
Retrieve properties of Thomson Datastream connection objects
Verify whether connections to Thomson Datastream data servers are valid
5-3
5 Function Reference
FactSet
factset
factset.close
factset.fetch
factset.get
factset.isconnection
Establish connections to FactSet data servers
Close connections to FactSet data servers
Request data from FactSet data servers
Retrieve properties of FactSet connection objects
Verify whether connections to FactSet data servers are valid
5-4
FRED
FRED
®
fred
fred.close
fred.fetch
fred.get
fred.isconnection
Connect to FRED data servers
Close connections to FRED data servers
Request data from FRED data servers
Retrieve properties of FRED connection objects
Verify whether connections to FRED data servers are valid
5-5
5 Function Reference
Haver Analytics
haver
haver.aggregation
haver.close
haver.fetch
haver.get
haver.info
haver.isconnection
haver.nextinfo
havertool
Connect to local Haver Analytics database
Set Haver Analytics aggregation mode
Close Haver Analytics database
Request data from Haver Analytics database
Retrieve properties from Haver Analytics connection objects
Retrieve information about Haver Analytics v ariables
Verify whether connections to Haver Analytics data servers are valid
Retrieve information about next Haver Analytics variable
Run Haver Analytics graphical u ser interface (GUI)
5-6
Interactive Data Pricing and RemotePlus
Interactive Data Pricing and RemotePlus™
idc
idc.close
idc.fetch
idc.get
idc.isconnection
Connect to Interactive Data Pricing and Reference Data’s RemotePlus data servers
Close connections to Interactive Data Pricing and Reference Data’s RemotePlus data servers
Request data from Interactive Data Pricing and Reference Data’s RemotePlus data servers
Retrieve properties of Interactive Data Pricing and Reference Data’s RemotePlus connection objects
Verify whether connections to Interactive Data Pricing and Reference Data’s RemotePlus data servers are valid
5-7
5 Function Reference
Kx Systems
kx
kx.close
kx.exec
kx.fetch
kx.get
kx.insert
kx.isconnection
kx.tables
Connect to Kx Systems, Inc. kdb+ databases
Close connections to Kx Systems, Inc. kdb+ databases
Run Kx Systems, Inc. kdb+ commands
Request data from Kx Systems, Inc. kdb+ databases
Retrieve Kx Systems, Inc. kdb+ connection o bject properties
WritedatatoKxSystems,Inc. kdb+ databases
Verify whether connections to Kx Systems, Inc. kdb+ databases are valid
Retrieve table names from Kx Systems, Inc. kdb+ databases
5-8
Reuters
Reuters
®
reuters
reuters.close
reuters.fetch
reuters.get
reuters.history
reuters.stop
Create Reuters sessions
Release connections to Reuters data servers
Request data from Reuters data servers
Retrieve properties of Reuters session objects
Request data from Reuters Time Series One
Unsubscr
ibe securities
5-9
5 Function Reference
Reuters Datascope Tick History
rdth
rdth.close
rdth.fetch
rdth.get
rdth.isconnection
rdthloader
Connect to Reuters Datascope Tick History
Close Reuters Datascope Tick History connection
Request Reuters Datascope Tick History data
Get Reuters Datascope Tick History connection properties
Verify whether Reuters Datascope Tick History connections are valid
Retrieve data from Reuters Datascope Tick History file
5-10
Reuters Knowledge Direct
Reuters®Knowledge Direct
rkd
rkd.close
rkd.fetch
rkd.get
rkd.iscon
nection
Establish Reuters Knowledge D irect connection
Close Reuters Knowledge Direct connection
Request Reut data
Get propert Data connec
Verify whe Data conne
ers Knowledge Direct
ies of Reuters Knowledge
tion
ther Reuters Knowledge
ctions are valid
5-11
5 Function Reference
Reuters Newscope
rnseloader
Retrieve data from Reuters Newscope sentiment archive file
5-12
Yahoo!
Yaho o !
®
yahoo
yahoo.close
yahoo.fetch
yahoo.get
yahoo.isconnection
Connect to Yahoo! data servers
Close connections to Yahoo! data servers
Request data from Yahoo! data servers
Retrieve properties of Yahoo! connection objects
Verify whether connections to Yahoo! data servers are valid
5-13
5 Function Reference
5-14
Functions — Alphabetical List
6
bloomberg
Purpose Connect to Bloomberg data servers
bloomberg is not recommended. Use blp instead.
Syntax c = bloomberg
Description c = bloomberg establishes a connection, c, to a Bloomberg data server.
It uses port number when you installed the Bloomberg software on your machine.
Examples Establish a connection, c, to a Bloomberg data server:
c = bloomberg
See Also bloomberg.close, bloomberg.fetch, bloomberg.get,
bloomberg.isconnection
8194 and the default internet address provided
6-2
bloomberg.close
Purpose Close connections to Bloomberg data servers
bloomberg is not recommended. Use blp instead.
Syntax close(Connect)
Arguments
Connect
Description close(Connect) closes the connection to the Bloomberg data server.
Examples Establish a Bloomberg connection c:
c = bloomberg
Close this connection:
Bloomberg connection object created with the
bloomberg function.
close(c)
See Also bloomberg
6-3
bloomberg.fetch
Purpose Request data from Bloomberg data servers
bloomberg.fetch is not recommended. Use blp.getdata, blp.history, blp.realtime,orblp.timeseries instead.
Syntax data = fetch(Connect, 'Security')
data = fetch(Connect, 'Security', 'HEADER', 'Flag', 'Ident')
data = fetch(Connect, 'Security', 'GETDATA', 'Fields',
'Override', 'Values', 'Ident')
data = fetch(Connect, 'Security', 'TIMESERIES', 'Date',
'Minutes', 'TickField')
data = fetch(Connect, 'Security', 'HISTORY', 'Fields',
'FromDate', 'ToDate', 'Period' , 'Currency', 'Ident')
ticker = fetch(Connect, 'SearchString', 'LOOKUP', 'Market')
data = fetch(Connect, 'Security', 'REALTIME', 'Fields',
'MATLABProg')
data = fetch(Connect, 'Security', 'STOP')
Description For a given security, fetch returns header (default), current,
time-series, real time, and historical data via a connection to a Bloomberg data server.
6-4
data = fetch(Connect, 'Security') fills the header fields with data
from the most recent date with a bid, ask, or trade.
data = fetch(Connect, 'Security', 'HEADER', 'Flag', 'Ident')
for the specified security type identifiers, based upon the value of
If
returns data for the most recent date of each individual field
Flag.
'Flag' is 'DEFAULT', fetch fills the header fields with data from
the most recent date with a bid, ask, or trade. Alternatively, you could use the command
If
'Flag' is 'TODAY', fetch returns the header field data with data
data = fetch(Connect,'Security').
from today only.
If
'Flag' is 'ENHANCED', fetch returns the header field data for the
most recent date of each individual field. In this case, for example, the bid and ask group fields c ou ld come from different dates.
bloomberg.fetch
data = fetch(Connect, 'Security', 'GETDATA', 'Fields', 'Override', 'Values', 'Ident')
for the specified fields of the indicated security. You can further specify the data with the optional
Override, Values and Ident arguments.
Note If a call to the fetch function with the GETDAT A argument encounters an invalid security in a list of securities to retrieve, it returns
data = fetch(Connect, 'Security', 'TIMESERIES', 'Date', 'Minutes', 'TickField')
NaN data for the invalid security’s fields.
returns the tick data for a single security
for the specified date. You can further specify data with the optional
Minutes and TickField arguments. If there is no data found in the
specified range,
fetch returns an empty matrix.
returns the current market data
You can specify
TickField = 'Trade' or TickField = 1 returns d ata for ticks of type Trade. The function dftool('ticktypes') returns the lis t of intraday
tick fields.
TickField as a string or numeric value. For example,
fetch returns intraday tick data requested with an interval
with the following columns:
Time
Open
High
Low
Value of last tick
Volume total value of ticks
Total value of ticks for the time range
Number of ticks
fetch fun ction returns columns 7 and 8 only if they make sense for
The the requested field.
6-5
bloomberg.fetch
For today’s tick data, enter the command:
For today’s trade time series aggregated into five-minute intervals, enter:
data = fetch(Connect, 'Security', 'HISTORY', 'Fields', 'FromDate', 'ToDate', 'Period', 'Currency', 'Ident')
historical data for the specified field for the date range
ToDate. You can set the time period with the optional Period argument
to return a more specific data set. You can further specify returned data by appending the
Note If a call to the fetch function with the HISTORY argument encounters an invalid security in a list of securities to retrieve, it returns no data for any securities in the list.
data = fetch(Connect,'Security', 'TIMESERIES', now)
data = fetch(Connect,'Security','TIMESERIES', ...
now, 5, 'Trade')
returns
FromDate to
Currency or Ident argument.
6-6
ticker = fetch(Connect, 'SearchString', 'LOOKUP', 'Market')
uses SearchSt ring to find the ticker symbol f or a security trading in a designated market. The output
ticker is a column vector of possible
ticker values.
Note If you supply Ident without a period or currency, enter [] for the missing values.
data = fetch(Connect, 'Security', 'REALTIME', 'Fields', 'MATLABProg')
subscribes to a given security or list of securities,
requesting the indicated fields, and runs any specified MATLAB
Arguments
bloomberg.fetch
function. See pricevol, showtrades,orstockticker for information on the data returned by asynchronous Bloomberg events.
data = fetch(Connect, 'Security', 'STOP') unsubscribes the list
of securities from processing Bloomberg real-time events.
Connect
'Security'
'Flag'
'Currency'
'Ident'
Bloomberg connection object cre ate d with the bloomberg function.
A MATLAB string containing the name of a security, or a cell array of strings containing a list of securities, specified in a format recognizable by the B loomberg server. You can substitute a
CUSIP number for a security
name as needed. You can only call a single security when using the
TIMESERIES flag as well.
Note This argument is case sensitive.
AMATLABstringindicatingthedatesfor which to retrieve data. Possible values are:
DEFAULT: Data from most recent bid, ask, or trade. If you do not specify
a
Flag value, fetch uses the default value of 'DEFAULT'.
TODAY: Today’s data only.
ENHANCED: Data from most recent date of each individual field.
(Optional) Currency in which the fetc h function returns historical data. A list of valid currenciesappearsinthefile Default =
[].
@bloomberg/bbfields.mat.
(Optional) Security type identifier. A list of valid security type identifiers appears in the file
@bloomberg/bbfields.mat.Default=[].
6-7
bloomberg.fetch
'Fields'
'Override'
'Values'
'Date'
'Minutes'
'TickField'
'FromDate'
'ToDate'
'Period'
A MATLAB string or cell array of strings specifying specific fields for which you request data. A list of valid field names appears in the file
@bloomberg/bbfields.mat. The variable bbfieldnames contains the list
of field names. D efault =
[].
(Optional) String or cell array of strings containing override field list. Default =
[].
(Optional) String or cell array of strings containing override field values.
Date string, serial date number, or cell array of dates that specifies dates for the time-series data. Specify
now to retrieve today’s time-series data.
(Optional) Numeric value for tick interval in minutes.
(Optional) You can specify a string or numeric value for this field. For example, of type
TickField = 'Trade' or TickField = 1 return data for ticks
Trade.Usethecommanddftool('ticktypes') to return the
list of intraday tick fields.
Beginning date for historical data.
Note You can specify dates in any of the formats supported by datestr and datenum that display a year, month, and day.
End date for historical data.
(Optional) Period of the data. A MATLAB three-part string w ith the format:
6-8
'Frequency Days Data'
Frequency
d: Daily (default)
w:Weekly
m:Monthly
q:Quarterly
Values:
bloomberg.fetch
s: Semiannually
y:Yearly
Days Values:
o: Omit all days for which there is no data (default)
i: Include all trading days
a: Include all calendar days
Data Values:
b: Report missing data using Bloomberg (default)
s: Show missing data as last found value
n: Report missing data as NaN
For example, 'dan' returns daily data for all calendar days, reporting missing values as value.
NaN.Ifavalueisunspecified,fetch returns a default
'Currency'
Note If you do not specify a value for Period, fetch uses default values.
(Optional) Currency type. The file @bloomberg/bbfields.mat lists supported currencies.
6-9
bloomberg.fetch
'Market'
A MATLAB string indicating the market in which a particular security trades. Possible values are:
Comdty: (Commodities)
Corp: (Corporate bonds)
Equity:(Equities)
Govt: (Government bonds)
Index:(Indexes)
M-Mkt:(MoneyMarketsecurities)
Mtge: Mortgage-backed securities)
Muni: (Municipal bonds)
Pfd: (Preferred stocks)
'MATLABProg'
A string that is the name of any valid MATLAB program.
Examples Retrieving Header Data
Retrieve header data for a United States equity with ticker ABC:
D = fetch(C,'ABC US Equit y')
6-10
Retrieving Opening and Closing Prices
Retrieve the opening and closing prices:
D = fetch(C,'ABC US Equit y',' GETDATA',...
{'Last_Price';'Open'})
Retrieving Override Fields
Retrieve the requested fields, given override fields and values:
D = fetch(C, '3358ABCD4 Corp', 'GETDATA',...
bloomberg.fetch
{'YLD_YTM_ASK', 'ASK', 'OAS_SPREAD_ASK', 'OAS_VOL_ASK'},... {'PX_ASK', 'OAS_VOL_ASK'}, {'99.125000', '14.000000'})
Retrieving Time Series Data
Retrieve today’s time series:
D = fetch(C, 'ABC US Equity', 'TIMESERIES', now)
Retrieving Time Series Data, Aggregated into Time Intervals
Retrieve today’s trade time series for the given security, aggregated into five-minute intervals:
D = fetch(C, 'ABC US Equity', 'TIMESERIES', now, 5,'Trade')
Retrieving Time Series Default C losing Price
Retrieve the closing price for the given dates, using the default period of the data:
D = fetch(C, 'ABC US Equity', 'HISTORY', 'Last_Price', ... '8/01/99', '8/10/99')
Retrieving Monthly Closing Price
Retrieve the monthly closing price for the specified dates:
D = fetch(C, 'ABC US Equity', 'HISTORY', 'Last_Price', ... '8/01/99', '9/30/00', 'm')
See Also bloomberg, bloomberg.close, bloomberg.get,
bloomberg.isconnection
6-11
bloomberg.get
Purpose Retrieve Bloomberg connection object properties
bloomberg.get is not recommended. Use blp.get instead.
Syntax value = get(Connect, 'PropertyName')
value = get(Connect)
Arguments
Connect
Bloomberg connection object created with the
bloomberg function.
PropertyName
(Optional)AMATLABstringorcellarrayofstrings containing property names. Property names are:
'Connection'
'IPAddress'
'Port'
'Socket'
'Version'
Description value = get(Connect, 'PropertyName') returns a MATLAB
structure containing the value of the specified properties for the Bloomberg connection o bject.
value = get(Connect) returns the value for all properties.
Examples Establish a connection, c, to a Bloomberg data server:
c = bloomberg
Retrieve this connection’s properties:
p = get(c, {'Port', 'IPAddress'})
p=
port: 8194
6-12
ipaddress: 111.222.33.444
See Also bloomberg, bloomberg.close, bloomberg.fetch,
bloomberg.isconnection
bloomberg.get
6-13
bloomberg.getdata
Purpose Current Bloomberg data
Syntax d = getdata(b,s,f)
d = getdata(b,s,f,o,ov)
Description d = getdata(b,s,f) returns the data for the fields f for the security
list
s. This method uses the Bloomberg ActiveX
not support overrides. For more robust functionality, refer to the
bloomberg.fetch method.
d = getdata(b,s,f,o,ov) returns the data for the fields f for the
security list values,
s using the override fields o with corresponding override
ov.
®
interface and does
Examples The command
d = getdata(c,'ABC US Equ ity' ,{'LAST_PRICE';'OPEN'})
returns the today’s current and open price of the given security.
The command
d = getdata(c,'3358ABCD4 Corp',...
{'YLD_YTM_ASK','ASK','OAS_SPREAD_ASK','OAS_VOL_ASK'},... {'ASK','OAS_VOL_ASK'},{'99.125000','14.000000'})
returns the requested fields given override fields and values.
See Also bloomberg.fetch, bloomberg.history, bl oomberg.lookup,
bloomberg.realtime, bloomberg.timeseries
6-14
bloomberg.history
Purpose Historical Bloomberg data
bloomberg.history is not recommended. Use blp.history instead.
Syntax d = history(c,s,f,fromdate,todate)
d = history(c,s,f,fromdate,todate,per) d = history(c,s,f,fromdate,todate,per,cur)
Description d = history(c,s,f,fromdate,todate) returns the historical data for
the security list This method uses the Bloomberg ActiveX interface. For more robust functionality, refer to the
d = history(c,s,f,fromdate,todate,per) returns the historical
data for the field, period of the data:
s for the fields f for the dates fromdate to todate.
bloomberg.fetch method.
f, for the dates fromdate to todate. per specifies the
'd'
'w'
'm'
'q'
'y'
'o'
'i'
'a'
'b'
's'
'n'
For example, reporting missing data as
Daily.
Weekly.
Monthly.
Quarterly.
Yearly.
Omit all days for which there is no data.
Include all trading days.
Include all calendar days.
Report missing data u sing Bloomberg default.
Show missing data as last found value.
Report missing data as Nan.
per = 'dan' returns daily data for all calendar days
NaN’s. per = ' n' returns the data using the
default periodicity and default calendar reporting missing data as
If you do not specify
per, the method uses default period for the data.
NaN’s.
6-15
bloomberg.history
d = history(c,s,f,fromdate,todate,per,cur) returns the
historical data for the security list
fromdate to todate based on the given currency, cur.Loadthefile bloomberg/bbfields to see the list of supported currencies.
Examples Example 1
The command
d = history(c,'ABC US Equ ity' ,'LAST_PRICE','8/01/99',...
'8/10/99')
returns the closing price for the given dates for the given security using the default period of the data.
Example 2
The command
D = HISTORY(c,'ABC US Equ ity' ,'LAST_PRICE','8/01/99',...
'8/10/99','m')
s for the fields f for the dates
6-16
returns the monthly closing price for the given dates for the given security.
Example 3
The command
D = HISTORY(c,'ABC US Equ ity' ,'LAST_PRICE','8/01/99',...
'8/10/99','m','USD')
returns the monthly closing price converted to US dollars for the given dates for the given security.
Example 4
The command
D = HISTORY(c,'ABC US Equ ity' ,'LAST_PRICE','8/01/99',...
'8/10/99',[],'USD')
bloomberg.history
returns the closing p rice converted t o US dollars for the given dates for the g iven security using the default period of the data.
6-17
bloomberg.isconnection
Purpose Verify whether con ne ctions to Bloomberg data servers are valid
bloomberg is not recommended. Use blp instead.
Syntax x = isconnection(Connect)
Arguments
Connect
Description x = isconnection(Connect) returns x=1iftheconnectiontothe
Bloomberg data server is valid, and
Examples Establish a connection, c, to a Bloomberg data server:
c = bloomberg
Verify that c is a valid connection:
Bloomberg connection object created with the
bloomberg function.
x=0otherwise.
x = isconnection(c)
x=1
See Also bloomberg, bloomberg.close, bloomberg.fetc h, bloomberg.get
6-18
bloomberg.isfield
Purpose Verify if valid Bloomberg field
bloomberg is not recommended. Use blp instead.
Syntax x = isfield(b,f)
Description x = isfield(b,f) returns true if specified field, f, is a valid B loomberg
field and false otherwise. Bloomberg connection handle.
Examples x = isfield(b,{'LAST_PRICE','VOLUME','OPEN','HIGH'})
returns
x= 1111
See Also bloomberg.close, bloomberg.fetch, bloomberg.get,
bloomberg.isconnection
f can be a cell array of strings. b is the
6-19
bloomberg.lookup
Purpose Bloomberg security search
bloomberg is not recommended. Use blp instead.
Syntax d = lookup(b,s,market)
Description d = lookup(b,s,market) returns the list of matching securities given
the security search string Bloomberg ActiveX interface.
Examples The command
D = LOOKUP(C,'Intl Bus Ma c',' Equity')
returns the securities along with their ticker symbols matching the search string types are:
Comdty: (Commodities)
'Intl Bus Mac' for the Equity market. Valid market
s and market m. This method uses the
Corp: (Corporate bonds)
Equity:(Equities)
Govt: (Government bonds)
Index:(Indexes)
M-Mkt: (Money Market securities)
Mtge: Mortgage-backed securities)
Muni: (Municipal bonds)
Pfd: (Preferred stocks)
See Also bloomberg.fetch, bloomberg.getdata
6-20
bloomberg.realtime
Purpose Bloomberg realtime data retrieval
bloomberg.realtime is not recommended. Use blp.realtime instead.
Syntax realtime(c,s,f,api)
Description realtime(c,s,f,api) subscribes to a given security or list of securities
s requesting the fields f and runs the specified function by api.Seethe
function by asynchronous Bloomberg events.
Examples The command
subscribes to the security ABC US Equity requesting the fields
Last_Trade and Volume to update in realtime running the function stockticker.
bloomberg.showtrades for information on the data returned
realtime(c,'ABC US Equity',{'Last_Trade','Volume'},... 'stockticker')
See Also bloomberg.fetch, bloomberg.getda ta, bloomberg.pricevol,
bloomberg.stop, bloomberg.stockticker, bloomberg.showtrades
6-21
bloomberg.pricevol
Purpose Price and volume (demonstration)
bloomberg is not recommended. Use blp instead.
Syntax pricevol(InputList)
Arguments
InputList
Description pricevol(InputList) demonstrates the Bloomberg real-time data
import functionality, where described in the following table.
InputList is an input list of elements as
Fields from which you request real-time data.
InputList(1) = COM.Bloomberg.Data.1
InputList(2) = 1
InputList(3) = ('Security')
InputList(4) = 1
InputList(5) = 2
InputList(6) = {[43.58]}
InputList(7) = 0
InputList(8)
InputList(9) = 'Data'
The input argument to process real-time events.
InputList(8) contains the information required
Bloomberg handle
Event ID
Security string
Cookie
Field number ID
Return data for the given tick
Status
Structure containing the previous fields
Event type
Examples Display the most recent Trade and Volume values in a figure window
and show the most recent trade with volumes:
b = bloomberg;
d = fetch(b, 'ABC US Equity', 'REALTIME', ...
6-22
bloomberg.pricevol
{'Last_Trade', 'Volume'}, 'pricevol');
See Also bloomberg.showtrades, bloomberg.stockticker
6-23
bloomberg.showtrades
Purpose Recent trade data (demonstration)
bloomberg is not recommended. Use blp instead.
Syntax showtrades(InputList)
Arguments
InputList
Description showtrades(InputList) demonstrates the Bloomberg real-time data
import functionality, where described in the following table:
InputList is an input list of elements as
Fields from which you request real-time data.
InputList(1) = COM.Bloomberg.Data.1
InputList(2) = 1
InputList(3) = ('Security')
InputList(4) = 1
InputList(5) = 2
InputList(6) = {[43.58]}
InputList(7) = 0
InputList(8)
InputList(9) = 'Data'
The input argument to process real-time events.
InputList(8) contains the information required
Bloomberg handle
Event ID
Security string
Cookie
Field number ID
Return data for the given tick
Status
Structure containing the above fields
Event type
Examples Establish a connection, c, to a Bloomberg data server:
c = bloomberg;
6-24
bloomberg.showtrades
Display the most recent Trade, Bid, Ask,andVWAP (volume-weighted adjusted price), and a list of the most recent trades with volu m es:
d = fetch(c, 'GOOG US Equity', 'REALTIME', ... {'Last_Trade','Bid','Ask','Volume','VWAP'},'showtrades');
See Also bloomberg.pricevol, bloomberg.stockticker
6-25
bloomberg.stockticker
Purpose Trades with volumes (demonstration)
bloomberg is not recommended. Use blp instead.
Syntax stockticker(InputList)
Arguments
InputList
Description stockticker(InputList) demonstrates the Bloomberg real-time data
import functionality, where described in the following table.
InputList is an input list of elements as
Fields from which you request real-time data.
InputList(1) = COM.Bloomberg.Data.1
InputList(2) = 1
InputList(3) = ('Security')
InputList(4) = 1
InputList(5) = 2
InputList(6) = {[43.58]}
InputList(7) = 0
InputList(8)
Bloomberg handle
Event ID
Security string
Cookie
Field number ID
Return data for the given tick
Status
Structure containing the above fields
InputList(9) = 'Data'
The input argument
InputList(8) contains the information required
Event type
to process real-time events.
Examples Retrieve a list of trades with volumes for each requested security:
b = bloomberg;
d = fetch(b, {'IBM US Equity', 'EMC US Equity', 'NTAP US Equity'}, ...
'REALTIME', {'Last_Trade', 'Volume'}, 'stockticker');
6-26
bloomberg.stockticker
** EMC US Equity ** 0 @ 12.65 08-Apr-2005 10:24:57
** IBM US Equity ** 0 @ 88.17 08-Apr-2005 10:24:57
** NTAP US Equity ** 0 @ 29.02 08-Apr-2005 10:24:57
** EMC US Equity ** 200 @ 12.66 08-Apr-2005 10:24:58
** EMC US Equity ** 1400 @ 12.65 08-Apr-2005 10:24:58
** EMC US Equity ** 3100 @ 12.66 08-Apr-2005 10:25:00
** IBM US Equity ** 1300 @ 88.17 08-Apr-2005 10:25:00
.
.
.
See Also bloomberg.pricevol, bloomberg.showtrades
6-27
bloomberg.stop
Purpose Stop Bloomberg realtime data retrieval
bloomberg is not recommended. Use blp instead.
Syntax stop(c,s)
stop(c,s,api)
Description stop(c,s) desubscribes a given security or l ist of securities s.Data
events for the security no longer process.
stop(c,s,api) desubscribes a given security or list of securities s and
unregisters the specified callback
To desubscribe all securities and turn off data event handling, use
close(c).
The Bloomberg connection is now closed.
Examples Example 1
The command
api.
6-28
stop(C,'ABC US Equity')
desubscribes from the security ABC US Equity.
Example 2
The command
stop(C,'ABC US Equity','stockticker')
desubscribes from the security ABC US Equity and turns off data event handling by the function
stockticker.
Example 3
The command
STOP(C,'','STOCKTICKER')
turns off data event handling by the function stockticker.
bloomberg.stop
See Also bloomberg.fetch, bloomberg.getda ta, bloomberg.pricevol,
bloomberg.realtime, bloomberg.st ockt icker, bloomberg.showtrades
6-29
bloomberg.timeseries
Purpose Bloombergintradaytickdata
bloomberg.timeseries is not recom m e nd ed. Use blp.timeseries
instead.
Syntax d = timeseries(c,s,f,t)
d = timeseries(c,s,f,{startdate,enddate}) d = timeseries(c,s,f,t,b)
Description d = timeseries(c,s,f,t) returns the tick data for the security s for
the date robust functionality, refer to the
d = timeseries(c,s,f,{startdate,enddate}) returns the tick data
for the security
d = timeseries(c,s,f,t,b) returns the tick data for the security s for
the date requested with an interval is returned with the columns representing
Time, Open, High, Low, Last Price and Volume of the ticks in the bar.
t. This method uses the BloombergActiveX interface. F or more
bloomberg.fetch method.
s for the date range defined by startdate and enddate.
t in intervals of b minutes for the field, f.Intradaytickdata
Examples Example 1
The command
returns today’s time series for the given security with the timestamp and tick value.
Example 2
The command
returns today’s Last Price series for the given security aggregated into 5-minute intervals minute intervals.
Example 3
The command
6-30
d = timeseries(c,'ABC US Equity','Last Price',floor(now))
d = timeseries(c,'ABC US Equity','Last Price',floor(now),5)
bloomberg.timeseries
d = timeseries(c,'ABC US Equity','Last Price',... {'12/08/2008 00:00:00','12/10/2008 23:59:59.99'},5)
returns the Last Price series for 12/08/2008 and 12/10/2008 for the given security, aggregated into 5-minute intervals.
See Also bloomberg.fetch, bloomberg.getdata, bloomberg.history
6-31
blp
Purpose Bloomberg V3 communications server connection
Syntax c = blp
Description c = blp makes a connection to the local Bloomberg V3 communications
server.
Examples Establish a connection, c, to a Bloomberg data server:
c=blp
See Also blp.close, blp.getdata, blp.his tory, blp.realtime,
blp.timeseries
6-32
Purpose Close connection to Bloomberg V3 data server
Syntax close(C)
Description close(C) closes the connection, C, to the Bloomberg V3 session.
blp.close
6-33
blp.display
Purpose Display Bloomberg V3 connection object
Syntax disp = display(c)
Description disp = display(c) displays the Bloomberg V3 connection object.
6-34
Purpose Get Bloomberg V3 connection properties
Syntax V = get(C,'PropertyName')
V = get(C)
Description V = get(C,'PropertyName') returns the value of the specified
properties for the Bloomberg V3 connection object. string or cell array of strings containing property names. The property names are
V = get(C) returns a structure where each field name is the name of a
property of
session, ipaddress,andport.
C an d each field contains the value of th a t property.
'PropertyName' is a
See Also blp.getdata, blp.history, blp.realt ime, blp.timeseries
blp.get
6-35
blp.getdata
Purpose Current Bloomberg V3 data
Syntax D = getdata(B,S,F)
D = getdata(B,S,F,O,OV)
Description D = getdata(B,S,F) returns the data for the fields F for the security
list
S for the Bloomberg V3 connection object B
D = getdata(B,S,F,O,OV)
security list values
S using the override fields O with corresponding override
OV.
returns the data for the fields F for the
Examples D = getdata(C,'ABC US E quit y',{'LAST_PRICE';'OPEN'}) returns
today’s current and open price of the given security.
D = fetch(C,'3358ABCD4 Corp','GETDATA',{'YLD_YTM_ASK','ASK','OAS_SPREAD_ASK','OAS_VOL_ASK'}, {'ASK','OAS_VOL_ASK'},{'99.125000','14.000000'})
requested fields given override fields and values.
returns the
See Also blp, blp.history, blp.realtime, blp.timeseries
6-36
blp.history
Purpose Bloomberg V3 historical data
Syntax D = history(S,F,FromDate,ToDate)
D = history(C,S,F,FromDate,ToDate,Per) D = history(S,F,FromDate,ToDate,Per,Cur)
Description D = history(S,F,FromDate,ToDate) returns the historical data for
the security list
D = history(C,S,F,FromDate,ToDate,Per) returns the historical
data for the field, the period of the data. For example, returns daily data for all calendar days reporting missing data as NaN.
Per = {'actual'} returns the data using the default periodicity and
default calendar reporting missing data as
Per are as follows:
Value Time Period
daily
S for the fields F for the dates FromDate to ToDate.
F, for the dates FromDate to ToDate. Per specifies
Per = {'daily','calendar'}
NaN. The possible values of
Daily
weekly
monthly
quarterly
semi_annually
yearly
actual
calendar
fiscal
non_trading_weekdays
all_calendar_days
active_days_only
Weekly
Monthly
Quarterly
Semi annually
Yearly
Anchor date specification
Anchor date specification
Anchor date specification
Non trading weekdays
Return all calendar days
Active trading days only
6-37
blp.history
Value Time Period
previous_value
nil_value
D = history(S,F,FromDate,ToDate,Per,Cur) returns the
historical data for the security list
FromDate to ToDate based on the given currency, Cur.Loadthefile bloomberg/bbfields to see the list of supported currencies.
Examples D = history(C,'ABC US E quit y',...
'LAST_PRICE','8/01/99','8/10/99')
given dates for the given security using the default period of the data.
D = history(C,'ABC US E quit y',... 'LAST_PRICE','8/01/99','8/10/99','monthly')
monthly closing price for the given dates for the given security.
D = history(C,'ABC US E quit y',... 'LAST_PRICE','8/01/99','8/10/99','monthly','USD')
monthly closing price converted to US dollars for the given dates for the given security.
Fill missing values with previous values
Fill missing values with NaN
S for the fields F for the dates
returns the closing price for the
returns the
returns the
D = history(C,'ABC US E quit y',... 'LAST_PRICE','8/01/99','8/10/99', {'daily','actual','all_calendar_days', 'nil_value'},'US D')
returns the daily closing price converted to US dollars for the given dates for the given security.
D = history(C,'ABC US E quit y',... 'LAST_PRICE','8/01/99','8/10/99',[],'USD')
price conv erted to US dollars for the given dates for the given security using the default period of the data.
See Also blp, blp.realtime, blp.timeseries
6-38
returns the closing
blp.realtime
Purpose Bloomberg V3 realtime data retrieval
Syntax [SUBS,T] = realtime(C,S,F,API)
Description [SUBS,T] = realtime(C,S,F,API) subscribes to a given security or
list of securities by
API. It returns the subscription list, SUBS and the timer T associated
with the real time callback for the subscriptionlist. Runtheexample
v3showtrades for information on the data returned by asynchronous
Bloomberg events. Type example.
Examples realtime(C,'ABC US
Equity',{'Last_Trade','Volume'},'v3stockticker')
the security and Volume to update in realtime while running the function
v3stockticker.
See Also blp, blp.history, blp.timeseries
S requesting the fields F and runs the specified function
help v3showtrades for information on the
subscribes to
ABC US Equity requesting the fields Last_Trade
6-39
blp.stop
Purpose Unsubscribe real time requests for Bloomberg V3
Syntax stop(B,SUBS,T)
stop(B,SUBS,T,S)
Description stop(B,SUBS,T)unsubscribes all real time requests associated with
the Bloomberg connection, associated with the real time callback for the subscription list.
stop(B,SUBS,T,S)unsubscribes all real time requests associated with
the Bloomberg unsubscribes real time r equests for each security, the subscription list, callback for the subscription list.
B, and subscription list, S UBS.T is the timer
SUBS. T is the timer associated with the real time
S,on
6-40
blp.timeseries
Purpose Bloomberg V3 intraday tick data
Syntax D = timeseries(C,S,T)
D = timeseries(C,S,{StartDate,EndDate}) D = timeseries(C,S,T,B,F)
Description D = timeseries(C,S,T) returns the raw tick data for the security S
for the date T.
D = timeseries(C,S,{StartDate,EndDate}) returns the raw tick
data for the security
EndDate.
D = timeseries(C,S,T,B,F)returns the tick data for the security S for
the date requested with an interval is returned with the columns representing Time, Open, High, Low, Last Price, number of ticks and Volume of the ticks in the bar.
T in intervals of B minutes for the field, F.Intradaytickdata
Examples D = timeseries(C,'ABC US Equity',FLOOR(NOW)) returns today’s
time series for the given security. The timestamp and tick value are returned.
S for the date range defined by StartDate and
D = timeseries(C,'ABC US Equity',FLOOR(NOW),5,'Trade')
returns today’s Trade tick series for the given security aggregated into 5 minute intervals.
D = timeseries(C,'ABC US Equity',{'12/08/2008 00:00:00','12/10/2008 23:59:59.99'},5,'Trade')
Trade tick series for 12/08/2008 and 12/10/2008 for the given security aggregated into 5 minute intervals.
See Also blp, blp.history, blp.realtime
returns the
6-41
datastream
Purpose Establish connections to Thomson Datastream API
Syntax Connect = datastream('UserName', 'Password', 'Source', 'URL')
Arguments
'UserName'
'Password'
'Source'
'URL'
Note Thomson assigns the values for you to enter for each argume nt. EnterallargumentsasMATLABstrings.
User name.
User password.
To connect to the Thomson Datastream API, enter
'Datastream' in this field.
Web URL.
Description Connect = datastream('UserName', 'Password', 'Source',
'URL')
provides access to Thomson Datastream software content.
makes a connection to the Thomson Datastream API, w hich
Examples Establish a connection to the Thomson Datastream API:
Connect = datastream('User1', 'Pass1', 'Datastream', ...
'http://dataworks.thomson.com/Dataworks/Enterprise/1.0')
See Also datastream.close, datastream.fetch, datastream.get,
datastream.isconnection
6-42
datastream.close
Purpose Close connections to Thomson Datastream data servers
Syntax close(Connect)
Arguments
Connect
Thomson Datastream connection object created with the
datastream function.
Description close(Connect) closes a connection to a Thomson Datastream data
server.
See Also datastream
6-43
datastream.fetch
Purpose Request data from Thomson Datastream data servers
Syntax data = fetch(Connect, 'Security')
data = fetch(Connect, 'Security', 'Fields') data = fetch(Connect, 'Security', 'Fields', 'Date') data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate')
data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period')
data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period', 'Currency')
Arguments
Connect
'Security'
'Fields'
'Date'
'FromDate'
Thomson Datastream connection object created with the
datastream function.
MATLAB string containing the name of a security, or cell array of strings containing names of multiple securities. This data is in a format recognizable by the Thomson Datastream data server.
(Optional) MATLAB string or cell array of strings indicating the data fields for which to retrieve data.
(Optional) MATLAB string indicating a specific calendar date for which you request data.
(Optional) Start date for historical data.
6-44
datastream.fetch
'ToDate'
(Optional) End date for historical data. If you specify a value for
'ToDate', 'FromDate' cannot be
an empty value.
Note You can specify dates in any of the formats supported by
datestr and datenum that show
a year, month, and day.
'Period'
'Currency'
(Optional) Period within a date range.
Period values are:
'd': daily values
'w':weeklyvalues
'm': monthly values
(Optional) Currency in which
fetch returns the data.
Note You can enter the optional arguments 'Fields', 'FromDate',
'ToDate', 'Period',and'Currenc y' as MATLAB strings or empty
arrays (
[]).
Description data = fetch(Connect, 'Security') returns the default time series
for the indicated security.
data = fetch(Connect, 'Security', 'Fields') returns data for
the specified security and fields.
data = fetch(Connect, 'Security', 'Fields', 'Date') returns
data for the specified secu r ity and fields on a particu lar da t e.
6-45
datastream.fetch
data = fetch(Connect, 'Security', 'Fields', 'FromDate', 'ToDate')
indicated date range.
data = fetch(Connect, 'Security', 'Fields', 'FromDate', 'ToDate', 'Period')
with the indicated period.
data = fetch(Connect, 'Security', 'Fields', 'FromDate', 'ToDate', 'Period', 'Currency')
which to report the data.
Note The Thomson Datastream interface returns all data as strings. For example, it returns array of strings within the structure. There is no way to determine the data type from the Datastream
Examples Retrieving Time Series Data
returns data for the specified s ecurity and fields for the
returns instrument data for the g iven range
also specifies the currency in
Price data to the MATLAB workspace as a cell
®
interface.
6-46
Return the trailing one-year price time series for the instrument
'P', which is the default value for the 'Fields' argument using the
command:
data = f
etch(Connect, 'ICI')
Or the command:
data =
fetch(Connect, 'ICI', 'P')
Retrieving Opening and Closing Prices
Return the closing and opening prices for the instruments P and PO on the date September 1, 2007.
data = fetch(Connect, 'ICI', {'P', ' PO'} , '09/01/2007')
datastream.fetch
Retrieving Monthly Opening and Closing Prices for a Specified Date Range
Return the monthly closing and opening prices for the securities ICI and IBM from 09/01/2005 to 09/01/2007:
data = fetch(Connect, {'ICI', 'IBM'}, {'P', 'PO'}, ... '09/01/2005', '09/01/2007', 'M')
See Also datastream.close, datastream, datastream.get,
datastream.isconnection
6-47
datastream.get
Purpose Retrieve properties of Thomson Datastream connection objects
Syntax value = get(Connect, 'PropertyName')
value = get(Connect)
Arguments
Connect
PropertyName
Thomson Datastream connection object created with the
datastream function.
(Optional)AMATLABstringor cell array of strings containing property names. Valid property names include:
user
datasource
endpoint
wsdl
sources
systeminfo
version
Description value = get(Connect, 'PropertyName') returns the value of the
specified properties for the Thomson Datastream connection object.
value = get(Connect) returns a MATLAB structure where each field
name is the name of a property of value of the property.
Connect. Each field contains the
See Also datastream.close, datastream, datastream.fetch,
datastream.isconnection
6-48
Loading...