IQML User Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 225

IQML User Guide

MATLAB connector to DTN IQFeed

Version 2.64

October 11, 2022

Fully compatible with:


Windows, Linux, Mac OS
DTN IQFeed 5.0 - 6.2
MATLAB R2008b - R2022b

© Yair Altman, Octahedron Ltd.

https://UndocumentedMatlab.com/IQML

Undocumented Matlab
The engineering choice for professional Matlab solutions
IQML User Guide 2

Table of Contents
DISCLAIMER .................................................................................................................... 4
1 Introduction ..................................................................................................................... 5
2 Installation and licensing ................................................................................................. 6
2.1 Installing IQML .............................................................................................................. 6
2.2 Licensing and activation................................................................................................. 7
2.3 Switching activated computers ....................................................................................... 9
2.4 Updating the installed version ........................................................................................ 9
3 Using IQML .................................................................................................................. 10
3.1 General usage............................................................................................................... 10
3.2 Common request properties ......................................................................................... 13
3.3 Blocking & non-blocking modes................................................................................... 13
3.4 Common causes of confusion ....................................................................................... 14
3.5 Returned data format.................................................................................................... 17
3.6 Run-time performance .................................................................................................. 20
4 Querying the latest market data ..................................................................................... 24
4.1 Snapshot (top of book) quotes ...................................................................................... 24
4.2 Fundamental information ............................................................................................. 35
4.3 Interval bars ................................................................................................................. 40
4.4 Market depth (Level 2) ................................................................................................. 44
4.5 Greeks, fair value, and implied volatility ..................................................................... 51
4.6 Market summary data and scanner .............................................................................. 56
5 Historical and intra-day data.......................................................................................... 64
5.1 Daily data ..................................................................................................................... 64
5.2 Weekly data .................................................................................................................. 70
5.3 Monthly data ................................................................................................................ 73
5.4 Interval data ................................................................................................................. 76
5.5 Tick data ....................................................................................................................... 83
5.6 Market summary data and scanner .............................................................................. 89
6 Streaming data ............................................................................................................... 91
6.1 Streaming quotes .......................................................................................................... 91
6.2 Regional updates .......................................................................................................... 98
6.3 Interval bars ............................................................................................................... 102
6.4 Market depth (Level 2) ............................................................................................... 109
7 News ............................................................................................................................ 113
7.1 Configuration ............................................................................................................. 113
7.2 Story headlines ........................................................................................................... 114
7.3 Story text ..................................................................................................................... 119
7.4 Story count.................................................................................................................. 121
7.5 Streaming news headlines .......................................................................................... 123
8 Lookup of symbols and codes ..................................................................................... 127
8.1 Symbols lookup ........................................................................................................... 127
8.2 Options/futures chain ................................................................................................. 133
8.3 Markets lookup ........................................................................................................... 139
8.4 Security types lookup .................................................................................................. 141
8.5 SIC codes lookup ........................................................................................................ 143
8.6 NAICS codes lookup ................................................................................................... 145
8.7 Trade condition codes lookup .................................................................................... 147
IQML User Guide 3

9 Connection, administration and other special commands ........................................... 149


9.1 Connecting & disconnecting from IQFeed ................................................................. 149
9.2 Server time.................................................................................................................. 153
9.3 Client stats .................................................................................................................. 154
9.4 Sending a custom command to IQFeed ...................................................................... 158
9.5 Modifying IQFeed’s registry settings ......................................................................... 159
10 Attaching user callbacks to IQFeed messages ........................................................... 160
10.1 Processing IQFeed messages in IQML .................................................................... 160
10.2 Run-time performance implications ......................................................................... 164
10.3 Usage example – using callbacks to parse options/futures chains ........................... 165
10.4 Usage example – using callbacks for realtime quotes GUI updates ........................ 166
10.5 Usage example – using callbacks for realtime order-book GUI updates ................. 167
11 Alerts ......................................................................................................................... 170
11.1 General Usage.......................................................................................................... 170
11.2 Alert Configuration .................................................................................................. 172
11.3 Alerts Query ............................................................................................................. 176
11.4 Alert Editing or Deletion .......................................................................................... 176
12 Messages and logging ................................................................................................ 177
12.1 IQML messages ........................................................................................................ 177
12.2 IQFeed logging......................................................................................................... 179
13 Frequently-asked questions (FAQ) ............................................................................ 182
14 Troubleshooting ......................................................................................................... 185
15 Professional services.................................................................................................. 187
15.1 Sample program screenshots .................................................................................... 188
15.2 About the author ....................................................................................................... 191
16 Spread the word! ........................................................................................................ 192
Appendix A – online resources....................................................................................... 194
Appendix B – change log ............................................................................................... 195
B.1 Complete change log (functional + documentation) .................................................. 195
B.2 Functional change log (excluding documentation changes) ...................................... 213
IQML User Guide 4

DISCLAIMER

THIS SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,


EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR
NONINFRINGEMENT.

THIS SOFTWARE IS NOT OFFICIALLY APPROVED OR ENDORSED BY ANY


REGULATORY, GOVERNING OR COMMERCIAL BODY, INCLUDING SEC, FINRA,
MATHWORKS AND/OR DTN.

MUCH EFFORT WAS INVESTED TO ENSURE THE CORRECTNESS, ACCURACY


AND USEFULNESS OF THE INFORMATION PRESENTED IN THIS DOCUMENT
AND THE SOFTWARE. HOWEVER, THERE IS NEITHER A GUARANTEE THAT THE
INFORMATION IS COMPLETE OR ERROR-FREE, NOR THAT IT MEETS THE
USER’S NEEDS. THE AUTHOR AND COPYRIGHT HOLDERS TAKE ABSOLUTELY
NO RESPONSIBILITY FOR POSSIBLE CONSEQUENCES DUE TO THIS DOCUMENT
OR USE OF THE SOFTWARE.

THE FUNCTIONALITY OF THE SOFTWARE DEPENDS, IN PART, ON THE


FUNCTIONALITY OF OTHER SOFTWARE, HARDWARE, SYSTEMS AND SERVICES
BEYOND OUR CONTROL. SUCH EXTERNAL COMPONENTS MAY CHANGE OR
STOP TO FUNCTION AT ANY TIME, WITHOUT PRIOR NOTICE AND WITHOUT
OUR CONTROL. THEREFORE, THERE CAN BE NO ASSURANCE THAT THE
SOFTWARE WOULD WORK, AS EXPECTED OR AT ALL, AT ANY GIVEN TIME.

IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR


ANY CLAIM, DAMAGES, LOSS, OR OTHER LIABILITY, WHETHER IN ACTION OF
CONTRACT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE,
REGARDLESS OF FORM OF CLAIM OR WHETHER THE AUTHORS WERE
ADVISED OF SUCH LIABILITIES.

WHEN USING THIS DOCUMENT AND SOFTWARE, USERS MUST VERIFY THE
BEHAVIOR CAREFULLY ON THEIR SYSTEM BEFORE USING THE SAME
FUNCTIONALITY FOR LIVE TRADES. USERS SHOULD EITHER USE THIS
DOCUMENT AND SOFTWARE AT THEIR OWN RISK, OR NOT AT ALL.

ALL TRADING SYMBOLS AND TRADING ORDERS DISPLAYED IN THE


DOCUMENTATION ARE FOR ILLUSTRATIVE PURPOSES ONLY AND ARE NOT
INTENDED TO PORTRAY A TRADING RECOMMENDATION.
IQML User Guide 5

1 Introduction
DTN provides financial data-feed services via its IQFeed service (www.iqfeed.net).
IQFeed customers use its services using a specialized application (“client”) that can
be installed on the user’s computer.1 User programs can interface to IQFeed’s client
application in order to retrieve market data from the IQFeed servers.
Matlab is a programming platform that is widely-used in the financial sector. Matlab
enables users to quickly analyze data, display results in graphs or interactive user
interfaces, and to develop decision-support and automated trading programs.
IQFeed does not come with a Matlab API connector. This is the role of IQML: IQML
is a program that runs in Matlab and connects it to IQFeed. IQML provides a seamless
Matlab interface to IQFeed data and functionality, via easy-to-use Matlab commands,
that encapsulate and simplify the complexities of IQFeed’s API for Matlab users.

IQML consists of three software components (in addition to this User Guide):
1. A Java package (IQML.jar) that connects Matlab to IQFeed’s client application.
2. A Matlab function (IQML.p) that provides IQFeed’s data in an easy-to-use
manner, without needing to know anything about the underlying connector.
3. A Matlab file (IQML.m) that serves as a help file. This file contains no code,
just the help comment; the code itself is contained in the two other software
components. The help text is displayed when you run Matlab’s help function.
IQFeed queries (for trades and tick quotes, historical data, market info etc.) can be
initiated with simple one-line Matlab code, using the Matlab function (IQML.p).
Users can easily attach Matlab code (callbacks) to incoming IQFeed messages. This
enables users to trigger special operations (for example, adding an entry in an Excel
file, sending an email or text message, sending a trade order to an OMS application)
whenever a certain condition is detected, for example if a specified price is reached.
This document explains how to install and use IQML. Depending on the date that you
installed IQML, your version may be missing some features discussed in this document.
At any time, you can always download the latest IQML version from
https://UndocumentedMatlab.com/files/IQML/IQML.zip.

1
IQConnect.exe on Windows, IQFeed application on MacOS. or ran as a Windows app on Mac/Linux using Parallels/Wine.
Note: some MacOS users have reported problems with the “native” app (which is basically just a bottled Wine installation)
compared to a standard Wine install. This is a pure IQFeed/Mac issue, and not an IQML one; using Wine seems to solve it. In
any case, only the IQFeed client needs to run under Wine - Matlab itself can run natively, but note that certain Windows-only
functionality (such as discussed in §9.5 and §12.2) will not work in native mode, only under Parallels/Wine.
IQML User Guide 6

2 Installation and licensing


2.1 Installing IQML
IQML requires the following in order to work:
1. An active account at DTN IQFeed
2. An installation of the IQFeed client (IQConnect)
3. An installation of Matlab R2008a or a newer release
On older Matlab releases, some IQML functionality may still be available.
Contact info@UndocumentedMatlab.com for details.
Installing IQML is simple:
1. Read IQML’s license agreement.2 This is required even for the trial version of
IQML. If you do not accept the agreement you cannot use IQML.
2. Download IQML.zip3 to a local folder (e.g.: C:\IQML\).
3. Unzip the downloaded IQML.zip file in this local folder.
4. Add the folder to Matlab’s path by running Matlab’s pathtool command, or
via HOMEENVIRONMENTSet path… in Matlab Desktop’s toolstrip.
The folder needs to be in Matlab’s path whenever you run IQML.
5. If you are running the Production (non-trial) version of IQML, you will need
to activate your license at this point. When you purchase your license you will
be given specific instructions for this. See §2.2 for licensing details.
6. Ensure that the IQFeed client is working and can be used to log-in to IQFeed.4
7. You can now run IQML within Matlab. To verify that IQML is properly
installed, retrieve the latest IQFeed server time, as follows (see §9.2):5
>> t = IQML('time')
8. You can query the installed version using IQML’s 'version' action, as follows:
>> disp(IQML('version'))
Version: 2.55
Release: '10-May-2021'
License: 'Professional'
Expiry: '31-Dec-2022'
Filepath: 'C:\IQML\IQML.p'
9. Once the IQML product is installed, you will be notified in the Matlab console
(Command Window) whenever there is a new version available. You can
always update your installation to the latest version, as follows:
>> IQML('update')
Downloading the latest IQML version from http://undocumentedmatlab.com
into C:\IQML\...
Download complete - installing...
Installation of the latest IQML version is now complete.

2
https://UndocumentedMatlab.com/files/IQML/IQML_License_Agreement.pdf
3
https://UndocumentedMatlab.com/files/IQML/IQML.zip
4
IQConnect.exe on Windows, IQFeed application on MacOS. or ran as a Windows app on Mac/Linux using Parallels/Wine.
Note: some MacOS users have reported problems with the “native” app (which is basically just a bottled Wine installation)
compared to a standard Wine install. This is a pure IQFeed/Mac issue, and not an IQML one; using Wine seems to solve it. In
any case, only the IQFeed client needs to run under Wine - Matlab itself can run natively, but note that certain Windows-only
functionality (such as discussed in §9.5 and §12.2) will not work in native mode, only under Parallels/Wine.
5
In some cases, you may need (or want) to specify the IQFeed Username,Password for the initial connection – see §9.1
IQML User Guide 7

2.2 Licensing and activation


IQML’s license uses an activation that is specific to the installed computer. This uses
a unique fingerprint reported by the Operating System, that includes the Windows ID
(on Windows systems), computer name, disk ID, and list of hardware MAC addresses.
Once the computer’s license is activated, the activation key is stored on the IQML’s
webserver and validated online when IQML connects to IQFeed (i.e., at the beginning
of an IQFeed session), and once every few hours while it is connected. Validating the
license only takes 1-2 secs, so it does not affect IQML’s run-time performance. If you
have any concern regarding the online activation, please contact us for clarifications.
Since activation depends on the computer fingerprint, IQML will stop working if you
modify any component that affects the fingerprint. This could happen if you reinstall
the operating system (OS); change hard disk, computer name, or network adapters
(e.g., switch between wifi/cellular/wired connection, or use a new USB networking
device); modify MAC addresses; or use software that creates dynamic MACs. In such
cases, you might see an error message such as the following when you use IQML:
Error using IQML
IQML is not activated on this computer.

Some additional information may be displayed to help you diagnose the problem.
To fix such cases, simply revert back to the original hardware/networking
configuration, and then IQML will resume working. If you wish to make the
configuration change permanent, you can contact us in order to switch the activation
to the new configuration – see the following section (§2.3) for details.
Computer fingerprints are typically stable, and are not supposed to change
dynamically. However, some software programs (especially on MacOS, but also
sometimes on Windows) create dynamic MAC addresses and/or dynamically modify
the computer name (hostname). This may then be reflected in the OS-reported
fingerprint, possibly causing IQML to stop working. The solution is to find a way to
keep the fingerprint components static, with the same values as the activated
fingerprint.6 You can determine the nature of the OS-reported fingerprint as follows:
>> IQML('license', 'debug',1)

Using this command, you can determine which fingerprint component has changed
and take the appropriate action to fix it so that the reported fingerprint will match the
activated fingerprint. If you decide that the fingerprint changes are permanent, contact
us to change the activated fingerprint (see §2.3).
To check whether your license is activated, run the following command in Matlab:
>> isActivated = IQML('validate');
This will return true if the license is activated, and an error if not. Instead of an error
event, you can request the error message as a string, using the following command:
>> [isActivated, errMsg] = IQML('validate');

6
For example, the computer’s name can be set using the OS hostname command, or the following method on Mac OS:
https://knowledge.autodesk.com/support/smoke/learn-explore/caas/sfdcarticles/sfdcarticles/Setting-the-Mac-hostname-or-
computer-name-from-the-terminal.html
IQML User Guide 8

A short time before you license term is over, you will start to see a notification
message in your Matlab console (Command Window) alerting you about this:
*** Your IQML license will expire in 3 days (10-Mar-2018).
*** To extend your license please email info@undocumentedmatlab.com
This informational message will only appear during the initial connection to IQFeed,
so it will not affect your regular trading session.
When the license term is over, IQML will stop working and display an error message:
*** Your IQML license has expired on 10-Mar-2018.
*** To extend your license please email info@undocumentedmatlab.com
You can always renew/extend a license on https://UndocumentedMatlab.com/IQML.
To query the installed version, use IQML’s 'version' action, as follows:
>> data = IQML('version')
data =
Version: 2.55
Release: '10-May-2021'
License: 'Professional'
Expiry: '31-Dec-2022'
Filepath: 'C:\IQML\IQML.p'
Multiple IQML license options are available for purchase. Longer license terms are
naturally more cost-effective than shorter ones. At the end of any license term you
can decide to renew the same term, or purchase any other term:
 2-months or 6-months license: these short-term licenses can be repeatedly
renewed beyond the free trial, for product evaluation or program development.
 1-year license: this is the standard, most popular license term.
 Multi-year license: these discounted long-term licenses will work for a longer
duration than the standard license year without requiring a renewal, as long as
IQFeed continues to provide its API service and your environment remains stable.
 Volume (multi-computer) license: the same license as for a single computer,
but when you purchase multiple licenses at once, you get a volume discount.
 Site license: enables to run IQML on an unlimited number of computers
within the same Windows Domain. This license does not require end-user
activation, only a single centralized activation. It supports cloud deployment,
where computer hardware fingerprints (but not the domain) often change.
 Deployment (compiled or OEM) license: enables to use IQML within a
compiled program that runs on an unlimited number of computers, in any site
or domain. This license does not require any end-user activation, only a single
centralized activation of the parent executable to which the license is tied.
 Source-code license: unlimited in duration, can be installed on an unlimited
number of computers within the organization, and requires no activation. This
license requires signing a dedicated NDA (non-disclosure agreement).
 Bundle license: a discounted bundle of licenses for IQML and IB-Matlab (the
InteractiveBrokers-Matlab connector). The combination of Matlab+IQFeed+IB
is quite common in trading systems.
Each of these licenses can be selected in one of two variants: Standard and Pro. The
Standard license contains most IQFeed functionality; the Pro license provides access
to the full set of IQFeed data. A detailed comparison is provided in §3.1 and §3.4.
IQML User Guide 9

2.3 Switching activated computers


You can switch the IQML license activation between computers or computer
hardware configurations (i.e., fingerprint hash-code) whenever you purchase a license
renewal. For license terms of 1 year or longer, up to 2 activation switches per year are
also included, at no extra cost. A handling fee will be incurred for other re-activations.
In order to change the activation fingerprint, simply email us the new configuration’s
fingerprint and we will make the switch on IQML’s activation server.
Activation switches can take up to two business days to process, but typically
complete within a few hours during European business hours. You will receive a
confirmation email when the activation switch is complete.
2.4 Updating the installed version
Once IQML is installed, you will be notified in the Matlab console (Command Window)
whenever a new version is available. An example of such a notification is:
>> IQML(...) % some IQML command
A newer version of IQML (2.32) is available. Updates include:
2.32 (2019-12-16)
- [2.4] Modified the hyperlinks in the new-version message
- [5.*] Improved processing speed of historic data queries
where [#.#] indicates the corresponding sections in the User Guide.
To install the new version, run IQML('update'), or download IQML.zip from
http://undocumentedmatlab.com/files/IQML/IQML.zip and unzip it in C:\IQML
You can decide to ignore this notification and keep using your existing IQML version,
or to follow the notification’s advice and update your version – the choice is yours.
You can update IQML to the latest version any time during the license term, as follows:
>> IQML('update')
Downloading the latest IQML version from http://undocumentedmatlab.com
into C:\IQML\...
Download complete - installing...
Installation of the latest IQML version is now complete.
This update process preserves the current version as backup, so you could revert to it
later (see below). Following the update, you can verify the new release’s version:
>> data = IQML('version')
data =
Version: 2.55
Release: '10-May-2021'
License: 'Professional'
Expiry: '31-Dec-2022'
Filepath: 'C:\IQML\IQML.p'
After installing the latest version, if you discover that this version does not work well,
you can always revert back to a previous version:
1. run IQML('revert'), which replaces the current version with a previous
version that was preserved in the last IQML('update'), or:
2. download http://UndocumentedMatlab.com/files/IQML/IQML_previous.zip,
unzip this file in your IQML folder, then restart Matlab. The current version is not
preserved, so you will not be able to revert to it later by running IQML('revert').
After a version update by any method, restart Matlab, and run data=IQML('version')
to verify the new version. Then email us to let us know why you reverted, so that we
could correct the problem in upcoming versions.
IQML User Guide 10

3 Using IQML

3.1 General usage


IQML uses the IQFeed client7 to connect to the IQFeed server. If an active IQFeed
client is not detected, IQML will automatically attempt to start the IQFeed client and
to connect to it. Note that this may not work for some IQFeed client installations. You
can always start the IQFeed client manually, before running IQML. In any case, if an
IQFeed connection is unsuccessful, IQML will error.
IQML’s Matlab wrapper function is called IQML, contained within the IQML.p file.
Its accompanying IQML.m file provides basic usage documentation using standard
Matlab syntax, e.g.:
>> help('IQML')
>> help IQML % equivalent alternative
>> doc IQML

The IQML function accepts a variable number of input parameters, and returns data in
a single output argument, with an optional errorMsg output. The general syntax is:
>> [data, errorMsg] = IQML(action, parameters);
where:
 data
is the output value. If this output value is requested, then Matlab
processing will block data until the result is available; if the output data is not
requested then the Matlab processing will proceed immediately (non-
blocking) – the IQFeed data will stream asynchronously (see below).
 errorMsg is the latest error message that was reported (if any); see §3.5.
 action is a string that denotes the requested query type (mandatory input).
 parameters can be specified, depending on the requested action. There are
several ways to specify parameters, which are described below.
For example:
>> data = IQML('time'); %'time' action (blocking), 0 parameters
>> IQML('quotes', 'Symbol','IBM'); %streaming 'quotes' action, 1 parameter
>> IQML('command', 'String',command, 'PortName','Admin'); %2 parameters
Note that when an output data is requested, IQML treats the request as blocking
(synchronous), meaning that Matlab processing will wait for IQFeed’s data (or a
timeout) before proceeding with the next Matlab command. For example:
>> t = IQML('time'); % blocking until data is available
When an output data is not requested, IQML treats the request as streaming (non-
blocking, a-synchronous) and Matlab processing will proceed immediately. This non-
blocking mode is typically useful for sending IQFeed requests (for example, to start
streaming trades/ticks), without waiting for a response from IQFeed. The streamed
data is accumulated by IQML in the background, and can later be retrieved using the
mechanism that is discussed in §6. Examples of such non-blocking commands:
>> IQML('quotes', 'Symbol','IBM'); %start non-blocking IBM quotes stream
>> IQML('command', 'String',command); %asynchronous/non-blocking command

7
IQConnect.exe on Windows, IQFeed application on MacOS. or ran as a Windows app on Mac/Linux using Parallels/Wine
IQML User Guide 11

Here are the action values recognized by IQML, in the Standard and Professional
licenses; trial licenses have the full functionality of the Professional license:
User Guide Stan- Pro &
Action Description
Section(s) dard trial
'version' Display product version information §2.1 Yes Yes
'license' Display the license fingerprint & activation key §2.2 Yes Yes
'validate' Check whether IQML is activated on this computer §2.2 Yes Yes
'update' Update the IQML installation to the latest version §2.4 Yes Yes
'revert' Update the IQML installation to a previous version §2.4 Yes Yes
'doc' Display this User Guide in a separate window - Yes Yes
'quotes' Fetch quotes/trades information on a ticker §4.1, §6.1 Yes Yes
'fundamental' Fetch fundamental information on a ticker §4.2 Yes Yes
'intervalbars' Fetch custom streaming interval bars on a ticker §4.3, §6.3 Yes Yes
'marketdepth' Fetch level 2 market depth information on a ticker §4.4, §6.4 - Yes
'greeks' Report option Greeks, fair value, implied volatility §4.5 - Yes
'history' Fetch historical or intra-day data bars from IQFeed §5 Yes Yes
'summary' Fetch historical market summary data from IQFeed §5.6 - Yes
'regional' Fetch regional update information on a ticker §6.2 - Yes
'news' Fetch news headlines or stories from IQFeed §7 - Yes
'lookup' Fetch list of symbols/codes matching a set of criteria §8 Yes Yes
'chain' Fetch futures/options chain matching a set of criteria §8.2 - Yes
'disconnect' Disconnect IQML from IQFeed §9.1 Yes Yes
'reconnect' Disconnect and then re-connect IQML to IQFeed §9.1 Yes Yes
'time' Retrieve the latest IQFeed server & message times §9.2 Yes Yes
'stats' Retrieve connection and network traffic statistics §9.3 Yes Yes
'command' Send a custom command to IQFeed §9.4 Yes Yes
'registry' Open Windows Registry Editor at IQFeed’s settings §9.5 Yes Yes
'alert' Alert the users upon IQFeed streaming events §11 - Yes
'log' Control IQFeed logging of messages and events §12.2 Yes Yes
IQML accepts input parameters in several alternative formats, which are equivalent –
you can use whichever format that you prefer:
 As name-value pairs – for example:
>> IQML('command', 'String',command, 'PortName','Admin'); %2 parameters
 As a Matlab struct, with parameters contained in corresponding struct fields e.g.:
>> params = []; % initialize
>> params.String = command;
>> params.PortName = 'Admin';
>> IQML('command', params);
 As a Matlab class, with parameters contained in corresponding class properties.
 As a Matlab table, with parameters contained in corresponding table variables.
 As field-separated rows in an Excel input file – for example:
>> IQML('command', 'C:\MyData\inputFile.xlsx');
where:
o Each column contains a separate parameter
o Row #1 contains the parameter names, and
rows 2+ contain their corresponding values,
one row per command
o All commands use the same action ('command' in this example)
IQML User Guide 12

Each parameter must have an associated value. The value’s data type depends on the
specific parameter: it could be numeric, a string, a function handle etc. The definition
of all the parameters and their expected data types is listed in the appropriate section
in this User Guide that explains the usage for the associated action.
Note: if you specify parameters using a struct/class/table format, and then reuse this
object for different IQML commands (by altering a few parameters), the entire set of
parameters will be used, possibly including some leftover parameters from previous
IQML commands. This may lead to unexpected results. For example:
% 1st IQML command – stop streaming timestamp messages every 1 second
>> params = []; % initialize
>> params.String = 'S,TIMESTAMPSOFF';
>> params.PortName = 'Level1';
>> IQML('command', params);
% 2nd IQML command – stop streaming client stats messages every 1 sec
>> params.String = 'S,CLIENTSTATS OFF'; %reuse existing params struct
>> IQML('command', params);
% 3rd IQML command – start streaming quotes messages for IBM
>> params.Symbol = 'IBM'; %reuse existing params struct
>> IQML('quotes', params);

In this example, the 2nd IQML command above will have no effect, because the
PortName parameter in the params struct from the 1st IQML command will be reused
in the 2nd command, sending it to the Level1 port, instead of to the Admin port.
Similarly, the 3rd IQML command will result in a warning, because the 'quotes' action
does not expect the String and PortName parameters that were carried over (reused)
from the 2nd command. To avoid such unexpected results, it is therefore best to reset
the object (params=[] for a struct) before preparing each IQML command.
IQML is quite tolerant of user input: parameter names (but generally not their values)
are case-insensitive, parameter order does not matter, non-numeric parameter values
can be specified as either char arrays ('abc') or strings ("abc"), and some of these can
be shortened. For example, the following commands are all equivalent:
>> IQML('quotes', 'Symbol','IBM');
>> IQML('quotes', 'symbol','IBM');
>> IQML('Quotes', "Symbol","IBM");
>> IQML('Quotes', 'Symbol','IBM');
>> IQML('QUOTES', 'symbol',"IBM");

The full list of acceptable input parameters, and their expected values, is listed in the
following sections, grouped by usage. If you specify an unexpected parameter, it will be
ignored and a warning message will be displayed in the Matlab Command Window:
>> IQML('quotes', 'badName',1)
Warning: 'badName' is not a valid parameter for the 'quotes' action in IQML

When using IQML, there is no need to worry about connecting or disconnecting from
the IQFeed client – IQML handles these activities automatically, without requiring
user intervention. Users only need to ensure that the IQFeed client is active and
logged-in when the IQML command is invoked in Matlab.
IQML reads data using the IQFeed account to which the IQFeed client is connected.
In other words, the IQFeed account type is transparent to IQML: the only way to
control which IQFeed data is available to IQML is to login to the IQFeed client using
the appropriate username/password. Refer to §9.1 for additional details.
IQML User Guide 13

3.2 Common request properties


The following properties can be specified in IQML, with most actions:
Data
Parameter Default Description
type
Symbol / Symbols 8 string (none) The asset symbol, as known by IQFeed.9
Max number of seconds (0-9000) to wait for
Timeout number 5.0 data in a blocking request (0 means infinite).
Debug logical false or 0 If true or 1, additional information is displayed.
One of:
 2 – parse all the data in incoming IQFeed
messages (default; most verbose, slowest)
 1 – do not parse lookup codes (e.g. trade
condition, price formats, market id).
MsgParsingLevel number 2 The corresponding Description fields will
either be missing, or contain empty strings.
The codes can be parsed separately (see §8).
 0 – do not parse lookup code; also do not
convert string data into numeric values (i.e.
all data fields will remain strings: ‘3.14’).
This is the fastest but least verbose option.
true or 1 If true or 1, IQFeed error messages raise a Matlab
RaiseErrorMsgs logical 10
error in blocking (non-streaming) mode (see §12)
function Custom user callback function to process
ProcessFunc [] incoming IQFeed data messages (see §10).
handle
NumOfEvents integer inf The maximal number of messages to process.
OutputFormat string 'struct' 'cells', 'struct', 'table' or 'timetable' (see §3.5).
Additional properties are request-specific and are listed below in the relevant
sections. For example, the 'history' action has additional properties that control the
parameters of the historic data request (start/end date, data type, etc.).
3.3 Blocking & non-blocking modes
Whenever you specify an output parameter in a call to IQML, the program will block
until a response is available (i.e., a synchronous request). If no output parameter is
specified, IQML immediately returns (non-blocking, a-synchronous) and additional
Matlab commands can immediately be issued. This non-blocking mode is typically
useful for sending IQFeed requests to start streaming data (for example, streaming
trades/ticks or news headlines), without waiting for any response from IQFeed. The
streamed data is accumulated by IQML in the background, and can later be retrieved
using the mechanism that is discussed in §6. For example:
>> t = IQML('time'); % blocking until data is available
>> IQML('quotes', 'Symbol','IBM'); %start non-blocking IBM quotes stream
>> IQML('command', 'String',command); %asynchronous/non-blocking command

8
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization.
9
https://iqfeed.net/symbolguide
10
Using the 2nd (optional) output parameter of IQML implies a default value of false (0) for RaiseErrorMsgs (see §3.5)
IQML User Guide 14

3.4 Common causes of confusion


1. A common cause of error is specifying symbols incorrectly. IQFeed is very
sensitive about this: if the specified symbol is invalid,11 or if your account does
not have the corresponding market subscription, IQFeed will report an error:
>> IQML('quotes', 'Symbol','xyz123')
Symbol 'XYZ123' was not found!
If the request is blocking, an error (exception) will be thrown (raised), which
can be trapped and handled by the user, using a Matlab try-catch construct:
try
data = IQML('fundamental', 'Symbol','xyz123');
catch err
fprintf(2, 'Error: %s\n', err.message);
% do some intelligent processing here...
end
IQFeed’s website includes a detailed symbol-lookup search engine.12 If you are
still unsure about a symbol name, please contact IQFeed’s customer support.
2. If any request parameter is invalid or if the request is not accepted by IQFeed, a
run-time error will result, which can be trapped as shown above. For example:
IQML historic data query (EURGBP.FXCM) error: Unauthorized user
ID (your IQFeed account is not authorized for this data)
3. A common confusion source is specifying numeric values as strings or vice versa.
For example, IQML(...,'Timeout','10') rather than IQML(...,'Timeout',10). Each
IQML parameter expects a value of a specific data type, as listed in the parameter
tables in this user guide. IQML is sometimes smart enough to automatically
convert to the correct data type, but you should not rely on this: it is better to
always use the correct data type. Otherwise, Matlab might get confused when
trying to interpret the string '10' as a number, and odd results might happen.
4. While most of IQML’s functionality is available in all license types, some
actions/functionality are only available in the Professional IQML license:13
 Parallelized queries (§3.6)
 Customizable data fields in quotes data (§4.1, §6.1)
 Level 2 market depth quotes (§4.4, §6.4, §10.5)
 Option Greeks, Fair Value and Implied Volatility (§4.5)
 Regional updates (§6.2)
 News (§7)
 Options/futures chain lookup (§8.2)
 Alerts (§11)
If you have a Standard license and try to access Professional-only functionality,
a run-time error will result:
>> data = IQML('news');
The 'news' action is not available in your Standard license of IQML, only
in the Professional license. Contact info@undocumentedmatlab.net to
upgrade your license.

11
For example, EURUSD.FXCM is a valid symbol, but EURUSD and USDEUR.FXCM are invalid
12
https://iqfeed.net/symbolguide
13
Standard license can be converted into a Professional license at any time; contact info@undocumentedmatlab.com for details.
IQML User Guide 15

5. IQFeed reports dates in different formats, depending on the specific query:


either in the standard American mm/dd/yyyy format (for example:
'01/29/2018'), or in yyyymmdd format (for example: '2018-01-29' or
'20180129 12:29:48'). Dates are usually reported as strings. In some cases, a
corresponding Matlab datenum value is also reported, for example (§5.5, §6.1):
Symbol: 'IBM'
Timestamp: '2018-03-07 13:23:02.036440'
Datenum: 737126.557662458
...
Symbol: '@VX#'
LatestEventDatenum: 737128.637260451
LatestEventTimestamp: '20180309 15:17:39'
...
Depending on the data field, the timestamp is either your local computer’s time,
or IQFeed servers (New York) time – not the exchange time. To get the
exchange time, you would need to do the appropriate time-zone arithmetic.
6. By default, Matlab displays data in the console (“Command Window”) using
“short” format, which displays numbers rounded to 4 digits after the decimal.
The data actually has higher precision, so when you use it in a calculation the
full precision is used, but this is simply not displayed in the console.
IQML does not truncate/round/modify the IQFeed data in any manner!
To display the full numeric precision in the Matlab console, change your
Command Window’s Numeric Format from “short” to “long” (or “long g”) in
Matlab’s Preferences window, or use the “format long” Matlab command:
>> data = IQML('quotes', 'symbol','ONLIB.X'); %overnight LIBOR rate
>> data.Close % short format (only 4 digits after decimal)
ans =
1.4463
>> format long g % long format (full precision displayed)
>> data.Close
ans =
1.44625
IQML User Guide 16

7. In the few seconds following an initial connection to IQFeed, some queries


may return empty data. In such cases, you should try to refetch the data after a
short pause.
For example, the following code snippet tries to refetch the S&P index history
up to 10 times, with a 0.5-second pause between retries, and raises an error
only if no data is available even after all these retries:
data = IQML('history','symbol','SPX.XO');
numTries = 10;
while isempty(data) && numTries > 0
% Wait a bit and then retry
pause(0.5)
data = IQML('history','symbol','SPX.XO');
numTries = numTries - 1;
end
if isempty(data), error('data is not available'); end
IQML User Guide 17

3.5 Returned data format


Many queries in IQML return their data in the form of a struct-array (a Matlab array
of structs), for example (see §8.6):
>> data = IQML('lookup', 'DataType','NAICS')
data =
1175×1 struct array with fields:
id
description
>> data(1)
ans =
id: 111110
description: 'Soybean Farming'
>> data(2)
ans =
id: 111120
description: 'Oilseed (except Soybean) Farming'
For various purposes (readability, maintainability, performance, usability), users may
wish to modify this data structure. You can easily convert the data using Matlab’s
builtin functions struct2cell() (which converts the struct-array into a cell-array), or
struct2table() (which converts the struct-array into a Matlab table object):
>> disp(struct2cell(data)')
[111110] 'Soybean Farming'
[111120] 'Oilseed (except Soybean) Farming'
[111130] 'Dry Pea and Bean Farming'
...
>> disp(struct2table(data))
id description
______ ___________________________________________________
111110 'Soybean Farming'
111120 'Oilseed (except Soybean) Farming'
111130 'Dry Pea and Bean Farming'
...
Note that empty data cannot be converted using struct2table() or struct2cell():
>> data = IQML('lookup', 'DataType','NAICS', 'Description','xyz')
data =
[]
>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.
>> struct2table(data)
Error using struct2table (line 26)
S must be a scalar structure, or a structure array with one column or one row.
When querying multiple symbols, IQML automatically tries to merge the data into a 2D
array of structs (NxM: N data points for each of M symbols). If this is impossible (e.g.
different number of data points per symbol), the results are reported as a cell array:
>> data = IQML('history', 'Symbol','IBM,AAPL,T')
data =
100×3 struct array with fields:
Symbol
Datestamp
Datenum
...
>> data = IQML('history', 'Symbol','IBM,AAPL,T,@ESH20C120000')
data =
1×4 cell array
{100×1 struct} {100×1 struct} {100×1 struct} {65×1 struct}
IQML User Guide 18

Cell-array results may also occur when some query elements report no results at all:
>> data = IQML('quotes','symbol','IBM,AAPL,FB,XXXXXX')
IQFeed error: Symbol 'XXXXXX' is invalid/unavailable!
data =
1×4 cell array
{1×1 struct} {1×1 struct} {1×1 struct} {0×0 double}

When the results are reported in simple struct format (i.e., scalar or 1D struct array,
but not a cell array or 2D struct array), users can request results in equivalent Matlab
14
table or timetable formats, using the optional OutputFormat parameter:
>> data = IQML('history', 'symbol','IBM', 'outputformat','table')
data =
100×9 table
Symbol Datestamp Datenum High Low Open ...
_______ ______________ _______ ________ ________ ______ ...
{'IBM'} {'2020-08-11'} 738014 130.47 126.61 128.76 ...
{'IBM'} {'2020-08-12'} 738015 127.79 125.876 127.61 ...
{'IBM'} {'2020-08-13'} 738016 126.39 124.77 125.96 ...
...
>> data = IQML('history', 'symbol','IBM', 'outputformat','timetable')
data =
100×9 timetable
Time Symbol Datestamp Datenum High Low ...
___________ _______ ______________ _______ ________ ________ ...
11-Aug-2020 {'IBM'} {'2020-08-11'} 738014 130.47 126.61 ...
12-Aug-2020 {'IBM'} {'2020-08-12'} 738015 127.79 125.876 ...
13-Aug-2020 {'IBM'} {'2020-08-13'} 738016 126.39 124.77 ...
...

Note: when no timestamp field is reported, the results cannot be converted into a Matlab
timetable. In such cases, a regular table will be reported, with a warning message:
>> data = IQML('quotes', 'symbol','IBM', 'outputformat','timetable')
Warning: Cannot convert IQFeed query results into a Matlab timetable:
no timestamp field in results, reverting to regular table
(Type "warning off IQML:CannotConvertToTimetable" to suppress this warning.)
data =
1×19 table
...

When the results cannot be converted into a table, requesting an OutputFormat of


table or timetable will result in a warning message and the results will be reported
unchanged (as an empty array, a cell-array, or 2D struct array):
>> data = IQML('history', 'symbol','IBM,AAPL,FB', 'outputformat','table')
Warning: Cannot convert IQFeed query results into a Matlab table: Input struct-
ture must be a scalar structure or a structure array with one column or one row.
(Type "warning off IQML:CannotConvertToTable" to suppress this warning.)
data =
100×3 struct array with fields:
Symbol
Datestamp
Datenum
...

14
Note: table format is only available on Matlab releases R2013b or newer; timetables only on R2016b or newer.
IQML User Guide 19

When OutputFormat is set to 'cells', the results are reported as a cell-array, whose
elements match the results columns. This typically equates to a single cell element for
each queried symbol. If you query N symbols, a 1xN cell-array will be reported,
where each cell element will contain the separate results for each of the N symbols in
a struct (or struct-array) format. For example:
>> data = IQML('history', 'symbol','IBM', 'outputformat','cells')
data =
1×1 cell array
{100×1 struct}
>> data = IQML('history', 'symbol','IBM,FB', 'outputformat','cells')
data =
1×2 cell array
{100×1 struct} {100×1 struct}
>> data = IQML('history', 'symbol','IBM,FB,xxxxx', 'outputformat','cells')
data =
1×3 cell array
{100×1 struct} {100×1 struct} {1×0 double}

As can be seen from these examples, the data format for each of the symbols (i.e. the
contents of each cell element) remains unchanged: struct array or empty array. To
break down the internal struct arrays into their constituents, you can use Matlab’s
struct2cell() or struct2table() functions, as explained at the top of this section:
>> data = IQML('history', 'symbol','IBM,FB,xxxxx', 'outputformat','cells');
>> cellfun(@struct2table, data, 'uniform',false, 'ErrorHandler',@(s,v)table)
ans =
1×3 cell array
{100×9 table} {100×9 table} {0×0 table}

The following table compares the possible output types of various IQML queries:
OutputFormat
Base IQML query
'cells' 'struct' (default) 'table' 'timetable'
1×1 cell array 100×1 100×9 100×9
IQML('history','symbol','IBM')
{100×1 struct} struct array table timetable
1×0 empty cell
IQML('history','symbol','xxxx') 1×0 empty double row vector
array
1×2 cell array
IQML('history','symbol','IBM,xxxx')
{100×1 struct} {1×0 double}
1×2 cell array
100×2
IQML('history','symbol','IBM,FB') {100×1 struct}
struct array
{100×1 struct}
1×1 cell array
IQML('quotes','symbol','IBM') 1x1 struct 1×19 table
{1×1 struct}
1×2 cell array
IQML('quotes','symbol','IBM,FB') {1×1 struct} 1x2 struct 2×19 table
{1×1 struct}
1×1 cell array 1000×1 1000×6 1000×6
IQML('news')
{1000×1 struct} struct array table timetable

A second, optional, output parameter of IQML returns the latest error message (if any):15
>> [data, errorMsg] = IQML('quotes', 'Symbol','IBM', 'Timeout',0.1)
data =
[]
errorMsg =
'IQML timeout: either IQFeed has no data for this query, or the Timeout
parameter should be set to a value larger than 0.1'

15
Using the 2nd (optional) output parameter of IQML implies a default value of false (0) for the RaiseErrorMsgs parameter.
IQML User Guide 20

3.6 Run-time performance

3.6.1 General considerations


IQML’s standard processing has an overhead of 1-2 milliseconds per IQFeed
message, depending on several factors:
 Message type/complexity – simple messages such as the periodic timestamp
updates are simpler to process than complex messages (e.g. fundamental data).
 The Debug parameter (see §3.2) – A value of 1/true is ~1 msec slower per
message, compared to the default value of 0/false (depending on message type).
 The MsgParsingLevel parameter (§3.2) – A value of 0 is ~1 msec faster per
message, compared to the default value of 2 (depending on message type).
 The UseParallel parameter (see below) enables query parallelization (faster).
 The Fields parameter (§4.1, §5.1-§5.5, §6.1) – fewer fields are faster.
 User-defined callbacks (§10) add their own processing time per message. See
§10.2 for suggested ways to speed-up this callback processing overhead.
 Each active alert (§11) uses 1-2 msecs per message (depending on alert type, and
only for the alert’s corresponding message type). If the alert action is
triggered, then its processing time is added. For example, displaying a popup
message might take 1 sec, and sending an email might take a few seconds.
 Computer capabilities – faster CPU and memory (RAM) enable faster
processing, if your computer has enough physical memory to avoid swapping.
Adding memory is typically much more cost-effective than upgrading the CPU.
This means that without any defined alert or user-specified callback, nor any other
code running in the background (for example, a Matlab data analysis program), we
can expect IQML to process up to 500-1000 IQFeed messages per second by default.
This is a relatively fast throughput, but if you stream real-time quotes for hundreds of
liquid securities concurrently then you might reach this limit. When this happens,
Matlab may be so bogged-down from the flood of incoming messages that it will
become unresponsive, and you may need to restart IQConnect and/or Matlab.
Similarly, if you request a blocking (non-streaming) request with multiple data items
(for example, thousands of historical data or news items), the query may take a while
to process, requiring us to set a higher-than-default Timeout parameter value. For
example, if you issue a blocking request for 20K data bars, IQFeed will send 20K
data messages (one message per bar). If each of these messages takes 1-2 msecs to
process, the total processing time for the IQML query will be 20-40 secs.
When IQFeed is connected, it continuously sends messages to IQML: periodic
“heartbeat” and status messages, and messages for any active streaming quotes or news
events that you requested. These messages are automatically processed by IQML in the
background, reducing the CPU time that is left available to process other IQML queries
(e.g., a blocking historical data query) or Matlab analysis functions. It is therefore
advisable to stop streaming IQFeed data when not needed, even if only temporarily.
IQML User Guide 21

In cases of high load, numerous streaming message events (quote ticks, news items etc.)
may inundate the system, causing Matlab to appear frozen for long minutes, until the
events backlog is fully processed. IQML’s built-in overflow handling mechanism (the
OverflowMode and MaxEventsBacklog parameters, §6.1) could assist in such cases.
IQFeed includes a built-in logging mechanism. Setting the logger to record fewer data
items will improve run-time performance (see §12.2). IQFeed’s log file can become
very large very fast and reduce system performance if left unattended. It is intended
to be used for troubleshooting purposes only and not on a constant basis. This is
especially true if you log streaming data, large historic data, and/or Debug data.
Also, by default IQFeed stores the log file in the user’s Documents folder, which
might be automatically synced to OneDrive or Dropbox clouds. The log file can grow
to several GBs per day, so such a sync could result in marked slowdown.16 To
improve performance, disable this sync, or place the log file in a non-synced folder.

3.6.2 Paralellization
With the Professional and trial IQML licenses, you can use Matlab’s Parallel Computing
Toolbox to parallelize IQFeed queries. This can be done both externally (placing IQML
commands in parfor/spmd blocks, so that they will run independently), and internally (for
some IQML query types, using the UseParallel parameter). If you have the Standard
IQML license, or if you do not have Matlab’s Parallel Computing Toolbox, you can still
run concurrent IQML commands in separate Matlab sessions, just not in the same session.
IQML automatically tries to parallelize queries when the UseParallel parameter value
(default: false) is set to 1 or true. The list of parallelizable queries includes:
 Requests resulting in multiple blocking queries in a single IQML command
(for example, historical data for multiple symbols or a date range – see §5)
 Requests for full news-story of all returned news headlines in a blocking query,
using the GetStory parameter (see §7.2)
 Requests for fundamental/quotes data on all symbols in an options-chain or
futures-chain, using the WhatToShow parameter (see §8.2)
When setting UseParallel to 1 or true, IQML will use parallel Matlab tasks (so-called
‘headless workers’ or ‘labs’) from the currently-active parallel pool created by the Parallel
Computing Toolbox. If no pool is active, the default local pool is automatically started.
Here is a run-time example showing the effect of using a 4-worker pool to parallelize
a news-story query, resulting in a 3.5x speedup (not 4x, due to parallelization overheads):
>> tic, data = IQML('news', 'DataType','headlines', 'MaxItems',100, ...
'GetStory',1); toc
Elapsed time is 56.311768 seconds.

>> parpool('local',4) % start 4 workers in parallel pool (optional)


>> tic, data = IQML('news', 'DataType','headlines', 'MaxItems',100, ...
'GetStory',1, 'UseParallel',1); toc
Elapsed time is 15.799185 seconds.

16
http://forums.dtn.com/index.cfm?page=topic&topicID=5771
IQML User Guide 22

Depending on the number of CPU cores and available memory (RAM) on your
computer, and the amount of work that the OS and other tasks as doing in the
background, a pool of 14 workers (the maximum for IQFeed and IQML) can result in
a speedup of up to 10-12x for parallelizable queries (such as historical data fetches),
compared to the corresponding non-parallel (serial) query.
IQML parallelization has several performance implications:
 Starting the parallel pool can take some time (a few seconds, up to a minute or
two, depending on configuration). It is best to start the pool before any time-
critical operations to avoid this startup time upon the first parallel query. Starting
the pool (with an optional size) can be done using Matlab’s parpool function.
 The default pool uses the same number of workers as the number of physical
cores on your computer. This makes sense for CPU-intensive programs, but
IQML queries are limited by I/O, not CPU. Therefore, unless you also use the
parallel pool for CPU-intensive computations in your program, it makes sense
to start a pool that has more workers than the number of CPU cores. You can
configure your local cluster for this.17 Note that IQFeed limits (throttles) the
rate of some query types, limiting the effective parallel pool size.18 Larger
worker pools use extra CPU and memory and degrade IQML’s overall perfor-
mance. Different pool sizes are optimal for different queries; you can try using
various pools, to find an optimal size for your specific queries and system.
 For any parallelizable IQML command, you can set a MaxWorkers parameter
value that limits number of workers for that command (up to the pool size).
When MaxWorkers < pool size, only MaxWorkers will be used to process
the IQML command; the other workers will remain idle and consume no CPU.
 Changing the parallel pool size entails a restart of the entire pool, which could
take quite some time. It is advised to pre-allocate the maximal pool size that
you will need (using the optional pool size argument of the parpool command,
or by configuring the local cluster’s default pool size). When you need fewer
workers (for example, to limit the number of parallel historical data queries),
use the MaxWorkers parameter to limit the number of active workers,
without modifying the pool size.
 Note that the more parallel workers that you use, the more memory will be
used by the program, and the higher the risk that some internal program
elements might conflict with each other. You can test various pool sizes to
check which size fits best for your particular computer and query types.
 In addition to the workers startup time, each worker independently connects to
IQFeed upon the first IQML command it encounters, taking a few extra seconds.
 Due to parallelization overheads, inter-task memory transfers, and CPU task-
switches (especially in a case of more workers than cores), speedup will always
be smaller than the number of workers. The actual speedup will depend on query

17
https://www.mathworks.com/help/distcomp/discover-clusters-and-use-cluster-profiles.html#f5-16540
18
Until Dec. 2020, IQFeed allowed up to 15 concurrent (parallel) historical data queries; since then 50 queries/sec are allowed,
regardless of the number of concurrent queries. See http://forums.iqfeed.net/index.cfm?page=topic&topicID=5832 for details.
IQML User Guide 23

type and computer/OS configuration. Parallelization may even cause slowdown


in some cases (e.g. quote queries, due to waiting for market events, not CPU).
 It is only possible to parallelize workers on the local computer, not on other
computers in a distributed grid/cluster/cloud. This is due to IQFeed/exchange
limitations, which prohibit distribution of data to other computers.
Historical data queries have two parallelization variants:
 When requesting data for multiple symbols, the symbols are split across the
available parallel workers (up to the specified MaxWorkers value or the active
pool size, whichever is lower), one or more complete symbol query per worker.
Therefore, if you query fewer symbols than workers, some workers will remain
idle (unused). In such a case, consider using a smaller parallel pool, with fewer
workers, taking up less CPU and memory resources. Alternatively, run a serial
for-loop over the symbols, parallelizing the date/time dimension (next bullet).
 When requesting data for just a single symbol, the requested date/time segment
(BeginDate to EndDate etc.) is evenly split across the workers. You should
always set BeginDate to the earliest time of actual available data: without a
date/time segment (for example no BeginDate), parallelization is impossible, so
IQML reverts to slow serial mode. Likewise, when data is limited (for example,
1-sec intervals are only available for the past 180 days) and BeginDate is older
than the earliest data, some workers will remain idle (processing a date/time
range with little or no data); the actual work will be done by fewer workers than
optimal, resulting in slower-than-optimal performance.

3.6.3 Reported data-fields


Also in the Professional IQML license, you can customize the fields that IQML reports
for market data quotes and historic data bars. The Fields parameter can be set to a
cell-array of strings ({'Bid','Ask','Last'}), or a comma-separated string
('Bid,Ask,Last'). All subsequent queries of the same type will only report the
requested fields. For example:
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields',{'Bid','Ask','Last'})
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields','Bid,Ask,Last') %equivalent
data =
Symbol: 'AAPL'
Bid: 222.71
Ask: 222.91
Last: 222.11

Note: the fewer fields that you request, the faster the required processing time, by both
IQFeed and IQML (see §4.1, §5.1-§5.5, §6.1 for details). Requesting fewer fields (as
in the example above, which only requested 3 quote fields) results in faster processing
and reduced memory consumption. To improve the run-time and reduce memory usage
it is advisable to request only those data fields that your program actually needs.
IQML User Guide 24

4 Querying the latest market data


4.1 Snapshot (top of book) quotes
We start with a simple example to retrieve the latest market information for Alphabet
Inc. Class C, which trades using the GOOG symbol, using IQML’s 'quotes' action:
>> data = IQML('quotes', 'Symbol','GOOG')
data =
Symbol: 'GOOG'
Most_Recent_Trade: 1092.14
Most_Recent_Trade_Size: 1
Most_Recent_Trade_Time: '09:46:31.960276'
Most_Recent_Trade_Market_Center: 25
Total_Volume: 113677
Bid: 1092.13
Bid_Size: 100
Ask: 1092.99
Ask_Size: 100
Open: 1099.22
High: 1099.22
Low: 1092.38
Close: 1090.93
Message_Contents: 'Cbaohlc'
Message_Description: 'Last qualified trade; A bid update
occurred, An ask update occurred; An open
declaration occurred; A high declaration
occurred; A low declaration occurred; A
close declaration occurred'
Most_Recent_Trade_Conditions: '3D87'
Trade_Conditions_Description: 'Intramaket Sweep; Odd lot trade'
Most_Recent_Market_Name: 'Direct Edge A (EDGA)'
As can be seen, the returned data object is a Matlab struct with self-explanatory fields.19
To access any specific field, use the standard Matlab dot-notation:
>> bidPrice = data.Bid; %=1092.13 in this specific case
If the symbol is not currently trading, some fields return empty values:
>> data = IQML('quotes', 'Symbol','GOOG')
data =
Symbol: 'GOOG'
Most_Recent_Trade: 1078.99
Most_Recent_Trade_Size: 1
Most_Recent_Trade_Time: '19:58:47.052099'
Most_Recent_Trade_Market_Center: 26
Total_Volume: 0
Bid: 1077.6
Bid_Size: 100
Ask: 1079.89
Ask_Size: 200
Open: []
High: []
Low: []
Close: 1078.92
Message_Contents: 'Cbav'
Message_Description: 'Last qualified trade; A bid update
occurred; An ask update occurred;
A volume update occurred'
Most_Recent_Trade_Conditions: '0517'
Trade_Conditions_Description: 'Average Price Trade; Form-T Trade'
Most_Recent_Market_Name: 'Direct Edge X (EDGX)'

19
The textual Description fields depend on the MsgParsingLevel parameter having a value of 2 or higher (see §3.2 and §8).
The Bid and Ask fields are typically NBBO (National Best Bid and Offer) quotes.
IQML User Guide 25

In this example, the query was sent outside regular trading hours (on Sunday) so Open,
High and Low are empty. As expected, the data indicates this was a “Form-T” trade.

Other fields may sometimes be empty. For example, overnight LIBOR rate (Symbol=
'ONLIB.X') reports empty Bid, Ask, Most_Recent_Trade_Size (and Total_Volume=0).
In rare cases, you might see invalid field values (e.g. 0), which may indicate a data
error. IQML does not modify the data reported by IQFeed, so if you see this problem
consistently for a certain security or exchange, please contact IQFeed’s support.
If you specify an incorrect security name or classification properties, or if you do not
have the necessary market subscription, then no data is returned, and an error
message is displayed (see discussion in §3.4).
>> IQML('quotes', 'Symbol','xyz123')
Symbol 'XYZ123' was not found!

You may request more than a single snapshot quote: To get the next N real-time
quotes, specify the NumOfEvents parameter. The result is an array of structs in the
same format as above (or an empty array if no data is available):
>> data = IQML('quotes', 'Symbol','IBM', 'NumOfEvents',4)
data =
4×1 struct array with fields:
Symbol
Most_Recent_Trade
Most_Recent_Trade_Size
...
>> data(1)
ans =
Symbol: 'IBM'
Most_Recent_Trade: 159.16
Most_Recent_Trade_Size: 75
Most_Recent_Trade_Time: '09:36:15.534201'
Most_Recent_Trade_Market_Center: 24
Total_Volume: 135267
...

Note that it is possible that not all the requested quotes will be received before
IQML’s timeout (default value: 5 secs) returns the results:
>> data = IQML('quotes', 'Symbol','IBM', 'NumOfEvents',4)
Warning: IQML timeout: only partial data is returned. Perhaps the Timeout
parameter should be set to a value larger than 5 or the NumOfEvents parameter
to a value smaller than 4
data =
2×1 struct array with fields:
Symbol
Most_Recent_Trade
Most_Recent_Trade_Size
...

To control the maximal duration that IQML will wait for the data, set the Timeout
parameter. For example, to wait up to 60 secs to collect the next 4 upcoming quotes:
>> data = IQML('quotes', 'Symbol','IBM', 'NumOfEvents',4, 'timeout',60);
IQML User Guide 26

You can request quotes for multiple symbols at the same time, in a single IQML
command, by specifying a colon-delimited or cell-array list of symbols. For example:
>> data = IQML('quotes', 'symbols',{'IBM','GOOG','AAPL'});
>> data = IQML('quotes', 'symbols','IBM:GOOG:AAPL'); % equivalent

The result will be an array of Matlab structs that correspond to the requested symbols:
data =
1×3 struct array with fields:
Symbol
Most_Recent_Trade
Most_Recent_Trade_Size
Most_Recent_Trade_Time
Most_Recent_Trade_Market_Center
Total_Volume
Bid
...
>> data(2)
ans =
struct with fields:
Symbol: 'GOOG'
Most_Recent_Trade: 1078.99
Most_Recent_Trade_Size: 1
Most_Recent_Trade_Time: '19:58:47.052099'
Most_Recent_Trade_Market_Center: 26
Total_Volume: 0
Bid: 1077.6
Bid_Size: 100
Ask: 1079.89
Ask_Size: 200
Open: []
High: []
Low: []
Close: 1078.92
Message_Contents: 'Cbav'
Message_Description: 'Last qualified trade; A bid update
occurred; An ask update occurred;
A volume update occurred'
Most_Recent_Trade_Conditions: '0517'
Trade_Conditions_Description: 'Average Price Trade; Form-T Trade'
Most_Recent_Market_Name: 'Direct Edge X (EDGX)'

If you have the Professional license of IQML and also Matlab’s Parallel Computing
Toolbox, then setting the UseParallel parameter to true (or 1) will process the quotes
query for all the specified symbols in parallel (see discussion in §3.6). Note that in the
case of quote queries, there is often little or no speedup in parallelization, because the
delay is caused by waiting for market quote events, not due to CPU processing:
>> data = IQML('quotes', 'symbols',{'IBM','GOOG','AAPL'}, 'UseParallel',true);

Note that if you request quotes for a very large number of symbols in a single IQML
command, and especially if you set UseParallel to true, you might run into your IQFeed
account’s symbols-limit (MaxSymbols; see §9.3). In such a case, IQFeed-generated
error messages such as the following will be displayed on the Matlab console:
Warning: Requesting 3258 symbol quotes, which is more than your IQFeed account's
concurrent symbols limit (500) - quotes for some symbols may not be available.
(Type "warning off IQML:MaxSymbols" to suppress this warning.)
Level1 symbol limit reached - symbol 'IBM' not serviced!
IQML User Guide 27

By default, IQFeed reports 16 data fields for each quote: Symbol, Most Recent Trade,
Most Recent Trade Size, Most Recent Trade Time, Most Recent Trade Market
Center, Total Volume, Bid, Bid Size, Ask, Ask Size, Open, High, Low, Close,
Message Contents, and Most Recent Trade Conditions.20
If the Fields parameter is set to an empty value ({} or ''), the current set of fields and the
full list of available fields, are reported (in this case, a Symbol parameter is unnecessary):
>> data = IQML('quotes', 'fields',{})
data =
CurrentFields: {1×16 cell}
AvailableFields: {1×68 cell}

>> data.AvailableFields
ans =
1×68 cell array
Columns 1 through 5
{'Symbol'} {'Exchange ID'} {'Last'} {'Change'} {'Percent Change'}
Columns 6 through 11
{'Total Volume'} {'High'} {'Low'} {'Bid'} {'Ask'} {'Bid Size'}
Columns 12 through 17
{'Ask Size'} {'Tick'} {'Range'} {'Open Interest'} {'Open'} {'Close'}
Columns 18 through 22
{'Spread'} {'Settle'} {'Delay'} {'Restricted Code'} {'Net Asset Value'}
...

If you have the Professional (or trial) IQML license, you can request IQFeed to report
up to ~70 data fields, and/or change the reported fields and their order, using the
optional Fields parameter, as follows:
We can set Fields to 'All' (or 'all') to request all available data fields in reported quotes:21
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields','all')
data =
Symbol: 'AAPL'
x7_Day_Yield: []
Ask: 222.91
Ask_Change: []
Ask_Market_Center: 28
Ask_Size: 100
Ask_Time: '19:59:42.031900'
Available_Regions: []
Average_Maturity: []
Bid: 222.71
...

The field names in the reported Matlab struct are the same as the IQField field names,
except for the following minor changes to create valid Matlab field identifiers:
 spaces are replaced by '_' (“Ask Change”  Ask_Change)
 'x' is prefixed to fields that start with numbers (“7 Day Yield”  x7_Day_Yield)
A complete table of available fields is provided for convenience at the bottom of this
section. If you are uncertain about the meaning of a certain field, or wish to know

20
The additional textual fields Message_Description, Trade_Conditions_Description and Most_Recent_Market_Name are
IQML-generated textual interpretations of the codes in the IQFeed-generated Message_Contents, Trade_Conditions and
Most_Recent_Trade_Market_Center fields, respectively, as governed by the MsgParsingLevel parameter (see §3.2).
21
Additional description fields will be generated by IQML for those fields that report value codes (for example, the Fraction
Display Code and Financial Status Indicator fields), as governed by the MsgParsingLevel parameter (see §3.2).
IQML User Guide 28

which field reports certain data, please ask your DTN IQFeed representative (after all,
IQML just reports the data as provided by IQFeed).
Some of the reported field values may be empty. For example, AAPL’s
Average_Maturity value is empty since this field is only relevant for bonds, not stocks.
Similarly, EURUSD.FXCM’s Market_Capitalization value is empty because Forex
securities have no market cap. Likewise, Net_Asset_Value is only relevant for funds.
Delay=[] indicates a real-time quote, whereas Delay=15 indicates that the quote was
delayed 15 minutes by the exchange (presumably because you do not possess a real-
time data subscription for this exchange/security-type).22
The Fields parameter can be set to any subset of AvailableFields,23 as either a cell-
array of strings, or as a comma-separated string. In this case, any subsequent quotes
query will report the requested fields, in the specified order. For example:
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields',{'Bid','Ask','Last'})
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields','Bid,Ask,Last') %equivalent
data =
Symbol: 'AAPL'
Bid: 222.71
Ask: 222.91
Last: 222.11

The order of the specified Fields indicates the order in which the data fields will be
reported. For example, to change the order of the reported data fields above:
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields','Last,Ask,Bid')
data =
Symbol: 'AAPL'
Last: 222.11
Ask: 222.91
Bid: 222.71

Note that the Symbol field is always reported in the first position, regardless of whether
or not it was specified in the Fields list, or its specified position order in the Fields
list (also note the optional spaces between the comma-separated field names):
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields','Ask, Bid, Last, Symbol')
data =
Symbol: 'AAPL'
Ask: 222.91
Bid: 222.71
Last: 222.11

As noted, Fields can be set to any subset of the AvailableFields. If a bad field is
specified (one which is not available in IQFeed), an error message will be displayed:
>> data = IQML('quotes', 'Symbol','AAPL', 'Fields','Bid, Ask, xyz')
Error using IQML
Bad field 'xyz' was requested in IQML quotes command (check the
capitalization/spelling).
Available fields are: 7 Day Yield, Ask, Ask Change, Ask Market Center, ...

Note: the more fields that you request, the longer the required processing time, by both
IQFeed and IQML. To improve run-time performance and reduce latency, request
only those data fields that are actually needed by your program.

22
See §9.3 for a programmatic method to determine whether your exchange subscription is delayed or real-time.
23
AvailableFields is reported by an IQML('quotes','fields',{}) command – see the previous page in this User Guide.
IQML User Guide 29

The following parameters affect quotes data queries:


Parameter Data type Default Description
Limits the query to the specified symbol(s).
Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
(none)
Symbols 24 string, or
 {'IBM', 'AAPL', 'GOOG'}
cell-array
This parameter must be set to valid symbol
of strings
name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).
NumOfEve Returns up to the specified number of quotes
integer 1
nts
Max number of seconds to wait for incoming
Timeout number 5.0 data (0-9000, where 0 means infinite)
If set to true or 1, and the Parallel Toolbox is
logical installed, querying multiple symbols is done
UseParallel false
(true/false) in parallel (see §3.6; Pro IQML license only)
MaxWorke (current parallel Max number of parallel workers to use (up to
integer the current pool size) when UseParallel=1
rs pool size)
Sets the list of data fields reported by IQFeed
for each quote. IQFeed’s default set has 16
'Symbol, Most fields; up to ~70 fields can be specified (a
Recent Trade, detailed list of fields is provided below).
Most Recent Trade If Fields is set to an empty value ({} or ''),
Size, Most Recent the list of current, available fields is returned.
colon or Trade Time, Most
comma- Recent Trade If Fields is not empty, subsequent quotes
separated Market Center, and chain queries will return the specified
Fields Total Volume, Bid, fields, in the specified order (Professional
string, or
cell-array Bid Size, Ask, Ask IQML license only). The Symbol field is
of strings Size, Open, High, always returned first, even if not specified.
Low, Close,
Message Contents, Examples:
Most Recent Trade  'Bid:Ask:Last:Ask Size'
Conditions'  'Bid, Ask, Last, Ask Size'
 {'Bid', 'Ask', 'Last', 'Ask Size'}
 'All' (indicates all available fields)
The full list of available fields in IQFeed as of December 2021 is listed below. Note
that some of these fields may not be available, and IQFeed may also add/modify this
list at any time. The list of fields that are actually available cen be retrieved in IQML
using the IQML('quotes','fields',{}) command, as explained above. For details about
any of these fields, please contact your DTN/IQFeed representative (IQML just reports
the data, it has no control over the reported values or definition of the data fields).

24
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 30

In the table below, the 16 default data fields are marked with a bold green font-face:
Requested Reported Field
Description Data origin 25
Field Name Field Name Type
7 Day Yield x7_Day_Yield float Value of a Money Market fund over past 7 days. Exchange/other
Ask Ask float Min price a market maker/broker agrees to accept. Exchange/other
Ask Change Ask_Change float Change in Ask since last offer. IQConnect
Ask Market Ask_Market_ Market Center that sent the ask information (see
integer Exchange/other
Center Center §8.3).
Ask_Market_ Human-readable name of the Ask Market Center.
(none) string IQConnect
Name Automatically reported with Ask_Market_Center
Ask Size Ask_Size integer The share size available for the ask price Exchange/other
hh:mm:ss Time of last ask. Reported as 99:99:99 outside
Ask Time Ask_Time Exchange/other
.ffffff trading hours to indicate an invalidated quote.26
Available Available_ Dash-delimited list of available regional
string IQConnect
Regions Regions exchanges.
Average Average_ Average number of days until maturity of a
float Exchange/other
Maturity Maturity Money Market Fund’s assets.
Bid Bid float Max price a market maker/broker agrees to pay. Exchange/other
Bid Change Bid_Change float Change in Bid since last offer. IQConnect
Bid Market Bid_Market_ Market Center that sent the bid information (see
integer Exchange/other
Center Center §8.3).
Bid_Market_ Human-readable name of the Bid Market Center.
(none) string IQConnect
Name Automatically reported with Bid_Market_Center
Bid Size Bid_Size integer The share size available for the bid price. Exchange/other
hh:mm:ss Time of last bid. Reported as 99:99:99 outside
Bid Time Bid_Time Exchange/other
.ffffff trading hours to indicate an invalidated quote.27
Change Change float Today's change (Last - Close) IQConnect
Change From Change_From_
float Change in last price since last open. IQConnect
Open Open
The closing price of the day. For commodities
Close Close float Exchange/other
this will be the last trade price of the session.
Close Range For commodities only. Range value for closing
Close_Range_1 float Exchange/other
1 trades that aren’t reported individually.
Close Range For commodities only. Range value for closing
Close_Range_2 float Exchange/other
2 trades that aren’t reported individually.
Days to Days_to_
string Number of days to contract expiration. IQConnect
Expiration Expiration
Decimal Decimal_
string Last Precision used. DTN
Precision Precision
The number of minutes a quote is delayed when
Delay Delay integer Exchange/other
not authorized for real-time data.28
hexadeci
Exchange ID Exchange_ID mal The Exchange Group ID. DTN
Exchange_ Human-readable name of the Exchange ID.
(none) string IQConnect
Description Automatically reported with Exchange_ID.

25
In this table, “exchange/other” means either the exchange, or some other 3rd-party that provides data to DTN/IQFeed.
26
http://forums.iqfeed.net/index.cfm?page=topic&topicID=3891
27
http://forums.iqfeed.net/index.cfm?page=topic&topicID=3891
28
See §9.3 for a programmatic method to determine whether your exchange subscription is delayed or real-time.
IQML User Guide 31

Requested Reported Field


Description Data origin 25
Field Name Field Name Type
Extended Price of the most recent extended trade (last
Extended_Trade float Exchange/other
Trade qualified trades + Form T trades).
Extended Extended_Trade MM/DD/
Date of the extended trade. Exchange/other
Trade Date _ Date CCYY
Extended
Extended_Trade Market Center of the most recent extended trade
Trade Market Integer Exchange/other
_ Market_Center (last qualified trades + Form T trades); see §8.3.
Center
Human-readable name of the Extended Trade
Extended_Trade
(none) string Market Center. Automatically reported with IQConnect
_Market_Name
Extended_Trade_Market_Center.
Extended Extended_Trade Size of the most recent extended trade (last
Integer Exchange/other
Trade Size _Size qualified trades + Form T trades).
Extended Extended_Trade hh:mm:ss Time of the most recent extended trade (last
Exchange/other
Trade Time _Time .ffffff qualified trades + Form T trades).
Extended Extended_
Trading Trading_ float Extended Trade minus Yesterday's close. IQConnect
Change Change
Extended Extended_
Trading Trading_ float Extended Trade minus Last. IQConnect
Difference Difference
Denotes if an issuer has failed to submit its
regulatory filings on a timely basis, has failed to
Financial
Financial_Status meet the exchange's continuing listing standards
Status char Exchange/other
_Indicator and/or filed for bankruptcy. A corresponding
Indicator
description field will be generated by IQML for
this field when MsgParsingLevel ≥ 2 (see §3.2)
Human-readable name of the Financial Status
Financial_Status
(none) string Indicator. Automatically reported with IQConnect
_Description
Financial_Status_Indicator.
Display formatting code. A corresponding
Fraction Fraction_
string description field will be generated by IQML for DTN
Display Code Display_ Code
this field when MsgParsingLevel ≥ 2 (see §3.2)
Fraction_ Human-readable name of Fraction Display Code.
(none) Display_ string Automatically reported with IQConnect
Description Fraction_Display_Code.
High High float Today's highest trade price. Exchange/other
Price of last trade of 100+ units in regular
Last Last float Exchange/other
trading session
MM/DD/
Last Date Last_Date Date of the last qualified trade. Exchange/other
CCYY
Last Market Last_Market_ Market Center of most recent last qualified
integer Exchange/other
Center Center trade.
Last_Market_ Human-readable name of the Last Market Center.
(none) string IQConnect
Name Automatically reported with Last_Market_Center
Last Size Last_Size integer Size of the most recent last qualified trade. Exchange/other
hh:mm:ss Time (including microseconds) of the most
Last Time Last_Time Exchange/other
.ffffff recent last qualified trade.
Low Low float Today's lowest trade price. Exchange/other
Market Market_ Real-time calculated market cap (Last price *
float IQConnect
Capitalization Capitalization Common Shares Outstanding).
IQML User Guide 32

Requested Reported Field


Description Data origin 25
Field Name Field Name Type
1 = market open, 0 = market closed.
Market Open Market_Open integer DTN
Note: valid for Futures and Future Options only.
Market_Open_ Human-readable name of the Market Open field.
(none) string IQConnect
Description Automatically reported with Market_Open.
Possible single character values include:
C – Last Qualified Trade
E – Extended Trade = Form T trade
O – Other Trade = any trade not accounted
for by C or E
b – A bid update occurred
non- a – An ask update occurred
delimited o – An Open event occurred
string of h – A High event occurred
Message Message_ single l – A Low event occurred
IQConnect
Contents Contents characters c – A Close event occurred
of s – A Settlement event occurred
message v – A volume update occurred
ID code Notes: you can get multiple codes in a single
message but you will only get one trade ID per
message. It is also possible to receive no codes
in a message if the fields that updated were not
trade or quote related. A corresponding
description field is generated by IQML for this
field when MsgParsingLevel ≥ 2 (see §3.2)
Message_ Human-readable name of the Message Contents.
(none) string IQConnect
Description Automatically reported with Message_Contents.
Price of the most recent trade (including trades
Most Recent Most_Recent_
float that do not qualify for “Last”, i.e. outside regular Exchange/other
Trade Trade
trading or <100 units)
Identifies if the trade was executed at the bid or
the ask price. As of IQFeed 6.1, this feature is
only supported for CME and ICE exchanges;
unsupported symbols return []. Exchange/other
Most Recent Most_Recent_ Possible values:
Trade Trade_ integer 0 – invalid or unsupported (only provided
Aggressor Aggressor 1 – latest trade was executed at Ask price by some
2 – latest trade was executed at Bid price exchanges)
3 – latest trade was executed at other price
[] – unknown or unsupported
(requires IQFeed client 6.1 or newer)
Trade_ Human-readable name of the Most Recent Trade
(none) Aggressor_ string Aggressor field. Automatically reported with IQConnect
Description Most_Recent_Trade_Aggressor.
string of Conditions that identify the type of most recent
Most Recent Most_Recent_
2-digit trade. A corresponding description field is
Trade Trade_ Exchange/other
hex generated by IQML for this field when
Conditions Conditions
numbers MsgParsingLevel ≥ 2 (see §3.2, §8.7)
Trade_ Human-readable name of the Most Recent Trade
(none) Conditions_ string Conditions field. Automatically reported with IQConnect
Description Most_Recent_Trade_Conditions.
Most Recent Most_Recent_ MM/DD/
Date of most recent trade. Exchange/other
Trade Date Trade_Date CCYY
Most Recent Most_Recent_ The day of month (1-31) in which the most
Trade Day Trade_Day_ integer recent trade occurred. (requires IQFeed client Exchange/other
Code Code 6.1 or newer)
IQML User Guide 33

Requested Reported Field


Description Data origin 25
Field Name Field Name Type
Most Recent Market Center of most recent trade. A
Most_Recent_
Trade corresponding description field will be generated
Trade_Market_ integer Exchange/other
Market by IQML for this field when MsgParsingLevel
Center
Center ≥ 2 (see §3.2, §8.3)
Human-readable name of the Most Recent Trade
Most_Recent_
(none) string Market Center. Automatically reported with IQConnect
Market_Name
Most_Recent_Trade_Market_Center.
Most Recent Most_Recent_
integer Size of most recent trade. Exchange/other
Trade Size Trade_Size
Most Recent Most_Recent_ hh:mm:ss Time (including microseconds) of most recent
Exchange/other
Trade Time Trade_Time .ffffff trade.
The market value of a mutual fund share. Equals
Net Asset Net_Asset_
float net assets / total number of shares outstanding. Exchange/other
Value Value
Duplicates the Bid field. Mutual Funds only.
Number of Number_of_
integer The number of trades for the current day. IQConnect/DTN
Trades Today Trades_Today
The opening price of the day. For commodities
Open Open float Exchange/other
this will be the first trade of the session.
Derivatives open interest (IEOptions, Futures,
Open Interest Open_Interest integer Exchange/other
FutureOptions, SSFutures only).
Open Range For commodities only. Range value for opening
Open_Range_1 float Exchange/other
1 trades that aren’t reported individually.
Open Range For commodities only. Range value for opening
Open_Range_2 float Exchange/other
2 trades that aren’t reported individually.
Percent Change Percent_Change float = Change / Close IQConnect
Percent Off
Percent_Off_
Average float Current Total Volume / Average Volume IQConnect
Average_Volume
Volume
Previous Day Previous_Day_
integer Previous Day's Volume. Exchange/other
Volume Volume
Price-Earnings Price_Earnings_ Real-time calculated PE (Last / Earnings Per
Ratio
float IQConnect
Ratio Share).
Range Range float Trading range for the current day (high - low) IQConnect
Restricted
Restricted_Code string "N"=Short Sale not restricted, "R"=Restricted. Exchange/other
Code
Restricted_Code Human-readable name of Restricted Code field.
(none) string IQConnect
_Description Automatically reported with Restricted_Code.
Settle Settle float Settle price (Futures or FutureOptions only). Exchange/other
Settlement MM/DD/
Settlement_Date The date that the Settle field is valid for. Exchange/other
Date YYYY
Spread Spread float The difference between Bid and Ask prices. IQConnect
Symbol Symbol string The symbol name of the security IQConnect
173=Up, 175=Down, 183=No Change. Based on
Tick Tick integer IQConnect
previous trade. Only valid for Last qualified trades
Tick_ Human-readable name of the Tick field.
(none) string IQConnect
Description Automatically reported with Tick.
TickID TickID integer Identifier for tick (not necessarily sequential). DTN
IQML User Guide 34

Requested Reported Field


Description Data origin 25
Field Name Field Name Type
Total IQConnect, DTN
Total_Volume integer Today's cumulative volume (number of shares).
Volume or exchange
Type Type string "Q"=Update message, "P"=Summary message IQConnect
Volatility Volatility float Real-time calculated volatility: (High-Low)/Last IQConnect
VWAP VWAP float Volume Weighted Average Price. IQConnect/DTN
IQML User Guide 35

4.2 Fundamental information


Fundamental data on a symbol can be fetched using a 'fundamental' action, as follows:
>> data = IQML('fundamental', 'symbol','IBM')
data =
Symbol: 'IBM'
Exchange_ID: 7
PE: 25.7
Average_Volume: 4588000
x52_Week_High: 180.95
x52_Week_Low: 139.13
Calendar_Year_High: 171.13
Calendar_Year_Low: 144.395
Dividend_Yield: 3.79
Dividend_Amount: 1.5
Dividend_Rate: 6
Pay_Date: '03/10/2018'
Ex_dividend_Date: '02/08/2018'
Short_Interest: 17484332
Current_Year_EPS: 6.17
Next_Year_EPS: []
Five_year_Growth_Percentage: -0.16
Fiscal_Year_End: 12
Company_Name: 'INTERNATIONAL BUSINESS MACHINE'
Root_Option_Symbol: 'IBM'
Percent_Held_By_Institutions: 59.9
Beta: 1.05
Leaps: []
Current_Assets: 49735
Current_Liabilities: 37363
Balance_Sheet_Date: '12/31/2017'
Long_term_Debt: 39837
Common_Shares_Outstanding: 921168
Split_Factor_1: '0.50 05/27/1999'
Split_Factor_2: '0.50 05/28/1997'
Market_Center: []
Format_Code: 14
Precision: 4
SIC: 7373
Historical_Volatility: 25.79
Security_Type: 1
Listed_Market: 7
x52_Week_High_Date: '03/08/2017'
x52_Week_Low_Date: '08/21/2017'
Calendar_Year_High_Date: '01/18/2018'
Calendar_Year_Low_Date: '02/09/2018'
Year_End_Close: 153.42
Maturity_Date: []
Coupon_Rate: []
Expiration_Date: []
Strike_Price: []
NAICS: 541512
Exchange_Root: []
Option_Premium_Multiplier: []
Option_Multiple_Deliverable: []
Session_Open_Time: []
Session_Close_Time: []
Base_Currency: []
Contract_Size: []
Contract_Months: []
Minimum_Tick_Size: []
First_Delivery_Date: []
FIGI: 'BBG000BLNNH6'
IQML User Guide 36

Security_SubType: []
Price_Format_Description: 'Four decimal places'
Exchange_Description: 'New York Stock Exchange (NYSE)'
Listed_Market_Description: 'New York Stock Exchange (NYSE)'
Security_Type_Description: 'Equity'
Security_SubType_Description: ''
SIC_Description: 'COMPUTER INTEGRATED SYSTEMS DESIGN'
NAICS_Description: 'Computer Systems Design Services'
SIC_Sector_Name: 'Services'
NAICS_Sector_Name: 'Professional, Scientific, Technical services'
Notes:
1. the naming, interpretation and order of returned data fields is controlled by
IQFeed, not by IQML – DTN might change these fields in the future.
2. Splits – when only one split is available, Split_Factor_2 will be empty; when no
splits are known to IQFeed, both split fields will be empty. Splits are reported as
'#.## <mm/dd/yyyy date>', i.e. an American-format date rounded to 2 decimal
digits.29 In any case, only the last 2 splits are reported by IQFeed.30
3. the inclusion of the *_Description fields (Price_Format_Description,
Exchange_Description, etc.) depends on the MsgParsingLevel parameter
having value of 2 or higher (see §3.2 for details). When MsgParsingLevel is 1
or 0, these fields will not be part of the returned data struct.
4. Depending on your IQFeed client version, additional fundamental data fields
may be returned. For example, the following fields were added in client 6.1
(some fields only have values for certain security types, e.g. futures/options):
Session_Open_Time, Session_Close_Time, Base_Currency, Contract_Size, FIGI,
Contract_Months, Minimum_Tick_Size, First_Delivery_Date, and Security_SubType.
For example, (redacted for clarity):
>> data = IQML('fundamental', 'symbol','@ES#')
data =
struct with fields:
Symbol: '@ES#'
Exchange_ID: 34
PE: []
Average_Volume: []
x52_Week_High: 3006
x52_Week_Low: 2350
...
Company_Name: 'E-MINI S&P 500 SEPTEMBER 2019'
Expiration_Date: '09/20/2019'
Exchange_Root: 'ES'
Session_Open_Time: '18:00:00'
Session_Close_Time: '17:00:00'
Base_Currency: 'USD'
Contract_Size: 50
Contract_Months: '--H--M--U--Z'
Minimum_Tick_Size: 0.25
Underlying_Contract: '@ESU19'
Exchange_Description: 'Chicago Mercantile Exchange (CME)'
Listed_Market_Description: 'Chicago Mercantile Exchange Mini Sized
Contracts (CMEMINI)'
Security_Type_Description: 'Future'

29
http://forums.iqfeed.net/index.cfm?page=topic&topicID=5582. Note that this could lead to numeric inaccuracies, for example
GOOGL’s split on 4/3/2014 is reported as 0.50 rather than the more accurate 1:1.998 = 0.5005. Also note that some splits (e.g.
GOOG’s 1:2.002 split on 3/27/2014) are not reported by IQFeed for some reason (probably a data error).
30
For additional (and more accurate) splits history, refer to https://www.stocksplithistory.com
IQML User Guide 37

To improve run-time performance, fundamental data is cached in Matlab memory for


each symbol. IQFeed is queried for fundamental data for a symbol only if the symbol
was not previously queried in the current Matlab session. This is typically a good
thing, because fundamental data is relatively stable. To force IQML to re-query
IQFeed for fundamental data even when it is cached, set the Debug parameter:
>> data = IQML('fundamental', 'symbol','AAPL', 'debug',true);
>> data = IQML('debug',false); % exit debug mode

It is possible to fetch fundamental data of multiple symbols in a single IQML


command, by specifying a colon-delimited or cell-array list of symbols: 31
>> data = IQML('fundamental', 'symbols','AAPL:GOOG') %or: {'AAPL','GOOG'}
data =
1×2 struct array with fields:
Symbol
Exchange_ID
PE
...
>> data(1)
ans =
Symbol: 'AAPL'
Exchange_ID: 5
PE: 20.4
Average_Volume: 26900000
x52_Week_High: 228.87
x52_Week_Low: 149.16
...
>> data(2)
ans =
Symbol: 'GOOG'
Exchange_ID: 5
PE: 51.9
Average_Volume: 1239000
x52_Week_High: 1273.89
x52_Week_Low: 909.7
Calendar_Year_High: 1273.89
...
The list of fundamental data fields in IQFeed as of 1/7/2019 is listed below. Note that
IQFeed may modify this list at any time (for example, IQFeed client 6.1 has added
several fields). For details about any of these fields, please ask DTN/IQFeed. IQML
just reports the data, it has no control over the reported values or definition of data
fields. Note that the fundamental data fields cannot be modified, unlike quotes fields.
Field Name Field Type Description Data origin 32
52 Week High float Highest price of last 52 weeks. For futures: contract High DTN
The date of the highest price of the last 52 weeks. For
52 Week High Date MM/DD/YYYY DTN
futures, this is the contract High Date.
52 Week Low float Lowest price of last 52 weeks. For futures: contract Low DTN
The date of the lowest price of the last 52 weeks. For
52 Week Low Date MM/DD/YYYY DTN
futures, this is the contract Low Date.
Average Volume integer Average daily volume (4 week average) DTN
Balance sheet date MM/DD/YYYY Last date that a company issued their quarterly report. Exchange/other

31
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
32
In this table, “exchange/other” means either the exchange, or some other 3rd-party that provides data to DTN/IQFeed.
IQML User Guide 38

Field Name Field Type Description Data origin 32


Base Currency string Futures and Future Options Only (IQFeed 6.1 or newer) 3rd party
A coefficient measuring a security’s relative volatility:
Beta float the covariance of this security’s price in relation to the Exchange/other
rest of the market. 30 day historical volatility.
Cal. Year High Date MM/DD/YYYY Date at which High price for current calendar year occurred DTN
Cal. Year Low Date MM/DD/YYYY Date at which Low price for current calendar year occurred DTN
Calendar year high float High price for the current calendar year. DTN
Calendar year low float Low price for the current calendar year. DTN
Common shares
float The amount of common shares outstanding (in thousands). Exchange/other
outstanding
Company name string Company name or contract description DTN
non-delimited string of upper-case single character month
Contract Months string 3rd party
codes (IQFeed 6.1 or newer)
Deliverable quantitiy of a future or option contract.
Contract Size string 3rd party
(IQFeed 6.1 or newer)
Coupon Rate float Interest Rate for a Bond. Exchange/other
The amount of total current assets held by a company as
Current assets float Exchange/other
of a specific date in Millions (lastADate)
The amount of total current liabilities held by a company
Current liabilities float Exchange/other
as of a specific date in Millions (lastADate).
Current year The portion of a company's profit allocated to each
float Exchange/other
earnings per share outstanding share of common stock
Dividend amount float The current quarter actual dividend Exchange/other
Dividend rate float The annualized dividend expected to be paid by company Exchange/other
The annual dividends per share paid by the company divided
Dividend yield float Exchange/other
by current market price per share of stock, as a % value.
This is the Exchange Group ID (code). Convert to decimal
Exchange ID hexadecimal DTN
and use the Listed Markets lookup to decode this value.
Exchange Root string The root symbol under which the exchange lists this symbol Exchange
The actual date in which a stock goes ex-dividend,
typically about 3 weeks before the dividend is paid to
Ex-dividend date MM/DD/YYYY Exchange/other
shareholders of record. The amount of the dividend is
reflected in a reduction of the share price on this date.
IEOptions by
Expiration Date MM/DD/YYYY IEOptions, Futures, FutureOptions, and SSFutures only the exchange;
others by DTN
Financial Instrument Global Identifier 33 (IQFeed 6.1 or
FIGI string 3rd party
newer). For example: 'BBG000BLNNH6' (IBM)
First Delivery Date MM/DD/YYYY Futures and Future Options Only (IQFeed 6.1 or newer) 3rd party
The numeric month in which the company’s fiscal year ends.
Fiscal year end integer Exchange/other
For example, 4=April, 10=October.
Five-year growth
float Earnings Per Share growth rate over a five year period Exchange/other
percentage
Format Code string Display format code DTN
34
Historical Volatility float Volatility of daily close prices in the last 30 trading days DTN

33
https://openfigi.com, https://omg.org/figi
34
DTN’s official description of this field is: “30-trading day volatility, calculated using Black-Scholes”. Apparently, the actual
IQML User Guide 39

Field Name Field Type Description Data origin 32


Leaps (there may
string Long term equity anticipation securities Exchange/other
be more than one)
Listed Market string The listing market ID DTN
The amount of long term debt held by a company as of a
Long-term debt float Exchange/other
specific date in Millions (lastADate).
Maturity Date MM/DD/YYYY Date of maturity for a Bond. DTN
Minimum Tick Size float Minimum price movement. (IQFeed 6.1 or newer) 3rd party
35
NAICS integer North American Industry Classification System code 3rd party
Next year earnings Total amount of earnings per share a company is estimated
float Exchange/other
per share to accumulate over the next 4 quarters of current fiscal year
Options Multiple
integer IEOptions only. 1 means they exist, 0 means they do not. 3rd party
Deliverables
Options Premium
float IEOptions only 3rd party
Multiplier
Pay date MM/DD/YYYY Date on which a company made its last dividend payment Exchange/other
PE float Price/Earnings ratio Exchange/other
Percent held by A percentage of outstanding shares held by banks and
float Exchange/other
institutions institutions.
Precision integer Number of decimal digits DTN
Root Option
string A space separated list (there may be more than one) Exchange/other
symbol
The security’s SubType code (IQFeed 6.1 or newer).
Security SubType integer DTN
1=Binary option, 2=weekly option, 3=ETF, []=other
Security Type string The security type code DTN
Session Close Time hh:mm:ss Futures and Future Options Only (IQFeed 6.1 or newer) 3rd party
Session Open Time hh:mm:ss Futures and Future Options Only (IQFeed 6.1 or newer) 3rd party
Total number of shares that were sold short and were not
Short Interest integer repurchased to settle outstanding short market positions. 3rd party
Valid data is only available for some exchanges/sec-types.36
Standard Industrial Classification – a 4-digit federal code
SIC integer Exchange/other
that identifies the security’s specific industry.
A float a space, then MM/DD/YYYY.
Split factor 1 string Exchange/other
For example: '0.5 12/20/2013'
A float a space, then MM/DD/YYYY.
Split factor 2 string Exchange/other
For example: '0.5 12/20/2013'
Strike Price float IEOptions only Exchange/other
Symbol string The Symbol ID to match with watch request DTN
The specific future contract that underlies a continuous
Underlying Contract string IQML
future. For example, for @ES# this might be '@ESU19' 37
Year End Close float Price of Year End Close (Equities Only) DTN

calculation (updated overnight) computes the volatility of day-to-day price change values of the last 30 trading days, using the
last 31 daily close prices, as follows: 100*sqrt(252)*std(ln(closei+1/closei)), rounded to the nearest 0.01. For futures, the cal-
culation is apparently based on 90 (not 30) values. When a contract is newly-listed, fewer values are used, with a minimum of 4.
35
https://www.census.gov/eos/www/naics
36
http://forums.dtn.com/index.cfm?page=topic&topicID=5787
37
Unlike all other fields, this field is not reported by IQFeed but rather computed by IQML, based on the reported fields (Symbol
and Expiration Date). It contains a non-empty value only for continuous future contracts (e.g. @ES#).
IQML User Guide 40

4.3 Interval bars


Interval bars data for one or more symbols can be fetched using the 'intervalbars' action.
For example, to fetch the latest 60-second interval bar for the current E-Mini contract:
>> data = IQML('intervalbars', 'Symbol','@ES#')
data =
Symbol: '@ES#'
BarType: 'Complete interval bar from history'
Timestamp: '2018-09-05 12:57:00'
Open: 2887.75
High: 2888.25
Low: 2887.5
Close: 2888.25
CumulativeVolume: 1117565
IntervalVolume: 913
NumberOfTrades: 0

In the returned data struct, we can see the following fields:


 Symbol – the requested Symbol.
 BarType – typically ‘Complete interval bar from history’, but in some cases
might be ‘Complete interval bar from stream’ or ‘Updated interval bar’.
 Timestamp – server timestamp (string format) for this interval bar. The
timestamp is of the end of the bar, not the beginning.
 Open – price at the start of this interval bar.
 High – highest price during this interval bar.
 Low – lowest price during this interval bar.
 Close – price at the end of this interval bar.
 CumulativeVolume – total trade volume since start of the current trading day.38
 IntervalVolume – trade volume during this interval bar.
 NumberOfTrades – number of trades during this interval bar. Relevant only
when IntervalType is set to 'ticks'/'trades'.
The IntervalType (default: 'secs') and IntervalSize (default: 60) parameters should
typically be specified together. Note that IntervalSize must be a positive integer
value (i.e. its value cannot be 4.5 or 0). If IntervalType is 'ticks'/'trades', IntervalSize
must be 2 or higher. If IntervalType is 'volume', IntervalSize must be 100 or higher.
If IntervalType is 'secs', IntervalSize must be any integer between 1-300 (5 minutes),
or any multiple of 60 (1 minute) between 300-3600 (1 hour), or 7200 (2 hours).39
We can ask for multiple bars by setting NumOfEvents or MaxItems to a positive integer,
resulting in an array of structs in the format above (empty array if no data is available):
>> data = IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',4)
data =
4×1 struct array with fields:
Symbol
BarType
...

38
In IQML version 2.63 and earlier, this field was called CummlativeVolume
39
Note that IQFeed’s limitations on live 'secs' interval bars are stricter than the limitations on historical interval bars (§5.4):
http://forums.dtn.com/index.cfm?page=topic&topicID=5529
IQML User Guide 41

>> data(1)
ans =
Symbol: '@VX#'
BarType: 'Complete interval bar from history'
Timestamp: '2018-09-05 12:36:00'
Open: 14.45
High: 14.5
Low: 14.45
Close: 14.45
CumulativeVolume: 57077
IntervalVolume: 17
NumberOfTrades: 0

IQFeed only returns interval bars that had market ‘action’. Other bars are not sent
from IQFeed – they will appear in IQML’s returned data as gaps in the Timestamp.
Also note that it is possible that not all the requested bars will be received before
IQML’s timeout (default value: 5 secs) returns the results:
>> data = IQML('intervalbars', 'Symbol','IBM', 'NumOfEvents',4)
Warning: IQML timeout: only partial data is returned. Perhaps the Timeout
parameter should be set to a value larger than 5 or the NumOfEvents parameter
to a value smaller than 4
data =
2×1 struct array with fields:
Symbol
BarType
...

To control the maximal duration that IQML will wait for the data, set the Timeout
parameter. For example, to wait up to 60 secs to collect 4 bars:
>> data = IQML('intervalbars', 'Symbol','IBM', 'NumOfEvents',4, 'timeout',60);

Interval bars query fetches historical bars data, starting from the date/time that is set by
the BeginDateTime parameter (see the parameters table below). This is similar to
(and subject to the same limitations as) fetching historical interval data (see §5.4), but
with no specified end point. IQML will return both the historical bars, as well as new
(live) real-time streaming interval bars, as they become available. BeginDateTime’s
default value is 00:00:00 today (server time), so you will almost always get historical
bars before live streaming bars. If you run the query at mid-day, you may get hundreds
of historical bars before you get the first live streaming bar. So, if you set NumOfEvents
to a low value, you might receive only historical bars, without any live streaming bars.
Unlike quotes (§4.1), when you specify NumOfEvents > 1, IQML does not wait for
new bars to arrive; instead, it returns previous (historic) bars, as long as this does not
conflict with the specified BeginDateTime. For example, if you set NumOfEvents=5,
you will receive the latest 5 bars: 4 complete historic bars, as well as the current
(incomplete) bar. If you require live (future) interval bars, then set BeginDateTime,
or use the streaming mechanism that is described in §6.3. For example, if you set
BeginDateTime to 5 bars ago and NumOfEvents=15, then IQFeed will return the 5
historic bars and wait for 10 additional future bars (subject to the specified Timeout).
Additional data filtering parameters: MaxDays, BeginFilterTime and EndFilterTime.
IQML User Guide 42

You can query multiple symbols at the same time, in a single IQML command, by
specifying a colon-delimited or cell-array list of symbols. For example:
>> data = IQML('intervalbars', 'symbols',{'IBM','GOOG','AAPL'});
>> data = IQML('intervalbars', 'symbols','IBM:GOOG:AAPL'); % equivalent

If the query returns the same number of data elements for all symbols, the results will
be returned as a struct array, with columns corresponding to the requested symbols:
data =
100×3 struct array with fields:
Symbol
BarType
Timestamp
Open
High
Low
Close
CumulativeVolume
IntervalVolume
NumberOfTrades

However, if IQML returns a different amount of data for various symbols, the results
are returned as a cell array, with cell elements corresponding to the requested symbols.
For example, in the following query, there is no symbol ‘XXX’ so IQML returns
empty results for this particular symbol:40
>> data = IQML('intervalbars', 'Symbol','IBM:GOOG:XXX', 'UseParallel',true)
data =
1×3 cell array
{100×1 struct} {100×1 struct} {0×0 double}

If you have the Professional license of IQML and also Matlab’s Parallel Computing
Toolbox, then setting the UseParallel parameter to true (or 1) will process the quotes
query for all the specified symbols in parallel (see discussion in §3.6):
>> data = IQML('intervalbars', 'symbols',{'IBM','GOOG','AAPL'}, ...
'UseParallel',1);

The following parameters affect interval bars data queries:


Parameter Data type Default Description
Limits the request to the specified
symbol(s). Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
41 (none)
Symbols string or  {'IBM', 'AAPL', 'GOOG'}
cell-array This parameter must be set to valid
of strings symbol name(s) when NumOfEvents>0.
Multiple symbols can be parallelized using
the UseParallel parameter (see below).

40
The UseParallel parameter is set here in order to avoid the run-time error of “Symbol ‘XXX’ was not found”
41
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 43

Parameter Data type Default Description


If set to true or 1, and if Parallel
Computing Toolbox is installed, then
logical
UseParallel false querying multiple symbols will be done in
(true/false)
parallel (see §3.6; Professional IQML
license only).
(the current Maximal number of parallel workers to
MaxWorkers integer parallel pool use (up to the current pool size) when
size) UseParallel=true
One of:
 inf – continuous endless streaming
interval bars for specified symbol(s)
 N>1 – stream only N interval bars
NumOfEvents integer Inf  1 – get only a single interval bar
 0 – stop streaming interval bars
 -1 – return latest interval bars data
while continuing to stream new bars
Returns up to the specified number of
MaxItems integer 100 bars (if available).
MaxDays integer 1 Max number of trading days to retrieve
Sets the type of interval size. One of the
following values:
IntervalType string 'secs'  's' or 'secs' – time [seconds] (default)
 'v' or 'volume' – traded volume
 't' or 'ticks' – number of ticks
Size of bars in IntervalType units. Must be
IntervalSize integer 60 ≥1 for secs, ≥2 for ticks, ≥100 for volume.
Only return bars that begin after this time
BeginFilterTime string '00:00:00' of day (US Eastern time-zone). Format:
'hhmm', 'hh:mm', 'hhmmss' or 'hh:mm:ss'.
Only return bars that end before this time
EndFilterTime string '23:59:59' of day (US Eastern time-zone). Format:
'hhmm', 'hh:mm', 'hhmmss' or 'hh:mm:ss'.
integer or '' Only return bars that begin after this
string or (empty string) date/time (US Eastern time-zone).
BeginDateTime datetime
meaning today Format: Matlab datenum, or 'yyyymmdd
object at 00:00:00 hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.
Max number of seconds to wait (0-9000)
Timeout number 5.0
for data in blocking mode (0 means infinite)
IQML User Guide 44

4.4 Market depth (Level 2)


Level 2 (II) market data on a symbol can be fetched using a 'marketdepth' action.
Starting in IQFeed client 6.2, the Level 2 data that is reported by IQFeed has changed
significantly, preventing IQML from keeping exact backward compatibility with the
format of the Level 2 data that was reported in IQFeed clients 6.1 or older. IQML
works with both client types, but the returned data will be slightly different depending
on the specific IQFeed client/protocol. The documentation below highlights the
differences between IQML results with IQFeed clients up to 6.1, vs. clients since 6.2.

4.4.1 Common functionality


The following example fetches Level 2 data for the S&P E-Mini continuous future:
>> data = IQML('marketdepth', 'symbol','@ES#')
data =
10×1 struct array with fields:
Symbol
Bid
Ask
BidSize
AskSize
BidTime
AskDate
AskTime
BidInfoValid
AskInfoValid
BidCount
AskCount
Condition
Condition_Description
ID
ID_Description
BidSizeRatio
AskSizeRatio

The latest data (i.e., state of the market-depth table) is returned as a Matlab struct array,
whose elements correspond to the market-depth rows. For example, to see the data for
row #3 (i.e., 2 rows below the top-of-book row), you can access array element #3:
>> data(3)
ans =
struct with fields:
Symbol: '@ES#'
Bid: 3878
Ask: 3879.25
BidSize: 86
AskSize: 103
BidTime: '10:51:27.753961'
AskDate: '2021-02-22'
AskTime: '10:51:28.411595'
BidInfoValid: 1
AskInfoValid: 1
BidCount: 44
AskCount: 50
Condition: 52
Condition_Description: 'regular'
ID: 'MD03'
ID_Description: 'Order book row #3'
BidSizeRatio: 0.231182795698925
AskSizeRatio: 0.207243460764588
IQML User Guide 45

Note: In IQFeed 6.2 or newer, AskDate field is reported without a corresponding BidDate;
in IQFeed 6.1 or older, the field is common to both Bid,Ask and called simply Date.
BidInfoValid and AskInfoValid values are logical (true/false) values, which appear
as 1 or 0 (respectively) in the returned data struct. The ID field ('MD03' in this case)
indicates that this is market-depth row 3 (also note the related ID_Description field).
BidCount and AskCount indicate how many separate trade orders there are for this
particular bid/ask level. These fields are only available in IQFeed 6.2 or newer.
BidSizeRatio and AskSizeRatio are the relative fraction of bid/ask size in this particular
bid/ask level. For example, if the total sum of BidSize in all the reported levels is 1000
and a particular level has BidSize=23, then BidSizeRatio will be 0.023. Note that if you
limit the reported levels (using the NumOfEvents and MaxLevels parameters), this
will affect the total sum of bid/ask sizes in the calculation of the SizeRatio fields.
Each incoming market depth message provides information on a single Level 2 data
row. IQFeed’s messages arrive at a random, unsorted, unpredictable order in two
groups: first the messages that define the current (snapshot) baseline of all rows, then
update messages for individual rows when traders add, cancel or modify orders.
Depending on the requested Symbol, IQFeed may report 5 to 15 market-depth rows.
To ensure that all baseline data rows are received, set NumOfEvents and MaxLevels
parameters to at least the total number of rows expected for the Symbol. For example:
>> data = IQML('marketdepth','symbol','@ES#','NumOfEvents',999,'MaxLevels',15)
data =
15×1 struct array with fields:
Symbol
Bid
Ask
...

The returned struct array can be converted into a Matlab table object, as follows:42
>> struct2table(data)
ans =
15×18 table
Symbol Bid Ask BidSize AskSize BidTime ...
______ _______ _______ _______ _______ _________________
'@ES#' 2927.25 2927.5 58 121 '03:21:25.213504'
'@ES#' 2927 2927.75 78 111 '03:21:22.040253'
'@ES#' 2926.75 2928 94 129 '03:21:15.037291'
'@ES#' 2926.5 2928.25 95 107 '03:21:04.023779'
'@ES#' 2926.5 2928.75 104 184 '03:42:19.025285'
'@ES#' 2926.25 2929 123 181 '03:42:43.020801'
'@ES#' 2926 2929.25 137 127 '03:43:01.042949'
'@ES#' 2925.75 2929.5 86 135 '03:42:01.029094'
'@ES#' 2925.5 2929.75 183 161 '03:42:02.021818'
'@ES#' 2925.25 2930 152 382 '03:42:07.003202'
...

Alternatively, you can also receive the results directly in table format, using the
OutputFormat parameter (see §3.2):
>> data = IQML('marketdepth', ..., 'OutputFormat','table');

42
Some fields at the table’s right side are not shown here due to space limitations, but are available in the actual Matlab object
IQML User Guide 46

If your IQFeed account is not authorized/subscribed for Level 2 data, you will receive
an error message whenever you request market depth data:43
Account not authorized for Level II

If your IQFeed account is authorized for Level 2 data but not for a certain exchange, you
will receive an error message when requesting market depth info from that exchange:
>> data = IQML('marketdepth', 'Symbol','IBM') % not subscribed to NYSE Level2
Error using IQML
Symbol 'IBM' was not found!

Note: IQFeed often reports an error that the requested symbol was not found, even
when this is not the case! This is probably due to a bug on IQFeed’s servers. In such
cases, if you are certain that you are indeed subscribed to the corresponding Level 2
data and that it should exist for the requested symbol, simply pause a few seconds and
then resubmit your query. Here is a code snippet for retrying the query up to 5 times:
tries = 5;
while tries > 0
try
data = IQML('marketdepth', ...);
break % successful fetch – exit the retry loop
catch err
if tries == 1 % failed 5 attempts
rethrow(err); % give up and rethrow the original error
end
tries = tries – 1;
pause(2.0); % pause 2 secs before retrying the fetch query
end
end

4.4.2 Detailed quotes in IQFeed 6.2 or newer


If you are using IQFeed client/protocol 6.2 or newer, you can request detailed insight
into the various price levels using the Detailed parameter (default: false). When
Detailed is set to true or 1, the price levels’ components are reported: the constituent
orders (for futures), or the top market maker quotes (for equities):
>> data = IQML('marketdepth', 'Symbol','@ES#', 'Detailed',1, ...
'OutputFormat','table', 'MaxLevels',999)
data =
211×18 table
Symbol Bid Ask BidSize AskSize BidTime ...
______ _______ _______ _______ _______ _________________
'@ES#' 3868.25 3871.5 2 1 '08:01:21.390568'
'@ES#' 3867.75 3871.5 2 1 '07:53:00.399083'
'@ES#' 3867.25 3874.5 1 10 '08:04:28.829508'
'@ES#' 3865.75 3876 1 1 '07:44:45.468775'
'@ES#' 3865.5 3876.25 2 2 '04:06:45.172317'
'@ES#' 3864 3879.25 3 1 '04:06:36.324680'
'@ES#' 3862.25 3880.75 2 1 '03:56:05.241568'
'@ES#' 3862.25 3881 2 2 '04:23:28.283821'
'@ES#' 3860 3881.25 1 10 '03:37:42.519913'
'@ES#' 3860 3882.5 2 2 '03:55:39.598845'
'@ES#' 3860 3887.25 5 1 '21:53:56.596841'

43
IQML does not automatically establish a conection with IQFeed’s L2 server during IQML startup, in order to avoid a display
of this error message for users who do not have an IQFeed Level 2 subscription. Instead, IQML connects to IQFeed’s L2 server
only as needed, upon the first IQML marketdepth request. This initial connection causes a very small delay in the first L2 query.
IQML User Guide 47

For futures, the returned data will include the order IDs of the constituent trade orders
(in the BidOrderID, AskOrderID fields) as well as their relative priority (in BidPriority
and AskPriority fields). For example:
>> table2struct(data(1,:))
ans =
struct with fields:
Symbol: '@ES#'
Bid: 3868.25
Ask: 3871.5
BidSize: 2
AskSize: 1
BidTime: '08:01:21.390568'
AskDate: '2021-02-22'
AskTime: '08:04:46.779352'
BidInfoValid: 1
AskInfoValid: 1
BidPriority: 9996864447
AskPriority: 9996874599
Condition: 52
Condition_Description: 'regular'
BidOrderID: 647979156407
AskOrderID: 647981205874
BidSizeRatio: 0.00118133490844654
AskSizeRatio: 0.00515463917525773
In the case of equities, the top market-maker quotes will be reported, in this case with
BidMMID, AskMMID fields instead of BidOrderID, AskOrderID). Only the top quotes for each
market maker is reported (market width):44
>> data = IQML('marketdepth', 'Symbol','MSFT', 'Detailed',1, 'MaxLevels',999)
data =
32×1 struct array with fields:
Symbol
Bid
Ask
...
>> data(1)
ans =
struct with fields:
Symbol: 'MSFT'
Bid: 234.13
Ask: 234.15
BidSize: 100
AskSize: 227
BidTime: '13:01:43.019850'
AskDate: '2021-02-22'
AskTime: '13:01:43.004548'
BidInfoValid: 1
AskInfoValid: 1
BidPriority: 1
AskPriority: 1
Condition: 52
Condition_Description: 'regular'
BidMMID: 'BATS'
AskMMID: 'NSDQ'
BidMMID_Description: 'CBOE TRADING, INC.'
AskMMID_Description: 'Nasdaq Execution Services, LLC.'
BidSizeRatio: 0.0188679245283019
AskSizeRatio: 0.0512762593178225

44
IQFeed does not offer deep market depth for equities, nor market width for futures. For such detailed data DTN offers
premium services such as Nasdaq TotalView (http://nasdaqtrader.com/Trader.aspx?id=Totalview2).
IQML User Guide 48

Note that the rows are sorted by descending Bid and ascending Ask, such that BATS
may appear as the top price level for Bid (as in the snippet above), but only in row #2
for Ask. This can be understood by viewing the data in table format:
>> data = IQML('marketdepth', 'Symbol','MSFT', 'Detailed',1, ...
'OutputFormat','table', 'MaxLevels',999)
data =
32×18 table
Symbol Bid Ask BidSize AskSize ... BidMMID AskMMID ...
_______ ______ ______ _______ _______ _______ _______
'MSFT' 234.13 234.15 100 227 'BATS' 'NSDQ'
'MSFT' 234.13 234.16 200 100 'NSDQ' 'BATS'
'MSFT' 234.11 234.49 1000 100 'IEXX' 'BOSX'
'MSFT' 225.22 235.44 100 100 'BOSX' 'IEXX'
'MSFT' 225.22 242.38 100 100 'VIRT' 'SSUS'
'MSFT' 225.19 244.63 100 100 'SSUS' 'CINN'
'MSFT' 224.96 245.14 100 100 'CINN' 'VIRT'
'MSFT' 220.74 247.08 100 100 'SGAS' 'SGAS'
'MSFT' 218.41 252.91 1000 1000 'ADAM' 'ADAM'
'MSFT' 218.41 252.91 100 100 'BARD' 'BARD'
'MSFT' 218.41 252.91 100 100 'BMOC' 'BMOC'
'MSFT' 218.41 252.91 100 100 'CSTI' 'CSTI'
...
Also note that for equities, IQFeed returns market width (not depth) data – the top
bid/ask row (but not order-book depth) for each market maker that trades the equity.
Using the reported Level 2 data from different market makers enables arbitrage
trading: buying a security from market maker A (who offers the lowest Ask price)
and selling to market maker B (who offers the highest Bid price).
Note that depending on the time of your query you may receive a different set of
market-makers, between 0 and dozens of market maker rows. Market makers who do
not have any valid Bid/Ask are not reported by default. If you wish to receive Level 2
quotes even when they are empty (invalid Bid and Ask), set the IncludeEmptyQuotes
parameter to true or 1 (default value: false). For example:
>> IQML('marketdepth', 'symbol','MSFT', 'NumOfEvents',70, ...
'IncludeEmptyQuotes',true, 'OutputFormat','table')
ans =
67×14 table
Symbol Bid Ask BidSize AskSize BidTime Date ...
______ ______ _______ _______ _______ _________________ ____________
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 129.39 0 600 '18:29:49.000347' '2019-05-01'
'MSFT' 127.91 130.09 100 100 '04:03:41.004392' '2019-05-02'
...

4.4.3 Detailed quotes in IQFeed 6.1 or older


In IQFeed client/protocol 6.1 or older, the Detailed parameter is ignored:
 Futures are always reported without detail. In other words, each price level
displays the summary of all constituent trade orders for that price, without
details of the constituent orders (market depth).
 Equities are always reported with detail. In other words, each price level
displays the top bid/ask quotes of a different market maker (market width).45

45
IQFeed does not offer deep market depth for equities, nor market width for futures. For such detailed data DTN offers
premium services such as Nasdaq TotalView (http://nasdaqtrader.com/Trader.aspx?id=Totalview2).
IQML User Guide 49

For example:
>> data = IQML('marketdepth', 'symbol','MSFT', 'NumOfEvents',50)
data =
5×1 struct array with fields:
...
>> data(1)
ans =
struct with fields:
Symbol: 'MSFT'
Bid: 0
Ask: 129.39
BidSize: 0
AskSize: 600
BidTime: '18:29:49.000347'
Date: '2019-05-01'
AskTime: '99:99:99.000000'
BidInfoValid: 0
AskInfoValid: 1
Condition: 52
Condition_Description: 'regular'
ID: 'BATS'
ID_Description: 'CBOE TRADING, INC.'
BidSizeRatio: 0
AskSizeRatio: 0.12
>> data(2)
ans =
struct with fields:
Symbol: 'MSFT'
Bid: 127.91
Ask: 130.09
BidSize: 100
AskSize: 100
BidTime: '04:03:41.004392'
Date: '2019-05-02'
AskTime: '04:17:07.020285'
BidInfoValid: 1
AskInfoValid: 1
Condition: 52
Condition_Description: 'regular'
ID: 'NSDQ'
ID_Description: 'Nasdaq Execution Services'
BidSizeRatio: 0.02
AskSizeRatio: 0.02
>> struct2table(data)
ans =
4×16 table
Symbol Bid Ask BidSize AskSize BidTime Date ...
______ ______ ______ _______ _______ _________________ ____________
'MSFT' 0 129.39 0 600 '18:29:49.000347' '2019-05-01'
'MSFT' 127.91 130.09 100 100 '04:03:41.004392' '2019-05-02'
'MSFT' 127.54 127.98 200 4800 '19:53:35.049950' '2019-05-01'
'MSFT' 127.97 128.71 100 100 '04:17:13.037004' '2019-05-02'
...
In this example, which was ran outside regular trading hours (early morning of 2019-
05-02), BATS reported a valid Ask from the previous evening, but no valid Bid. The
other market makers (NSDQ, etc.) reported both valid Bid and Ask. Note that the
reported BidTime is a valid time whereas AskTime is not (rather than the opposite, as would
be expected, since only Ask is valid). This is apparently a bug in IQFeed 6.1’s data.46

46
http://forums.iqfeed.net/index.cfm?page=topic&topicID=5594. This data bug is apparantly resolved in IQFeed 6.2.
IQML User Guide 50

As noted above, depending on the time of your query you may receive a different set
of market-makers, between 0 and dozens of market maker rows. Market makers who
do not have any valid Bid/Ask are not reported by default. If you wish to receive
Level 2 quotes even when they are empty (invalid Bid and Ask), set the
IncludeEmptyQuotes parameter to true or 1 (default value: false). For example:
>> IQML('marketdepth', 'symbol','MSFT', 'NumOfEvents',70, ...
'IncludeEmptyQuotes',true, 'OutputFormat','table')
ans =
67×16 table
Symbol Bid Ask BidSize AskSize BidTime Date ...
______ ______ _______ _______ _______ _________________ ____________
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 129.39 0 600 '18:29:49.000347' '2019-05-01'
'MSFT' 127.91 130.09 100 100 '04:03:41.004392' '2019-05-02'
...

4.4.4 Common parameters


The following parameters affect market depth queries with all IQFeed client versions:
Parameter Data type Default Description
Limits the request to the specified symbol(s).
colon or Examples:
comma-  '@ES#'
Symbol or delimited  'IBM:AAPL:GOOG'
(none)  'IBM,AAPL,GOOG'
Symbols 47 string, or
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings This parameter must be set to valid symbol
name(s) when NumOfEvents>0
One of:
 inf – continuous endless streaming
Level 2 data for specified symbol(s)
 N>1 – only process N incoming quotes
NumOfEvents integer 10  1 – get only a single quote
 0 – stop streaming market depth data
 -1 – return the latest Level 2 data while
continuing to stream new data updates
MaxLevels integer 5 Max number of price levels (rows) to return
If set to true or 1, empty Level 2 quotes (with
IncludeEmpty logical
false neither a valid Bid nor valid Ask) will also be
Quotes (true/false) returned. By default (false), they will not be.
If set to true or 1, each price level’s components
logical will be reported: trade order IDs for futures;
Detailed false market makers for equities. This parameter is
(true/false)
ignored in IQFeed client/protocol 6.1 or older.
Max number of seconds to wait (0-9000) for
Timeout number 5.0 data in blocking mode (0 means infinite)
Note: Market Depth (Level 2) data is only available in the Professional IQML license.

47
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 51

4.5 Greeks, fair value, and implied volatility


Extra data can be fetched (calculated) for asset options using the 'greeks' action:
 Greeks (Delta, Vega, Theta, Rho, Gamma etc.)
 Fair value for the derivative and the difference vs. actual trading price
 Implied volatility based on the fair vs. trading prices
>> data = IQML('greeks', 'symbol','IBM1814L116')
data =
Symbol: 'IBM1814L116'
Asset_Name: 'IBM DEC 2018 C 116.00'
Strike_Price: 116
Expiration_Date: '12/14/2018'
Days_To_Expiration: 30
Inferred_Asset_Side: 'Call'
Underlying_Symbol: 'IBM'
Underlying_Asset_Name: 'INTERNATIONAL BUSINESS MACHINE'
Underlying_Spot: 121.3
Underlying_Historic_Volatility: 37.1
Assumed_Risk_Free_Rate: 0
Assumed_Dividend_Yield: 0
Asset_Fair_Value: 8.1193
Asset_Latest_Price: 7.05
Asset_Price_Diff: 1.0693
Implied_Volatility: 0.28242
Volatility_Used_By_Greeks: 0.371
Delta: 0.68197
Vega: 0.12404
Theta: -0.076697
Rho: 6.1318
CRho: 6.7992
Omega: 10.189
Lambda: 10.189
Gamma: 0.027646
Vanna: -0.3527
Charm: 0.0021809
Vomma: 5.8043
Veta: 2.4262
Speed: -0.0012419
Zomma: -0.061581
Color: -0.00038078
Ultima: -45.238
Annual_Factor_Used: 365
This_Asset_Latest_Quote: [1×1 struct]
Underlying_Latest_Quote: [1×1 struct]
This_Asset_Fundamentals: [1×1 struct]
Underlying_Fundamentals: [1×1 struct]
The reported Matlab struct contains a few fields with basic information on the derivative
and its underlying, followed by fair-value, implied volatility and Greek values.
At the bottom of the returned data-struct, four sub-structs provide direct access to the
latest quotes data (§4.1, for example data.This_Asset_Latest_Quote.Total_Volume) and
fundamenta data (§4.2, for example data.Underlying_Fundamentals.Average_Volume), for
both the option asset and its underlying stock.
Note that the returned quotes data is subject to the Fields parameter value that was set
in the most recent quotes data query (see §4.1). If the most recent Fields value does
not include pricing data (Most_Recent_Trade, Bid, Ask, Last, or Close fields), then some
returned data fields (for example Asset_Price_Diff and Implied_Volatility) will be empty.
IQML User Guide 52

The following Greek values are reported by IQML:


Field Symbol Derivative
order Definition Description
Sensitivity of fair value to changes in the
Delta Δ 1 ∂V/∂S underlying asset’s spot price
Sensitivity of fair value to changes in the
Vega ν 1 ∂V/∂σ
underlying asset’s volatility; also called Kappa
Theta Θ 1 -∂V/∂τ Sensitivity of fair value to maturity time (decay)
Rho ρ 1 ∂V/∂r Sensitivity of fair value to risk-free rate
CRho - 1 ∂V/∂b Sensitivity of fair value to the carry-rate
% change in fair value due to a 1% change in
Omega, Ω
1 Δ × S/V the underlying asset price (these are synonym
Lambda λ
fields, both are reported for convenience)
Sensitivity of Delta to changes in the
Gamma Γ 2 ∂Δ/∂S
underlying asset’s spot price
Sensitivity of Delta to changes in the
Vanna - 2 ∂Δ/∂σ
underlying asset’s volatility
Charm - 2 -∂Δ/∂τ Sensitivity of Delta to maturity time (decay)
Sensitivity of Vega to changes in underlying
Vomma - 2 ∂ν/∂σ asset’s volatility; also sometimes called Volga
Veta - 2 ∂ν/∂τ Sensitivity of Vega to the maturity time
Sensitivity of Gamma to changes in the
Speed - 3 ∂Γ/∂S
underlying asset’s spot price
Sensitivity of Gamma to changes in the
Zomma - 3 ∂Γ/∂σ
underlying asset’s volatility
Color - 3 ∂Γ/∂τ Sensitivity of Gamma to maturity time (decay)
Sensitivity of Vomma (Volga) to changes in the
Ultima - 3 ∂3V/∂σ3
underlying asset’s volatility
You can request data for multiple symbols at the same time, in a single IQML command,
by specifying the symbols using a colon-delimited string or a cell-array. For example:
>> data = IQML('greeks', 'symbols',{'IBM1814L116','IBM1814X116'});
>> data = IQML('greeks', 'symbols','IBM1814L116:IBM1814X116'); % equivalent

The result will be an array of Matlab structs that correspond to the requested symbols:
data =
2×1 struct array with fields:
Symbol
Asset_Name
Strike_Price
...

If you have Matlab’s Parallel Computing Toolbox, set the UseParallel parameter to true
(or 1) to process the Greeks query for the specified symbols in parallel (see §3.6):
>> data = IQML('greeks', 'symbols',{'IBM1814L116','IBM1814X116'}, ...
'UseParallel',true);
IQML User Guide 53

Notes:
1. Greeks and related derivative data (the the 'greeks' action in general) are only
available in IQML Professional and trial licenses, not in the Standard license.
2. Greeks, fair-price and implied vol values are computed by IQML on your local
computer. They are NOT provided by IQFeed, and are NOT approved by DTN.
3. There is a performance impact: the calculations require some data fetches from
IQFeed. These extra fetches and calculations may take up to 0.3-1 secs per query,
depending on CPU, IQFeed round-trip latency, and the specific parameters.
4. The calculations assume vanilla European-style options using Black-Scholes-
Merton’s model.48 Using IQML’s calculations with other derivatives (American/
Asian/barrier/exotic options etc.) may result in incorrect/misleading values.
5. There are various possible ways to estimate implied volatility from the option’s
trading price and fair value. IQML uses a standard Newton-Raphson iterative
approximation method; other methods may result in slightly different values.
6. Certain fields sometimes report invalid values. For example, Implied_Volatility
may contain –Inf or +Inf when the Newton-Raphson algorithm fails to converge
to a valid value. Likewise, some Greeks may contain a NaN value in certain cases
(for example, a contract so far out-of-the-money that it has no trading price).
7. Some Greeks are also known by other names: Vega is sometimes called Kappa;
Vomma is also known as Volga or vega convexity; Omega is also called Lambda
or elasticity; Charm is also known as delta decay; and Color as gamma decay.
8. Various sources/systems calculate Greeks in different manners. For example,
Vega, Rho, Veta and Ultima values are sometimes divided by 100 (but not in
IQML); Theta, Charm, Veta and Color are sometimes annualized and
sometimes divided by a representative number of days per year
(365/364/360/253/252) to provide 1-day estimates (customizable in IQML,
365 by default);49 The foreign rate/dividends yield is ignored by some sources
and included by others in the calculations; Some sources report Color as the
positive rate of change of Gamma relative to maturity time, while others
report it as the negative rate of change.50 In addition, some sources apparently
have buggy math implementations.51 The result is that different sources
provide different Greek values for the same inputs. IQML’s values are
basically identical to those of Matlab’s Financial Toolbox, NAG and Maple.52
Unfortunately, IQFeed’s standalone Option Chains utility reports different
values. IQML adheres to the core math formulae53 and we believe that IQML
provides mathematically-accurate results. However, the discrepancy between
the values reported by different systems means that you must carefully ensure
that IQML’s reported values fit your needs and expectations.

48
Support for American options is planned in a future release of IQML; there are no current plans to support Asian/exotic options.
49
Matlab’s Financial Toolbox, NAG and Maple report annualized values; for annual values in IQML, set the AnnualFactor to 1.
50
For example, the reported Color value is negative in NAG compared to IQML and Maple.
51
This does not imply that there are no calculation bugs in IQML’s implementation; the Greeks calculation is not trivial.
52
Excluding a few quirks, such as a negative Color value reported by NAG, or Maple’s Lambda calculation, or the AnnualFactor
of 1 used by both NAG & Maple. Also compare the very similar values reported by the online calculator http://option-price.com
53
John Hull, Options, Futures, and Other Derivatives (ISBN 9780134472089); https://en.wikipedia.org/wiki/Greeks_(finance)
IQML User Guide 54

By default, IQML uses the derivative’s fundamental data and default 0% rates in its
calculations. You can override these defaults using the following optional parameters:
 UnderlyingSymbol – by default this is the Asset_Name’s first string token, or
the first portion of Symbol. For example, for IBM1814L116, Asset_Name='IBM
DEC 2018 C 116.00' so Underlying_Symbol is set to 'IBM' (the first token in the
Asset_Name); for @BOF20P28500 the Underlying_Symbol is set to '@BOF20'
(Soybean Oil Jan 2020 Future).54 To check the auto-inferred
UnderlyingSymbol, check the Underlying_Asset_Name field in the returned data.
The Underlying_Symbol value can be overrriden using the UnderlyingSymbol
parameter. For example, you could specify that the underlying symbol for
Greeks computation of GOOG1816K1000 is not the default 'GOOG'
(Alphabet Inc Class C), but rather 'GOOGL' (Class A).
 Side – by default, the option side ('Call' or 'Put') is determined by IQML from
the derivative contract’s Asset_Name. For example, for IBM1814L116,
Asset_Name='IBM DEC 2018 C 116.00', which is automatically inferred to be a
Call option. You can override the inferred side for contracts that have a non-
standard Asset_Name (or one which is not properly reported by IQFeed in its
Fundamental Data message) that IQML cannot properly analyze.
 HistoricVolatility – this is usually reported by IQFeed in the underlying
asset’s fundamental data (data.Underlying_Fundamentals.Historical_Volatility)
and this is used in IQML by default. Instead of this reported value, you can specify
another value (for example, the S&P 500 volatility), as a fixed percent value.
 UseImpliedVolatility – by default, IQML uses HistoricVolatility to calculate
Greek values. Set UseImpliedVolatility to 1 or true to calculate Greeks using
the Implied_Volatility instead (this may be useful for some commodities).
 RiskFreeRate – this is the domestic risk-free rate. IQML uses 0% by default; you
can specify any other fixed percentage rate (based on e.g. LIBOR55 or T-bill56).
 DividendsYield – this is the underlying asset’s dividend yield. IQML uses 0%
by default; you can specify any other fixed percentage value. In the context of
Forex currencies, this value may represent the foreign risk-free (carry) rate.
 DaysToExpiration – by default, IQML determines the duration until contract
expiry (maturity) based on its Expiration_Date. This duration can be set to any
positive number of days (not necessarily an integer value).
 AnnualFactor – by default, IQML normalizes the reported Theta, Charm,
Veta and Color values by dividing the computed annualized value by 365 in
order to provide 1-day estimates. You can override this scaling factor to any
positive number. Setting a value of 1 provides annualized results (i.e., not 1-day
estimates), as reported by Matlab’s Financial Toolbox, NAG and Maple. For
various uses you could also use other factors such as 364, 360, 253, 252, 12 or 4.

54
Some short-listed future contracts do not have an immediately inferable UnderlyingSymbol. For example, the underlying
symbol of @CF20C4000 (Corn Jan 2020 Call 4000) is not @CF20 (which does not exist). In such cases, IQML tries to use a
corresponding contract of the next or the following months (in this case @CH20 - Corn March 2020). Sometimes this mechanism
fails. For example, the underlying of @S2Z19C8700 (Soybeans Week 2 Dec 2019 Call 8700) is not @S2Z19, @S2F20 etc.
(which do not exist) but rather @SZ20 (Soybeans Jan 2020). In such cases, you must specify the UnderlyingSymbol manually.
55
You can query the current LIBOR rate with IQML, for example using symbol ONLIB.X (overnight rate), 1MLIB.X (1 month),
3MLIB.X (3 months), or 1YLIB.X (1 year). Additional durations are also available
(http://iqfeed.net/symbolguide/index.cfm?pick=indexRATES&guide=mktindices), but a 1-month rate is often used even for
shorter or longer option durations, for consistency. Also see http://forums.iqfeed.net/index.cfm?page=topic&topicID=4387.
56
You can query the current T-bill rate with IQML, for example using symbol TB30.X (30-day rate), IRX.XO (91 days),
TB180.X (180 days), or 1YCMY.X (1 year). Also see http://forums.iqfeed.net/index.cfm?page=topic&topicID=4387.
IQML User Guide 55

Here is a usage example with some non-default parameters:


>> data = IQML('greeks', 'symbol','IBM1814L116', 'DaysToExpiration',13.5, ...
'RiskFreeRate',2.5, 'DividendsYield',3.2, 'AnnualFactor',1)

The following parameters affect Greeks data queries:


Parameter Data type Default Description
Limits the query to the specified symbol(s).
Examples:
colon-  'GOOG1816K1000'
Symbol or
delimited  'IBM1814L116:GOOG1816K1000'
Symbols 57
string, or (none)  {'IBM1814L116', 'GOOG1816K1000'}
cell-array
This parameter must be set to valid symbol
of strings
name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).
If set to true or 1, and if Parallel Computing
logical
UseParallel false Toolbox is installed, then querying multiple
(true/false) symbols will be done in parallel (see §3.6).
MaxWorke (current parallel Max number of parallel workers to use (up
integer
rs pool size) to the current pool size) when UseParallel=1
Underlying '' (i.e. taken from Symbol of the derivative’s underlying asset
string the contract name)
Symbol
'' (i.e. taken from Either 'Call' or 'Put'
Side string the contract name)
-1 (i.e. taken from Value that represents the underlying’s price
HistoricVol the underlying volatility (in percent). 1.0 means 1%;
number asset’s reported -1 means a dynamic value based on the
atility
historic volatility) underlying asset’s reported historic volatility.
UseImplied logical If set to true or 1, the Implied_Volatility (not
false HistoricVolatility) will be used for Greeks
Volatility (true/false)
RiskFreeR Domestic risk-free rate
number 0.0
Specified in percent; 1.0 means 1%.
ate
Underlying stock’s dividends yield, or the
DividendsY foreign currency risk-free (carry) rate.
number 0.0
ield Specified in percent; 1.0 means 1%.
-1 (i.e. taken from Number of days until the contract expires
DaysToExp
number the contract’s
iration (matures)
expiration date)
The computed Theta, Charm, Veta and
AnnualFac Color values are divided by this factor
number 365
before being reported. Typical values are
tor
365, 364, 360, 253, 252, 12, 4 or 1.
Note: The Greeks functionality is only available in the Professional and trial IQML
licenses, not in the Standard license.

57
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 56

4.6 Market summary data and scanner


All the queries described so far in this chapter return data for individually-specified
Symbols. We can retrieve a complete market snapshot of all traded securities of a
specific SecType and Exchange, using a 'summary' query:
>> data = IQML('summary') % latest 5-minute data for all NYSE equities
data =
4749×1 struct array with fields:
Symbol
Exchange
Type
Last
TradeSize
TradedMarket
TradeDate
TradeTime
Open
High
Low
Close
... (total of 28 data fields)
>> data(1)
ans =
struct with fields:
Symbol: 'A'
Exchange: 7
Type: 1
Last: 72.5315
TradeSize: 5
TradedMarket: 5
TradeDate: 20190711
TradeTime: 103502
Open: 73.77
High: 73.78
Low: 72.5315
Close: 73.37
Bid: 72.51
BidMarket: 18
BidSize: 200
Ask: 72.54
AskMarket: 5
AskSize: 100
Volume: 257497
PDayVolume: 1785225
UpVolume: 84799
DownVolume: 80276
NeutralVolume: 92422
TradeCount: 2371
UpTrades: 733
DownTrades: 832
NeutralTrades: 806
VWAP: 73.1309
This query shows that 4749 equities are currently trading on NYSE.58 This data is
daily (i.e., the cummulative day’s Open/High/Low/Volume etc.), and is updated on
IQFeed’s servers every 5 minutes. DTN says that “the timing of the snapshot is not
guaranteed, but data will be gathered every 5 minutes”. Therefore, you should assume
for safety that the data is up to 5 minutes old. To get the latest data, use real-time
snapshot (§4.1) and fundamental (§4.2) queries, or streaming quotes (§6.1).

58
This query was run on July 11, 2019 at 11am EDT
IQML User Guide 57

The default DataType parameter value ('snapshot') fetches trading data. To fetch a
market summary of fundamental data, set DataType='fundamental'. For example:
>> data = IQML('summary', 'DataType','fundamental')
data =
4749×1 struct array with fields:
Symbol
Description
PeRatio
AvgVolume
... (total of 41 data fields)
>> data(1)
ans =
struct with fields:
Symbol: 'A'
Description: 'AGILENT TECHNOLOGIES'
PeRatio: 21
AvgVolume: 1908
DivYield: 0.89
DivAmount: 0.164
DivRate: 0.656
PayDate: 20190724
ExDivDate: 20190701
CurrentEps: 3.5
SIC: 3825
Precision: 4
Display: 14
GrowthPercent: -0.14
FiscalYearEnd: 20181001
Volatility: 16.5
ListedMarket: 7
OptionRoots: 'A'
InstitutionalPercent: 86.905
YearEndClose: 67.46
Beta: 1.35
Assets: 3848
Liabilities: 1171
BalanceSheetDate: 20190430
LongTermDebt: 1799
CommonSharesOutstanding: 315993
MarketCap: 23184
x52WeekHigh: 82.27
x52WeekHighDate: 20190321
x52WeekLow: 61.01
x52WeekLowDate: 20181024
CalHigh: 82.27
CalHighDate: 20190321
CalLow: 62
CalLowDate: 20190103
LastSplit: []
LastSplitDate: []
PrevSplit: []
PrevSplitDate: []
NAICS: 334516
ShortInterest: 4130628

You can control the query using the DataType (default: 'snapshot'), SecType
(default: 'equity') and/or Exchange (default: 'NYSE') parameters:
>> data = IQML('summary', 'SecType','bond', 'Exchange','NYSE', ...
'DataType','fundamental');
IQML User Guide 58

>> struct2table(data)
ans =
6326×11 table
Symbol Description Precision Display ListedMarket MaturityDate CouponRate ...
___________ __________________________________________ _________ _______ ____________ _____ _______ __________
'A20.CB' 'AGILENT TECHNOLOGIES INC. 5.0% SR NTS' [] 12 7 20200715 [] ...
'A23.CB' 'AGILENT TECHNOLOGIES INC. 3.875% 07/15/2' [] 12 7 20230715 3.875
'A26.CB' 'AGILENT TECHNOLOGIES INC 3.05 09/22/2026' [] 12 7 20260922 3.050
'AA.28.CB' 'ALUMINUM CO OF AMERICA 6.75% NTS 1/15/28' [] 12 7 20280115 []
'AA20.CB' 'ALCOA INC. 6.15% SR NTS' [] 12 7 20200815 []
'AA21.CB' 'ALCOA INC. 5.4% SR NTS' [] 12 7 20210415 []
'AA22.CB' 'ALCOA INC NT 5.87%' [] 12 7 20220223 []
'AA24.CB' 'ALCOA INC 5.125% 10/01/2024' [] 12 7 20241001 []
'AA27.CB' 'ALCOA INC 5.9% NTS 2/1/27' [] 12 7 20270201 5.900
'AA37.CB' 'ALCOA INC 5.95% NTS 2/1/37' [] 12 7 20370201 5.950
'AAP20.CB' 'ADVANCE AUTO PARTS INC. 5.75%' [] 12 7 20200501 []
'AAP22.CB' 'ADVANCE AUTO PARTS INC 4.5%' [] 12 7 20220115 []
'AAP23.CB' 'ADVANCE AUTO PARTS 4.5 12/01/23' 2 12 7 20231201 []
'AAPL22.CB' 'APPLE INC 1.00% NOTES 22' [] 0 7 20221110 []
...

Note that there is no Symbol parameter in a 'summary' query – data for all the symbols
that match the specified SecType and Exchange is returned. For historic market
summaries, add the Date parameter (see §5.6 for details).
By default, only data fields that contain information are returned. For example, in the
snapshot query for equities, only 28 of 35 data fields are reported; 7 fields are removed
from the returned struct array since they contain an empty ([]) value for all securities:
MutualDiv, SevenDayYield, OpenInterest, Settlement, SettlementDate, ExpirationDate,
59
Strike. Similarly, 3 additional fields (High, Low and VWAP) are not reported for bonds
(only 25 fields contain information). To include all these fields (with their empty data
values) in the reported data, set the ReportEmptyFields parameter to true (or 1):
>> data = IQML('summary', 'ReportEmptyFields',true)
data =
4749×1 struct array with fields:
Symbol
Exchange
... (total of 35 data fields)
>> data(1)
ans =
struct with fields:
Symbol: 'A'
...
NeutralTrades: 806
VWAP: 73.1309
MutualDiv: []
SevenDayYield: []
OpenInterest: []
Settlement: []
SettlementDate: []
ExpirationDate: []
Strike: []
Likewise, with a 'fundamental' query, only 41 of 47 possible fields are reported for
equities (EstEps, MaturityDate, CouponRate, LEAPs, WRAPs and Expiration fields are not
reported);60 for bonds only 11 fields are reported (Symbol, Description, Precision, Display,
ListedMarket, MaturityDate, CouponRate, x52WeekHigh, x52WeekHighDate, x52WeekLow and
x52WeekLowDate), while 36 other fields are not. As before, to include these fields (with
their empty data values) in the reported data, set ReportEmptyFields to true (or 1).

59
Additional fields (for example, Open, High, Low) are missing when the query is run early in the day, before start of trading.
60
The EstEps field was reported by IQFeed in some runs but not others; the reason for this is unclear.
IQML User Guide 59

Market summary queries can take a long time to download data, depending on amount of
data and your computer speed. To ensure the query does not time-out before completing
the download, the default Timeout value for summary queries is set to 300 secs, unlike
other queries (5 secs). In some cases, you may need to specify an even larger Timeout.

To reduce processing time, numeric codes (e.g., Exchange, TradedMarket and NAICS) are not
interpreted into textual form, unlike the corresponding real-time snapshot (§4.1) and
fundamental (§4.2) queries. Use a lookup query (§8) to fetch a description of such codes.

The returned data can be filtered based on multiple criteria, effectively serving as a
market scanner (for the latest data by default, or for any other historic date). This is
done by setting the Filter parameter to the relevant criteria. For example, to return all
NYSE equities whose latest market capitalization is larger than $5Bn, we set a condition
on the MarketCap data field (which reports values in $Mn, so $5Bn=5000):
data = IQML('summary', 'SecType','Equity', 'DataType','fundamental', ...
'Exchange','NYSE', 'Filter','MarketCap>5000');

This query only returns 1398 equities, compared to the unfiltered 4749. Multiple filter
criteria can be specified using a cell-array. For example (this returns just 100 equities):
data = IQML('summary', 'SecType','Equity', 'DataType','fundamental', ...
'Exchange','NYSE', 'Filter',{'MarketCap>5000','PeRatio<9'});

Multiple filter criteria are AND’ed, meaning that all of the criteria conditions must be
met for a security to be reported. If you want to use an OR condition (for example,
Market-cap>$5B or P/E<9), combine the conditions within a single filter criterion:
data = IQML('summary', 'SecType','Equity', 'DataType','fundamental', ...
'Exchange','NYSE', 'Filter','MarketCap>5000 | PeRatio<9');

In general, any Matlab expression (arithmetic, function etc.) that involves the reported
data field(s) and results in a scalar logical value, is acceptable as Filter critera.

Criteria conditions are case-sensitive and must use exactly the same field names as
the reported data fields, otherwise the criteria will be ignored. For example:
data = IQML('summary', 'SecType','Equity', 'DataType','fundamental', ...
'Exchange','NYSE', 'Filter','marketcap>5000');
Warning: ignoring bad summary filter 'marketcap>5000': Unrecognized function
or variable 'marketcap'
(Type "warning off IQML:summary:filter" to suppress this warning.)

Whenever any field is included in a filter condition, securities that do not have data for
that field (have an empty [] value) will automatically be filtered out of the returned data
– they are considered to have failed the entire condition, even if it was only a part of an
or condition. For example, if your filter condition is MarketCap>5000, then securities
that have MarketCap=[] (i.e. unknown) will not be reported.

Note that the filtering/scanning is not applied at the data source (IQFeed) but rather in
IQML, after the full set of data has been downloaded from IQFeed. Therefore, filtered
queries will always take longer to process than regular (unfiltered) summary queries.
IQML User Guide 60

Note: Market summaries are only available with IQFeed client 6.1 or newer, and only
if you are subscribed to the requested data at DTN and there is a relevant data for
download (summary data is only available for some combinations of SecType and
Exchange). In all other cases, you may receive an error such as one of the following:
The 'summary' query is only supported by IQFeed client 6.1 or newer; you are
using version 6.0.
IQML market summary query error: 50004,User not authorized for market summary
file requested.
IQML market summary query error: 50007,No file available.

A related mechanism for fetching pre-filtered market scans for a select number of
Exchanges and Filters is available by setting DataType='Top'. This scanner type does
not depend on DTN subscription or IQFeed 6.1, and is much faster than snapshot queries.
However, it is limited to just 13 predefined filters and 3 US exchanges (AMEX, NYSE,
NASDAQ), only supports equities, does not provide historic data, and returns only up
to top 50 matching equity symbols61 with a few relevant data fields (far fewer fields
than the snapshot queries), updated every 5 minutes during the trading day:
>> data = IQML('summary', 'DataType','top', 'Exchange','NYSE', 'Filter','active')
data =
50×1 struct array with fields:
...

>> data(1)
ans =
struct with fields:
Last_Update_Time: '2019/07/12 16:25 EST'
Exchange: 'NYSE'
Symbol: 'ABEV'
Company_Name: 'AMBEV S.A.'
Last_Price: 4.84
Previous_Price: 4.95
Price_Change_Dollars: -0.11
Price_Change_Percent: -2.222
Last_Volume: 50633779
Previous_Volume: 27402071
Volume_Change_Percent: 84.78

Several Filter types return additional data fields, depending on the filter. For example:
>> data = IQML('summary', 'DataType','top', 'Filter','volume spike');
>> data(1)
ans =
struct with fields:
Last_Update_Time: '2019/07/16 16:25 EST'
Exchange: 'NYSE'
Symbol: 'CPE'
Company_Name: 'CALLON PETROLEUM'
Last_Price: 5.73
Previous_Price: 5.38
Price_Change_Dollars: 0.35
Price_Change_Percent: 6.506
Last_Volume: 55574971
Previous_Volume: 57244474
Volume_Change_Percent: -2.92
Average_Volume: 8296000
Volume_vs_Avg_Change_Percent: 569.9

61
The reported equities must not only match the predefined Filter condition, but also have a close price > $2 and volume > 0.
IQML User Guide 61

Here’s another example – top NASDAQ equities with last price lower than their VWAP:
>> data = IQML('summary', 'DataType','top', 'Exchange','NASDAQ', ...
'Filter','vwap % down');
>> data(1)
ans =
struct with fields:
Last_Update_Time: '2019/07/16 16:25 EST'
Exchange: 'NASDAQ'
Symbol: 'IMRN'
Company_Name: 'IMMURON LTD ADR'
Last_Price: 4.3
Previous_Price: 2.93
Price_Change_Dollars: 1.37
Price_Change_Percent: 46.758
Last_Volume: 11022919
Previous_Volume: 4704
Volume_Change_Percent: 234230.76
VWAP: 5.427
Last_Minus_VWAP_Chng_Pct: -20.77
Note that the 'Top' query may return empty ([]) data for some combinations of
Exchange and Filter on certain dates, depending on the market data and availability
of the requested scanner on IQFeed’s servers.62 Also note that the reported data may
by up to 5 minutes old during the trading day (depending on the query time).
The following table summarizes the differences between market summary query types:
Snapshot Fundamental Top
DataType 'snapshot' 'fundamental' 'top'
Exchange Multiple Only AMEX, NYSE, NASDAQ
SecType Multiple Only 'equity'
Latest (intra-day) or Only latest (updated every 5
Date
historic (end of day) minutes during the trading day)
Any Matlab function of any Only one of 13 predefined
Filter type
combination of data fields types
Filter combinations Multiple criteria supported Not supported
Historic Date support Yes Not supported (only latest)
Query processing time Tens/hundreds of secs <1 sec
IQFeed client Requires client 6.1 or newer Any (client 5.0 or newer)
Requires an active IQFeed Does not require an active
IQFeed connection
connection (IQConnect login) IQFeed connection
Result data fields Up to 35 fields Up to 47 fields Only 11-13 data fields
All securities that fit the
Result records Only up to the top 50 securities
parameters (many thousands)
Data refresh time Every 5 minutes during the trading day 63

62
As of December 2019, IQFeed has a known server problem causing AMEX data to return no results. See
https://web.archive.org/web/20190907202634/http://www.iqfeed.net/dev/api/stats_doc.txt
63
Except bid/ask, which are reportedly those of the last trade (possibly older than 5 minutes) – see
http://forums.dtn.com/index.cfm?page=topic&topicID=5871
IQML User Guide 62

The following parameters affect market summary data queries:


Parameter Data type Default Description
DataType string 'snapshot' Either 'snapshot', 'fundamental' or 'top'
Exchange string 'NYSE' One of the markets listed in §8.3
One of the security types listed in §8.4.
SecType string 'Equity'
SecType is ignored when DataType='top'
Date for which to fetch the end-of-day
data. See §5.6 for details. Examples:
 737089 (Matlab datenum format)
integer or now  datetime('Jan 29, 2018')
string or (latest  20180129 (yyyymmdd format)
Date datetime available
 '20180129'
object data)  '2018/01/29'
 '2018-01-29'
Date is ignored when DataType='top'
If true, then irrelevant data fields (which
ReportEmptyFields logical false or 0 contain empty [] values for all securities)
are reported; if false (default), they are not
When DataType='top', one of:64
 'active' – most active (highest volume)
 'gainer' – highest positive price $ change
 'loser' – lowest negative price $ change
 '% gainer' – highest pos. price % change
 '% loser' – lowest neg. price % change
string 'active'  '52 week high' – daily high > 52-week
 '52 week low' – daily low < 52-week
 'volume up' – compared to previous
 'volume spike' – compared to average
 'VWAP up' – last price > VWAP
Filter  'VWAP down' – last price < VWAP
 'VWAP % up' – % above VWAP
 'VWAP % down' – % below VWAP
When DataType='snapshot','fundamental':
Zero or more filter criteria (condition
string or strings) – Matlab expression(s) involving
the reported data fields, which result in a
cell-array {}
logical (true/false) value. Examples:
of strings  'MaturityDate > 20241231'
 'MarketCap > 5000 & PeRatio < 9'
 {'MarketCap > 5000', 'Beta >= 1.2'}
Max number of seconds to wait for incoming
Timeout number 300
data (0-9000, where 0 means infinite)

Note: market summary functionality is only available in the Professional IQML license

64
See https://web.archive.org/web/20190907202634/http://www.iqfeed.net/dev/api/stats_doc.txt for details
IQML User Guide 63

In addition to the market summary features above, IQFeed offers hundreds of market
indices, stats, breadths and indicators using dedicated “virtual” symbols. In general,
market indices have a suffix of .X (or .XO for CBOE indices), 65 and calculated
stats/indicators have a suffix of .Z.66 Their current and historic values can be queried
in IQML just as any other symbol, subject to having the necessary DTN data subsc-
ription. Some examples for such symbols:
 NDX.X – NASDAQ 100 index
 SPX.XO – S&P 500 index
 VIX.XO – Volatility index
 TNX.XO – 10-year US T-Note
 NASTRIN.Z – NASDAQ Composite index TRIN (trading index)
 TIQD.Z – NASDAQ Composite index underlying issues ticks decreases
 VILA.Z – LSE underlying issues shares volume increases
 VCNED.Z – NYSE ARCA equity puts contracts volume decreases
 DI6D.Z – S&P 500 issues Dollar volume decreases
 JTFT.Z – FTSE 100 net tick total
 RIRT.Z – Russell 2000 trading index (TRIN)
 SCQIT.Z – NASDAQ index calls trading index (TRIN)
 H30NL.Z – NYSE 30-day new lows
 AI1T.Z – Dow Jones Industrial Average components’ average price
 M200NA.Z – Percent of NYSE stock prices below their 200-day moving avg.
 PREM.Z – E-mini S&P 500 market premium
 FRNT.Z – NYSE new 52-week high/low ratio
 IRGT.Z – NASDAQ Global Select increasing/decreasing issues ratio
 JTQT.Z – NASDAQ net up-down ticks
 JV6T.Z – S&P 500 net puts-calls volume
 TCQID.Z – NASDAQ Composite index calls ticks decreases
 IPCFA.Z – CBOE equity ETFs calls issues increases
 OPNET.Z – NYSE equity (stocks + ETFs) calls open interest total
 @EM.OI.Z or GLB.OI.Z – 1-month Eurodollar future open interest
 @EM.VOL.Z or GLB.VOL.Z – 1-month Eurodollar future total volume

65
https://ws1.dtn.com/IQ/Guide/indices_index.html
66
https://ws1.dtn.com/IQ/Guide/DTNCalculatedIndicators.pdf , https://ws1.dtn.com/IQ/Guide/stats_all.html
IQML User Guide 64

5 Historical and intra-day data


Historical data can be retrieved via the 'history' action, subject to your account
subscription rights, and IQFeed’s pacing limitations. Several data-types are available,
which can be set using the DataType parameter (default: 'day').67
5.1 Daily data
To retrieve historic daily data bars, set DataType to 'd' or 'day' (or just leave this
parameter out, since 'day' is the default data type), and set the asset’s Symbol:
>> data = IQML('history', 'symbol','IBM');
>> data = IQML('history', 'symbol','IBM', 'dataType','day') %equivalent
data =
100×1 struct array with fields:
Symbol
Datestamp
Datenum
High
Low
Open
Close
PeriodVolume
OpenInterest
We received an array of Matlab structs containing daily bars, one per each of the last
N trading days (excluding currently-trading day’s bar for IQFeed clients 6.0 or older;
including the current day’s bar for 6.1 or newer). By default, we receive up to N=100
data bars, ordered from oldest to newest. We ran the query above using IQFeed client
5.2 on March 6, 2018 so we received daily data from 2017-10-10 until 2018-03-05:
>> data(1)
ans =
Symbol: 'IBM'
Datestamp: '2017-10-10'
Datenum: 736978
High: 148.95
Low: 147.65
Open: 147.71
Close: 148.5
PeriodVolume: 4032601
OpenInterest: 0
>> data(end)
ans =
Symbol: 'IBM'
Datestamp: '2018-03-05'
Datenum: 737124
High: 157.49
Low: 153.75
Open: 154.12
Close: 156.95
PeriodVolume: 3670630
OpenInterest: 0
You can aggregate the numeric values into Matlab arrays as follows:
dates = {data.Datestamp}; % cell-array of strings
closes = [data.Close]; % array of numeric values
You can then use these arrays for vectorized processing, plotting etc. For example:
dates2 = datetime(dates); % array of datetime objects
[maxVal, maxIdx] = max(closes); % maximal value and location index
[minVal, minIdx] = min(closes); % minimal value and location index

67
http://iqfeed.net/dev/api/docs/HistoricalviaTCPIP.cfm
IQML User Guide 65

plot(dates2, closes); hold on;


plot(dates2(maxIdx), maxVal, '^g'); % maximal data point – green ▲
plot(dates2(minIdx), minVal, 'vr'); % minimal data point – red ▼

You can change the order at which the data bars are reported, using the DataDirection
parameter (1 means oldest-to-newest (default); -1 means newest-to-oldest):
>> data = IQML('history', 'symbol','IBM', 'dataDirection',-1);
>> data(1)
ans =
Symbol: 'IBM'
Datestamp: '2018-03-05'
Datenum: 737124
High: 157.49
Low: 153.75
Open: 154.12
Close: 156.95
PeriodVolume: 3670630
OpenInterest: 0
It is possible that there may be fewer than N=100 daily bars for an asset. For example,
the symbol @EMF19 (1-month Euro-Dollar Jan 2019 future on CME) started trading
on 2018-01-12, so we only get 35 daily bars when we run the query on 2018-03-06:
>> data = IQML('history', 'symbol','@EMF19');
data =
35×1 struct array with fields:
Symbol
...
You can ask IQFeed to limit the maximal number of data bars (N) using the
MaxItems parameter:
>> data = IQML('history', 'symbol','IBM', 'maxItems',20)
data =
20×1 struct array with fields:
Symbol
...
In this example, data(1).Datestamp='2018-02-05', i.e. 20 trading days ago.
Note that the MaxItems parameter only has an effect if the additional data bars
actually exist. In other words, it controls the maximum number of returned data bars –
the actual number of bars may be less than this value.68

68
For example, IQFeed’s trial account is limited to 1-year of daily data points; IQFeed automatically trims trial-account queries
down to this limit: http://forums.dtn.com/index.cfm?page=topic&topicID=5535
IQML User Guide 66

When the number of data bars that IQFeed sends is very large, it could take a while
for the information to be sent. In such a case, IQML might time-out on the request and
return only partial data. Such a case is detected and reported by IQML:
>> data = IQML('history', 'symbol','IBM', 'maxItems',-1)
Warning: IQML timeout: only partial data is returned: the Timeout parameter
should be set to a value larger than 5
data =
1274×1 struct array with fields:
Symbol
...
As suggested by the message, you can set the Timeout parameter to a high value in
order to allow IQML more time to gather the data before returning the results:
>> data = IQML('history', 'symbol','IBM', 'maxItems',-1, 'timeout',60) %oldest:1/2/96
data =
5577×1 struct array with fields:
Symbol
...
You can also specify a BeginDate/EndDate interval for the returned data. Dates can be
specified in several formats: numeric Matlab datenum (737089), Matlab datetime
object, numeric yyyymmdd (20180129), string ('2018/01/29', '2018-01-29', '20180129').
Note that MaxItems takes precedence over BeginDate, regardless of DataDirection.
For example, if MaxItems=5, you will only get the 5 latest bars, for any BeginDate.69
You can request historical data for multiple symbols at the same time, in a single IQML
command, by specifying a colon-delimited or cell-array list of symbols. For example:
>> data = IQML('history', 'symbol',{'IBM','GOOG','AAPL'}, 'maxItems',20)
>> data = IQML('history', 'symbol','IBM:GOOG:AAPL', 'maxItems',20) %equivalent
The result will be an array of Matlab structs that correspond to the requested symbols
(3 symbols with 20 data-points each, in this example):
data =
20×3 struct array with fields:
Symbol
...
>> data(1,2) % 2nd index (column) is the symbol; GOOG data is in data(:,2)
ans =
struct with fields:
Symbol: 'GOOG'
Datestamp: '2018-07-10'
Datenum: 737251
High: 1159.59
Low: 1149.59
Open: 1156.98
Close: 1152.84
PeriodVolume: 798412
OpenInterest: 0
In certain cases, when you request historic data for multiple symbols, you might
receive a different number of data bars for different symbols, depending on data
availability. In such cases, the result will not be an N-by-M struct array, but a cell
array (one cell for each symbol) that contains struct arrays. For example:
data =
1×3 cell array
{77×1 struct} {100×1 struct} {55×1 struct}

69
Note: Regular IQFeed accounts have access to 15+ years of daily data, but IQFeed limits its trial account to just 365 days of
historical daily data – see https://help.dtniq.com/support-faqs
IQML User Guide 67

IQML queries for multiple symbols or dates (if BeginDate and EndDate are specified)
can be parallelized using the UseParallel parameter, if you have a Professional IQML
license and Matlab’s Parallel Computing Toolbox (§3.6):
>> data = IQML('history', 'UseParallel',true, 'symbol',symbols) %multi-symbols
>> data = IQML('history', 'UseParallel',true, 'symbol','IBM',...
'BeginDate',19900102, 'EndDate',20181028) %date range

By default, IQML reports 9 data fields for each daily history bar: Symbol, Datestamp,
Datenum, High, Low, Open, Close, PeriodVolume, and OpenInterest. If the Fields
parameter is set to an empty value ({} or ''), the current set of fields and the full list of
available fields, are reported (in this case, a Symbol parameter is unnecessary):
>> data = IQML('history', 'fields',{})
data =
struct with fields:
CurrentFields: {1×9 cell}
AvailableFields: {1×9 cell}
>> data.AvailableFields
ans =
1×9 cell array
Columns 1 through 6
{'Symbol'} {'Datestamp'} {'Datenum'} {'High'} {'Low'} {'Open'}
Columns 7 through 9
{'Close'} {'PeriodVolume'} {'OpenInterest'}

If you have the Professional (or trial) IQML license, you can request IQML to report
fewer data fields, and/or change the reported fields order, using the optional Fields
parameter. Fields can be set to any subset of AvailableFields, as either a cell-array of
strings, or as a comma-separated string. All subsequent daily history queries will report
the requested fields, in the specified order, until Fields is changed again. For example:
>> data = IQML('history', 'Symbol','IBM', 'Fields',{'Datenum','Close'})
>> data = IQML('history', 'Symbol','IBM', 'Fields','Datenum,Close') %equivalent
data =
100×1 struct array with fields:
Datenum
Close
>> data(1)
ans =
struct with fields:
Datenum: 737751
Close: 134.34

The order of the specified Fields indicates the order in which the data fields will be
reported. For example, to change the order of the reported data fields above:
>> data = IQML('history', 'Symbol', 'IBM', 'Fields','Close,Datenum ')
data =
100×1 struct array with fields:
Close
Datenum

As noted, Fields can be set to any subset of the AvailableFields. If a bad field is
specified (one which is not available in IQFeed), an error message will be displayed:
>> data = IQML('history', 'Symbol','IBM', 'Fields','Close, xyz')
Error using IQML
Bad field 'xyz' was requested in IQML history command (check the spelling).
Available fields are: Symbol,Timestamp,Datenum,High,Low,Open,Close,...
IQML User Guide 68

As noted above, whenever we change the set of fields (or even just their order), this
new set of fields is used in all subsequent daily history queries in the current Matlab
session.
To revert the reported set of fields to the default set (AvailableFields), set Fields to
'All' (or 'all'):
>> data = IQML('history', 'Symbol','IBM', 'Fields','all')
data =
100×1 struct array with fields:
Symbol
Datestamp
Datenum
High
Low
Open
Close
PeriodVolume
OpenInterest

Note: there are several important differences between the Fields parameter in history queries
and in quotes queries (§4.1):
1. The Symbol field is not mandatory in history queries, and does not necessarily need
to be the first reported data field, unlike in quotes queries.
2. IQML reports all available history data fields by default. You can use the Fields
parameter to reduce the reported data fields, even down to just a single data field. In
contrast, quotes queries report only some of the available fields by default.

The fewer fields that you request, the faster the processing time and the smaller the
memory usage. To improve run-time performance and reduce memory consumption,
request only those data fields that are actually needed by your program.
The following parameters affect daily history data queries:
Parameter Data type Default Description
Limits query to specified symbol(s). Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
(none)
Symbols 70 string or  {'IBM', 'AAPL', 'GOOG'}
cell-array This parameter must be set to valid symbol
of strings name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).
1 Sets the order of data bars in the returned
meaning struct array. One of the following values:
DataDirection integer
oldest first,  1 means oldest-to-newest (default)
newest last  -1 means newest-to-oldest
Report up to specified number of data bars
MaxItems integer 100
(if available). -1 or inf mean all available.

70
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 69

Parameter Data type Default Description


Earliest bar date to report. Examples:
 737089 (Matlab datenum format)
 datetime('Jan 29, 2018')
 20180129 (yyyymmdd format)
integer or '1900/01/01'  '20180129'
string or (i.e., from as  '2018/01/29'
BeginDate  '2018-01-29'
datetime early as data
object is available) Note: if there are more data points than
MaxItems between BeginDate–EndDate,
only the last MaxItems data points (from
EndDate backward) will be returned,
regardless of BeginDate.
integer or '2099/12/31' Latest bar date to report.
EndDate string or (i.e., until See BeginDate parameter above for details.
datetime now)
Max # of seconds to wait for incoming data
Timeout number 5.0
(0-9000, where 0 means infinite)
If set to true or 1, and if Parallel Computing
logical Toolbox is installed, then querying multiple
UseParallel false symbols or dates will be done in parallel
(true/false)
(see §3.6; Professional IQML license only).
Maximal number of parallel workers to use
(the current (up to the current pool size) when UseParallel
integer
MaxWorkers parallel pool
=true. Note: increased parallelization might
(1-∞) size, up to 15)
cause IQFeed run-time throttling errors.
Sets the list of data fields reported by IQML
for each data bar, as a sub-set of IQFeed’s
default set of 9 fields.
If Fields is set to an empty value ({} or ''),
colon or 'Symbol, the list of current, available fields is returned.
comma- Datestamp, If Fields is not empty, subsequent history
Datenum, queries in the same Matlab session will
separated
Fields High, Low,
return the specified fields, in the specified
string, or Open, Close,
cell-array PeriodVolume, order (Professional IQML license only).
of strings OpenInterest' Examples:
 'Datestamp:Open:Close'
 'Datestamp,Open,Close'
 {'Datestamp', 'Open', 'Close'}
 'All' (indicates all available fields)
'' When Progress is set to 'console', the data
Progress string (empty download progress is displayed in the
string) console. See §5.4 for details.
IQML User Guide 70

5.2 Weekly data


To retrieve historic weekly data bars, set DataType to 'w' or 'week':
>> data = IQML('history', 'symbol','FB', 'dataType','week')
data =
100×1 struct array with fields:
Symbol
Datestamp
Datenum
High
Low
Open
Close
PeriodVolume
OpenInterest

As with the daily bars, we received an array of Matlab structs containing weekly bars,
one per each of the last N weeks (excluding currently-trading day for IQFeed clients
6.0 or older; including the current day for 6.1 or newer). By default we receive up to
N=100 data bars (~2 years), ordered from oldest to newest. We ran the query above
on Tuesday March 6, 2018 using IQFeed client 5.2 so we received weekly data from
Friday 2016-04-15 (the data bar for April 11-15, 2016) until 2018-03-05 (the data bar
for Monday March 5, 2018 only, excluding March 6). Each bar’s Datestamp indicates
the end-date of the bar. Note that all data bars except for the latest have a Friday date.
As with the daily bars, you can change the data bars order, using the DataDirection
parameter (1 means oldest-to-newest (default); -1 means newest-to-oldest).
>> data = IQML('history', 'symbol','FB', 'dataType','week', 'dataDirection',-1);
As with the daily bars, you can ask IQFeed to limit the maximal number of data bars
(N) using the MaxItems parameter:
>> data = IQML('history', 'symbol','FB', 'dataType','week', 'maxItems',20);
In this example, data(1).Datestamp='2017-10-27', i.e. the Friday 20 weeks ago.
As with the daily bars, you can set the Timeout parameter to a high value in order to
allow IQML more time to gather data before returning the results. This is typically not
necessary for weekly data requests, because of the relatively small amount of data.
You can also specify a BeginDate for the returned data. Dates can be specified in various
formats: as a numeric Matlab datenum (737089), a Matlab datetime object, numeric
yyyymmdd (20180129), or as a string ('2018/01/29', '2018-01-29', '20180129').71
For example, if we a query with a BeginDate of Monday Jan 29, 2018, we will receive
data bars starting on Friday Feb 2, 2018 (which includes the weekly data of Jan 29):
>> data = IQML('history','symbol','FB','dataType','week','BeginDate',20180129);
Note: IQFeed clients 6.0 or earlier do not report a data bar for the currently-trading day;
clients 6.1 or newer do report a data bar that includes the current trading day.
Also note that MaxItems has precedence over BeginDate, regardless of DataDirection.
For example, if MaxItems=5, we’ll only get the 5 latest bars, even if there are more
than 5 weeks between BeginDate and EndDate.

71
Note: Regular IQFeed accounts can access 15+ years of historic data, but IQFeed limits trial accounts to just one year – see
https://help.dtniq.com/support-faqs. Also note that in some cases, depending on current day-of-week compared to the requested
BeginDate, an addidional (older) bar might be returned that includes the week that was prior to the requested BeginDate.
IQML User Guide 71

As with daily data requests, you can request historical data for multiple symbols at the
same time, in a single IQML command, by specifying a colon-delimited or cell-array
list of symbols. For example:
>> data = IQML('history', 'symbol',{'IBM','GOOG','AAPL'}, ...
'dataType','week', 'maxItems',20)
>> data = IQML('history', 'symbol','IBM:GOOG:AAPL', ...
'dataType','week', 'maxItems',20) %equivalent
The result will be an array of Matlab structs that correspond to the requested symbols
(3 symbols with 20 data-points each, in this example):
data =
20×3 struct array with fields:
Symbol
Datestamp
...
In certain cases, when you request historic data for multiple symbols, you might
receive a different number of data bars for different symbols, depending on data
availability. In such cases, the result will not be an N-by-M struct array, but a cell
array (one cell for each symbol) that contains struct arrays. For example:
data =
1×3 cell array
{77×1 struct} {100×1 struct} {55×1 struct}

IQML queries for multiple symbols can be parallelized using the UseParallel parameter, if
you have a Professional IQML license and Matlab’s Parallel Computing Toolbox (§3.6):
>> data = IQML('history', 'symbol',symbols, 'UseParallel',true, ...
'dataType','week', 'maxItems',20)

By default, IQML reports 9 data fields for each weekly history bar: Symbol,
Datestamp, Datenum, High, Low, Open, Close, PeriodVolume, and OpenInterest.
If the Fields parameter is set to an empty value ({} or ''), the current set of fields and the
full list of available fields, are reported (in this case, a Symbol parameter is unnecessary).
If you have the Professional (or trial) IQML license, you can request IQML to report
fewer data fields, and/or change the reported fields order, using the optional Fields
parameter. All subsequent weekly history queries will report only the requested
fields, in the specified order. Fewer fields mean faster processing time and smaller
memory usage. Refer to §5.1 for a description of the Fields parameter usage.
The following parameters affect weekly history data queries:
Parameter Data type Default Description
Limits the query to the specified symbol(s).
Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
(none)
Symbols 72 string or
 {'IBM', 'AAPL', 'GOOG'}
cell-array
This parameter must be set to valid symbol
of strings
name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).

72
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 72

Parameter Data type Default Description


1 Sets the order of data bars in the returned
meaning oldest struct array. One of the following values:
DataDirection integer  1 means oldest-to-newest (default)
bar is first,
newest is last  -1 means newest-to-oldest
Reports up to specified number of data bars
MaxItems integer 100 (if available). -1 or inf mean all available.
Earliest bar to report. Examples:
 737089 (Matlab datenum format)
 datetime('Jan 29, 2018')
 20180129 (yyyymmdd format)
integer or '1900/01/01'  '20180129'
string or (i.e., from as  '2018/01/29'
BeginDate
datetime early as data  '2018-01-29'
object is available) Note: if there are more data points than
MaxItems between BeginDate and
EndDate, only the latest MaxItems data
points (from EndDate backward) will be
returned, regardless of BeginDate.
integer or '2099/12/31' Latest bar date to report.
EndDate string or (i.e., until See BeginDate parameter above for details.
datetime now)
Max number of seconds to wait for incoming
Timeout number 5.0
data (0-9000, where 0 means infinite)
If set to true or 1, and if Parallel Computing
logical Toolbox is installed, then querying multiple
UseParallel false
(true/false) symbols will be done in parallel (see §3.6;
Professional IQML license only).
(the current Max number of parallel workers to use (up
integer
MaxWorkers parallel pool to the current pool size) when UseParallel=1
(1-∞) size, up to 15) Increased parallelization might cause errors.
Sets the list of data fields reported by IQML
for each data bar, as a sub-set of IQFeed’s
default set of 9 fields.
If Fields is set to an empty value ({} or ''),
colon or 'Symbol, the list of current, available fields is returned.
comma- Datestamp, If Fields is not empty, subsequent history
Datenum,
separated queries in the same Matlab session will
Fields High, Low,
string, or Open, Close, return the specified fields, in the specified
cell-array PeriodVolume, order (Professional IQML license only).
of strings OpenInterest' Examples:
 'Datestamp:Open:Close'
 'Datestamp,Open,Close'
 {'Datestamp', 'Open', 'Close'}
 'All' (indicates all available fields)
IQML User Guide 73

5.3 Monthly data


To retrieve historic monthly data bars, set DataType to 'm' or 'month':
>> data = IQML('history', 'symbol','FB', 'dataType','month')
data =
100×1 struct array with fields:
Symbol
Datestamp
Datenum
High
Low
Open
Close
PeriodVolume
OpenInterest
As with the daily bars, we received an array of Matlab structs containing monthly
bars, one per each of the last N months (excluding currently-trading day for IQFeed
clients 6.0 or older; including the current day for IQFeed clients 6.1 or newer). By
default we receive up to N=100 data bars (~8 years), ordered from oldest to newest.
We ran the example query above on March 6, 2018 using IQFeed client 5.2 so we
received monthly data from 2009-12-31 (the data bar for 12/2009) until 2018-03-05
(the data bar for March 2018 up to March 5, 2018, excluding data from March 6).
As with the daily bars, you can change the data bars order, using the DataDirection
parameter (1 means oldest-to-newest (default); -1 means newest-to-oldest).
>> data = IQML('history', 'symbol','FB', 'dataType','month', ...
'dataDirection',-1);
As with the daily bars, you can ask IQFeed to limit the maximal number of data bars
(N) using the MaxItems parameter:
>> data = IQML('history', 'symbol','FB', 'dataType','month', 'maxItems',20);
In this example, data(1).Datestamp='2016-08-31', i.e. 20 months ago.
As with the daily bars, you can set the Timeout parameter to a high value in order to
allow IQML more time to gather data before returning the results. This is typically not
necessary for monthly data requests, because of the relatively small amount of data.
You can also specify a BeginDate for the returned data. Dates can be specified in various
formats: as a numeric Matlab datenum (737089), a Matlab datetime object, numeric
yyyymmdd (20180129), or as a string ('2018/01/29', '2018-01-29', '20180129').
For example, if we a query with a BeginDate of Jan 29, 2018, we will receive data
bars starting on Jan 31, 2018 (which includes the monthly data of Jan 29):
>> data = IQML('history','symbol','FB','dataType','month','BeginDate',20180129);
Note: IQFeed clients 6.0 or earlier do not report a data bar for the currently-trading day;
clients 6.1 or newer do report a data bar that includes the current trading day.
Also note that MaxItems has precedence over BeginDate, regardless of DataDirection.
For example, if MaxItems=5, we’ll only get the 5 latest bars, even if there are more
than 5 months between BeginDate and EndDate.73

73
Note: Regular IQFeed accounts can access 15+ years of historic data, but IQFeed limits trial accounts to just one year – see
https://help.dtniq.com/support-faqs
IQML User Guide 74

As with daily data requests, you can request historical data for multiple symbols at the
same time, in a single IQML command, by specifying a colon-delimited or cell-array
list of symbols. For example:
>> data = IQML('history', 'symbol',{'IBM','GOOG','AAPL'}, ...
'dataType','month', 'maxItems',20)
>> data = IQML('history', 'symbol','IBM:GOOG:AAPL', ...
'dataType','month', 'maxItems',20) %equivalent
The result will be an array of Matlab structs that correspond to the requested symbols
(3 symbols with 20 data-points each, in this example):
data =
20×3 struct array with fields:
Symbol
Datestamp
...
In certain cases, when you request historic data for multiple symbols, you might
receive a different number of data bars for different symbols, depending on data
availability. In such cases, the result will not be an N-by-M struct array, but a cell
array (one cell for each symbol) that contains struct arrays. For example:
data =
1×3 cell array
{77×1 struct} {100×1 struct} {55×1 struct}

IQML queries for multiple symbols can be parallelized using the UseParallel parameter, if
you have a Professional IQML license and Matlab’s Parallel Computing Toolbox (§3.6):
>> data = IQML('history', 'symbol',symbols, 'UseParallel',true, ...
'dataType','month', 'maxItems',20)

By default, IQML reports 9 data fields for each monthly history bar: Symbol,
Datestamp, Datenum, High, Low, Open, Close, PeriodVolume, and OpenInterest.
If the Fields parameter is set to an empty value ({} or ''), the current set of fields and the
full list of available fields, are reported (in this case, a Symbol parameter is unnecessary).
If you have the Professional (or trial) IQML license, you can request IQML to report
fewer data fields, and/or change the reported fields order, using the optional Fields
parameter. All subsequent monthly history queries will report only the requested
fields, in the specified order. Fewer fields mean faster processing time and smaller
memory usage. Refer to §5.1 for a description of the Fields parameter usage.
The following parameters affect monthly history data queries:
Parameter Data type Default Description
Limits the query to the specified symbol(s).
Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
(none)
Symbols 74 string or
 {'IBM', 'AAPL', 'GOOG'}
cell-array
This parameter must be set to valid symbol
of strings
name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).

74
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 75

Parameter Data type Default Description


1 Sets the order of data bars in the returned
meaning oldest struct array. One of the following values:
DataDirection integer bar is first,  1 means oldest-to-newest (default)
newest is last  -1 means newest-to-oldest
Returns up to the specified number of data
MaxItems integer 100
bars (if available). -1 means all available.
Earliest bar that includes a date. Examples:
 737089 (Matlab datenum format)
 datetime('Jan 29, 2018')
 20180129 (yyyymmdd format)
integer or '1900/01/01'  '20180129'
BeginDate
string or (i.e., from as  '2018/01/29'
datetime early as data  '2018-01-29'
object is available) Note: if there are more data points than
MaxItems between BeginDate and
EndDate, only the last MaxItems data
points (from EndDate backward) will be
returned, regardless of BeginDate.
integer or '2099/12/31' Latest bar date to report.
EndDate string or (i.e., until See BeginDate parameter above for details.
datetime now)
Timeout number 5.0 Max number of seconds to wait for incoming
data (0-9000, where 0 means infinite)
If set to true or 1, and if Parallel Computing
logical Toolbox is installed, then querying multiple
UseParallel false
(true/false) symbols will be done in parallel (see §3.6;
Professional IQML license only).
(the current Max number of parallel workers to use (up
integer
MaxWorkers parallel pool to the current pool size) when UseParallel=1
(1-∞) size, up to 15) Increased parallelization might cause errors.
Sets the list of data fields reported by IQML
for each data bar, as a sub-set of IQFeed’s
default set of 9 fields.
If Fields is set to an empty value ({} or ''),
colon or 'Symbol, the list of current, available fields is returned.
comma- Datestamp,
Datenum,
If Fields is not empty, subsequent history
separated
Fields High, Low, queries in the same Matlab session will
string, or Open, Close, return the specified fields, in the specified
cell-array PeriodVolume, order (Professional IQML license only).
of strings OpenInterest' Examples:
 'Datestamp:Open:Close'
 'Datestamp,Open,Close'
 {'Datestamp', 'Open', 'Close'}
 'All' (indicates all available fields)
IQML User Guide 76

5.4 Interval data


To retrieve historic data bars having a custom width, possibly as short as a single
second, set DataType to 'i' or 'interval', and set the asset’s Symbol:
>> data = IQML('history', 'symbol','FB', 'dataType','interval')
data =
100×1 struct array with fields:
Symbol
Timestamp
Datenum
High
Low
Open
Close
TotalVolume
PeriodVolume
NumberOfTrades
>> data(end)
ans =
Symbol: 'IBM'
Timestamp: '2018-03-07 09:43:00'
Datenum: 737126.404861111
High: 156.97
Low: 156.77
Open: 156.83
Close: 156.77
TotalVolume: 215082
PeriodVolume: 16080
NumberOfTrades: 0
The returned data struct here is similar to the struct returned by the daily, weekly and
monthly historical data queries. Unlike those queries, interval-query result does not
include an OpenInterest field, but does include two new fields: TotalVolume (which
indicates the total daily volume up to that bar), and NumberOfTrades. Also note that we
get a Timestamp field (US Eastern timezone), not Datestamp as with other history queries.
Bars that had no trading action are not reported. In the example query above, we see
the following Timestamp values, where we clearly see a gap during non-trading hours:
>> {data.Timestamp}'
ans =
100×1 cell array
{'2018-03-06 14:59:00'}
{'2018-03-06 15:00:00'}
{'2018-03-06 15:01:00'}
... % contiguous data bars
{'2018-03-06 15:59:00'}
{'2018-03-06 16:00:00'}
{'2018-03-06 16:03:00'}
{'2018-03-06 16:11:00'}
...
{'2018-03-07 08:45:00'}
{'2018-03-07 09:22:00'}
{'2018-03-07 09:31:00'}
{'2018-03-07 09:32:00'}
... % contiguous data bars
{'2018-03-07 09:43:00'}
{'2018-03-07 09:44:00'}

As with the other queries, the current (partial) interval bar is never reported, nor bars
that have no data (e.g., 16:04-16:10, 8:34-8:44, 8:46-9:21 in the example above).
IQML User Guide 77

The default interval size is 60 secs (aligned on the full-minute mark). You can specify
different interval sizes using the IntervalSize parameter. For example, a 15-sec interval:
>> data=IQML('history','symbol','FB','dataType','interval','intervalSize',15);

IQFeed is smart enough to automatically align data bars to full minutes/hours when
the requested IntervalSize enables this (as is the case for 15 or 60-sec intervals). For
example, with 15-sec IntervalSize we may get bars for 10:04:30, 10:04:45, 10:05:00.
When such alignment is not possible, you will get non-aligned bars. For example,
with a 13-sec IntervalSize: 09:59:18, 09:59:31, 09:59:57, 10:00:10.
By default, IntervalSize specifies the interval’s size in seconds and all the bars have
this same duration. You can change this by setting the IntervalType parameter
(default: 'secs') to 'volume' or 'ticks'/'trades'. Naturally, if you change IntervalType,
the data bars will now have non-equal durations.
>> data = IQML('history', 'symbol','FB', 'dataType','interval', ...
'intervalType','ticks');

The IntervalType (default: 'secs') and IntervalSize (default: 60) parameters should
typically be specified together. Note that IntervalSize must be a positive integer
value (i.e. its value cannot be 4.5 or 0). If IntervalType is 'ticks'/'trades', IntervalSize
must be 2 or higher; If IntervalType is 'volume', IntervalSize must be 100 or higher;
If IntervalType is 'secs', IntervalSize must be between 1 and 86400 (1 day).75
By default, IQML reports data in intervals whose labels are set at the end of the
interval. For example, a data item at 11:12:34 with IntervalSize=60 (1 minute) will
be included in the interval labeled ‘11:13:00’. You can modify this default behavior
by setting the LabelAtBeginning parameter to 1 (or true), so that the labels are set at
the beginning. In this example, the data item will be reported in the ‘11:12:00’ interval.
Note: using LabelAtBeginning parameter requires IQFeed client version 6.0 or newer.
By default, IQML only reports interval data from today. This means that if you run a
query during the weekend, you will not see any data:76
>> data = IQML('history', 'symbol','FB', 'dataType','interval')
data =
1×0 empty double row vector

You can ask to see additional (older) calendar days by specifying a positive Days
parameter value. If you set Days to -1, then all available information will be reported,
subject to the other filter criteria.
Similarly, you can specify a date/time window for the returned data: only bars
between the specified BeginDateTime and EndDateTime (US Eastern time) will be
reported, regardless of the value of the Days parameter.
Note: queries having UseParallel=true are only parallelized if BeginDateTime is
specified, or if multiple Symbols are specified (see below). Single-Symbol queries
that have an empty (unspecified) BeginDateTime are not parallelizable.

75
Note that IQFeed’s limitations on live 'secs' interval bars (§4.3, §6.3) are stricter than the limitations on historical interval bars:
http://forums.dtn.com/index.cfm?page=topic&topicID=5529
76
IQML versions up to 2.42 reported a NO_DATA error in such cases; IQML returns [] without an error in version 2.43 or newer.
IQML User Guide 78

In addition, you can specify a daily time-window: only bars between BeginFilterTime
and EndFilterTime in each day (US Eastern time-zone) will be reported. This could
be useful, for example, to limit the results only to the regular trading hours.

As with the daily bars, you can change the data bars order, using the DataDirection
parameter (1 means oldest-to-newest (default); -1 means newest-to-oldest).
>> data=IQML('history','symbol','FB','dataType','interval','dataDirection',-1);

As with the daily bars, you can ask IQFeed to limit the maximal number of data bars
(N) using the MaxItems parameter:
>> data = IQML('history', 'symbol','FB', 'dataType','interval', 'maxItems',20);

Note that MaxItems takes precedence over BeginDateTime, regardless of


DataDirection. For example, if MaxItems=5, you will only get the 5 latest bars
(before EndDateTime), regardless of the specified BeginDateTime.

As with the daily bars, you can set the Timeout parameter to a high value in order to
allow IQML more time to gather data before returning the results (or set to -1 to
disable the timeout entirely). This is especially important for historic interval and
ticks data queries, since they could return a huge number of data points, which can
take a lot of time to download and process.

In addition to Timeout, for long queries it is advisable to set the Progress parameter
to 'console', in order to display a periodic progress update message in the console
every 1000 data points (every ~1-2 secs), as well as at the end of the query:
>> data = IQML('history', 'symbol','IBM', 'dataType','interval', ...
'IntervalType','ticks', 'IntervalSize',10, ...
'BeginDateTime','20200623 100000', ...
'EndDateTime', '20200623 160000', ...
'MaxItems',-1, 'timeout',-1, 'progress','console');
1000 history data points processed for IBM. Latest: 2020-06-23 13:30:42 ...
2000 history data points processed for IBM. Latest: 2020-06-23 15:34:06 ...
2460 history data points processed for IBM. Latest: 2020-06-23 15:59:59

As with daily data requests, you can request historical data for multiple symbols at the
same time, in a single IQML command, by specifying a colon-delimited or cell-array
list of symbols. For example:
>> data = IQML('history', 'symbol',{'IBM','GOOG','AAPL'}, ...
'dataType','interval', 'maxItems',20)
>> data = IQML('history', 'symbol','IBM:GOOG:AAPL', ...
'dataType','interval', 'maxItems',20) %equivalent

The result will be an array of Matlab structs that correspond to the requested symbols
(3 symbols with 20 data-points each, in this example):
data =
20×3 struct array with fields:
Symbol
Datestamp
...
IQML User Guide 79

In certain cases, when you request historic data for multiple symbols, you might
receive a different number of data bars for different symbols, depending on data
availability. In such cases, the result will not be an N-by-M struct array, but a cell
array (one cell for each symbol) that contains struct arrays. For example:
data =
1×3 cell array
{77×1 struct} {100×1 struct} {55×1 struct}

IQML queries for multiple symbols or a date/time range (i.e., if BeginDateTime is


specified) can be parallelized using the UseParallel parameter, if you have a
Professional IQML license and Matlab’s Parallel Computing Toolbox (see §3.6):
>> data = IQML('history', 'dataType','interval', 'UseParallel',true, ...
'symbol',symbols) % multiple symbols parallelized
>> data = IQML('history', 'dataType','interval', 'UseParallel',true, ...
'symbol','IBM' ,... % single-symbol date-range parallelized
'BeginDateTime',20181026100000, ...
'EndDateTime', 20181026110000)

In some cases, users may be tempted to use the historical data mechanism to retrieve
real-time data. This is relatively easy to set-up. For example, using an endless Matlab
loop that sleeps for 60 seconds, requests the latest historical data for the past minute
and then goes to sleep again, or using a periodic timer object that wakes up every
minute. In such cases, consider using streaming rather than historical queries (see §6).
Some software vendors make a distinction between intra-day and historical
information. However, as far as IQFeed and IQML are concerned, this is merely a
semantic difference and there is no practical difference.
Note: IQFeed limits interval data to the past 180 calendar days if you make the
request outside trading hours, but just past 8 days for requests during US trading
hours (9:30-16:30 US Eastern time, Mon-Fri). So, if you request month-old data during
trading hours you will get empty results, even if the request was just for a single hour.77
The only exception to the 8/180-day limitation are interval bars of full minutes
(IntervalType='secs' and IntervalSize a multiple of 60), since these bars are pre-
computed and have a lesser impact on IQFeed’s servers. The other interval types are
computed on-the-fly from tick data, and so are limited in duration in order not to
overload IQFeed’s servers, especially during trading hours when server load is high.
IQFeed imposes other limitations based on interval size: minute data is only available
since 2005-2007;78 longer intervals (daily/weekly/monthly) can access up to 15+ years.79
IQFeed subscriptions for daily and intra-day data are different. If you only subscribed
for daily data, you will receive a run-time error when fetching intra-day interval data:
IQML historic data query (EURGBP.FXCM) error: Unauthorized user ID
(your IQFeed account is not authorized for this data)

77
The above is true for IQFeed regular accounts; IQFeed trial accounts are limited to only 4 days of intraday data and just one
year of daily data (see https://help.dtniq.com/support-faqs)
78
Specifically for minute (60 sec) intervals, IQFeed’s developer FAQ indicates that “Minute interval data dating back to mid
2005 for select contracts and mid 2007 for all others [is available]”.
79
Again, these values are for regular IQFeed accounts; IQFeed limits trial accounts (see note #77 above)
IQML User Guide 80

Also note that IQFeed’s interval data typically exclude irregular “O” trades (see §5.5).

By default, IQML reports 10 data fields for each interval bar: Symbol, Timestamp,
Datenum, High, Low, Open, Close, TotalVolume, PeriodVolume, and NumberOfTrades.
If the Fields parameter is set to an empty value ({} or ''), the current set of fields and the
full list of available fields, are reported (in this case, a Symbol parameter is unnecessary).
If you have the Professional (or trial) IQML license, you can request IQML to report
fewer data fields, and/or change the reported fields order, using the optional Fields
parameter. All subsequent interval history queries will report only the requested
fields, in the specified order. Fewer fields mean faster processing time and smaller
memory usage. Refer to §5.1 for a description of the Fields parameter usage.

Finally, note that whereas sub-daily data may report data from non-trading days (e.g.,
Sunday night, when ES starts trading), these are typically added to the following
trading day’s bar with daily/weekly/monthly bars.80

80
http://forums.dtn.com/index.cfm?page=topic&topicID=5608
IQML User Guide 81

The following parameters affect interval history data queries:


Parameter Data type Default Description
Limits the query to the specified symbol(s).
Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
(none)
Symbols 81 string or
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings This parameter must be set to valid symbol
name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).

1, meaning Sets the order of data bars in the returned


oldest bar is struct array. One of the following values:
DataDirection integer
first, newest  1 means oldest-to-newest (default)
is last  -1 means newest-to-oldest
LabelAtBeginn logical  0: data at 11:17:41 is reported as ‘11:18’
false
ing (true/false)  1: same data is reported as ‘11:17’
Returns up to the specified number of data
MaxItems integer 100 bars (if available). -1 means all available.
Number of preceding calendar days to
1 process. -1 means unlimited (all available
Days integer meaning data, subject to the other criteria), 1 means
today only today, 2 means today & yesterday, etc.

Sets the type of interval size. One of the


following values:
IntervalType string 'secs'  's' or 'secs' – time [seconds] (default)
 'v' or 'volume' – traded volume
 't', 'trades' or 'ticks' – number of ticks
Size of bars in IntervalType units. Must be
IntervalSize integer 60 ≥1 for secs, ≥2 for ticks, ≥100 for volume bars
Only return bars that begin after this time of
day (US Eastern time-zone). Only relevant
BeginFilterTime string '00:00:00' when Days>0 or BeginDateTime is not ''.
Format: hhmm, hh:mm, hhmmss or hh:mm:ss
Only return bars that end before this time of
day (US Eastern time-zone). Only relevant
EndFilterTime string '23:59:59'
when Days>0 or BeginDateTime is not ''.
Format: hhmm, hh:mm, hhmmss or hh:mm:ss

81
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 82

Parameter Data type Default Description


Only return bars that begin after this
date/time (US Eastern time-zone).
'' Overrides the Days parameter.
(empty Format: Matlab datenum, or 'yyyymmdd
integer or string) hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.
string or meaning
BeginDateTime datetime Note: MaxItems has precedence over
from as
object BeginDateTime: If there are more data
early as
points than MaxItems between Begin/
data is
EndDateTime, only the last MaxItems
available
data points (from EndDateTime backward)
are returned, regardless of BeginDateTime.
'' Only return bars that end before this
integer or date/time (US Eastern time-zone).
(empty
string or Overrides the Days parameter.
EndDateTime string)
datetime
meaning Format: Matlab datenum, or 'yyyymmdd
object
now hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.
Max number of seconds to wait for incoming
Timeout number 5.0
data (0-9000, where 0 means infinite)
If true or 1, and Parallel Computing Toolbox
logical is installed, then querying multiple symbols
UseParallel false
(true/false) or a date/time range will be done in parallel
(see §3.6; Professional IQML license only).
Maximal number of parallel workers to use
(the current (up to the current pool size) when UseParallel
integer
MaxWorkers parallel pool
(1-∞) size, up to 15) =true. Note: increased parallelization might
cause IQFeed run-time throttling errors.
Sets the list of data fields reported by IQML
for each data bar, as a sub-set of IQFeed’s
default set of 10 fields.
'Symbol,
If Fields is set to an empty value ({} or ''),
colon or Timestamp, the list of current, available fields is returned.
comma- Datenum, If Fields is not empty, subsequent history
High, Low, queries in the same Matlab session will
separated
Fields Open, Close,
string, or TotalVolume, return the specified fields, in the specified
cell-array PeriodVolume order (Professional IQML license only).
of strings NumberOf- Examples:
Trades'
 'Timestamp:Open:Close'
 'Timestamp,Open,Close'
 {'Timestamp', 'Open', 'Close'}
 'All' (indicates all available fields)
'' When Progress is set to 'console', the down-
Progress string (empty
string) load progress is displayed in the console.
IQML User Guide 83

5.5 Tick data


Unlike data bars, which aggregate ticks and provide summary information, it is also
possible to retrieve historic individual trades (“ticks”). To retrieve this data, set
DataType to 't' or 'ticks', and set the asset’s Symbol:
>> data = IQML('history', 'symbol','AAPL', 'dataType','ticks')
data =
100×1 struct array with fields:
Symbol
Timestamp
Datenum
Last
LastSize
TotalVolume
Bid
Ask
TickID
BasisForLast
TradeMarketCenter
TradeConditions
TradeAggressorCode
DayOfMonth
BasisDescription
TradeMarketName
TradeDescription
AggressorDescription
>> data(end)
ans =
Symbol: 'AAPL'
Timestamp: '2019-10-04 09:45:03.862626'
Datenum: 737702.406294699
Last: 224.67
LastSize: 100
TotalVolume: 5226196
Bid: 224.66
Ask: 224.68
TickID: 7432
BasisForLast: 'C'
TradeMarketCenter: 19
TradeConditions: '01'
TradeAggressorCode: 0
DayOfMonth: 4
BasisDescription: 'Last qualified trade'
TradeMarketName: 'Nasdaq Trade Reporting Facility (NTRF)'
TradeDescription: 'Normal Trade'
AggressorDescription: 'Unknown/unsupported'
The data struct here is quite different than the historical bar queries above. Notice the
Timestamp field, specified in micro-second precision (US Eastern time-zone). See a
discussion of the time resolution in the next page. The DayOfMonth, TradeAggressorCode
and AggressorDescription fields only appear if you use IQFeed client 6.1 or newer.
Note that the textual Description fields depend on the MsgParsingLevel parameter
having a value of 2 or higher (see §3.2 and §8)
Also note that only trade ticks are provided, along with the Bid and Ask prices at the
time of the trade. IQFeed does not report historic non-trading ticks (i.e., Bid/Ask
changes that occurred between the trades).
The Last and LastSize fields typically refer to the last trade. The type (“basis”) of
data in these fields is determined according to the BasisForLast field, which is
IQML User Guide 84

explained in the BasisDescription field for convenience.82 Possible basis values are:83
 C – Last qualified trade.
 E – Extended trade = form T trade.
 O – Other trade = any trade not accounted for by C or E.
 S – Settle = daily settle (only applicable to commodities).
In general, algo-trading should rely only on “C” trades, and potentially also “E”
trades. “O” trades often have wide price swings (i.e. large variation from mainstream
trading prices); this adds noise to charts and may confuse data analytics.84 IQFeed’s
interval data (§5.4) typically exclude such irregular “O” trades.
Note that the difference between TotalVolume values from one tick to the next does not
always equal LastSize, since some trade types (e.g. implied and block trades) are not
reported with a separate tick, but are included in the next tick’s TotalVolume.85
Also note that TickID values are not always increasing, and almost never contiguous.
They are generally provided by the exchange as unique trade identifiers and so should
not be used as an indicator of missing data, and their order is not quarantined. Instead,
it is better to rely on the Timestamp or Datenum fields.
In some cases, implied (rather than normal trade) ticks are reported. For example, the
following tick was retrieved for the VIX index continuous future (@VX#):
>> data = IQML('history', 'symbol','@VX#', 'dataType','ticks');
>> data(1)
ans =
Symbol: '@VX#'
Timestamp: '2019-10-04 09:42:41.499000'
Datenum: 737702.404646979
Last: 18.68
LastSize: 1
TotalVolume: 16711
Bid: 18.65
Ask: 18.7
TickID: 6118279
BasisForLast: 'O'
TradeMarketCenter: 32
TradeConditions: '4D'
TradeAggressorCode: 0
DayOfMonth: 4
BasisDescription: 'Other trade = any trade not accounted for by C or E'
TradeMarketName: 'CBOE Futures Exchange (CFE)'
TradeDescription: 'Implied'
AggressorDescription: 'Unknown/unsupported'
Note that in the case of @VX# on CBOE, the ticks are only reported in millisecond
resolution, not microseconds as for IBM. In this case, Timestamp still shows 6 digits
after the seconds decimal, but they always end in 000 (…:57.899000). The actual
time resolution of reported ticks depends on the specific exchange and security type.86

82
Note that the textual Description fields depend on the MsgParsingLevel parameter having a value of 2 or higher (see §3.2)
83
Other tick types (basis codes) are NOT reported by IQFeed: http://forums.dtn.com/index.cfm?page=topic&topicID=5783
(these other tick types are usually rare). Additional tick types may possibly be added by IQFeed in the future.
84
http://forums.iqfeed.net/index.cfm?page=topic&topicID=3898
85
http://forums.dtn.com/index.cfm?page=topic&topicID=5855
86
Micro-second resolution is only available with IQFeed client 5.2 or newer, and only in certain setups (e.g. CMEGroup and
equity markets). Contact IQFeed support if you are unsure about the resolution provided by a certain setup configuration.
IQML User Guide 85

By default, IQML only reports ticks data from today. This means that if you run a
query during the weekend or any other non-trading day, you will not see any data:87
>> data = IQML('history', 'symbol','FB', 'dataType','ticks')
data =
1×0 empty double row vector

You can ask to see additional (older) calendar days by specifying a positive Days
parameter value. If you set Days to -1, then all available information will be reported,
subject to the other filter criteria.
Similarly, you can specify a date/time window for the returned data: only bars
between the specified BeginDateTime and EndDateTime (both of them US Eastern
time-zone) will be reported, regardless of the value of the Days parameter.
Note: queries having UseParallel=true are only parallelized if BeginDateTime is
specified, or if multiple Symbols are specified (see below). Single-Symbol queries
that have an empty (unspecified) BeginDateTime are not parallelizable.
In addition, you can specify a daily time-window: only ticks between BeginFilterTime
and EndFilterTime in each day (US Eastern time-zone) will be reported. This could
be useful, for example, to limit the results only to the regular trading hours.
You can also limit the maximal number of ticks using the MaxItems parameter.
Note: by default IQFeed limits ticks data to the past 180 calendar days if you make
the request outside trading hours, but just past 8 days for requests during US trading
hours (9:30-16:30 US Eastern time).88 This means that if during trading hours you
request historic data from a month ago, you will get none (empty results), even if the
request was just for a single hour of data.89
You can change the order of the reported ticks, using the DataDirection parameter (1
means oldest-to-newest (default); -1 means newest-to-oldest). MaxItems has precedence
over BeginDateTime, regardless of DataDirection. For example, if MaxItems=5,
we’ll only get the 5 latest ticks (before EndDateTime), regardless of BeginDateTime.
As with daily data requests, you can request data for multiple symbols at the same time,
in a single IQML command by specifying a colon-delimited or cell-array list of Symbols:
>> data = IQML('history', 'symbol',{'IBM','GOOG','AAPL'}, ...
'dataType','ticks', 'maxItems',20)
>> data = IQML('history', 'symbol','IBM:GOOG:AAPL', ...
'dataType','ticks', 'maxItems',20) %equivalent

The result will be an array of Matlab structs that correspond to the requested symbols
(3 symbols with 20 data-points each, in this example):
data =
20×3 struct array with fields:
Symbol
Datestamp
...

87
IQML versions up to 2.42 reported a NO_DATA error in such cases; IQML returns [] without an error in version 2.43 or newer.
88
Historic ticks older than 180 days can be purchased from DTN – http://forums.iqfeed.net/index.cfm?page=topic&topicID=4376
89
This is true for regular IQFeed accounts; IQFeed trials are limited to 4 days of intraday data (https://help.dtniq.com/support-faqs)
IQML User Guide 86

In certain cases, when you request historic data for multiple symbols, you might
receive a different number of data bars for different symbols, depending on data
availability. In such cases, the result will not be an N-by-M struct array, but a cell
array (one cell for each symbol) that contains struct arrays. For example:
data =
1×3 cell array
{77×1 struct} {100×1 struct} {55×1 struct}

IQML queries for multiple symbols or a date/time range (i.e., if BeginDateTime is


specified) can be parallelized using the UseParallel parameter, if you have a
Professional IQML license and Matlab’s Parallel Computing Toolbox (see §3.6):
>> data = IQML('history', 'dataType','ticks', 'UseParallel',true, ...
'symbol',symbols) % multiple symbols parallelized
>> data = IQML('history', 'dataType','ticks', 'UseParallel',true, ...
'symbol','IBM' ,... % single-symbol date-range parallelized
'BeginDateTime',20181026100000, ...
'EndDateTime', 20181026110000)

By default, IQML reports 18 data fields for each tick: Symbol, Timestamp, Datenum,
Last, LastSize, TotalVolume, Bid, Ask, TickID, BasisForLast, TradeMarketCenter,
TradeConditions, TradeAggressorCode, DayOfMonth, BasisDescription,
TradeMarketName, TradeDescription, and AggressorDescription.90 If the Fields
parameter is set to an empty value ({} or ''), the current set of fields and the full list of
available fields, are reported (in this case, a Symbol parameter is unnecessary). If you
have the Professional (or trial) IQML license, you can request IQML to report fewer
data fields, and/or change the reported fields order, using the optional Fields
parameter. All subsequent tick history queries will report only the requested fields, in
the specified order. Fewer fields mean faster processing time and smaller memory
usage. Refer to §5.1 for a description of the Fields parameter usage.

Finally, as with other IQML commands, you can set the Timeout parameter to a high
value in order to allow IQML more time to gather data before returning the results (or
set to -1 to disable the timeout entirely). This is especially important for historic
interval and ticks data queries, since they could return a huge number of data points,
which can take a lot of time to download and process.
In addition to Timeout, for long queries it is advisable to set the Progress parameter
to 'console', in order to display a periodic progress update message in the console
every 1000 data points (every ~1-2 secs), as well as at the end of the query:
>> data = IQML('history', 'symbol','IBM', 'dataType','ticks', ...
'BeginDateTime','20200623 150000', ...
'EndDateTime', '20200623 152000', ...
'MaxItems',-1, 'timeout',-1, 'progress','console');
1000 history data points processed for IBM. Latest: 2020-06-23 15:05:06.665127...
2000 history data points processed for IBM. Latest: 2020-06-23 15:11:43.512718...
3000 history data points processed for IBM. Latest: 2020-06-23 15:16:47.954088...
3489 history data points processed for IBM. Latest: 2020-06-23 15:20:00.076970

90
The textual fields BasisDescription, TradeMarketName, TradeDescription and AgressorDescription are IQML-
generated textual interpretations of the codes in the IQFeed-generated BasisForLast, TradeMarketCenter,
TradeConditions and TradeAggressorCode fields respectively, as governed by the MsgParsingLevel parameter (see §3.2)
IQML User Guide 87

The following parameters affect ticks history data queries:


Parameter Data type Default Description
Limits the query to the specified symbol(s).
Examples:
colon or  '@VX#'
comma-  'IBM:AAPL:GOOG'
Symbol or delimited  'IBM,AAPL,GOOG'
(none)
Symbols 91 string or  {'IBM', 'AAPL', 'GOOG'}
cell-array
This parameter must be set to valid symbol
of strings
name(s). Multiple symbols can be parallelized
using the UseParallel parameter (see below).
1 Sets the order of ticks in the returned struct
meaning array. One of the following values:
DataDirection integer oldest tick
is first,  1 means oldest-to-newest (default)
newest last  -1 means newest-to-oldest
Returns up to the specified number of ticks
MaxItems integer 100
(if available). -1 means all available.
1 Number of preceding calendar days to
process. -1 means unlimited (all available
Days integer meaning data, subject to the other criteria), 1 means
today only today, 2 means today & yesterday, etc.
Only return ticks that begin after this time of
day (US Eastern). Only relevant when Days>0
BeginFilterTime string '00:00:00'
or BeginDateTime is not ''. Format:
‘hhmm’, ‘hh:mm’, ‘hhmmss’ or ‘hh:mm:ss’.
Only return ticks that end before this time of
day (US Eastern). Only relevant when Days>0
EndFilterTime string '23:59:59'
or BeginDateTime is not ''. Format:
‘hhmm’, ‘hh:mm’, ‘hhmmss’ or ‘hh:mm:ss’.
Only return ticks that begin after this
date/time (US Eastern time-zone).
'' Overrides the Days parameter.
(empty Format: Matlab datenum, or 'yyyymmdd
integer or string) hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.
string or meaning
BeginDateTime datetime Note: MaxItems has precedence over
from as
object BeginDateTime: If there are more data
early as
points than MaxItems between
data is
BeginDateTime and EndDateTime, only
available
the last MaxItems data points (from
EndDateTime backward) will be returned,
regardless of BeginDateTime.

91
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 88

Parameter Data type Default Description


Only return ticks that end before this
'' date/time (US Eastern time-zone)
integer or
(empty
string or
EndDateTime string) Overrides the Days parameter.
datetime
meaning
object Format: Matlab datenum, or 'yyyymmdd
now
hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.
Max number of seconds to wait for incoming
Timeout number 5.0
data (0-9000, where 0 means infinite)
If set to true or 1, and if Parallel Computing
Toolbox is installed, then querying multiple
logical
UseParallel false symbols or a date/time range will be done
(true/false)
in parallel (see §3.6; Professional IQML
license only).
Maximal number of parallel workers to use
(the current (up to the current pool size) when UseParallel
integer
MaxWorkers parallel pool
=true. Note: increased parallelization might
(1-∞) size, up to 15)
cause IQFeed run-time throttling errors.
'Symbol,
Timestamp, Sets the list of data fields reported by IQML
Datenum, Last, for each data bar, as a sub-set of IQFeed’s
LastSize, default set of 18 fields.
TotalVolume,
Bid, Ask, If Fields is set to an empty value ({} or ''),
TickID,
BasisForLast,
the list of current, available fields is
colon or TradeMarket- returned.
comma- Center,
TradeCondi- If Fields is not empty, subsequent history
separated
Fields tions, queries in the same Matlab session will
string, or TradeAggres- return the specified fields, in the specified
cell-array sorCode,
DayOfMonth, order (Professional IQML license only).
of strings
BasisDescrip-
tion, Examples:
TradeMarket-  'Timestamp:Bid:Ask'
Name,
TradeDescrip-  'Timestamp,Bid,Ask '
tion,  {'Timestamp', 'Bid', 'Ask'}
AggressorDes-
cription'
 'All' (indicates all available fields)
'' When Progress is set to 'console', the data
Progress string (empty download progress is periodically displayed
string) in the console.
IQML User Guide 89

5.6 Market summary data and scanner


All the queries described so far in this chapter return historic data for individually-
specified Symbols. We can retrieve historic end-of-day market state (quotes/trades and
fundamental data) of all traded securities as-of a single historic date (May 20, 2018 or
later), using a 'summary' query (see §4.6) with a non-default Date parameter:
>> data = IQML('summary', 'Date',20190110) %all NYSE equities on Jan 10, 2019
data =
4706×1 struct array with fields:
Symbol
Exchange
Type
Last
... (total of 28 data fields)
>> data(1)
ans =
struct with fields:
Symbol: 'A'
Exchange: 7
Type: 1
Last: 69.9
TradeSize: 3350
TradedMarket: 7
TradeDate: 20190110
TradeTime: 180131
Open: 69.05
High: 69.95
Low: 68.6
Close: 69.25
Bid: 50
BidMarket: 11
BidSize: 400
Ask: 69.9
AskMarket: 11
AskSize: 100
Volume: 1080882
PDayVolume: 2442291
UpVolume: 413506
DownVolume: 231604
NeutralVolume: 435772
TradeCount: 10340
UpTrades: 3070
DownTrades: 2819
NeutralTrades: 4447
VWAP: 69.5782

This query shows that 4706 equities were traded on NYSE on Jan 10, 2019. The data
may change over time, as DTN retroactively fixes its historic records.
The default DataType parameter value ('snapshot') fetches end-of-day trading data.
To fetch end-of-day fundamental data, set DataType='fundamental':92
>> data = IQML('summary', 'Date',20190110, 'DataType','fundamental');

Note that there is no Symbol parameter in a 'summary' query – data for all the
symbols that match the specified SecType (default: 'equity'), Exchange (default:
'NYSE') and/or Date (default: now/latest) is returned. For historic snapshot trading
data of specific symbols, use one of the other query types (§5.1-§5.5). Unfortunately,
there is no corresponding alternative for historic fundamental data of specific symbols.

92
Note that we only receive 4705 securities in the fundamental query compared to 4706 securities for the snapshot query (ASXw
has snapshot data but no fundamentals) – this is an IQFeed data error. NYSE bonds on the same date show a similar phenomemon:
three symbols (CVS.24.CB, DUK.46B.CB, TXT27.CB) have snapshot data but no fundamentals. All these are IQFeed data errors.
IQML User Guide 90

We can filter the returned data for various criteria using the Filter parameter (see §4.6),
effectively serving as a market scanner for the requested historic date.
Using end-of-day historic summary query enables fetching the data for securities that
are no longer traded (expired contacts93 and delisted equities94). Fetching historic data
for such non-trading symbols using any other query type is not possible.
Note: Market summary is only available with IQFeed client 6.1 or newer, and only if you
are subscribed to the requested DTN data, and only if IQFeed has relevant history data
(data is only available for trading days since May 20, 2018, and only for some SecType/
Exchange combinations). Otherwise, you may receive an error such as one of these:
The 'summary' query is only supported by IQFeed client 6.1 or newer; you are
using version 6.0.
IQFeed market summary query error: Code: 50004 - User not authorized for
market summary file requested.
IQFeed market summary query error: Code: 50007 - No file available for NASDAQ
on 2020-11-29 (possibly a non-trading day; try a different Date).
The following parameters affect historic market summary queries (see §4.6 for details):
Parameter Data type Default Description
DataType string 'snapshot' Either 'snapshot' or 'fundamental' (not 'top')
Exchange string 'NYSE' One of the markets listed in §8.3
SecType string 'Equity' One of the security types listed in §8.4
Date for which to fetch the end-of-day data
(May 20, 2018 or later). Examples:
integer or now  737454 (Matlab datenum format)
string or (latest  datetime('Jan 29, 2019')
Date datetime available  20190129 (yyyymmdd format)
object data)  '20190129'
 '2019/01/29'
 '2019-01-29'
If true, then irrelevant data fields (which
ReportEmptyFields logical false or 0 contain empty [] values for all securities)
are reported; if false (default), they are not
Zero or more filter criteria (condition
strings) – Matlab expression(s) involving
string or the reported data fields, which result in a
Filter cell-array {} logical (true/false) value. Examples:
of strings  'MaturityDate > 20241231'
 'MarketCap > 5000 & PeRatio < 9'
 {'MarketCap > 5000', 'Beta >= 1.2'}
Max number of seconds to wait for incoming
Timeout number 300
data (0-9000, where 0 means infinite)
Note: market summary functionality is only available in the Professional IQML license

93
A [huge] static text file containing a [very long] list of expired option symbols is available for download from DTN’s website
(http://www.iqfeed.net/downloads/beta/IEOPTION.zip; see http://forums.iqfeed.net/index.cfm?page=topic&topicID=3326 for
details). Note that this file is not actively maintained, so it is better to use the API functionality via IQML.
94
A static text file containing a list of delisted ticker symbols is available for download from DTN’s website
(http://www.iqfeed.net/downloads/beta/EQUITY.zip; see http://forums.iqfeed.net/index.cfm?page=topic&topicID=5822 for
details). Note that this file is not actively maintained, so it is better to use the API functionality via IQML.
IQML User Guide 91

6 Streaming data
Streaming data is a near-real-time mechanism, where IQFeed sends ongoing
asynchronous update messages to IQML of tick (quote and trade) and news events.
These events are accumulated in IQML memory buffers. They can either be queried
asynchronously (via ad-hoc queries that “peek” at the latest accumulated data without
disturbing the ongoing streaming, as shown in §6.1-§6.4), or handled synchronously
(immediately as each event is received, using callbacks (§10) or alerts (§11)).
Depending on your IQFeed subscription, streaming may be delayed by 10+ minutes
compared to a real-time feed (a real-time data subscription is needed for live data).95
6.1 Streaming quotes
The streaming quotes mechanism has two distinct parts:
1. Request IQFeed to start sending a stream of quotes for a specified security.
This is done by using the 'quotes' action and setting a NumOfEvents
parameter to a positive >1 value.
2. At any later time(s), you can access the accumulated quotes using either of the
following alternatives:
a. Use 'quotes' action and NumOfEvents of -1 (minus one). This will return
the latest streamed data, without stopping the background streaming.
b. If you set the AssignTo variable in the original request, you can directly
access the streamed data in the specified base workspace variable.
For example, to request 100 streaming quotes for a continuous VIX future contract:
IQML('quotes', 'Symbol','@VX#', 'NumOfEvents',100)

IQFeed will start sending quotes to IQML in the background, up to the specified
NumOfEvents, without affecting normal Matlab processing. You can continue to work
in Matlab, process/display information etc., while quotes accumulate in the background.
Quotes will only stream in the background in non-blocking mode. If you assign the
IQML command results to a variable, the request is treated as blocking and IQML will
wait for all the events to accumulate (or Timeout to occur), as described in §4.1:
IQML('quotes', 'Symbol','@VX#', 'NumOfEvents',100); % streaming, non-blocking
data = IQML('quotes', 'Symbol','@VX#', 'NumOfEvents',100); % blocking
NumOfEvents can be any number >1 for streaming (a value of 1 is the standard snapshot
query in §4.1). To collect streaming quotes endlessly, set NumOfEvents to inf. Note
that in Matlab, inf is a number (not a string), so do not enclose it in quotes ('inf').
The quotes are collected into an internal data buffer in IQML. A different buffer is
maintained for each symbol. The buffer size can be controlled using the MaxItems
parameter, which has a default value of 1. This means that by default only the latest
streaming quote of each type (bid/ask) is stored, along with high/low/close data.
If you set a higher value for MaxItems,96 then up to the specified number of latest
quotes will be stored. For example, to store the latest 5 quotes:
IQML('quotes', 'Symbol','@VX#', 'NumOfEvents',100, 'MaxItems',5)

95
See §9.3 for a programmatic method to determine whether your exchange subscription is delayed or real-time.
96
MaxItems is a numeric parameter like NumOfEvents, so don’t enclose the parameter value within string quotes (‘’)
IQML User Guide 92

Note: MaxItems increases memory usage, multiplied by the number of streamed symbols.97
Subsequent requests to retrieve the latest accumulated quotes buffer data, without
stopping the background streaming, should use NumOfEvents < 0 (e.g. -1). These
requests return a Matlab data struct similar to the following:
>> data = IQML('quotes', 'Symbol','@VX#', 'NumOfEvents',-1)
data =
Symbol: '@VX#'
Command: 'w@VX#'
isActive: 1
EventsToProcess: 100
EventsProcessed: 57
LatestEventDatenum: 737128.637260451
LatestEventTimestamp: '20180309 15:17:39'
DataType: 'quotes and trades'
ProcessType: 'stream'
AssignTo: ''
errorMsg: ''
BufferSize: 5
Buffer: [5×1 struct]
LatestData: [1×1 struct]
In the returned data struct, we can see the following fields:
 Symbol – the requested Symbol.
 Command – the command sent to IQFeed, including the requested Symbol.
 isActive – logical flag indicating whether quotes are currently streamed for this
security. When NumOfEvents ticks are received, this flag is set to false (0).
 EventsToProcess – total number of streaming ticks requested for the security
(using the NumOfEvents parameter).
 EventsProcessed – number of streaming ticks received for this security. When
EventsProcessed >= EventsToProcess, streaming quotes are turned off and
isActive is set to false (0). Note that it is possible that EventsProcessed >
EventsToProcess, since it takes a while for the streaming cancellation request
to reach IQFeed, and during this time a few additional ticks may have arrived.
 LatestEventDatenum – Matlab numeric datenum representation of the
LatestEventTimestamp (local timezone).
 LatestEventTimestamp – timestamp (string format) when this quote event was
received by IQML (local timezone).
 DataType – type of data to stream (set by DataType parameter, see below).
 ProcessType – always equal to 'stream' for streaming quotes.
 AssignTo – the name of the assigned variable in the base Matlab workspace
(=AssignTo parameter, see below). In normal cases, this field is empty ('').
 errorMsg – contains the error message in case streaming cannot be processed
(for example: 'Symbol not found'). In normal cases, this field is empty ('').
 BufferSize – size of the data buffer (=MaxItems parameter, see below).
 Buffer – buffer of size BufferSize, accumulating the latest quote updates.
 LatestData – latest quote event received from IQFeed.

97
Quotes use up to ~16KB of Matlab memory (depending on the selected Fields). So, if MaxItems=1000, each streamed
symbol would need up to 1000*16KB = 16MB of Matlab memory when its buffer becomes full (which could take a while).
Streaming 100 symbols will require up to ~1.6GB. Such large memory usage might significantly degrade overall performance.
IQML User Guide 93

Here is a simulated timeline that illustrates the use of streaming data in IQML:
Events
Time User command Description
so far
IQML('quotes', 'Symbol','IBM', Streaming data for IBM starts.
9:50:00 0 'MaxItems',100,'NumOfEvents',100) Up to 100 events to accumulate.
data = IQML('quotes', Return the 23 accumulated quotes;
9:50:10 23 'symbol','IBM', 'NumOfEvents',-1) background streaming continues.
data = IQML('quotes', Return the 42 accumulated quotes;
9:50:20 42 'symbol','IBM', 'NumOfEvents',-1) background streaming continues.
IQML('quotes', 'Symbol','IBM',
Reduce max # of events 10080.
9:50:30 57 'MaxItems',80, 'NumOfEvents',80) Only 57 events accumulated until
now, so streaming continues.
data = IQML('quotes', Return the 65 accumulated quotes;
9:50:40 65 'symbol','IBM', 'NumOfEvents',-1) background streaming continues.
IQML('quotes', 'Symbol','IBM',
Reduce max # of events 800.
9:50:50 72 'NumOfEvents',0) 72 events accumulated until now, so
streaming stops immediately.
Different quotes are sent independently from IQFeed server with a unique timestamp.
Note: data.LatestEventDatenum and data.LatestEventTimestamp are specified in local
time-zone. In contrast, data.LatestData.Most_Recent_Trade_Time and data.Buffer.-
Most_Recent_Trade_Time use the server time-zone, typically US Eastern.
To get the quotes data, simply read the fields of the returned data struct, for example:98
>> data.LatestData
ans =
Symbol: '@VX#'
Most_Recent_Trade: 17.08
Most_Recent_Trade_Size: []
Most_Recent_Trade_Time: '08:06:20.716000'
Most_Recent_Trade_Market_Center: 32
Total_Volume: 4507
Bid: 17.05
Bid_Size: 63
Ask: 17.1
Ask_Size: 244
Open: 17.2
High: 17.35
Low: 17
Close: 17.23
Message_Contents: 'Cbasohlcv'
Message_Description: 'Last qualified trade; A bid update
occurred; An ask update occurred; A
settlement occurred; An open declaration
occurred; A high declaration occurred; A
low declaration occurred; A close decla-
ration occurred; A volume update occurred'
Most_Recent_Trade_Conditions: '4D'
Trade_Conditions_Description: 'Implied'
Most_Recent_Market_Name: 'CBOE Futures Exchange (CFE)'
Note that data.LatestData is typically the same as data.Buffer(end), regardless of
the values of MaxItems or NumOfEvents.99

98
The textual description fields depend on the MsgParsingLevel parameter having a value of 2 or higher (see §3.2 and §8)
99
When NumOfEvents events have been received, IQFeed is instructed to stop streaming updates, but some update messages
IQML User Guide 94

Each streaming security asset can have a different BufferSize, by specifying a different
MaxItems value in the command (large for heavily-traded assets, small for others).
Once the data is retrieved, you can direct IQML to clear (empty) the internal Buffer,
by setting ClearBuffer to true or 1. The latest buffer will be returned, and the internal
Buffer (but no other field) will be immediately emptied, awaiting new streaming quotes:100
data = IQML('quotes', 'symbol','IBM', 'NumOfEvents',-1, 'ClearBuffer',true);
To stop collecting streaming quotes, simply resend a request with NumOfEvents=0:
IQML('quotes', 'symbol','IBM', 'NumOfEvents',0);
IQFeed reports 16 standard data fields by default. If you have the Professional (or
trial) IQML license, you can customize the returned data fields by requesting up to 50+
additional fields, removing standard fields, and setting the order of the reported fields.
This can be done using the Fields parameter, as explained in §4.1. For example:
IQML('quotes', 'symbol','IBM', 'fields','Last,Ask,Bid', 'numOfEvents',6);
Note: setting the Fields parameter only affects streaming data from then on – it does
not affect previously-received data. Therefore, you should set Fields parameter in the
initial streaming command, not ongoing data-fetch commands (NumOfEvents<0).
When DataType is 'q' or 'quotes', whenever any of the requested data fields (either
the standard 16 fields, or a customized set) gets updated (not necessarily to a different
value), a new tick (update/quote) message is sent/streamed. Adding data fields means
a corresponding increase in tick messages. It is not possible in IQFeed to request data
fields without the corresponding update messages for these fields (or vice versa). The
only exception to this rule is setting DataType to 't' or 'trades': in this case only trade
updates (containing all the requested fields) will be streamed, but no field updates.
In summary, the fewer data fields that are requested, the faster the run-time processing,
and the lower the corresponding tick message rate, thus enabling a larger number of
usable quotes to be streamed and processed by your Matlab program each second.
You can specify multiple symbols for streaming at the same time, in a single IQML
command, by specifying a colon-delimited or cell-array list of symbols. For example:
IQML('quotes', 'symbols',{'IBM','GOOG','AAPL'}, 'numOfEvents',6);
IQML('quotes', 'symbols','IBM:GOOG:AAPL', 'numOfEvents',6); % equivalent
And similarly, when retrieving the accumulated streaming data:
>> data = IQML('quotes', 'symbol','IBM:GOOG:AAPL', 'numOfEvents',-1);
data =
1×3 struct array with fields:
Symbol
Command
isActive
EventsToProcess
EventsProcessed
LatestEventDatenum
LatestEventTimestamp
DataType
ProcessType
BufferSize
Buffer
LatestData

may already be on their way from IQFeed before streaming actually stops. These extra update messages are not accumulated
in the Buffer, but the latest of these messages will be reflected in LatestData field.
100
During the buffer clear operation some streaming data may be lost, so it is advised not to clear too often.
IQML User Guide 95

>> data(1).LatestData
ans =
struct with fields:
Symbol: 'IBM'
Most_Recent_Trade: 142.48
Most_Recent_Trade_Size: 41149
Most_Recent_Trade_Time: '17:33:40.531781'
Most_Recent_Trade_Market_Center: 19
...
To get the latest data for all streamed symbols, omit the Symbol parameter (or set it to
empty ['']) in the IQML command. Note: this will return both active and non-active streams:
>> data = IQML('quotes', 'numOfEvents',-1); % no symbol: return ALL streams
data =
1×5 struct array with fields:
Symbol
Command
...
Similarly, to cancel all active streams in a single command, omit Symbol (or set it to ''):101
>> IQML('quotes', 'numOfEvents',0); % no symbol: stop ALL streams
IQFeed typically allows streaming up to 500 symbols. This limit can be increased by
paying DTN for increased data subscriptions. In any case, the actual maximal number of
concurrently-streaming symbols is limited by performance considerations (see §3.6).
Note: Streaming quote messages are automatically processed by IQML in the
background, reducing the CPU time that is left available to process other IQML queries
(e.g., a blocking historical data query) or Matlab analysis functions. It is therefore
advisable to stop streaming IQFeed data when not needed, even if only temporarily.
In cases of high load (such as market open/close), numerous streaming message
events (quote ticks, news items etc.) flood the system, causing Matlab to appear frozen
for long minutes, until the events backlog is fully processed. For such cases, use IQML’s
built-in overflow protection mechanism with OverflowMode and MaxEventsBacklog
parameters. By default, OverflowMode is 0 (no protection); when OverflowMode is
set to 1, then in cases of extreme load, if more than MaxEventsBacklog messages
(default=100) have still not yet been processed, then any additional messages will be
immediately dropped (ignored) and not processed. This allows Matlab time to process
the backlog, before additional new messages are accepted for processing. The
downside is that new (more recent) messages are ignored, whereas the older messages
in the backlog are processed. Alternatively, set OverflowMode to 2 to ignore the older
messages in the backlog and only process the newer messages. This OverflowMode=2
alternative is a bit slower than the OverflowMode=1 alternative, so the messages
processing rate of OverflowMode=1 will unusally be higher. In summary:
 OverflowMode=0 does not protect from messages overflow; all messages
will be processed. Matlab may appear frozen when flooded with IQFeed msgs.
 OverflowMode=1 will drop new messages when the backlog is too large; this
is the fastest overflow handling alternative, having minimal CPU overhead.
 OverflowMode=2 will drop old messages from the backlog when it’s too
large; slower than OverflowMode=1, but more responsive to new messages.

101
Note that cancelling all active streams cancels streaming regional updates (§6.2) in addition to streaming quotes.
IQML User Guide 96

Notes about the usage of OverflowMode:


 OverflowMode is only relevant for streaming data. Overflow protection is
automatically disabled (OverflowMode set to 0) for any other (blocking) query.
For example, if you request blocking market data (NumOfEvents>0) while
quotes are streaming, overflow handling will be disabled from then onward.
 OverflowMode and MaxEventsBacklog are specific to each of the major
IQFeed data query ports: Level1, Level2, and Lookup. When you specify
these parameters to a specific query, they are automatically assigned to the
appropriate data port and only affect the messages arriving via that port. For
example, you can set different overflow handling parameters for Level1/
Level2 data. Similarly, a blocking historic data query (using the Lookup port)
does not disable overflow handling for streaming quotes (using the Level1 port).
Note that during non-trading hours, there is no streaming data (of course). To test the
streaming-data mechanism during non-trading hours, use the dummy symbol TST$Y,
for which IQFeed sends a continuous 24/7 stream of pre-recorded data.102
When debugging streaming, it is sometimes useful to assign the streamed data to a
base Matlab workspace variable, which can be monitored live using Matlab’s Variable
Explorer or directly checked/used within a Matlab script, without a need to call
IQML('quotes',…,'numOfEvents',-1) to constantly refetch the latest data. This data
mirroring can be done by setting the AssignTo parameter to any valid Matlab variable
name or assignment target, for example: 'myData' or 'streamed.VX' or 'data{3}'.
>> IQML('quotes', ..., 'AssignTo','myData');
% streaming data in background is mirrored in base workspace variable myData:
>> myData
myData =
struct with fields:
Symbol: '@VX#'
Command: 'w@VX#'
isActive: 1
EventsToProcess: Inf
EventsProcessed: 129
LatestEventDatenum: 737902.831878183
LatestEventTimestamp: '20200421 19:57:54'
DataType: 'quotes and trades'
ProcessType: 'stream'
AssignTo: 'myData'
errorMsg: ''
BufferSize: 100
Buffer: [100×1 struct]
LatestData: [1×1 struct]

Here is a summary of the IQML parameters that directly affect streaming quotes:
Parameter Data type Default Description
colon or Limits request to specified symbol(s). E.g.:
Symbol or  '@VX#'
comma- (none)
Symbols 103
delimited  'IBM:AAPL:GOOG'

102
IQFeed’s streaming functionality of TST$Y is currently broken. To get notified when DTN reports that the functionality is
fixed, follow this forum thread: http://forums.dtn.com/index.cfm?page=topic&topicID=4286
103
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 97

string, or  'IBM,AAPL,GOOG'
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings This parameter must be set to valid symbol
name(s) when NumOfEvents>0
One of:
 inf – continuous endless streaming
quotes for the specified security
 N>1 – stream only N quotes
NumOfEvents integer MaxItems  1 – get only a single quote (default)
 0 – stop streaming quotes
 -1 – return latest accumulated quotes data
while continuing to stream new quotes data
Number of streaming quotes stored in cyclic
MaxItems integer 1 buffer. Once this number of quotes are received
old quotes are discarded as new quotes arrive.
One of:
 'q' or 'quotes' (default) – stream both
DataType string 'q' trades & quote (bid/ask update) events
 't' or 'trades' – stream trade events only
Sets the list of data fields reported by IQFeed
for each quote. IQFeed’s default set has 16
fields; 50+ additional fields can be specified.
If Fields is set to an empty value ({} or ''),
'Symbol, the list of current, available fields is returned.
colon or Most Recent
If Fields is not empty, subsequent quotes
comma- Trade,
queries will return the specified fields, in the
Most Recent
separated specified order (Professional IQML license
Fields Trade Size,
only). The Symbol field is always returned
string, or Most Recent
cell-array first, even if not specified.
Trade Time,
of strings …' Examples:
(see §4.1)  {'Bid', 'Ask', 'Last'}
 'Bid, Ask, Last'
 'Bid:Ask:Last'
 'All' (indicates all available fields)
logical If true or 1, the internal cyclic quotes buffer is
ClearBuffer false
(true/false) cleared after the data is returned to the caller
'' Contains the assignment target (typically a
AssignTo string (empty variable name) in the base Matlab workspace,
string) useful for stream debugging.
If set, the overflow handling for the query’s
IQFeed data port is updated as follows:
OverflowMode integer []  0 – none (all messages are processed)
 1 – drop new msgs until backlog clears
 2 – drop old backlog messages (slower)
Size of messages backlog, per IQFeed data
MaxEventsBacklog integer 100
port, above which overflow handling is done
IQML User Guide 98

6.2 Regional updates


Regional quotes are Bid and Ask prices delivered from various regional markets
(exchanges). The streaming regional market update mechanism has two parts, just
like streaming ticks (§6.1):
1. Request IQFeed to start sending a stream of regional updates. This is done by
using the 'regional' action and setting a NumOfEvents parameter to a positive >1
value. You must specify the Symbol(s) for which regional updates will stream.
2. At any later time(s), you can access the accumulated regional updates using
either of the following alternatives:
a. Use 'regional' action and NumOfEvents of -1 (minus one). This will
return the latest streamed data, without stopping the background streaming.
b. If you set the AssignTo variable in the original request, you can directly
access the streamed data in the specified base workspace variable.
For example, to request 100 streaming regional updates for Facebook:
IQML('regional', 'Symbol','FB', 'NumOfEvents',100)
This causes IQFeed to start sending regional updates to IQML in the background, up
to the specified NumOfEvents, without affecting normal Matlab processing. You can
continue to work with Matlab, process and display information etc., while the regional
updates accumulate in the background.
Regional updates will only stream in the background in non-blocking mode. If you
assign the IQML command results to a variable, the request is treated as blocking and
IQML will wait for all data to accumulate (or Timeout to occur), as described in §7.2:
IQML('regional', 'Symbol','FB', 'NumOfEvents',100); % streaming, non-blocking
data = IQML('regional', 'Symbol','FB', 'NumOfEvents',100); % blocking
NumOfEvents can be any number higher than 1 for streaming to work (a value of 1
is the standard snapshot regional-update request described in §7.2). To collect
streaming regional updates endlessly, set NumOfEvents to the value inf. Note that in
Matlab, inf is a number (not a string), so do not enclose it in quotes ('inf').
The regional updates are collected into an internal data buffer in IQML. A different
buffer is maintained for each symbol. The buffer size can be controlled using the
MaxItems parameter, which has a default value of 1104. This means that by default
only the latest streaming regional update that affect the specified symbols will be
stored in the buffer and become accessible for later processing.
If you set a higher value for MaxItems, then up to the specified number of latest
regional update items will be stored. For example, to store the latest 5 updates:
IQML('regional', 'Symbol','FB', 'NumOfEvents',100, 'MaxItems',5)
Note that using a large MaxItems increases memory usage. This could have an
adverse effect if you set a very large buffer size (many thousands) and/or streaming of
a large number of different securities.105

104
Note that MaxItems is a numeric parameter like NumOfEvents, so don’t enclose the parameter value within string quotes (‘’)
105
Each regional update item uses 2KB of Matlab memory. During trading hours, there could be dozens of updates per second
for highly liquid symbols (i.e., 500MB or more per hour, if all updates are saved). Limiting MaxItems to some finite value
ensures that the memory usage and performance impact remain low.
IQML User Guide 99

Subsequent requests to retrieve the latest accumulated regional updates buffer data,
without stopping the background streaming, should use NumOfEvents = -1 (minus one).
These requests return a Matlab data struct similar to the following:
>> data = IQML('regional', 'Symbol','FB', 'NumOfEvents',-1)
data =
Symbol: 'FB'
Command: 'S,REGON,FB'
isActive: 1
EventsToProcess: 100
EventsProcessed: 83
LatestEventDatenum: 737146.784037153
LatestEventTimestamp: '20180327 18:49:00'
DataType: 'regional'
ProcessType: 'stream'
AssignTo: ''
errorMsg: ''
BufferSize: 5
Buffer: [5×1 struct]
LatestData: [1×1 struct]
In the returned data struct, we can see the following fields:
 Symbol – the requested Symbol.
 Command – the command sent to IQFeed, including the requested Symbol.
 isActive – a logical flag indicating whether regional updates are currently
being streamed for this security. When NumOfEvents ticks have been
received, this flag is set to false (0).
 EventsToProcess – total number of streaming regional updates requested
(using the NumOfEvents parameter).
 EventsProcessed – number of streaming regional updates received. When
EventsProcessed >= EventsToProcess, streaming updates are turned off and
isActive is set to false (0).
Note that it is possible that EventsProcessed > EventsToProcess, since it takes
a while for the streaming cancellation request to reach IQFeed and during this
time a few additional update messages may have arrived.
 LatestEventDatenum – Matlab numeric datenum representation of the
LatestEventTimestamp (local timezone).
 LatestEventTimestamp – timestamp (string format) when this regional update
event was received by IQML (local timezone).
 DataType – always equal to 'regional' for streaming regional updates.
 ProcessType – always equal to 'stream' for streaming regional updates.
 AssignTo – the name of the assigned variable in the base Matlab workspace
(=AssignTo parameter, see below). In normal cases, this field is empty ('').
 errorMsg – contains the error message in case streaming cannot be processed
(for example: 'Symbol not found'). In normal cases, this field is empty ('').
 BufferSize – size of the data buffer (=MaxItems parameter, see below).
 Buffer – buffer of size BufferSize, accumulating the latest regional updates.
 LatestData – latest regional update event received from IQFeed.
To get the regional updates data, simply read the fields of the returned data struct:106

106
The textual Description fields depend on the MsgParsingLevel parameter having a value of 2 or higher (see §3.2 and §8)
IQML User Guide 100

>> data.LatestData
ans =
RegionalBid: 155.34
RegionalBidSize: 100
RegionalBidTime: '12:29:45'
RegionalAsk: 155.55
RegionalAskSize: 200
RegionalAskTime: '12:29:45'
FractionDisplayCode: 14
DecimalPrecision: 4
FractionDisplayDescription: 'Four decimal places'
MarketCenter: 11
MarketCenterDescription: 'NYSE Archipelago (NYSE_ARCA)'
Each update has an associated timestamp, since different regional updates are sent
separately and independently from IQFeed server.
Note: data.LatestEventDatenum and data.LatestEventTimestamp are specified in the
local time-zone; in contrast, data.LatestData.RegionalBidTime and .RegionalAskTime
are specified in the server’s time-zone (typically US Eastern time zone).
Note that data.LatestData is typically the same as data.Buffer(end), regardless of
the values of MaxItems or NumOfEvents.107
Each streaming security asset can have a different BufferSize, by specifying a
different MaxItems value in the streaming command. This can be used for specifying
a larger MaxItems for heavily-traded assets vs. lightly-traded ones.
Once the data is retrieved, you can direct IQML to clear (empty) the internal Buffer, by
setting ClearBuffer to true or 1. The latest buffer will be returned, and the internal Buffer
(but no other field) will be immediately emptied, awaiting new regional updates:108
data = IQML('regional', 'symbol','FB', 'NumOfEvents',-1, 'ClearBuffer',true);
To stop collecting regional updates, simply resend a request with NumOfEvents=0:
IQML('regional', 'symbol','FB', 'NumOfEvents',0);
You can specify multiple symbols for streaming at the same time, in a single IQML
command, by specifying a colon-delimited or cell-array list of symbols. For example:
IQML('regional', 'symbols',{'IBM','GOOG','AAPL'}, 'numOfEvents',6);
IQML('regional', 'symbols','IBM:GOOG:AAPL', 'numOfEvents',6); % equivalent
As with streaming quotes (§6.1), to get the latest data for all streamed symbols, omit
the Symbol parameter or set it to empty ['']. This returns all streams (both active/not):
>> data = IQML('regional', 'numOfEvents',-1); % no symbol: get ALL streams
data =
1×5 struct array with fields:
Symbol
Command
isActive
EventsToProcess
...
Similarly, to cancel all active streams in a single command, omit Symbol (or set it to ''):109
>> IQML('regional', 'numOfEvents',0); % no symbol: ALL streams are stopped

107
When NumOfEvents events have been received, IQFeed is instructed to stop streaming updates, but one or more update
messages may already be on their way from IQFeed before streaming actually stops. These extra update messages are not
accumulated in the Buffer, but the latest of these messages will be reflected in LatestData field.
108
During and around the time of the buffer clear, some streaming data may be lost, so it is advised not to clear to often…
109
Note that cancelling all active streams cancels streaming quotes (§6.1) in addition to streaming regional updates.
IQML User Guide 101

When debugging streaming, it is sometimes useful to assign the streamed data to a


base Matlab workspace variable, which can be monitored live using Matlab’s Variable
Explorer or directly checked/used within a Matlab script, without a need to call
IQML('regional',…,'numOfEvents',-1) to constantly refetch the latest data. This data
mirroring can be done by setting the AssignTo parameter to any valid Matlab variable
name or assignment target, for example: 'myData' or 'streamed.FB' or 'data{3}'.
>> IQML('regional', ..., 'AssignTo','myData');
% streaming data in background is mirrored in base workspace variable myData:
>> myData
myData =
Symbol: 'FB'
Command: 'S,REGON,FB'
isActive: 1
EventsToProcess: 100
EventsProcessed: 83
...

Here is a summary of the IQML parameters that affect streaming regional updates:
Parameter Data type DefaultDescription
Limits the request to the specified symbol(s).
colon or Examples:
comma-  '@VX#'
Symbol or delimited  'IBM:AAPL:GOOG'
(none)
Symbols 110
string, or  'IBM,AAPL,GOOG'
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings This parameter must be set to valid symbol
name(s) when NumOfEvents>0
One of:
 inf – continuous endless streaming
regional updates for specified security
 N>1 – stream only N regional updates
NumOfEvents integer MaxItems  1 – get only a single update (default)
 0 – stop streaming regional updates
 -1 – return the latest accumulated
regional updates data while continuing
to stream new regional updates data
Number of streaming regional updates stored
in a cyclic buffer. Once this number of
MaxItems integer 1 updates has been received, the oldest update
is discarded whenever a new update arrives.
logical If true or 1, the internal cyclic quotes buffer is
ClearBuffer false
(true/false) cleared after the data is returned to the caller.
'' Contains the assignment target (typically a
AssignTo string (empty variable name) in the base Matlab workspace,
string) useful for stream debugging.
Note: Regional updates data is only available in the Professional IQML license.

110
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 102

6.3 Interval bars

The streaming interval bars feature has two parts, just like streaming ticks (§6.1):
1. Request IQFeed to start sending a stream of interval bars for a specified
security. This is done by using the 'intervalbars' action and setting a
NumOfEvents parameter to a positive >1 value.
2. At any later time(s), you can access the accumulated interval bars using either
of the following alternatives:
a. Use 'intervalbars' action and NumOfEvents of -1 (minus one). This will
return the latest streamed data, without stopping the background streaming.
b. If you set the AssignTo variable in the original request, you can directly
access the streamed data in the specified base workspace variable.
For example, request 80 streaming interval bars of a continuous VIX future contract:
IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',80)

This causes IQFeed to start sending interval bars to IQML in the background, up to
the specified NumOfEvents, without affecting normal Matlab processing. This
means you can continue to work with Matlab, process data, display information etc.
Quotes will only stream in the background in non-blocking mode. If you assign the
IQML command results to a variable, the request is treated as blocking and IQML will
wait for all the events to accumulate (or Timeout to occur), as described in §4.1:
IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',80); % streaming, non-blocking
data = IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',80); % blocking

NumOfEvents can be any number higher than 1 for streaming to work. To collect
streaming quotes endlessly, set NumOfEvents to the value inf. Note that in Matlab,
inf is a number (not a string), so do not enclose it in quotes ('inf').

The quotes are collected into an internal data buffer in IQML. A different buffer is
maintained for each symbol. The buffer size can be controlled using the MaxItems
parameter, which has a default value of 1. This means that by default only the latest
streaming interval bar is stored.
If you set a higher value for MaxItems,111 then up to the specified number of latest
quotes will be stored, subject to IQFeed server limitations:112
IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',80, 'MaxItems',3)

Note that using a large MaxItems increases memory usage. This may have an adverse
effect if you use a large buffer (many thousands) and/or stream multiple Symbols.113
Each streaming security asset can have a different BufferSize, by specifying a
different MaxItems value in the streaming command. This can be used for specifying
a larger MaxItems for heavily-traded assets vs. lightly-traded ones.

111
MaxItems is a numeric parameter like NumOfEvents, so don’t enclose the parameter value within string quotes (‘’)
112
The number of reported bars may possibly be limited by the IQFeed server, depending on your data subscriptions and exchange.
113
Interval bars use ~2KB of Matlab memory. So, if MaxItems=1000, each streamed symbol would need 1000*2KB = 2MB of
Matlab memory when its buffer becomes full (which could take a while). Streaming 100 symbols will require up to ~200MB.
IQML User Guide 103

Subsequent requests to retrieve the latest accumulated interval bars buffer data,
without stopping the background streaming, should use NumOfEvents = -1 (minus
one). These requests return a Matlab data struct similar to the following:
>> data = IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',-1)
data =
Symbol: '@VX#'
Command: 'BW,@VX#,60,,1,3,,,B'
isActive: 0
EventsToProcess: 80
EventsProcessed: 80
LatestEventDatenum: 737902.504044143
LatestEventTimestamp: '20200421 12:05:49.414'
DataType: 'intervalbars'
ProcessType: 'stream'
AssignTo: ''
errorMsg: ''
MaxDaysToProcess: 1
BufferSize: 3
Buffer: [3×1 struct]
LatestData: [1×1 struct]

In the returned data struct, we can see the following fields:


 Symbol – the requested Symbol.
 Command – the command sent to IQFeed, including the requested Symbol.
 isActive – logical flag indicating whether interval bars are currently streamed for
the security. Once NumOfEvents bars are received this flag is set to false (0).
 EventsToProcess – total number of streaming interval bars requested for the
security (using the NumOfEvents parameter).
 EventsProcessed – number of streaming interval bars received for this security.
When EventsProcessed>=EventsToProcess, streaming is turned off and isActive
is set to false (0). Note: it is possible that EventsProcessed > EventsToProcess,
since it takes a while for the streaming cancellation request to reach IQFeed,
and during this time a few additional bars may have arrived.
 LatestEventDatenum – Matlab numeric datenum representation of the
LatestEventTimestamp (local timezone).
 LatestEventTimestamp – timestamp (string format) when this bar event was
received by IQML (local timezone).
 DataType – always equal to 'intervalbars' for streaming interval bars.
 ProcessType – always equal to 'stream' for streaming interval bars.
 AssignTo– the name of the assigned variable in the base Matlab workspace
(=AssignTo parameter, see below). In normal cases, this field is empty ('').
 errorMsg – contains the error message in case streaming cannot be processed
(for example: 'Symbol not found'). In normal cases, this field is empty ('').
 MaxDaysToProcess – max number of trading days to process (=MaxDays param).
 BufferSize – size of the data buffer (=MaxItems parameter, see below).
 Buffer – buffer of size BufferSize, accumulating the latest quote updates.
 LatestData – single latest interval bar received from IQFeed.
IQML User Guide 104

To retrieve the interval bars data, read the fields of the returned data struct:114
>> data.LatestData
ans =
Symbol: '@VX#'
BarType: 'Complete interval bar from history'
Timestamp: '2020-04-21 04:50:00'
Open: 38.95
High: 38.95
Low: 38.85
Close: 38.9
CumulativeVolume: 6381
IntervalVolume: 18
NumberOfTrades: 0
BarTypeCode: 'BH'
EventDatenum: 737902.504044143
EventTimestamp: '20200421 12:05:49.414'
Note that data.LatestData is typically the same as data.Buffer(end), regardless of
the values of MaxItems or NumOfEvents.115
IQFeed sends interval bars asynchronously, with a Timestamp that identifies each bar
(server timezone, typically US Eastern timezone). Note that data.LatestEventDatenum=
data.LatestData.EventDatenum and data.LatestEventTimestamp=data.LatestData.-
EventTimestamp are specified in the local timezone (your computer’s time). Also note
that LatestEventTimestamp and EventTimestamp have a different format than Timestamp.
The data.LatestData.NumberOfTrades field indicates the number of trades that occurred
within this bar (i.e., not cumulative). This field is only relevant when IntervalType is
'ticks'/'trades'. In all other cases, the field will be empty ([]) or 0.
The IntervalType (default: 'secs') and IntervalSize (default: 60) parameters should
typically be specified together. Note that IntervalSize must be a positive integer
value (i.e. its value cannot be 4.5 or 0). If IntervalType is 'ticks'/'trades', IntervalSize
must be 2 or higher. If IntervalType is 'volume', IntervalSize must be 100 or higher.
If IntervalType is 'secs', IntervalSize must be any integer between 1-300 (5 minutes),
or any multiple of 60 (1 minute) between 300-3600 (1 hour), or 7200 (2 hours).116
The data.LatestData.BarType and BarTypeCode fields indicate if this is a historic bar
(BH), a complete bar from the live (real-time) stream (BC), or an update bar (BU).
Unlike other streaming types, intervalbar queries also fetch historic bars data, starting
from the date/time that is set by the BeginDateTime parameter. This is similar to
(and subject to the same limitations as) historic interval data (§5.4), but with no
specified end point. BeginDateTime’s default value is 00:00:00 today (server time),
so we almost always get historic (BH) bars before live streaming (BC) bars. IQML
will immediately return the historic bars, and new realtime streaming bars as they
become available. If we run the query at mid-day, we may get hundreds of historic
bars before the first live streaming bar. Depending on the specified BeginDateTime

114
See §4.3 for an explanation of the fields in this data struct
115
When NumOfEvents events have been received, IQFeed is instructed to stop streaming updates, but some update messages
may already be on their way from IQFeed before streaming actually stops. These extra update messages are not accumulated
in the Buffer, but the latest of these messages will be reflected in LatestData field.
116
Note that IQFeed’s limitations on live 'secs' interval bars are stricter than the limitations on historical interval bars (§5.4):
http://forums.dtn.com/index.cfm?page=topic&topicID=5529
IQML User Guide 105

and NumOfEvents, we may receive only historic bars without any live streaming bars.
Historic and streaming data bars can be distinguished based on their BarType field.
Note: the initial set of historic bars also includes the latest (incomplete) bar. For
example, if we query at 21:34, we get the complete historic (BH) intervalbars for
21:20, 21:25, 21:30 and also the current (incomplete) bar for 21:35. A minute later, at
exactly 21:35:00, IQFeed sends the complete BC bar for 21:35. This BC bar is added
at the end of the buffer, so we will see two 21:35 bars in the buffer.
By default, IQFeed only sends historic BH bars followed by streaming BC bars. If the
MaxUpdateDuration>0, IQFeed also sends BU bar update messages when the specified
number of seconds have passed since the last trade or BC bar message. For example, if
IntervalSize=60 and MaxUpdateDuration=15, the following scenario may occur:117
9:30:03 - A trade occurs - no message is sent by IQFeed (15-sec timer is reset to 0)
9:30:06 - A trade occurs - no message is sent by IQFeed (15-sec timer is reset to 0)
9:30:21 - No trade or BC message for 15 seconds, so IQFeed sends an update (BU) message
9:30:57 - A trade occurs - no message is sent by IQFeed (15-sec timer is reset to 0)
9:31:12 - No trade or BC message for 15 seconds, so IQFeed sends a new update (BU) message
9:31:15 - A trade occurs - this is the first trade outside the 9:30 minute, so IQFeed sends a bar
complete (BC) message for the 9:30 bar. (15-sec timer is reset to 0)
9:31:29 - A trade occurs - no message is sent by IQFeed (15-sec timer is reset to 0)
9:31:40 - A trade occurs - no message is sent by IQFeed (15-sec timer is reset to 0)
9:31:53 - A trade occurs - no message is sent by IQFeed (15-sec timer is reset to 0)
9:32:03 - A trade occurs - IQFeed sends a bar complete (BC) message for the 9:31 bar; only
10 seconds have passed since the last trade, so no BU message is sent by IQFeed before the BC.
Note: IQFeed only sends BC bar complete messages when the first trade outside the
bar occurs. This may occur a long time after the bar has ended. Use the
MaxUpdateDuration parameter to receive more timely BU bar update messages.
BU update bars are appended to the buffer like other bar messages, so we may see bars
with the same Timestamp. These bars do not necessarily have the same data, since they
were sampled at different times (per their respective EventDatenum, EventTimestamp).
The most updated data is always the last bar for each unique Timestamp. For example:
>> IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',inf, 'MaxItems',9, ...
'IntervalSize',60, 'IntervalType','secs', 'MaxUpdateDuration',15);
... % wait a while...
>> data = IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',-1);
>> struct2table(data.Buffer)
ans =
9×12 table
Symbol BarType Timestamp Open …
_______ ____________________________________ _____________________ _____ …
'@VX#' 'Complete interval bar from history' '2020-04-21 03:51:00' 39.45 …
'@VX#' 'Complete interval bar from history' '2020-04-21 03:52:00' 39.45 …
'@VX#' 'Complete interval bar from history' '2020-04-21 03:53:00' 39.35 …
'@VX#' 'Complete interval bar from stream' '2020-04-21 03:53:00' 39.35 …
'@VX#' 'Updated interval bar' '2020-04-21 03:54:00' 39.45 …
'@VX#' 'Complete interval bar from stream' '2020-04-21 03:54:00' 39.45 …
'@VX#' 'Updated interval bar' '2020-04-21 03:55:00' 39.45 …
'@VX#' 'Updated interval bar' '2020-04-21 03:55:00' 39.45 …
'@VX#' 'Complete interval bar from stream' '2020-04-21 03:55:00' 39.45 …

117
http://forums.iqfeed.net/index.cfm?page=topic&topicID=4341. IQFeed’s term “update interval” was renamed
MaxUpdateDuration in IQML in order to avoid confusion with the interval bars. Note: the described scenario depends on
IQFeed’s implementation of the “update interval” mechanism – this implementation is not in IQML’s control.
IQML User Guide 106

Once the data is retrieved, you can direct IQML to clear (empty) the internal Buffer,
by setting ClearBuffer to true or 1. The latest buffer will be returned, and the internal
Buffer (but no other field) will be immediately emptied awaiting new interval bars:118
data = IQML('intervalbars', 'symbol','IBM', 'NumOfEvents',-1, ...
'ClearBuffer',true);
To stop collecting interval bars, simply resend a request with NumOfEvents=0:
IQML('intervalbars', 'symbol','IBM', 'NumOfEvents',0);
You can specify multiple symbols for streaming at the same time, in a single IQML
command, by specifying a colon-delimited or cell-array list of symbols. For example:
IQML('intervalbars', 'symbols',{'IBM','GOOG','AAPL'}, 'numOfEvents',6);
IQML('intervalbars', 'symbols','IBM:GOOG:AAPL', 'numOfEvents',6); % equivalent
As with streaming quotes (§6.1), to get the latest data for all streamed symbols, omit
the Symbol parameter or set it to empty ['']. This returns all streams (both active/not).
In the following example, we get a struct array of size 5, one struct for each symbol
for which that we have requested intervalbars during this Matlab session:
>> data = IQML('intervalbars', 'numOfEvents',-1); % no symbol: get ALL streams
data =
1×5 struct array with fields:
Symbol
Command
isActive
...
Similarly, to cancel all active streams in a single command, omit Symbol (or set it to ''):
>> IQML('intervalbars', 'numOfEvents',0); % no symbol: stop ALL streams
When debugging streaming, it is sometimes useful to assign the streamed data to a
base Matlab workspace variable, which can be monitored live using Matlab’s Variable
Explorer or directly checked/used within a Matlab script, without a need to call
IQML('intervalbars',…,'numOfEvents',-1) to constantly refetch the latest data. This data
mirroring can be done by setting the AssignTo parameter to any valid Matlab variable
name or assignment target, for example: 'myData' or 'streamed.VX' or 'data{3}'.
>> IQML('intervalbars', ..., 'AssignTo','myData');
% streaming data in background is mirrored in base workspace variable myData:
>> myData
myData =
struct with fields:
Symbol: '@VX#'
Command: 'BW,@VX#,60,20200421 000000,7,100,,,B,s,,5'
isActive: 1
EventsToProcess: Inf
EventsProcessed: 129
LatestEventDatenum: 737902.831878183
LatestEventTimestamp: '20200421 19:57:54'
DataType: 'intervalbars'
ProcessType: 'stream'
AssignTo: 'myData'
errorMsg: ''
MaxDaysToProcess: 7
BufferSize: 100
Buffer: [100×1 struct]
LatestData: [1×1 struct]

118
During and around the time of the buffer clear, some streaming data may be lost, so it is advised not to clear to often…
IQML User Guide 107

The following parameters affect interval bars data queries:


Parameter Data type Default Description
Limits the request to the specified
colon or symbol(s). Examples:
comma-  '@VX#'
Symbol or delimited  'IBM:AAPL:GOOG'
Symbols 119
string, or
(none)  'IBM,AAPL,GOOG'
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings This parameter must be set to valid
symbol name(s) when NumOfEvents>0
One of:
 inf – continuous endless streaming
interval bars for specified symbol(s)
Max  N>1 – stream only N interval bars
NumOfEvents integer
Items  1 – get only a single interval bar
 0 – stop streaming interval bars
 -1 – return latest interval bars data
while continuing to stream new bars
Returns up to the specified number of bars
MaxItems integer 100 (if available). This is the max Buffer size.
MaxDays integer 1 Max number of trading days to retrieve
Sets the type of interval size. One of the
following values:
IntervalType string 'secs'  's' or 'secs' – time [seconds] (default)
 'v' or 'volume' – traded volume
 't' or 'ticks' – number of ticks
Size of bars in IntervalType units. Must be
IntervalSize integer 60 ≥1 for secs, ≥2 for ticks, ≥100 for volume.

Only return bars that begin after this time


of day (US Eastern time-zone).
BeginFilterTime string '00:00:00'
Format: ‘hhmm’, ‘hh:mm’, ‘hhmmss’ or
‘hh:mm:ss’.
Only return bars that end before this time
of day (US Eastern time-zone).
EndFilterTime string '23:59:59'
Format: ‘hhmm’, ‘hh:mm’, ‘hhmmss’ or
‘hh:mm:ss’.
Only return bars that begin after this
'' date/time (US Eastern time-zone).
integer or (empty Format: Matlab datenum, or 'yyyymmdd
string or string) hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.
BeginDateTime datetime meaning
Note: there is no corresponding
object today at
EndDateTime parameter for streaming
00:00:00
intervalbars (only for historic bars: §5.4).

119
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 108

Parameter Data type Default Description


Max number of seconds to wait after a
MaxUpdateDuration integer 0
trade before receiving a bar update message
Max number of seconds to wait (0-9000)
Timeout number 5.0
for data in blocking mode (0 means infinite)
logical If true or 1, the internal cyclic quotes buffer
ClearBuffer false
(true/false) is cleared after data is returned to the caller
'' Contains the assignment target (typically
AssignTo string (empty a variable name) in the base Matlab
string) workspace, useful for stream debugging.
If set, overflow handling for the query’s
IQFeed data port is updated as follows:
 0 – no overflow handling (all
OverflowMode integer [] messages will be processed)
 1 – drop new messages when
backlog is too large
 2 – drop old messages (slower)
Size of messages backlog, per IQFeed
MaxEventsBacklog integer 100 data port, above which overflow handling
is done (if OverflowMode is 1 or 2).
IQML User Guide 109

6.4 Market depth (Level 2)


The streaming market depth mechanism also has two distinct parts, just like
streaming level 1 quotes (§6.1):
1. Request IQFeed to start sending a stream of market depth quotes for a
specified security. This is done by using the 'marketdepth' action.
2. At any later time(s), you can access the current market depth data using either
of the following alternatives:
a. Use 'marketdepth' action and NumOfEvents of -1 (minus one). This will
return the latest streamed data, without stopping the background streaming.
b. If you set the AssignTo variable in the original request, you can directly
access the streamed data in the specified base workspace variable.
For example, let’s request market depth quotes for a continuous E-mini contract:
IQML('marketdepth', 'Symbol','@ES#')

This causes IQFeed to start sending market depth updates to IQML in the background,
up to the specified NumOfEvents, without affecting normal Matlab processing. This
means you can continue to work with Matlab, process data, display information etc.
Note that each incoming quote message updates the data for a single market depth
row. The market depth row cannot be specified nor predicted by the user, and the
order of messages is unrelated to the market depth row, for example, an update for
row #3 can follow an update of row #5.
Market depth data will only stream in the background in non-blocking mode. If you assign
the IQML command results to a variable, the request is treated as blocking and IQML
will wait for all the events to accumulate (or Timeout to occur), as described in §4.1:
IQML('marketdepth', 'Symbol','@ES#', 'NumOfEvents',600); % streaming, non-blocking
data = IQML('marketdepth', 'Symbol','@ES#', 'NumOfEvents',600); % blocking

NumOfEvents is an optional input parameter and can be any number >1 for streaming.
To collect market depth data endlessly, set NumOfEvents to the value inf. Note that
in Matlab, inf is a number (not a string), so do not enclose it in quotes ('inf').
The quotes are collected into an internal data structure in IQML. A different structure
is maintained for each symbol.
Subsequent requests to retrieve the latest accumulated interval bars buffer data,
without stopping the background streaming, should use NumOfEvents = -1 (minus
one). These requests return a Matlab data struct similar to the following:
>> data = IQML('marketdepth', 'Symbol','@ES#', 'NumOfEvents',-1)
data =
Symbol: '@ES#'
Command: 'w@ES#'
EventsToProcess: 600
EventsProcessed: 437
LatestEventDatenum: 737195.518211377
LatestEventTimestamp: '20180515 12:26:13'
AssignTo: ''
errorMsg: ''
IncludeEmptyQuotes: 0
LatestData: [1×10 struct]
IQML User Guide 110

In the returned data struct, we can see the following fields:


 Symbol – the requested Symbol.
 Command – the command sent to IQFeed, including the requested Symbol.
 EventsToProcess – total number of streaming interval bars requested for the
security (using the NumOfEvents parameter).
 EventsProcessed – number of streaming market depth data quotes received for
this security. When EventsProcessed >= EventsToProcess, streaming market
depth data for this security is turned off.
 LatestEventDatenum – Matlab numeric datenum representation of the
LatestEventTimestamp (local timezone).
 LatestEventTimestamp – timestamp (string format) when this market depth
quote event was received by IQML (local timezone).
 AssignTo – the name of the assigned variable in the base Matlab workspace
(=AssignTo parameter, see below). In normal cases, this field is empty ('').
 errorMsg – contains the error message in case streaming cannot be processed
(for example: 'Symbol not found'). In normal cases, this field is empty ('').
 IncludeEmptyQuotes – value of the specified IncludeEmptyQuotes parameter
(default value: false). If true or 1, then empty quotes (having no valid Bid or
Ask) will be reported and be counted as a valid “event”; otherwise they will not.
 LatestData – latest data received by IQFeed for each market depth row.
To retrieve the market depth data at the nth market depth row, simply read the fields of
the LatestData at the nth location, for example:
>> data.LatestData(4)
ans =
Symbol: '@ES#'
ID: 'MD04'
Bid: 2725.5
Ask: 2727.25
BidSize: 65
AskSize: 148
BidTime: '05:25:59.761191'
Date: '2018-05-15'
AskTime: '05:25:59.760278'
BidInfoValid: 1
AskInfoValid: 1
Condition: 52
Condition_Description: 'regular'
ID_Description: 'Order book row #4'

BidInfoValid and AskInfoValid values are logical (true/false) values, which appear
as 1 or 0, respectively, in the struct display above. The ID field indicates the
corresponding order-book row (for futures) or market-maker name (for equities).
Different market depth quotes are sent independently from the IQFeed server with a
unique timestamp, in a non-ordered manner. Note that data.LatestEventDatenum and
data.LatestEventTimestamp are specified in the local time-zone.
Note: unlike streaming quotes (§6.1), regional updates (§6.2), and interval bars (§6.3),
the streaming market depth mechanism does not store an internal buffer of quote
updates, so there is no Buffer field and previous updates are not stored. Only the latest
snapshot of the order book (in the LatestData field) is updated.
IQML User Guide 111

To stop collecting market depth quotes for a security, simply send the request again,
this time with NumOfEvents=0.
IQML('marketdepth', 'Symbol','@ES#', 'NumOfEvents',0);

You can specify multiple symbols for streaming at the same time, in a single IQML
command, by specifying a colon-delimited or cell-array list of symbols. For example:
IQML('marketdepth', 'symbols',{'IBM','GOOG','AAPL'});
IQML('marketdepth', 'symbols','IBM:GOOG:AAPL'); % equivalent

As with the blocking request (§4.4), you’ll receive an error message when requesting
market depth info from an exchange for which you have no Level 2 data subscription:
>> data = IQML('marketdepth', 'Symbol','IBM', ...) %not subscribed to NYSE L2
Error using IQML
Symbol 'IBM' was not found!

As with streaming quotes (§6.1), to get the latest data for all streamed symbols, omit
the Symbol parameter or set it to empty ['']. This returns all streams (both active/not):
>> data = IQML('marketdepth', 'numOfEvents',-1); % no symbol: get ALL streams
data =
1×5 struct array with fields:
Symbol
Command
isActive
EventsToProcess
...

Similarly, to cancel all active streams in a single command, omit Symbol (or set it to ''):
>> IQML('marketdepth', 'numOfEvents',0); % no symbol: ALL streams are stopped

When debugging streaming, it is sometimes useful to assign the streamed data to a


base Matlab workspace variable, which can be monitored live using Matlab’s Variable
Explorer or directly checked/used within a Matlab script, without a need to call
IQML('marketdepth',…,'numOfEvents',-1) to constantly refetch the latest data. This data
mirroring can be done by setting the AssignTo parameter to any valid Matlab variable
name or assignment target, for example: 'myData' or 'streamed.VX' or 'data{3}'.
>> IQML('marketdepth', ..., 'AssignTo','myData');
% streaming data in background is mirrored in base workspace variable myData:
>> myData
myData =
struct with fields:
Symbol: '@ES#'
Command: 'w@ES#'
EventsToProcess: 600
EventsProcessed: 437
LatestEventDatenum: 737195.518211377
LatestEventTimestamp: '20180515 12:26:13'
AssignTo: 'myData'
errorMsg: ''
IncludeEmptyQuotes: 0
LatestData: [1×10 struct]
IQML User Guide 112

The following parameters affect market depth data queries (see §4.4 for details):
Parameter Data type Default Description
Limits the request to the specified symbol(s).
colon or Examples:
comma-  '@ES#'
Symbol or delimited  'IBM:AAPL:GOOG'
(none)  'IBM,AAPL,GOOG'
Symbols 120 string, or
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings This parameter must be set to valid symbol
name(s) when NumOfEvents>0
One of:
 inf – continuous endless streaming
Level 2 data for specified symbol(s)
 N>1 – only process N incoming quotes
NumOfEvents integer 10  1 – get only a single quote
 0 – stop streaming market depth data
 -1 – return the latest Level 2 data while
continuing to stream new data updates
MaxLevels integer 5
Max number of data levels (rows) to return
If set to true or 1, empty Level 2 quotes (with
IncludeEmpty logical
false neither a valid Bid nor valid Ask) will also be
Quotes (true/false) returned. By default (false), they will not be.
If set to true or 1, each price level’s components
logical will be reported: trade order IDs for futures;
Detailed false market makers for equities. This parameter is
(true/false)
ignored in IQFeed client/protocol 6.1 or older.
logical If true or 1, the internal cyclic quotes buffer is
ClearBuffer false
(true/false) cleared after the data is returned to the caller.
'' Contains the assignment target (typically a
AssignTo string (empty variable name) in the base Matlab workspace,
string) useful for stream debugging.
Note: Market Depth (Level 2) data is only available in the Professional IQML license.

120
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 113

7 News
News headlines and stories can be retrieved via the 'news' action. Several data-types
are available, which can be set using the DataType parameter.
Note: News data is only available in the Professional IQML license.
7.1 Configuration
To retrieve the news configuration for your account, set DataType to 'config':
>> data = IQML('news', 'DataType','config')
data =
Category: 'All News'
Majors: [1×7 struct]
>> {data.Majors.Source}
ans =
1×7 cell array
{'DTN'} {'CPR'} {'CBW'} {'RTT'} {'CPZ'} {'CIW'} {'BEN'}
>> {data.Majors.Description}
ans =
1×7 cell array
{'DTN News'} {'PR Newswire'} {'Business Wire'} {'Real-Time Trader'}
{'GlobeNewswire Inc'} {'Marketwire'} {'Benzinga Pro'}
This shows that we are connected to 7 major news sources. We can drill-down for
details about these news sources:
>> data.Majors(1)
ans =
Source: 'DTN'
Description: 'DTN News'
AuthenticationCode: '1D'
IconID: 10
Minors: [1×4 struct]
>> data.Majors(1).Minors(1)
ans =
Source: 'DT5'
Description: 'Treasuries, Most Actives, Gainers, Losers'
AuthenticationCode: '1D'
>> data.Majors(1).Minors(2)
ans =
Source: 'RTL'
Description: 'Derivatives - Selected Futures and Options'
AuthenticationCode: '2Ab'
IconID: 10
Note that some news sources have no “Minor” news-sources:
>> data.Majors(2)
ans =
Source: 'CPR'
Description: 'PR Newswire'
AuthenticationCode: '1X'
IconID: 5
Minors: [1×0 struct]
>> data.Majors(7)
ans =
Source: 'BEN'
Description: 'Benzinga Pro'
AuthenticationCode: '1a'
IconID: 10
Minors: [1×0 struct]
News configuration queries do not have any user-settable parameters.
IQML User Guide 114

7.2 Story headlines


To retrieve the latest news headlines (in blocking mode), set DataType to 'headlines':
>> data = IQML('news', 'DataType','headlines')
data =
1000×1 struct array with fields:
Source
ID
Symbols
Timestamp
Datenum
Text
Story
URL
>> data(1)
ans =
Source: 'CPR'
ID: 21988707473
Symbols: {}
Timestamp: '2018-03-05 06:45:53'
Datenum: 737124.281863426
Text: 'The Surface Disinfectants Market is Expected to Grow at a CAGR
of 8.3% to a USD '
Story: ''
URL: ''
>> data(2)
ans =
Source: 'BEN'
ID: 21988707468
Symbols: {'BZFDA' 'CVRS'}
Timestamp: '2018-03-05 06:45:53'
Datenum: 737124.281863426
Text: 'Corindus Receives FDA Clearance for First Automated Robotic
Movemen...'
Story: ''
URL: ''
>> data(3)
ans =
Source: 'RTB'
ID: 21988701358
Symbols: {'BSX'}
Timestamp: '2018-03-05 06:42:33'
Datenum: 737124.279548611
Text: 'Boston Scientific Corp Q4 adjusted earnings Miss Estimates'
Story: ''
URL: ''

As can be seen, some stories are specific to particular symbols (BZFDA and CVRS in
story #21988707468, BSX in #21988701358), while others are not (#21988707473).
Also note that the news stories’ Timestamp is specified in US Eastern time-zone.121
When you retrieve news headlines, you might run into a timeout problem: by default,
IQFeed send the latest 1000 news headlines and only some of them might be received
by IQML before the built-in Timeout (default: 5 secs) forces IQML to return the data
to the user (remember, this is blocking mode, where a timeout applies):

121
The Timestamp field was reported in either yyyymmddHHMMSS or 'yyyymmdd HHMMSS' format (depending on the
specific news headline) in IQML versions 2.50 or earlier. Starting in IQML version 2.51, the Timestamp field is standardized
to 'yyyy-mm-dd HH:MM:SS' format, with an additional numeric Datenum field.
IQML User Guide 115

>> data = IQML('news', 'DataType','headlines')


Warning: IQML timeout: only partial data is returned. Perhaps the Timeout
parameter should be set to a value larger than 5 or the NumOfEvents parameter
to a value smaller than Inf
data =
738×1 struct array with fields:
Source
ID
Symbols
Timestamp
Datenum
Text
Story
URL

As suggested by the message, you can set the Timeout parameter to a high value in
order to allow IQML more time to gather the data before returning the results:122
>> data = IQML('news', 'DataType','headlines', 'Timeout',10)
data =
1000×1 struct array with fields:
Source
ID
...

You can filter the headlines to a specific set of symbols by specifying Symbols as a
colon-delimited or cell-array list of symbols.123 For example, to filter only headlines
that relate to symbols BSX, BSX/AAPL, and BSX/AAPL/GOOG, respectively:
>> data = IQML('news', 'DataType','headlines', 'Symbols','BSX')
data =
60×1 struct array with fields:
...
>> data = IQML('news', 'DataType','headlines', 'Symbols',{'BSX','AAPL'})
data =
677×1 struct array with fields:
...
>> data = IQML('news', 'DataType','headlines', 'Symbols','BSX:AAPL:GOOG')
data =
841×1 struct array with fields:
...

Note: Queries with a non-empty Symbols filter are much faster than symbol-less
queries (IQFeed takes an extra 1-3 secs to process symbol-less queries).
You can also limit the search to specific news sources, by specifying a colon-
separated or cell-array list of sources in the Sources parameter. For example:
>> data = IQML('news', 'DataType','headlines', 'Symbols','BSX:GOOG:AAPL', ...
'Sources','DTN:CPR:BEN')
data =
745×1 struct array with fields:
...

In this example, we see that when we limit our search to DTN (DTN News), CPR (PR
Newswire), and BEN (Benzinga Pro), we only get 745 headlines, compared to 841
headlines from all the news sources. The news source names are the ones reported by
the Majors.Source field, in the news configuration query (see §7.1).

122
The Timeout parameter is automatically set to a minimal value of 60 [secs] when GetStory parameter is requested (see below)
123
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 116

In addition to limiting the search to a certain news source, you can also limit it to
certain meta-tags that are assigned by some news sources, using the Symbols
parameter. For example, to limit the search to “Benzinga Ratings”:
>> data = IQML('news', 'DataType','headlines', 'Symbols','BZRatings');

You can limit the reported headlines to only a specific date, using the Date parameter:
>> data = IQML('news', 'DataType','headlines', 'Date',20180304, ...
'Symbols',{'BSX','AAPL'})
data =
14×1 struct array with fields:
ID
...

Date can be specified in various formats: as a Matlab datetime object, a numeric Matlab
datenum (737089), a numeric yyyymmdd value (20180129), or a string ('2018/01/29',
'2018-01-29' or '20180129'). Note: IQFeed only stores headlines of the past 180 days.124
You can also limit the maximal number of reported headlines using the MaxItems
parameter. This will report the latest MaxItems news headlines (fewer headlines may
actually be reported, depending on their availability):125
>> data = IQML('news', 'DataType','headlines', 'MaxItems',50)
data =
50×1 struct array with fields:
Source
ID
...

For performance reasons, it is always better to limit the query at the source (using the
various filter parameters Symbols, Sources, Date and MaxItems), rather than
filtering the messages after they are received. Using filter parameters reduces the
IQFeed server response time,126 network download time, and IQML processing time.
By default, only the headline text is returned. To also fetch the full news-story text
that is associated with each headline, set GetStory to true:127
>> data = IQML('news', 'DataType','headlines', 'GetStory',true);
>> data(1)
ans = Source: 'CBW'
ID: 22017456356
Symbols: {}
Timestamp: '20180524 092926'
Text: 'Global Barium Nitrate Market - Emergence of Environment-
Friendly Ox...'
Story: '09:28 Thursday, May 24, 2018. (RTTNews.com) - Babcock & Wilcox
Enterprises, Inc. (BW) confirmed that it had received a non-binding indication
of interest from Steel Partners to acquire B&W in a transaction in which B&W...
For comments and feedback: contact editorial@rttnews.com ↵Copyright(c) 2018
RTTNews.com All Rights Reserved'
URL: 'editorial@rttnews.com'

124
https://help.dtniq.com/support-faqs
125
IQFeed ignores MaxItems>4000, returning only 4000 headlines: http://forums.dtn.com/index.cfm?page=topic&topicID=5702
126
For example, as noted above, IQFeed takes an extra 1-3 secs to process symbol-less news queries.
127
See §7.3 for additional information on the story-text queries and the reported data
IQML User Guide 117

Each news story takes 0.3-0.5 secs to download, so querying the story text for multiple
headlines can take a long time. For example, such a query might take a full minute for
100 headlines. If you have Matlab’s Parallel Computing Toolbox and the Professional
IQML license, you can parallelize this query by setting UseParallel to true:
>> tic
>> data = IQML('news', 'DataType','headlines', 'MaxItems',100, 'GetStory',1);
>> toc
Elapsed time is 56.311768 seconds.
>> parpool('local',4) % start 4 workers in parallel pool (optional)
>> tic
>> data = IQML('news', 'DataType','headlines', 'MaxItems',100, 'GetStory',1,...
'UseParallel',1);
>> toc
Elapsed time is 15.799185 seconds.

News headlines queries with GetStory are composed of an initial headlines query,
followed by multiple news-story queries (§7.3) for each of the reported headline IDs.
Such queries with GetStory have an automatic minimal Timeout value of 60 [secs].
The Timeout parameter has a practical effect only on the initial headlines query, as
well as the subsequent story text queries (individually). The total query time does not
have a time-out and can take much longer than the specified Timeout. A Timeout of
60 (the default/min value for such queries) allows fetching up to ~10-20k headlines in
theory (depending on network/computer speed and MaxItems/Date parameter values),
but only up to 4k headlines are returned in practice (IQFeed’s undocumented limit).
The news-story queries for these 4k headlines could take an extra 20-40 minutes
(depending on network/computer speed), unless you parallelize the query. This would
not be cut short by Timeout, since Timeout affects each news-story query seperately.
You can only stop the query by typing Ctrl-C in Matlab’s console (Command Window).
IQML User Guide 118

The following parameters affect (filter) news headlines queries:


Parameter Data type Default Description
Limits the query to the specified symbols
colon or and meta-tags only (or to all symbols, if
comma- empty). Examples:
''  'IBM'
Symbol or delimited
(empty string),
Symbols 128 string or  'IBM:AAPL:GOOG'
meaning all
cell-array  'IBM,AAPL,GOOG'
of strings  {'IBM', 'AAPL', 'GOOG'}
 'BZRatings:BZTradingIdeas'
colon or Limits query to the specified news sources
comma- only (or to all sources, if empty). Examples:
''
delimited  'DTN'
Sources (empty string),
string or  'DTN:CPR:BEN'
meaning all
cell-array  'DTN,CPR,BEN'
of strings  {'DTN', 'CPR', 'BEN'}
Date at which the news headline was
published (or all dates, if empty). Examples:
integer or  737089 (Matlab datenum format)
string or []  datetime('Jan 29, 2018')
Date
datetime meaning all  20180129 (yyyymmdd format)
object  '20180129'
 '2018/01/29'
 '2018-01-29'
Maximal # of headlines to be reported by
integer IQFeed. Note that a lower number of head-
MaxItems 1000
(1-4000)129 lines may be reported, depending on their
availability, based on the other filters.
If false (default), only store the incoming
headline messages.
logical
GetStory false If true or 1, automatically fetch and store
(true/false)
the full story text for each incoming headline.
Parallelizable using UseParallel (see below).
Max # of seconds to wait for incoming data
Timeout number 5.0 (0-9000 where 0 means infinite). If GetStory
was requested Timeout is set to minimum 60.
If set to true or 1, and if Parallel Computing
logical Toolbox is installed, then querying story
UseParallel false headlines using GetStory=true is done in
(true/false)
parallel (see §3.6; Pro IQML license only).
MaxWorke (the current Max number of parallel workers to use (up
integer to the current pool size) when UseParallel=1
rs pool size)

128
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
129
IQFeed ignores MaxItems>4000, returning only 4000 headlines: http://forums.dtn.com/index.cfm?page=topic&topicID=5702
IQML User Guide 119

7.3 Story text


To read a particular story in full (blocking mode), specify DataType = 'story' and ID
(numeric ID, as provided in the story-headlines query, see §7.2). Different news
sources provide their news stories in different formats, for example:
>> data = IQML('news', 'DataType','story', 'ID',21988707468)
data =
ID: 21988707468
Symbols: {'BZFDA' 'CVRS'}
Text: 'Corindus Receives FDA Clearance for First Automated Robotic
Movement in technIQ Series for CorPath GRX Platform.'
URL: ''
>> data = IQML('news', 'DataType','story', 'ID',21988701358)
data =
ID: 21988701358
Symbols: {'BSX'}
Text: '06:42 Monday, March 05, 2018. (RTTNews.com) - Boston Scientific
Corp (BSX) released earnings for fourth quarter that declined
from the same period last year... % full text redacted here
Read the original article on RTTNews
(http://alpha.rttnews.com/9583/boston-scientific-corp-q4-
adjusted-earnings-miss-estimates.aspx) For comments and
feedback: contact editorial@rttnews.com. Copyright(c) 2018
RTTNews.com All Rights Reserved.'
URL: 'http://alpha.rttnews.com/9583/boston-scientific-corp-q4-
adjusted-earnings-miss-estimates.aspx'

In many cases, the news story is not specifically related to any particular symbol:
>> data = IQML('news', 'DataType','story', 'ID',21991159700)
data =
ID: 21991159700
Symbols: {}
Text: 'Global Nanocatalysts Strategic Business Report 2018: Market
Trends, Growth Drivers & Issues 2016-2024 -
ResearchAndMarkets.com. Mar. 12, 2018. Business Editors. DUBLIN-
-(BUSINESS WIRE)--Mar. 12, 2018--The Nanocatalysts – Global
Strategic Business Report... % full text redacted here
View source version on businesswire.com:
http://www.businesswire.com/news/home/20180312005490/en/ ...
For GMT Office Hours Call +353-1-416-8900. Related Topics:
Nanotechnology, Nanomaterials'
URL: 'http://www.businesswire.com/news/home/20180312005490/en/'

As can be seen in the examples here, the URL field is automatically extracted from the
story Text, when such a URL is reported (many stories do not report a URL). When a
webpage URL is not detected but an email address is, the URL field will report it:
>> data = IQML('news', 'DataType','story', 'ID',22386314395)
data =
ID: 22386314395
Symbols: {'CMRE-PB' 'CMRE-PC' 'CMRE-PD' 'CMRE-PE' 'CMRE'}
Text: 'March 01, 2021↵ MONACO, March 01, 2021 (GLOBE NEWSWIRE) --
Costamare Inc. (the Company or our) (NYSE: CMRE) announced today that its
Annual Report on Form 20-F for the fiscal year ended December 31, 2020 (the
Annual Report) has been filed with the U.S. Securities and Exchange Commission
and can be accessed on the Companys website, www.costamare.com, in the
Investors section under Annual Reports... % full text redacted here
Company Contacts:↵ Gregory Zikos - Chief Financial Officer Konstantinos
Tsakalidis - Business Development↵ Costamare Inc., Monaco Tel: (+377) 93 25
09 40 Email: ir@costamare.com'
URL: 'ir@costamare.com'
IQML User Guide 120

In some cases, the story may be assigned one or more meta-symbol tags. For
example, the following story is tagged for “Benzinga Ratings”:
>> data = IQML('news', 'DataType','story', 'ID',21991162633)
data =
ID: 21991162633
Symbols: {'BZRatings' 'MNTX'}
Text: 'Manitex International Sees Q4 Sales $64.40M vs $64.45M Est.
Manitex International (NASDAQ: MNTX) sees Q4 sales of $64.40M
vs $64.45M estimate.'
URL: ''

Note that separate paragraphs in the news story text are separated by a newline
(char(10)) in the reported data.Text field. This enables display of the story text in a
human-readable format, when you output the text to the Matlab console or GUI.

If the requested ID is invalid or does not exist, the returned data will be empty (no
error is reported):
>> IQML('news', 'DataType','story', 'ID',123456) % non-existing headline ID
ans =
[]

Aside from ID, the news story-text query does not have any user-settable parameters.

You can specify multiple IDs in a single IQML query command, by specifying an
array of values. For example:
>> data = IQML('news', 'DataType','story', 'ID',[22018991229,22018991585])
data =
2×1 struct array with fields:
ID
Symbols
Text
URL

>> data(1)
ans =
ID: 22018991229
Symbols: {}
Text: 'May 29, 2018 ↵Dublin, May 29, 2018 (GLOBE NEWSWIRE) -- The
European Financing in Cleantech Innovation report...
URL: ''

>> data(2)
ans =
ID: 22018991585
Symbols: {'BZEarnings' 'MOMO'}
Text: 'Momo Inc. Earlier Reported Q1 EPS $0.69 Beat $0.50 Estimate,
Sales $435.129M Beat $396.17M Estimate ↵Momo Inc. ...
URL: ''
IQML User Guide 121

7.4 Story count


It is sometimes useful to know the number of distinct news stories, from all news sources
(even those to which you are not subscribed), that relate to different symbols, indicating
level of news interest in those symbols. Set DataType to 'number' and the Symbols,
Sources and/or dates, to receive a Matlab struct with a numeric count for each symbol:
>> data = IQML('news', 'DataType','number', 'Symbols','BSX')
data =
BSX: 14
>> data = IQML('news', 'DataType','number', 'Symbols','BSX:HP:AAPL:GOOG')
data =
AAPL: 7
BSX: 14
GOOG: 2
HP: 0
In this example, we see that BSX has a higher news-count today than AAPL or GOOG.
Symbols having no news items will appear at the bottom of the struct with a count of 0.
You can limit the search to specific news sources, by specifying a colon-separated or
cell-array list of sources in the Sources parameter. For example:
>> data = IQML('news', 'DataType','number', 'Symbols','BSX:GOOG:AAPL',...
'Sources','DTN:CPR:BEN')
data =
AAPL: 2
BSX: 3
In this example, we see that when we limit our search to DTN (DTN News), CPR (PR
Newswire), and BEN (Benzinga Pro), AAPL and BSX have fewer news items, and
GOOG has none. The news source names are the ones reported by the Majors.Source
field, in the news configuration query (see §7.1).
You can also filter the search to only look at news items published at specific dates,
by specifying the BeginDate, EndDate and/or Date parameters. Dates can be specified
in several formats: as a Matlab datetime object, Matlab numeric datenum (737089),
numeric yyyymmdd (20180129), or string ('2018/01/29', '2018-01-29', '20180129'):
>> data = IQML('news', 'DataType','number', 'Symbols','BSX:GOOG:AAPL',...
'BeginDate',20180301)
data =
AAPL: 45
BSX: 19
GOOG: 15
>> data = IQML('news', 'DataType','number', 'Symbols','BSX:GOOG:AAPL',...
'BeginDate',20180301, 'EndDate',20180303)
data =
AAPL: 37
BSX: 3
GOOG: 13
>> data = IQML('news', 'DataType','number', 'Symbols','BSX:GOOG:AAPL',...
'EndDate',20180305)
data =
AAPL: 2038
BSX: 191
GOOG: 996
>> data = IQML('news', 'DataType','number', 'Symbols','BSX:GOOG:AAPL',...
'Date',20180301)
data =
AAPL: 16
BSX: 1
GOOG: 3
IQML User Guide 122

IQML returns a Matlab struct, so the reported symbols need to be valid field names,
and non-alphanumeric characters are automatically converted. For example:
>> data = IQML('news', 'DataType','number', 'Symbols','BOL.ST:BOL@SS:0QLL.L')
data =
x0QLL_L: 3
BOL_ST: 1
BOLxSS: 1

The following parameters affect (filter) news story-count queries:


Parameter Data type Default Description
colon or Limits query to specified symbols, meta-tags
comma- only (or to all symbols, if empty). Examples:
''
Symbol or delimited  'IBM'
(empty string),
Symbols 130
string or  'IBM:AAPL:GOOG'
meaning all
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings  'BZRatings,BZTradingIdeas'
colon or Limits the query to specified news sources
comma- only (or to all sources, if empty). Examples:
''
delimited  'DTN'
Sources (empty string),
string or  'DTN:CPR:BEN'
meaning all
cell-array  'DTN,CPR,BEN'
of strings  {'DTN', 'CPR', 'BEN'}
Specific date at which the news items were
published. Examples:
 737089 (Matlab datenum format)
integer or  datetime('Jan 29, 2018')
Date
string or []  20180129 (yyyymmdd format)
datetime meaning today
 '20180129'
object
 '2018/01/29'
 '2018-01-29'
Note: Date overrides BeginDate, EndDate
integer or '1900/01/01'
string or (i.e., from as Earliest date at which the news items were
BeginDate datetime
early as data is published. Examples: see Date above.
object available)
integer or
string or '2099/12/31' Latest date at which the news items were
EndDate datetime (i.e., until now) published. Examples: see Date above.
object

130
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 123

7.5 Streaming news headlines


The streaming news mechanism has two parts, just like streaming ticks (§6.1):
1. Request IQFeed to start sending a stream of news headlines. This is done by
using the 'news' action and setting a NumOfEvents parameter to a positive >1
value. You can limit the headlines to certain news source(s) using the Sources
parameter, and/or to certain symbol(s) using the Symbols parameter.
2. Later, whenever you wish to process the latest news headline(s), simply use
the 'news' action and NumOfEvents of -1 (minus one). This will return the
latest information (a data struct), without stopping the background streaming.
For example, let’s request 100 streaming headlines for Facebook and Apple:
IQML('news', 'Symbols','FB:AAPL', 'NumOfEvents',100)

This causes IQFeed to start sending news headlines to IQML in the background, up to
the specified NumOfEvents, without affecting normal Matlab processing. This
means that you can continue to work with Matlab, process and display information etc.
Headlines will only stream in the background in non-blocking mode. If you assign the
IQML command results to a variable, the request is treated as blocking and IQML will
wait for all the events to accumulate (or Timeout to occur), as described in §7.2:
IQML('news', 'NumOfEvents',100); % streaming, non-blocking
data = IQML('news', 'NumOfEvents',100); % blocking

NumOfEvents can be any number higher than 1 for streaming to work (a value of 1
is the standard snapshot news-headline request described in §7.2). To collect
streaming headlines endlessly, set NumOfEvents to the value inf. Note that in
Matlab, inf is a number (not a string), so do not enclose it in quotes ('inf').
The headlines are collected into an internal data buffer in IQML. Unlike streaming
quotes, all headlines, for all symbols, are collected in a single buffer. The buffer size
can be controlled using the MaxItems parameter, which has a default value of inf131.
This means that by default all the streaming headlines that affect the specified
symbols will be stored in the buffer and become accessible for later processing.132
If you set a higher value for MaxItems, then up to the specified number of latest
news headline items will be stored. For example, to store the latest 50 headlines:
IQML('news', 'NumOfEvents',100, 'MaxItems',50)

Note that using a large MaxItems increases memory usage, which could have an
adverse effect if you set a very large buffer size (many thousands) and/or streaming
for a large number of different securities.133

131
Note that this too is different from the streaming quotes mechanism, where the default MaxItems value is 1. Note that
MaxItems is a numeric parameter like NumOfEvents, so don’t enclose the parameter value within string quotes (‘’)
132
This might have a memory and performance implication if you leave streaming news on for a long time, for a large number of
symbols. See the discussion of memory and performance implications further below.
133
Each news headline item uses 1-2KB of Matlab memory. During trading hours, there could be 10-20 headlines per minute for
all symbols (i.e., 1K headlines, or 1-2MB per hour, unless you limit Symbols to certain symbols). Limiting Symbols to certain
symbols and/or setting MaxItems to some finite value, ensures that memory usage and performance impact remain low.
IQML User Guide 124

Subsequent requests to retrieve the latest accumulated headlines buffer data, without
stopping the background streaming, should use NumOfEvents = -1 (minus one).
These requests return a Matlab data struct similar to the following:
>> data = IQML('news', 'NumOfEvents',-1)
data =
Command: 'S,NEWSON'
isActive: 1
EventsToProcess: 100
EventsProcessed: 13
LatestEventDatenum: 737146.726041343
LatestEventTimestamp: '20180327 17:25:29'
DataType: 'news'
ProcessType: 'stream'
Sources: {}
Symbols: {}
BufferSize: 50
Buffer: [13×1 struct]
LatestData: [1×1 struct]
GetStory: 0
In the returned data struct, we can see the following fields:
 Command – the command sent to IQFeed.134
 isActive – a flag indicating whether headlines are currently being streamed.
When NumOfEvents ticks have been received, this flag is set to false (0).
 EventsToProcess – total number of streaming headlines requested (using the
NumOfEvents parameter).
 EventsProcessed – number of streaming headlines received. When
EventsProcessed >= EventsToProcess, streaming headlines are turned off and
isActive is set to false (0). Note that it is possible that EventsProcessed >
EventsToProcess, since it takes a while for the streaming cancellation request
to reach IQFeed and during this time a few additional items may have arrived.
 LatestEventDatenum – Matlab numeric datenum representation of the
LatestEventTimestamp.
 LatestEventTimestamp – local timestamp (string format) when this headline
was received by IQML.
 DataType – always equal to 'news' for streaming headlines.
 ProcessType – always equal to 'stream' for streaming headlines.
 Sources – cell array of acceptable news sources, set by the Sources parameter.
Headline events from all other sources are ignored. When Sources is empty,
no headline is ignored based on its source.
 Symbols – cell array of acceptable symbols, set by the Symbols parameter.
Headline events that affect all other symbols are ignored. When Symbols is
empty, no headline is ignored based on its related symbol(s).
 BufferSize – size of the data buffer (=MaxItems parameter, see below).
 Buffer – buffer of size BufferSize, accumulating the latest headline updates.
 LatestData – latest headline event received from IQFeed.
 GetStory – a flag indicating if story text was requested (GetStory parameter)

134
Note that this is not specific to symbols/sources: filtering based on symbol/source is done on the incoming headline messages.
IQML User Guide 125

To get the headline data, read the fields of the returned data struct, for example:
>> data.LatestData
ans =
Source: 'BEN'
ID: 21996096022
Symbols: {'BZRatings' 'FB'}
Timestamp: '20180326 083326'
Datenum: 737145.356550926
Text: 'Baird Maintains Outperform on Facebook Lowers Price Target to $210'
Story: ''
URL: ''

Each headline has an associated timestamp, since different headlines are sent
separately and independently from IQFeed server.
By default, GetStory is set to false, resulting in empty data.LatestData.Story. To
automatically retrieve the full story text associated with each streamed headline, set
GetStory to true (see §7.2). In any case, it is always possible to retrieve individual
story texts using their headline ID (see §7.3).
Note: while data.LatestEventDatenum and data.LatestEventTimestamp are specified
in the local time-zone, data.LatestData.Timestamp is specified in the server’s time-zone.
Note that data.LatestData is typically the same as data.Buffer(end), regardless of
the values of MaxItems or NumOfEvents.135
To stop collecting streaming headlines for a security, simply send the request again,
this time with NumOfEvents=0.
You can specify one or more symbols for streaming, by specifying a colon-delimited
or cell-array list of symbols. If Symbols is specified, then any headline that does not
relate to one or more of the specified Symbols will be ignored (skipped). For example:
IQML('news', 'symbols',{'IBM','GOOG','AAPL'}, 'numOfEvents',6);
IQML('news', 'symbols','IBM:GOOG:AAPL', 'numOfEvents',6); % equivalent

You can also specify meta-tags assigned by some news sources. For example, to limit
streaming headlines to “Benzinga Ratings” and anything related to Facebook or Apple:
IQML('news', 'Symbols','BZRatings:FB:AAPL', 'numOfEvents',6);

Note: if you omit the Symbols parameter in your IQML command, no filtering of
headlines based on affected symbols is performed, and all headlines will be collected.
Similarly, you can specify one or more news sources, by specifying a colon-delimited
or cell-array list of sources. If Sources is specified, then any headline that does not
originate from one of the specified Sources will be ignored and will not be recorded:
IQML('news', 'sources',{'DTN','CPR','BEN'}, 'numOfEvents',6);
IQML('news', 'sources','DTN:CPR:BEN', 'numOfEvents',6); % equivalent

135
When NumOfEvents events have been received, IQFeed is instructed to stop streaming updates, but one or more update
messages may already be on their way from IQFeed before streaming actually stops. These extra update messages are not
accumulated in the Buffer, but the latest of these messages will be reflected in LatestData field.
IQML User Guide 126

As before, if you omit the Sources parameter in your IQML command, no filtering of
headlines based on their source will be performed, and all headlines will be collected.
Here is a summary of the IQML parameters that affect streaming news headlines:
Parameter Data type Default Description
Limits the query to the specified symbols and
colon or meta-tags only (or all symbols, if empty), e.g.:
''
comma-  'IBM'
(empty
Symbol or delimited  'IBM:AAPL:GOOG'
string),
Symbols 136 string or  'IBM,AAPL,GOOG'
meaning
cell-array  {'IBM', 'AAPL', 'GOOG'}
all
of strings  'BZRatings:BZTradingIdeas'
colon or Limits the query to the specified news sources
'' only (or to all sources, if empty). Examples:
comma-
(empty  'DTN'
delimited
Sources string),  'DTN:CPR:BEN'
string or
meaning  'DTN,CPR,BEN'
cell-array
all  {'DTN', 'CPR', 'BEN'}
of strings
One of:
 inf – continuous endless streaming
headlines for the specified security
 N>1 – stream only N headlines
NumOfEvents integer Inf  1 – get only a single headline (default)
 0 – stop streaming headlines
 -1 – return the latest accumulated
headlines data while continuing to
stream new headlines data
Number of streaming headlines stored in a
cyclic buffer. Once this number of headlines
MaxItems integer Inf has been received, the oldest headline is
discarded whenever a new headline arrives.
DataType string 'headline' Ignored – only headlines can be streamed
If false (default), only store the incoming
logical headline messages.
GetStory false
(true/false) If true or 1, automatically fetch and store the
full story text for each incoming headline.
If set, the overflow handling for the query’s
IQFeed data port is updated as follows:
OverflowMod  0 – no overflow handling (all messages
integer []
e will be processed)
 1 – drop new messages when backlog fills
 2 – drop old messages (slower)
MaxEventsBa
integer 100 Size of messages backlog, per IQFeed data
cklog port, above which overflow handling is done

136
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 127

8 Lookup of symbols and codes


A list of symbols and lookup codes that match a specified set of criteria can be
retrieved using the 'lookup' and 'chain' actions. Various different lookups can be
requested, which differ by the DataType parameter.
8.1 Symbols lookup
To retrieve a list of symbols that match certain criteria, set the action to 'lookup',
DataType to 'symbols' and add one or more filtering criteria: Name, Description,
Market, SecType, SIC, and/or NAICS:
>> data = IQML('lookup', 'DataType','symbols', 'Name','IBM')
data =
1086×1 struct array with fields:
Symbol
Description
Market_ID
Market_Name
Sec_Type_ID
Sec_Type
>> data(1)
ans =
Symbol: 'IBM'
Description: 'INTERNATIONAL BUSINESS MACHINE'
Market_ID: 7
Market_Name: 'New York Stock Exchange (NYSE)'
Sec_Type_ID: 1
Sec_Type: 'Equity'
>> data(2)
ans =
Symbol: 'IBMG'
Description: 'ISHARES IBONDS SEP 2018 MUNI BOND'
Market_ID: 11
Market_Name: 'NYSE Archipelago (NYSE_ARCA)'
Sec_Type_ID: 1
Sec_Type: 'Equity'
>> data(9)
ans =
Symbol: 'IBM1804E120'
Description: 'IBM MAY 2018 C 120.00'
Market_ID: 14
Market_Name: 'OPRA System'
Sec_Type_ID: 2
Sec_Type: 'Index/Equity Option'
>> data(end)
ans =
Symbol: 'IBZ18-IBM19'
Description: '30 DAY INTERBANK CASH RATE DEC 18/JUN 19'
Market_ID: 64
Market_Name: 'ASX24 Commodities Exchange (ASXCM)'
Sec_Type_ID: 10
Sec_Type: 'Future Spread'

IQFeed returns a list of symbols whose symbol name contains (not necessarily begins
with) the term 'IBM', from different markets (exchanges) and different security types.
Note that the Name and Description filtering criteria are case-insensitive (so 'IBM',
'Ibm' and 'ibm' would all result in the same list of symbols), and also that they match
their string value anywhere within the corresponding asset field.
IQML User Guide 128

You can narrow-down the results by entering more-specific parameter values (e.g.
'IBM180' rather than 'IBM'), or by specifying additional filtering parameters. For
example, to filter the IBM list just to assets that include ‘business’ in their Description:
>> data = IQML('lookup', 'DataType','symbols', 'name','ibm', ...
'Description','business')
data =
8×1 struct array with fields:
Symbol
Description
Market_ID
Market_Name
Sec_Type_ID
Sec_Type

>> data = struct2table(data)


data =
8×6 table

Unlike the Name and Description (which match strings), the SIC and NAICS
parameters are numeric and match the beginning of the corresponding SIC/NAICS
sector/industry code. For example, the following query returns all assets that have
'inc' in their Description and belong to any sector whose SIC code begins with 83:137
>> data = IQML('lookup', 'DataType','symbols', 'Description','inc', 'SIC',83)
data =
6×1 struct array with fields:
Symbol
Description
Market_ID
Market_Name
Sec_Type_ID
Sec_Type
SIC_ID
SIC_Desc
>> data(1)
ans =
Symbol: 'HQGE'
Description: 'HQ GLOBAL ED INC'
Market_ID: 3
Market_Name: 'Nasdaq other OTC'
Sec_Type_ID: 1
Sec_Type: 'Equity'
SIC_ID: 8331
SIC_Desc: 'JOB TRAINING AND VOCATIONAL REHABILITATION SERVICES'
>> disp({data.Symbol; data.Description; data.SIC_ID; data.SIC_Desc}')
'HQGE' 'HQ GLOBAL ED INC' [8331] 'JOB TRAINING AND ...'
'KVIL' 'KIDVILLE INC' [8351] 'CHILD DAY CARE SERVICES'
'DRWN' 'A CLEAN SLATE INC.' [8361] 'RESIDENTIAL CARE'
'NVOS' 'NOVO INTEGRATED SCIENCES INC...' [8361] 'RESIDENTIAL CARE'
'SPRV' 'SUPURVA HEALTHCARE GROUP INC...' [8361] 'RESIDENTIAL CARE'

137
In this example, the matching SIC codes were 8331 (HQGE), 8351 (KVIL), 8361 (DRWN, NVOS, SPRV). IQFeed has a bug
(as of October 2019): no data is returned if SIC or NAICS < 10 (http://forums.iqfeed.net/index.cfm?page=topic&topicID=5653).
IQML User Guide 129

In this example, to retrieve just the 3 symbols in the Residential Care industry, set the
SIC value to the industry’s specific SIC code (8361), rather than its sector code (83).
When you specify a SIC or NAICS filtering criteria, the result contains two
additional fields (either SIC_ID and SIC_Desc, or NAICS_ID and NAICS_Desc,
respectively), in addition to the standard fields (Symbol, Description, Market_ID,
Market_Name, Sec_Type_ID and Sec_Type).138
Note that it is possible that not all the requested symbols will be received before
IQML’s timeout (default value: 5 secs) returns the results:139
>> data = IQML('lookup', 'DataType','symbols', 'Name','GOOG')
Warning: IQML timeout: only partial data is returned. Perhaps the Timeout
parameter should be set to a value larger than 5
data =
3848×1 struct array with fields:
Symbol
Description
Market_ID
Market_Name
Sec_Type_ID
Sec_Type

To control the maximal duration that IQML will wait for the data, set the Timeout
parameter. For example, to wait up to 30 secs to collect the complete list of symbols:
>> data = IQML('lookup', 'DataType','symbols', 'Name','GOOG', 'timeout',30)
data =
11562×1 struct array with fields:
...

In addition to Timeout, for long queries it is advisable to set the Progress parameter
to 'console', in order to display a periodic progress update message in the console
every 1000 data points (every ~1-2 secs), as well as at the end of the query:
>> data = IQML('lookup', 'DataType','symbols', 'Name','GOOG', 'timeout',-1,...
'progress','console');
1000 lookup symbols processed. Latest: GOOG2112N1460 ...
2000 lookup symbols processed. Latest: GOOG2116G1520 ...
3000 lookup symbols processed. Latest: GOOG2119B900 ...
4000 lookup symbols processed. Latest: GOOG2122M1822.5 ...
...
11562 lookup symbols processed

Naturally, it is quite possible that no symbol is found that matches the requested
criteria. In such a case, the result will be empty (and cannot be displayed using
Matlab’s struct2table() or struct2cell() functions):
>> data = IQML('lookup', 'DataType','symbols', 'Description','inc', 'NAICS',83)
data =
[]
>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.

138
The description of the various numeric codes for Market_ID, Sec_Type_ID, SIC and NAICS can be fetched separately – see
§8.3-§8.6 for details
139
IQML can process ~1000 symbols per second; coupled with the network and server-processing latencies we can expect ~4000
symbols to accumulate before the default timeout of 5 seconds kicks in.
IQML User Guide 130

An error message will result if you try to specify both SIC and NAICS filtering
criteria – only one (or none) of them is permitted in a lookup query:
>> data = IQML('lookup', 'DataType','symbols', 'NAICS',1234, 'SIC',83)
You can specify either SIC or NAICS parameter, but not both of them, in a
symbol lookup query
An error message will also result if you do not specify at least one of the filtering
criteria Name, Description, Market, SecType, SIC, NAICS:
>> data = IQML('lookup', 'DataType','symbols')
At least one of Name, Description, Market, SecType, SIC or NAICS parameters
must be specified in a symbol lookup query
You can filter the results based on one or more markets, and/or security types, using
the Market and SecType parameters (see §8.3, §8.4 for valid values). For example:
>> struct2table(IQML('lookup', 'datatype','symbols', 'name','GOOG', 'SecType','Equity'))
ans =
2×6 table
Symbol Description Market_ID Market_Name Sec_Type_ID Sec_Type
_______ ______________________ _________ ________________ ___________ ________
'GOOG' 'ALPHABET INC CLASS C' 21 'Nasdaq Global Select Market (NGSM)' 1 'Equity'
'GOOGL' 'ALPHABET INC CLASS A' 21 'Nasdaq Global Select Market (NGSM)' 1 'Equity'
>> data = IQML('lookup', 'datatype','symbols', 'name','GOOG', 'Market','NGSM');

Multiple Markets and/or SecTypes140 can be specified using a cell array. For
example, to get the list of all active (non-expired) GOOG equities and options:141
>> data = IQML('lookup', 'datatype','symbols', 'name','GOOG', ...
'SecTypes',{'Equity','IEOption'}, 'Timeout',20)
data =
8056×1 struct array with fields:
Symbol
Description
Market_ID
Market_Name
Sec_Type_ID
Sec_Type
You can specify both Market(s) and SecType(s) to get an even more granular
filtering. For example, to lookup only future options traded on CBOT:
>> data = IQML('lookup', 'datatype','symbols', 'name',symbol, ...
'SecTypes','FOption', 'Markets','CBOT');
Similarly, to lookup VIX (volatility) futures and future-spreads (but not combined
future volume OI symbols such as @VX1.OI.Z) on the CBOE Futures Exchange (CFE):
>> data = IQML('lookup', 'datatype','symbols', 'name','vx', ...
'SecTypes',{'Future','Spread'}, 'Markets','CFE');
If you specify one or more invalid Market(s) or SecType(s), you will get an error.
For example, a typical error is to specify a SecType of 'Option' instead of 'IEOption':
>> d = IQML('lookup','datatype','symbols','name','GOOG','SecTypes',{'Equity','Option'})
Invalid SecType(s) "OPTION". Allowed values: ARGUS, ARGUSFC, BONDS, CALC,
COMBINED_FOPTION, COMBINED_FUTURE, COMM3, EQUITY, FAST_RACKS, FOPTION,
FOPTION_IV, FOREX, FORWARD, FUTURE, ICSPREAD, IEOPTION, INDEX, ISO, JACOBSEN,
MKTRPT, MKTSTATS, MONEY, MUTUAL, NP_CAPACITY, NP_FLOW, NP_POWER,
PETROCHEMWIRE, PRECMTL, RACKS, RFSPOT, SNL_ELEC, SNL_NG, SPOT, SPREAD,
STRATSPREAD, STRIP, SWAPS, TREASURIES

140
Note that you can use either Market or Markets as the parameter name, and similarly, either SecType or SecTypes.
141
IQFeed only returns the symbols of active (non-expired) options/futures. See §8.2 for details about expired contracts.
IQML User Guide 131

When you specify Market(s) names (as opposed to IDs), note that IQML will match
the specified names as broadly as possible, with any exchange whose name or
description contain the specified values.142 For example, 'NASDAQ' will match not
only symbols that list directly on NASDAQ, but also symbols on Nasdaq Global
Market (NGM), Nasdaq Global Select Market (NGSM), Nasdaq OMX Futures
(NFX), Nasdaq other OTC, Nasdaq OTC Bulletin Board (OTCBB), etc. To receive
only symbols that list directly on NASDAQ (but not its affiliate markets), specify the
market ID (NASDAQ=5), instead of its name. See §8.3 for valid market ID values.

Instead of Market name(s) or SecType name(s), you can specify their corresponding
numeric codes,143 as a scalar integer value or as a numeric array of integers:
>> data = IQML('lookup','datatype','symbols','name','GOOG','SecTypes',1);
>> data = IQML('lookup','datatype','symbols','name','GOOG','SecTypes',[1,2]);

>> data = IQML('lookup','datatype','symbols','name','GOOG','Markets',21);


>> data = IQML('lookup','datatype','symbols','name','GOOG',’Markets',[21,14]);

In addition IQML’s symbols lookup functionality, users can search DTN’s database
online, at https://ws1.dtn.com/IQ/Search. A guide to the symbology used for various
security types by different exchanges is available at https://ws1.dtn.com/IQ/Guide.

142
Technically speaking, IQML searches for the specified Market name case-insensitively in both the market names (acronyms)
and in their description (see §8.3 for a list of available names/descriptions). For example:
 'OTC' will match the following exchanges: OTC (Nasdaq Other OTC), OTCBB (Nasdaq OTC Bulletin Board),
PK_IQXPREM (Pink Sheets – OTCQX – International PremierQX Tier), PK_QXPRIME (Pink Sheets – OTCQX –
PrimeQX Tier), PK_BBONLY (Pink Sheets – OTCBB Only Tier) and several others.
 'New' will match NYSE (New York Stock Exchange), NYMEX (New York Mercentile Exchange), NYISO (New York
Independent System Operator), NEISO (New England Independent System Operator) and a few others.
 'London' will match LSE (London Stock Exchange), LME (London Metals Exchange), LSEI (London Stock Exchange
International), and LPPM (London Platinum and Palladium Market).
 'amex' will match NYSE_AMEX (NYSE AMEX Options Exchange) and PK_NYSE_AMEX (Pink Sheets – NYSE
AMEX Listed).
 'commod' will match more than 20 exchanges, including COMEX (Commodities Exchange Center), ASXCM (ASX24
Commodities Exchange), ENCOM (EuroNext Commodities), KBCB (KCBOT-CBOT Intercommodity Spreads), DCE
(Dalian Commodity Exchange), ZCE (Zengchou Commodity Exchange), and MCX (Multi Commodity Exchange of India).
143
See §8.3 and §8.4 for the list of numeric codes that correspond to each market and security type
IQML User Guide 132

Here is a summary of the IQML parameters that affect symbols lookup:


Parameter Data type Default Description
'' Limits the query to assets that contain the
Name string (empty specified string in their symbol name (case
string) insensitive, anywhere within the symbol name)
'' Limits the query to assets that contain the
Description string (empty specified string in their description (case
string) insensitive, anywhere within the description)
integer, Limits the query to assets that belong to the
numeric specified market code(s) (scalar integer or
Market or [] numeric array), or market name(s) (case-
array, string,
Markets 144 (empty) insensitive string or cell-array of strings).
or cell-array
of strings See §8.3 for details on valid values.
integer, Limits the query to assets that have the
numeric specified security type code(s) (scalar integer
SecType or [] or numeric array), or security type name(s)
array, string,
SecTypes 145 (empty) (case-insensitive string or cell-array of strings).
or cell-array
of strings See §8.4 for details on valid values.
Limits the query to assets that belong to the
[] specified SIC sector/industry
SIC integer
(empty) (matches the beginning of the SIC number)
See §8.5 for details on valid values.
Limits the query to assets that belong to the
[] specified NAICS sector/industry
NAICS integer
(empty) (matches the beginning of the NAICS number)
See §8.6 for details on valid values.
Max # of seconds to wait for incoming data
Timeout number 5.0
(0-9000, where 0 means infinite)
''
When Progress is set to 'console', the data
Progress string (empty
download progress is displayed in the console
string)

144
In IQML, the Market and Markets parameters are synonymous – you can use either of them, in any capitalization
145
In IQML, the SecType and SecTypes parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 133

8.2 Options/futures chain


To retrieve a list of symbols that belong to a certain options/futures chain and match
certain criteria, set the action to 'chain'; DataType to one of 'options' (default),
'futures', 'foptions' (future options), or 'spreads'; Symbol to the underlying contract’s
symbol; and then add optional filtering criteria. For example:146
>> symbols = IQML('chain', 'Symbol','GOOG')' % options chain for GOOG
symbols =
1×1454 cell array
Columns 1 through 4
'GOOG1803H1000' 'GOOG1803H1010' 'GOOG1803H1020' 'GOOG1803H1030'
Columns 5 through 8
'GOOG1803H1040' 'GOOG1803H1050' 'GOOG1803H1055' 'GOOG1803H1060'
Columns 9 through 12
'GOOG1803H1065' 'GOOG1803H1070' 'GOOG1803H1075' 'GOOG1803H1077.5'
...

Depending on DataType, several filtering parameters can be specified: All chain queries
support the Symbol, Months, and NearMonths parameters. Options-related queries
(DataType='options' or 'foptions') also support a Side parameter. Index/equity
options query (DataType='options') also supports IncludeBinary, MinStrike,
MaxStrike, NumInMoney, NumOutOfMoney parameters. All chain queries except
'options' also support the Years parameter. Here’s an example filtered chain query:
% Report GOOG options having strike price between $1000-$1010 in next 4 months
>> symbols = IQML('chain', 'symbol','GOOG', 'NearMonths',4, ...
'MinStrike',1000, 'MaxStrike',1010)'
symbols =
1×58 cell array
Columns 1 through 4
'GOOG1803H1000' 'GOOG1803H1010' 'GOOG1810H1000' 'GOOG1810H1005'
Columns 5 through 8
'GOOG1810H1010' 'GOOG1813G1000' 'GOOG1813G1002.5' 'GOOG1813G1005'
Columns 9 through 12
'GOOG1813G1007.5' 'GOOG1813G1010' 'GOOG1817H1000' 'GOOG1817H1005'
...

The following table lists the valid combinations of filtering parameters per DataType:
↓parameter \ DataType: → options future spread foption
Symbol ok ok ok ok
Side ok N/A N/A ok
Months ok ok ok ok
NearMonths ok ok ok ok
Years N/A ok ok ok
IncludeBinary ok N/A N/A N/A
MinStrike ok N/A N/A N/A
MaxStrike ok N/A N/A N/A
NumInMoney ok N/A N/A N/A
NumOutOfMoney ok N/A N/A N/A

146
Option contract names in IQFeed use a variant of the OPRA OSI format. See a symbology guide at https://ws1.dtn.com/IQ/Guide,
or an older version at https://iqfeed.net/symbolguide/index.cfm?symbolguide=guide. Also see the related discussion here:
http://forums.dtn.com/index.cfm?page=topic&topicID=6968. Note: names might change due to corporate actions (splits etc.),
for example: BBD1918A15 vs. BBD11918A15.45 (http://forums.iqfeed.net/index.cfm?page=topic&topicID=5495).
IQML User Guide 134

Note that if you filter by MinStrike and/or MaxStrike, you cannot also filter by
NumInMoney/ NumOutOfMoney (and vice versa):
>> IQML('chain', 'symbol','FB','NumInMoney',2,'NumOutOfMoney',2,'MinStrike',90)
You cannot specify both a strike range and number of contracts in/out of money
in 'chain' query - choose only one set
Similarly, you can only specify one of the Months, NearMonths parameters, not both:
>> IQML('chain', 'symbol','FB', 'Months',2:6, 'NearMonths',3)
Either the Months or the NearMonths parameter can be specified, but not both,
in a 'chain' query
If no symbols match the specified criteria, or if you do not have the necessary market
permissions (subscription), then the IQML query will return an empty cell array:
>> symbols = IQML('chain', 'datatype','spreads','symbol','C','years',2010:2019)
symbols =
0×0 empty cell array

Note: IQFeed only returns active (non-expired) contracts. IQFeed offers download-
able static text files, which contain a [very long] list of securities that are no longer
traded (expired contacts147 and delisted equities148). These files are not actively
maintained by DTN IQFeed, so it is better to use the API functionality via IQML.
With IQFeed client 6.1 or newer, you can also fetch this data using IQML (see §5.6).
If you set WhatToShow to 'quotes', you’ll receive an array of structs that contain the
corresponding latest (top-of-market) quotes data for the corresponding symbols:
>> data = IQML('chain', 'symbol','GOOG', 'NearMonths',4, ...
'MinStrike',1000, 'MaxStrike',1010, 'WhatToShow','quotes')
data =
58×1 struct array with fields:
Symbol
...
>> data(1)
ans =
struct with fields:
Symbol: 'GOOG1803H1000'
Most_Recent_Trade: 120
Most_Recent_Trade_Size: 1
Most_Recent_Trade_Time: '15:57:12.930497'
Total_Volume: 0
Bid: 140.5
Bid_Size: 3
...
Close: 120
Message_Contents: 'Cbacv'
Message_Description: ...
Most_Recent_Trade_Conditions: 1
Trade_Conditions_Description: 'Normal Trade'
Most_Recent_Market_Name: 'MIAX PEARL Options exchange'
>> symbols = {data.Symbol}
symbols =
1×58 cell array
Columns 1 through 4
'GOOG1803H1000' 'GOOG1803H1010' 'GOOG1810H1000' 'GOOG1810H1005'
Columns 5 through 8
'GOOG1810H1010' 'GOOG1813G1000' 'GOOG1813G1002.5' 'GOOG1813G1005'
...

147
http://www.iqfeed.net/downloads/beta/IEOPTION.zip; see http://forums.iqfeed.net/index.cfm?page=topic&topicID=3326.
148
http://www.iqfeed.net/downloads/beta/EQUITY.zip; see http://forums.iqfeed.net/index.cfm?page=topic&topicID=5822.
IQML User Guide 135

Note: to receive quotes data for chain options, you must have a corresponding DTN
data subscription, otherwise IQFeed (and IQML) will report an error for all contracts:
IQFeed error: Symbol 'GOOG2221A3000' is invalid/unavailable!
IQFeed error: Symbol 'GOOG2228A3000' is invalid/unavailable!
IQFeed error: Symbol 'GOOG2131X3000' is invalid/unavailable!
IQFeed error: Symbol 'GOOG2207M3000' is invalid/unavailable!
...

Note: if you request quotes for multiple chain symbols, especially if you set UseParallel
to true, you might reach your IQFeed account’s symbols-limit (MaxSymbols; see §9.3).
In such cases, IQFeed-generated error messages will be displayed on the Matlab console:
Level1 symbol limit reached - symbol 'GOOG2019R600' not serviced!

You can request IQFeed to report a user-specified set of quotes data fields and/or
change the reported fields order, using the optional Fields parameter (see §4.1). If
you don’t specify Fields, the returned data is subject to the Fields parameter that was
set in the most recent quotes or chain query.
Also note that some of these structs (especially for out-of-money contracts) may contain
empty/invalid data, since their corresponding contract was never traded. For example:
>> data(7)
ans =
struct with fields:
Symbol: 'GOOG1813G1002.5'
Most_Recent_Trade: []
Most_Recent_Trade_Size: []
Most_Recent_Trade_Time: []
Most_Recent_Trade_Market_Center: []
Total_Volume: 0
Bid: 133.4
Bid_Size: 2
Ask: 140.2
Ask_Size: 1
Open: []
High: []
Low: []
Close: []
Message_Contents: 'bav'
Message_Description: 'A bid update occurred; An ask update
occurred; A volume update occurred'
Most_Recent_Trade_Conditions: 1
Trade_Conditions_Description: 'Normal Trade'
Most_Recent_Market_Name: ''
For this reason, you should be careful when concatenating the struct array’s data into
numeric arrays. In this example, only 40 of the 58 contracts had a Close price, so
concatenating into a numeric array results in an array that only has 40 data items:
>> [data.Close]
ans =
Columns 1 through 8
120 130.7 140.67 131.99 150.1 138.8 139.5 99.47
Columns 9 through 16
103.28 130.9 179.5 137.5 190.17 89.3 145 3.84
Columns 17 through 24
6 7.5 5.3 7.14 0.3 0.3 1.1 1.32
Columns 25 through 32
1.05 5.56 9.9 6.35 0.67 0.75 1.23 10
Columns 33 through 40
15.43 16.33 27.21 32.3 33.4 6.49 2.5 3.37
IQML User Guide 136

…instead, it is better in most cases to use cell arrays, where we can see empty cells:
>> {data.Close}
ans =
1×58 cell array
Columns 1 through 8
[120] [] [130.7] [] [] [140.67] [] []
Columns 9 through 16
[] [] [131.99] [150.1] [138.8] [139.5] [] [99.47]
Columns 17 through 24
[] [103.28] [130.9] [179.5] [137.5] [190.17] [] [89.3]
Columns 25 through 33
...
Similarly, set WhatToShow='fundamental' to get the fundamental data for all
symbols in the requested chain. For example:
>> data = IQML('chain', 'symbol','GOOG', 'NearMonths',4, ...
'MinStrike',1000, 'MaxStrike',1010, ...
'WhatToShow','fundamental')
data =
58×1 struct array with fields:
Symbol
Exchange_ID
PE
Average_Volume
...
>> data(1)
ans =
struct with fields:
Symbol: 'GOOG1803H1000'
Exchange_ID: 'E'
PE: []
Average_Volume: []
x52_Week_High: 120
x52_Week_Low: 120
Calendar_Year_High: []
Calendar_Year_Low: []
...
Fiscal_Year_End: []
Company_Name: 'GOOG AUG 2018 C 1000.00'
...
Expiration_Date: '08/03/2018'
Strike_Price: 1000
NAICS: []
Exchange_Root: []
Option_Premium_Multiplier: 100
Option_Multiple_Deliverable: 0
Price_Format_Description: 'Two decimal places'
Exchange_Description: 'Euronext Index Derivatives (ENID)'
Listed_Market_Description: 'OPRA System'
Security_Type_Description: 'Index/Equity Option'
SIC_Description: ''
NAICS_Description: ''
>> [data.Strike_Price]
ans =
Columns 1 through 8
1000 1010 1000 1005 1010 1000 1002.5 1005
Columns 9 through 16
1007.5 1010 1000 1005 1010 1000 1002.5 1005
Columns 17 through 24
1007.5 1010 1000 1005 1010 1000 1005 1010
...
IQML User Guide 137

Note: using WhatToShow iterates over all the reported chain symbols, requesting the
quotes/fundamental data for each symbol separately. If the number of symbols is large,
this could take a very long time, even if you parallelize the queries using UseParallel.
As an alternative in such cases, consider using a market summary query for the exchange
on which the chain’s contracts are traded (see §4.6). Once you get the summary report,
you can then extract the relevant market data for the contracts that were reported by
the chain command.149 A summary report may take several minutes to download
since it reports all the contracts of a certain type on that exchange, but this could still
be faster than the symbols iteration used by a chain query with WhatToShow.
The decision whether to use the chain query with WhatToShow, or a combination of
a simple chain query and market summary query, depends on the number of chain
contracts and other factors. Advice: try a unified chain query first, and use the market
summary alternative only in case the unified chain query takes too long.
Here is a summary of the IQML parameters that affect chain symbols lookup:
Parameter Data type Default Description
'' Symbol name of the underlying contract.
Symbol string This is a mandatory parameter – it must be set.
must be set! Note: Multiple symbols are NOT supported.
One of:
 'options' (default) – on index/equity
DataType string 'options'  'future'
 'spread' – future calendar spreads
 'foptions' – options on future
'cp' One of:
 'cp' (default) – both calls and puts
Side string (meaning  'c' – calls only
both calls  'p' – puts only
and puts) Only relevant if DataType='options'/'foptions'
One of:
 'symbols' (default) – list of symbols in chain
WhatToShow string 'symbols'
 'quotes' – return the latest quotes data
 'fundamental' – return fundamental data
One of:
 Numeric month value(s) between 1-12
(e.g.: 4, 2:5, [1,4,7])
 English month name (e.g. 'August', 'Apr')
[] meaning  English month names in cell array (e.g.
Months various
all {'Apr', 'July', 'September', 'Dec'})
 Financial month codes from the list
FGHJKMNQUVXZ (e.g. 'JKMN')
Cannot be specified together with NearMonths
integer Number of nearby contract months to report.150
NearMonths []
(0-99) Cannot be specified together with Months.

149
http://forums.dtn.com/index.cfm?page=topic&topicID=5872
150
IQFeed officially supports only 0-4, but in practice higher values are accepted, reporting contracts that expire farther out in
the future (for example, 2.5 years for SPX). Note: this is undocumented IQFeed behavior, so specifying a value of 5 or higher
may possibly not work properly (or at all) in certain cases. See http://forums.iqfeed.net/index.cfm?page=topic&topicID=5508
IQML User Guide 138

integer [] meaning 1+ years e.g. 2013:2019, default: current year.


Years
scalar/array current year Only relevant when DataType ≠ 'options'.
If true, binary/weekly options151 are reported,
IncludeBinary logical false or 0 otherwise (default) they are not. This parameter
is only relevant when DataType='options'.
Only report options having a higher strike price;
MinStrike number [] only relevant when DataType='options'.
Only report options having a lower strike price;
MaxStrike number [] only relevant when DataType='options'.
Only report this number of options in the
NumInMoney integer [] money; only relevant if DataType='options'.
NumOutOf Only report this number of options out of
integer []
Money money; only relevant if DataType='options'.
logical If set to true or 1, then querying chain quotes
UseParallel false
(true/false) will be done in parallel if possible (see §3.6).
(the current Max number of parallel workers to use (up to
MaxWorkers integer
pool size) the current pool size) when UseParallel=1
'Symbol,
Most Recent Sets the list of data fields reported by IQFeed
Trade, Most for each quote. IQFeed’s default set has 16
Recent Trade fields; 50+ additional fields can be specified
Size, Most (a detailed list of fields is provided in §4.1).
Recent Trade
Time, Most If Fields is set to an empty value ({} or ''),
colon or Recent Trade the list of current, available fields is returned.
comma- Market If Fields is not empty, subsequent quotes and
separated Center, Total
Fields Volume, Bid, chain queries will return the specified fields,
string, or
cell-array Bid Size, Ask, in the specified order. The Symbol field is
of strings Ask Size, always returned first, even if not specified.
Open, High,
Examples:
Low, Close,
Message  'Bid:Ask:Last:Ask Size'
Contents,  'Bid, Ask, Last, Ask Size'
Most Recent  {'Bid', 'Ask', 'Last', 'Ask Size'}
Trade  'All' (indicates all available fields)
Conditions'

Note: Options/futures chain lookup is only available in the Professional IQML license.

151
Weekly options are only excluded with IQFeed client 6.1 or newer; binary options are excluded with all clients.
IQML User Guide 139

8.3 Markets lookup


To retrieve a list of markets (exchanges), use 'lookup' action with 'markets' DataType:
>> data = IQML('lookup', 'DataType','markets')
data =
185×1 struct array with fields:
id
name
description
groupId
groupName
>> data(1)
ans =
id: 1
name: 'NGM'
description: 'Nasdaq Global Market'
groupId: 5
groupName: 'NASDAQ'
...

You can convert the data into a [perhaps] more readable form using Matlab’s builtin
struct2cell() and struct2table() functions, or the OutputFormat parameter (§3.5):
>> struct2cell(data)'
ans =
185×5 cell array
[1] 'NGM' 'Nasdaq Global Market' [5] 'NASDAQ'
[2] 'NCM' 'National Capital Market' [5] 'NASDAQ'
[3] 'OTC' 'Nasdaq other OTC' [5] 'NASDAQ'
[4] 'OTCBB' 'Nasdaq OTC Bulletin Board' [5] 'NASDAQ'
[5] 'NASDAQ' 'Nasdaq' [5] 'NASDAQ'
[6] 'NYSE_AMERICAN' 'NYSE American (Equities and Bonds)' [6] 'NYSE_AMERICAN'
[7] 'NYSE' 'New York Stock Exchange' [7] 'NYSE'
...

>> struct2table(data)
ans =
185×5 table
id name description groupId groupName
__ _______________ ____________________________________ _______ _____________
1 'NGM' 'Nasdaq Global Market' 5 'NASDAQ'
2 'NCM' 'National Capital Market' 5 'NASDAQ'
3 'OTC' 'Nasdaq other OTC' 5 'NASDAQ'
4 'OTCBB' 'Nasdaq OTC Bulletin Board' 5 'NASDAQ'
5 'NASDAQ' 'Nasdaq' 5 'NASDAQ'
6 'NYSE_AMERICAN' 'NYSE American (Equities and Bonds)' 6 'NYSE_AMERICAN'
7 'NYSE' 'New York Stock Exchange' 7 'NYSE'

You can narrow-down the results by specifying ID, Name and/or Description filtering
parameters. For example, to list only markets whose Description contains ‘Nasdaq’:
>> data = IQML('lookup', 'DataType','markets', 'Description','Nasdaq')
data =
10×1 struct array with fields:
id
name
description
groupId
groupName
IQML User Guide 140

>> disp(struct2cell(data)')
[ 1] 'NGM' 'Nasdaq Global Market' [ 5] 'NASDAQ'
[ 3] 'OTC' 'Nasdaq other OTC' [ 5] 'NASDAQ'
[ 4] 'OTCBB' 'Nasdaq OTC Bulletin Board' [ 5] 'NASDAQ'
[ 5] 'NASDAQ' 'Nasdaq' [ 5] 'NASDAQ'
[ 15] 'NASD_ADF' 'Nasdaq Alternate Display facility' [ 5] 'NASDAQ'
[ 19] 'NTRF' 'Nasdaq Trade Reporting Facility' [ 5] 'NASDAQ'
[ 21] 'NGSM' 'Nasdaq Global Select Market' [ 5] 'NASDAQ'
[105] 'PK_NASDAQ' 'Pink Sheets - NASDAQ Listed' [ 90] 'PK_SHEETS'
[134] 'N2EX' 'NASDAQ OMX-Nord Pool' [134] 'N2EX'
[139] 'NFX' 'NASDAQ OMX Futures' [139] 'NFX'

Naturally, it is quite possible that no markets exist that match the requested criteria. In
such a case, the result will be empty (and cannot be displayed using Matlab’s
struct2table() or struct2cell() functions):
>> data = IQML('lookup', 'DataType','markets', 'Name','xyz')
data =
[]
>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.

For performance reasons, and since lookup data is fairly static (although it changes
from time to time), it is usually fetched from the IQFeed servers only during IQML
startup. All subsequent lookup queries will return pre-fetched (cached) data, filtered
as needed based on your query criteria. To force IQML to fetch the latest lookup data
from IQFeed instead of the cached data, set the ForceRefresh parameter to true (or 1).
Note: IQFeed does not currently offer additional information about the listed markets,
such as their time-zone, operating times, and duration for delayed quotes.152 A table
of time-zones and delay amounts (but not operating times) for markets in DTN’s
ProphetX service is posted on http://pxweb.dtn.com/PXWebDoc/pages/Markets.aspx.
These markets generally overlap IQFeed’s markets, but the market names are
somewhat different (for example, Singapore’s International Monetary Exchange is
named 'SIME' in ProphetX, vs. 'SGX' in IQFeed). It is unclear to what extent ProphetX’s
market information is up-to-date or relevant to IQFeed, so be careful when using it.
Here is a summary of the IQML parameters that affect markets lookup:
Parameter Data type Default Description
integer or
[]
ID numeric Limits the query to the specified ID(s).
(empty)
array
'' Limits the query to markets that contain the
Name string (empty specified string in their name or groupName
string) (case insensitive, anywhere within the name)
'' Limits the query to markets that contain the
Description string (empty specified string in their description (case
string) insensitive, anywhere within the description)
logical If set to true or 1, then the data will be fetched
ForceRefresh false from the IQFeed servers, not pre-cached data.
(true/false)

152
http://forums.dtn.com/index.cfm?page=topic&topicID=5740
IQML User Guide 141

8.4 Security types lookup


To retrieve a list of security types, set action to 'lookup' and DataType to 'sectypes':
>> data = IQML('lookup', 'DataType','sectypes')
data =
40×1 struct array with fields:
id
name
>> data(1)
ans =
id: 1
name: 'EQUITY'
description: 'Equity'
>> data(2)
ans =
id: 2
name: 'IEOPTION'
description: 'Index/Equity Option'

You can convert the data into a [perhaps] more readable form using Matlab’s builtin
struct2cell() and struct2table() functions, or the OutputFormat parameter (§3.5):
>> disp(struct2cell(data)')
[ 1] 'EQUITY' 'Equity'
[ 2] 'IEOPTION' 'Index/Equity Option'
[ 3] 'MUTUAL' 'Mutual Fund'
[ 4] 'MONEY' 'Money Market Fund'
[ 5] 'BONDS' 'Bond'
[ 6] 'INDEX' 'Index'
[ 7] 'MKTSTATS' 'Market Statistic'
[ 8] 'FUTURE' 'Future'
[ 9] 'FOPTION' 'Future Option'
[10] 'SPREAD' 'Future Spread'
[11] 'SPOT' 'Spot'
[12] 'FORWARD' 'Forward'
...

>> disp(struct2table(data))
id name description
__ __________________ ______________________________________________
1 'EQUITY' 'Equity'
2 'IEOPTION' 'Index/Equity Option'
3 'MUTUAL' 'Mutual Fund'
4 'MONEY' 'Money Market Fund'
5 'BONDS' 'Bond'
6 'INDEX' 'Index'
...

>> data = IQML('lookup', 'DataType','sectypes', 'OutputFormat','table')


data =
40×3 table
id name description
__ __________________ ______________________________________________
1 'EQUITY' 'Equity'
2 'IEOPTION' 'Index/Equity Option'
3 'MUTUAL' 'Mutual Fund'
4 'MONEY' 'Money Market Fund'
5 'BONDS' 'Bond'
6 'INDEX' 'Index'
...
IQML User Guide 142

You can narrow-down the results by specifying ID, Name and/or Description filtering
parameters. For example, to list only secTypes whose Description contains ‘Option’:
>> struct2table(IQML('lookup', 'DataType','sectypes', 'Description','option'))
ans =
4×3 table
id name description
__ __________________ ____________________________
2 'IEOPTION' 'Index/Equity Option'
9 'FOPTION' 'Future Option'
36 'COMBINED_FOPTION' 'Combined FOption Volume OI'
39 'FOPTION_IV' 'FOption Implied Volatility'

Naturally, it is quite possible that no security types exist that match the requested
criteria. In such a case, the result will be empty (and cannot be displayed using
Matlab’s struct2table() or struct2cell() functions):
>> data = IQML('lookup', 'DataType','sectypes', 'Name','xyz')
data =
[]

>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.

For performance reasons, and since lookup data is fairly static (although it changes
from time to time), it is usually fetched from the IQFeed servers only during IQML
startup. All subsequent lookup queries will return pre-fetched (cached) data, filtered
as needed based on your query criteria. To force IQML to fetch the latest lookup data
from IQFeed instead of the cached data, set the ForceRefresh parameter to true (or 1).
Here is a summary of the IQML parameters that affect security types lookup:
Parameter Data type Default Description
integer or
[]
ID numeric Limits the query to the specified ID(s).
(empty)
array
'' Limits the query to secTypes that contain the
Name string (empty specified string in their name
string) (case insensitive, anywhere within the name)
'' Limits the query to secTypes that contain the
Description string (empty specified string in their description (case
string) insensitive, anywhere within the description)
logical If set to true or 1, then the data will be fetched
ForceRefresh false from the IQFeed servers, not pre-cached data.
(true/false)
IQML User Guide 143

8.5 SIC codes lookup


To retrieve a list of SIC sectors/industries, set action to 'lookup' and DataType to 'SIC':
>> data = IQML('lookup', 'DataType','SIC')
data =
1005×1 struct array with fields:
id
description
>> data(1)
ans =
id: 111
description: 'WHEAT'
>> data(2)
ans =
id: 112
description: 'RICE'

You can convert the data into a [perhaps] more readable form using Matlab’s builtin
struct2cell() and struct2table() functions, or the OutputFormat parameter (§3.5):
>> disp(struct2cell(data)')
[111] 'WHEAT'
[112] 'RICE'
[115] 'CORN'
[116] 'SOYBEANS'
[119] 'CASH GRAINS, NOT ELSEWHERE CLASSIFIED'
[131] 'COTTON'
[132] 'TOBACCO'
...
>> disp(struct2table(data))
id description
___ ___________________________________________________________
111 'WHEAT'
112 'RICE'
115 'CORN'
116 'SOYBEANS'
119 'CASH GRAINS, NOT ELSEWHERE CLASSIFIED'
131 'COTTON'
132 'TOBACCO'
...

>> data = IQML('lookup', 'DataType','SIC', 'OutputFormat','table')


data =
1005×2 table
id description
___ ___________________________________________________________
111 'WHEAT'
112 'RICE'
115 'CORN'
116 'SOYBEANS'
119 'CASH GRAINS, NOT ELSEWHERE CLASSIFIED'
131 'COTTON'
132 'TOBACCO'
...
IQML User Guide 144

You can narrow-down the results by specifying ID or Description filtering parameters.


For example, to list only the SIC codes whose Description contains ‘Oil’:
>> struct2table(IQML('lookup', 'DataType','SIC', 'Description','oil'))
ans =
22×2 table
id description
____ ___________________________________________________________________
251 'BROILER, FRYER, AND ROASTER CHICKENS'
711 'SOIL PREPARATION SERVICES'
1381 'DRILLING OIL AND GAS WELLS'
1382 'OIL AND GAS FIELD EXPLORATION SERVICES'
1389 'OIL AND GAS FIELD SERVICES, NOT ELSEWHERE CLASSIFIED'
2074 'COTTONSEED OIL MILLS'
2075 'SOYBEAN OIL MILLS'
2076 'VEGETABLE OIL MILLS, EXCEPT CORN, COTTONSEED, AND SOYBEAN'
2077 'ANIMAL AND MARINE FATS AND OILS'
2079 'SHORTENING, TABLE OILS, MARGARINE, AND OTHER EDIBLE FATS AND OILS'
2673 'PLASTICS, FOIL, AND COATED PAPER BAGS'
...

Naturally, it is quite possible that no security types exist that match the requested
criteria. In such a case, the result will be empty (and cannot be displayed using
Matlab’s struct2table() or struct2cell() functions):
>> data = IQML('lookup', 'DataType','SIC', 'Description','xyz')
data =
[]
>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.

For performance reasons, and since lookup data is fairly static (although it changes
from time to time), it is usually fetched from the IQFeed servers only during IQML
startup. All subsequent lookup queries will return pre-fetched (cached) data, filtered
as needed based on your query criteria. To force IQML to fetch the latest lookup data
from IQFeed instead of the cached data, set the ForceRefresh parameter to true (or 1).
Note: IQFeed has a confirmed internal bug as of October 2019: some ~150 SIC codes
are not reported, although they have corresponding symbols and are reported by the
symbols lookup query (§8.1).153 Symbols having such SIC codes will have an empty
SIC_Description field in the fundamental data query (§4.2) and empty SIC_Desc field in
the symbols lookup query (§8.1).
Here is a summary of the IQML parameters that affect SIC codes lookup:
Parameter
Data type Default Description
integer or
[]
ID numeric Limits the query to the specified ID(s).
(empty)
array
'' Limits the query to SIC entries that contain the
Description string (empty specified string in their description (case
string) insensitive, anywhere within the description)
logical If set to true or 1, then the data will be fetched
ForceRefresh false from the IQFeed servers, not pre-cached data.
(true/false)

153
http://forums.iqfeed.net/index.cfm?page=topic&topicID=5653
IQML User Guide 145

8.6 NAICS codes lookup


To retrieve a list of NAICS sectors/industries, set the action to 'lookup' and DataType
to 'NAICS':
>> data = IQML('lookup', 'DataType','NAICS')
data =
1175×1 struct array with fields:
id
description
>> data(1)
ans =
id: 111110
description: 'Soybean Farming'
>> data(2)
ans =
id: 111120
description: 'Oilseed (except Soybean) Farming'

You can convert the data into a [perhaps] more readable form using Matlab’s builtin
struct2cell() and struct2table() functions, or the OutputFormat parameter (§3.5):
>> disp(struct2cell(data)')
[111110] 'Soybean Farming'
[111120] 'Oilseed (except Soybean) Farming'
[111130] 'Dry Pea and Bean Farming'
[111140] 'Wheat Farming'
[111150] 'Corn Farming'
[111160] 'Rice Farming'
[111191] 'Oilseed and Grain Combination Farming'
[111199] 'All Other Grain Farming'
[111211] 'Potato Farming'
...
>> disp(struct2table(data))
id description
______ ___________________________________________________
111110 'Soybean Farming'
111120 'Oilseed (except Soybean) Farming'
111130 'Dry Pea and Bean Farming'
111140 'Wheat Farming'
111150 'Corn Farming'
111160 'Rice Farming'
111191 'Oilseed and Grain Combination Farming'
111199 'All Other Grain Farming'
111211 'Potato Farming'
...

>> data = IQML('lookup', 'DataType','NAICS', 'OutputFormat','table')


data =
1175×2 table
id description
___ ___________________________________________________________
111110 'Soybean Farming'
111120 'Oilseed (except Soybean) Farming'
111130 'Dry Pea and Bean Farming'
111140 'Wheat Farming'
111150 'Corn Farming'
111160 'Rice Farming'
111191 'Oilseed and Grain Combination Farming'
111199 'All Other Grain Farming'
111211 'Potato Farming'
...
IQML User Guide 146

You can narrow-down the results by specifying the ID or Description filtering


parameter. For example, to list only NAICS codes whose Description contains ‘Oil’:
>> struct2table(IQML('lookup', 'DataType','NAICS', 'Description','oil'))
ans =
20×2 table
id description
______ ____________________________________________________________________
111120 'Oilseed (except Soybean) Farming'
111191 'Oilseed and Grain Combination Farming'
112320 'Broilers and Other Meat Type Chicken Production'
115112 'Soil Preparation, Planting, and Cultivating'
213111 'Drilling Oil and Gas Wells'
213112 'Support Activities for Oil and Gas Operations'
237120 'Oil and Gas Pipeline and Related Structures Construction'
311223 'Other Oilseed Processing'
311225 'Fats and Oils Refining and Blending'
...

Naturally, it is quite possible that no security types exist that match the requested
criteria. In such a case, the result will be empty (and cannot be displayed using
Matlab’s struct2table() or struct2cell() functions):
>> data = IQML('lookup', 'DataType','NAICS', 'Description','xyz')
data =
[]
>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.

For performance reasons, and since lookup data is fairly static (although it changes
from time to time), it is usually fetched from the IQFeed servers only during IQML
startup. All subsequent lookup queries will return pre-fetched (cached) data, filtered
as needed based on your query criteria. To force IQML to fetch the latest lookup data
from IQFeed instead of the cached data, set the ForceRefresh parameter to true (or 1).

Note: IQFeed has a confirmed internal bug as of October 2019: some ~150 SIC codes
are not reported, although they have corresponding symbols and are reported by the
symbols lookup query (§8.1).154 A similar bug also applies to NAICS.

Here is a summary of the IQML parameters that affect NAICS codes lookup:
Parameter
Data type Default Description
integer or
[]
ID numeric Limits the query to the specified ID(s).
(empty)
array
'' Limits the query to NAICS entries that contain
Description string (empty the specified string in their description (case
string) insensitive, anywhere within the description)
logical If set to true or 1, then the data will be fetched
ForceRefresh false from the IQFeed servers, not pre-cached data.
(true/false)

154
http://forums.iqfeed.net/index.cfm?page=topic&topicID=5653
IQML User Guide 147

8.7 Trade condition codes lookup


To retrieve a list of trade condition codes, set the action to 'lookup' and DataType to
'conditions':
>> data = IQML('lookup', 'DataType','conditions')
data =
155×1 struct array with fields:
id
name
description
>> data(1)
ans =
id: 1
name: 'REGULAR'
description: 'Normal Trade'
>> data(2)
ans =
id: 2
name: 'ACQ'
description: 'Acquisition'
You can convert the data into a [perhaps] more readable form using Matlab’s builtin
struct2cell() and struct2table() functions, or the OutputFormat parameter (§3.5):
>> disp(struct2cell(data)')
[ 1] 'REGULAR' 'Normal Trade'
[ 2] 'ACQ' 'Acquisition'
[ 3] 'CASHM' 'Cash Only Market'
[ 4] 'BUNCHED' 'Bunched Trade'
[ 5] 'AVGPRI' 'Average Price Trade'
[ 6] 'CASH' 'Cash Trade (same day clearing)'
...
>> disp(struct2table(data))
id name description
__ _____________ ________________________________
1 'REGULAR' 'Normal Trade'
2 'ACQ' 'Acquisition'
3 'CASHM' 'Cash Only Market'
4 'BUNCHED' 'Bunched Trade'
5 'AVGPRI' 'Average Price Trade'
6 'CASH' 'Cash Trade (same day clearing)'
...
>> data = IQML('lookup', 'DataType','conditions', 'OutputFormat','table')
data =
155×3 table
id name description
__ _____________ ________________________________
1 'REGULAR' 'Normal Trade'
2 'ACQ' 'Acquisition'
3 'CASHM' 'Cash Only Market'
4 'BUNCHED' 'Bunched Trade'
5 'AVGPRI' 'Average Price Trade'
6 'CASH' 'Cash Trade (same day clearing)'
...
You can narrow-down the results by specifying ID, Name and/or Description filtering
parameters. For example, to list only conditions whose Description contains ‘Option’:
>> struct2table(IQML('lookup', 'DataType','conditions', 'Description','option'))
ans =
7×3 table
id name description
__ ______________ ___________________________________________________
IQML User Guide 148

39 'SPRD' 'Spread - Trade in Two Options in the Same Class


(a buy and a sell in the same class)'
40 'STDL' 'Straddle - Trade in Two Options in the Same Class
(a buy and a sell in a put and a call)'
43 'BWRT' 'Option Portion of a Buy/Write'
44 'CMBO' 'Combo - Trade in Two Options in the Same Options
Class (a buy and a sell in the same class)'
68 'STKOPT_TRADE' 'Stock-Option Trade'
82 'OPTION_EX' 'Option Exercise'
96 'OPT_ADDON' 'Short Option Add-On'

Naturally, it is quite possible that no security types exist that match the requested
criteria. In such a case, the result will be empty (and cannot be displayed using
Matlab’s struct2table() or struct2cell() functions):
>> data = IQML('lookup', 'DataType','conditions', 'Name','xyz')
data =
[]
>> struct2cell(data)
Undefined function 'struct2cell' for input arguments of type 'double'.
Note that the trade condition codes are typically reported by IQFeed as a string of one
or more 2-digit hexadecimal values.155 For example (see §4.1):
>> data = IQML('quotes', 'Symbol','GOOG')
data =
...
Most_Recent_Trade_Conditions: '3D87'
Trade_Conditions_Description: 'Intramaket Sweep; Odd lot trade'
In this example, the reported last trade had 2 trade conditions: hexadecimal 3D (=61,
meaning 'Intramaket Sweep')156 and hexadecimal 87 (=135, meaning 'Odd lot trade').
For performance reasons, and since lookup data is fairly static (although it changes
from time to time), it is usually fetched from the IQFeed servers only during IQML
startup. All subsequent lookup queries will return pre-fetched (cached) data, filtered
as needed based on your query criteria. To force IQML to fetch the latest lookup data
from IQFeed instead of the cached data, set the ForceRefresh parameter to true (or 1).
Here is a summary of the IQML parameters that affect trade conditions lookup:
Parameter Data type Default Description
integer or
[]
ID numeric Limits the query to the specified ID(s).
(empty)
array
'' Limits the query to trade conditions that
Name string (empty contain the specified string in their name
string) (case insensitive, anywhere within the name)
'' Limits the query to trade conditions that
Description string (empty contain the specified string in their description
string) (case insensitive, anywhere in the description)
logical If set to true or 1, then the data will be fetched
ForceRefresh false from the IQFeed servers, not pre-cached data.
(true/false)

155
Trade condition codes 15 or lower are reported with a leading 0, e.g. 05 or 0E. The availability of the codes’ translation in the
Trade_Conditions_Description field depends on MsgParsingLevel=2 (which is the default value; see §3.2).
156
The missing “r” in “Intramarket” is a typo in IQFeed’s data
IQML User Guide 149

9 Connection, administration and other special commands


9.1 Connecting & disconnecting from IQFeed
When using IQML, there is no need to worry about connecting or disconnecting from
IQFeed – IQML handles these activities automatically, without requiring user
intervention. The user only needs to ensure that IQFeed is active and logged-in when
the IQML command is invoked in Matlab.
IQML does not require any special configuration when connecting to IQFeed. It uses
whatever setting was previously set in the DTN IQConnect client application. You
might be prompted to enter a username/password, if IQConnect was not set up to
automatically connect using saved login/password information:

In addition to entering the login credentials in the client window, you can also specify
them programmatically. This could be useful when you have several IQFeed accounts
and wish to switch between them programmatically, or if you use IQFeed’s non-
Windows client installer on MacOs (which prevents user-entry in the login window):
>> IQML('time', 'Username','123456-1', 'Password','OpenSesame')

Note that the Username and Password parameters must be specified together, and
that they are only meaningful in the first IQML command that starts the connection. If
the Username and Password parameters are specified after a connection to IQFeed
has been established, they will be ignored for the current connection, but stored in
IQFeed’s registry for subsequent connections (see §9.5).
If you enter an invalid set of Username/Password, an error message will be thrown.
A different error will be thrown if IQML fails to connect to IQFeed within 10 seconds.
IQML User Guide 150

IQML can connect to a running IQFeed client, that was already started by another
process on the current computer (e.g. charting app or another Matlab process that runs
IQML), even without Username and Password in the initial IQML connection. IQML
will bypass login, connecting directly to the client process.
Once IQML connects to IQFeed, it remains connected via IQFeed’s client (IQConnect)
as long as the user does not exit the client application, or connects to IQFeed from
another computer (this automatically closes the client on the previous computer, since
exchange regulations do not allow using IQFeed on multiple computers concurrently).
IQML typically uses the latest API features supported by your installed IQFeed client.
For example, if you use client version 6.0.1.1, IQML will use IQFeed communication
protocol 6.0, and you will not have access to features of protocol 6.1.157 If you install a
newer IQFeed client, IQML will automatically detect this and use a newer protocol,
as determined by the new client version. For debugging purposes, you can override
Protocol to a version older than your installed client. For example, with a 6.0.1.1
client, you can set Protocol to 5.2 or 6.0, but not to 6.1 or newer:
>> IQML(..., 'Protocol',6.1)
Warning: Your IQFeed client (version 6.0.1.1) does not support Protocol 6.1 -
using Protocol 6.0 instead
(Type "warning off IQML:UnsupportedProtocol" to suppress this warning.)

You will be able to retrieve information in Matlab as soon as IQML connects to the
IQFeed client and [if necessary] the client finishes the login process and synchronizes
with the IQFeed servers. This process typically takes a few short seconds.
The following parameters affect the initial connection to IQFeed:
Parameter Data type Default Description
Username string (none) Used to launch and login into IQConnect
Password string (none) Used to launch and login into IQConnect
IQFeed API protocol that should be used. You can
installed set any protocol value supported by your IQConnect
Protocol number client’s client version. For example, client 6.0.1.1 supports
version protocols 5.2 and 6.0 (this client’s default), but not 6.1.

By default, IQML uses the following TCP ports to connect to IQFeed’s client:
 5009 – Level1Port – used for Level 1 queries/msgs (quotes, fundamentals)
 9100 – LookupPort – used for historical, news and lookup queries/messages
 9200 – Level2Port – used for Level II (market-depth) queries/messages
 9300 – AdminPort – used for administrative queries/messages (stats etc.)
 9400 – DerivativePort – used for interval-bars queries/messages
 60020 – LoginPort – used for login authentication
If any of these ports are already used by any other process at the time that IQFeed’s
client application (IQConnect) starts, it will not be able to communicate with IQML via

157
For example, historic market summary data and scanning (§5.6)
IQML User Guide 151

these ports.158 IQML tries to automatically detect such port conflicts, for example:
>> data = IQML('history', 'Symbol','IBM')
Error using IQML
Port #9100 is already used by process #12345 (SomeProcess.exe) and cannot be
used by IQFeed. Run IQML('registry') to set a different value for LookupPort.

You can resolve such port conflicts using any of the following methods:
1. Stop/uninstall the other process (SomeProcess.exe in this example)
2. Modify the other process’s settings to use different ports, so that they will not
conflict with IQFeed (this is rarely possible, but is preferable when possible)
3. Modify IQFeed’s registry settings to use a different port, which is not used by
any other process (see §9.5). If you choose this option, you will need to fix the
port again whenever you re-install the IQFeed client (for example, whenever
you update the client to a newer version), because the client’s installation
process resets the port values back to their default values.
After you resolve the problem using one of these alternatives, restart IQFeed’s
IQConnect client and then retry the IQML command. An IQConnect restart is necessary
since IQConnect reads the registry values and sets the ports only when it starts.
You can close a live connection to IQFeed using the 'disconnect' action:
>> IQML('disconnect')

This command disconnects IQML from the IQFeed client (IQConnect). If IQML was
the only application that was connected to the client, then the client will silently exit
after several seconds, unless a new IQFeed connection is established during this time.
If IQConnect is not active, the 'disconnect' action is silently ignored (no error).
There is no need for a corresponding 'connect' action, because IQFeed connection is
automatically (re-)established whenever this is required by a new IQML command.
IQML and IQConnect automatically try to recover from connection losses during
normal operation. You may see in the Matlab console one or more IQConnect error
messages such as the following, which indicate such a connection loss:
20180410 20:03:06.371 Level1 server disconnected!
or:
20180410 20:03:57.934 Unable to connect to L2IP server. Error Code: 10051
Error Msg: A socket operation was attempted to an unreachable network.
or:
20180410 20:03:57.934 Unable to connect to L2IP server. Error Code: 10065
Error Msg: A socket operation was attempted to an unreachable host.
or:
20180410 20:03:57.934 Unable to connect to L2IP server. Error Code: 10053
Error Msg: An established connection was aborted by the software in your host
machine.
or:
20180410 20:03:57.934 Unable to connect to L2IP server. Error Code: 10060
Error Msg: A connection attempt failed because the connected party did not
properly respond after a period of time

158
For example, Logitech GHub (via its LgHubUpdater.exe program) typically uses port 9100, IQFeed’s default Lookup port.
See http://forums.dtn.com/index.cfm?page=topic&topicID=5843
IQML User Guide 152

You can safely ignore such messages in most cases, since IQConnect will
automatically re-establish connection with IQFeed’s servers as soon as they become
accessible again, and show an appropriate informational message in Matlab’s console:
20180410 20:04:16.497 Level1 server is connected

You can actively disconnect and then connect to IQFeed using the 'reconnect' action:
>> IQML('reconnect')

The 'reconnect' action accepts an optional input parameter of Timeout (default value: 8
[secs]), which controls the pause duration between disconnecting IQML from IQFeed
and sending a termination signal to the IQConnect process, and reconnecting to
IQFeed again. The default pause of 8 secs allows IQConnect enough time (in most
cases) to properly terminate before IQML reconnects – this ensures a clean “restart”
of the IQFeed connection, with no leftovers from the previous connection session. If
you are not concerned about this aspect, and wish to restart IQML’s connections
without necessarily resarting IQConnect, use a lower Timeout.159 For example:
>> IQML('reconnect', 'timeout',0) % reconnect immediately after disconnecting

Note that after reconnecting to IQFeed, you will need to request any and all streaming
data again (see §6), since IQFeed resets data streaming after a client disconnect.

Also note that in the few seconds following an initial connection (or re-connection) to
IQFeed, some queries may return empty data. In such cases, you should try to refetch
the data after a short pause (see §3.4 for details).

159
IQConnect remains alive a few seconds after receiving a termination signal. If a reconnection request or any IQML query is
received during these few seconds, IQConnect will not terminate and will service the incoming requests. The default pause of
8 seconds was chosen by experimentation that showed that in most cases this is sufficient time to ensure that IQConnect
terminates. When Timeout is set to 0, no termination signal is sent to IQConnect and IQML reconnects immediately; When
Timeout is set to any value between 0-8, the resulting pause will be smaller than the default (i.e., faster reconnection), but it is
not assured that IQConnect has properly terminated by then, and this might potentially result in a bad reconnection. You can
experiment with various Timeout value to see what works best for your specific computer setup.
IQML User Guide 153

9.2 Server time


You can request the latest IQFeed server time using the 'time' action:
>> data = IQML('time')
data =
latestEventDatenum: 737114.660205451
latestEventTimeStamp: '20180223 15:50:41'
latestServerDatenum: 737114.368518519
latestServerTimestamp: '20180223 08:50:40'

The returned data struct includes the following data fields:


 latestEventDatenum – a Matlab numeric datenum value that corresponds to
the local time in which the very latest message has arrived from IQFeed.
 latestEventTimeStamp – a human-readable format of latestEventDatenum
 latestServerDatenum – a Matlab numeric datenum value that corresponds to
the latest server time that was received from IQFeed.
 latestServerTimeStamp – a human-readable format of latestServerDatenum

Note that the server time may be off by up to a full second from the current time,
depending on when the last timestamp message was received from IQFeed. IQFeed
sends server time messages once every second, so latestServerDatenum lags by 0.5
secs behind the current time on average.

Similarly, latestEventDatenum reports the time at which the last message was
received from IQFeed. This message could be a timestamp message, or any other data
message. For this reason, the lag here is typically much lower than the lag of
latestServerDatenum.

The 'time' action has no settable properties.


IQML User Guide 154

9.3 Client stats


You can retrieve the updated IQFeed connection traffic stats using the 'stats' action:
>> data = IQML('stats')
data =
Timestamp: '20210203 12:57:30.653'
Datenum: 738190.539938113
ServerIP: '66.112.148.226'
ServerPort: 60002
MaxSymbols: 1300
NumOfStreamingSymbols: 15
NumOfAvailableSymbols: 1285
NumOfClientsConnected: 3
SecondsSinceLastUpdate: 1
NumOfReconnections: 0
NumOfAttemptedReconnections: 0
StartTime: 'Mar 07 11:03AM'
MarketTime: 'Mar 07 04:34AM'
ConnectionStatus: 'Connected'
IQFeedVersion: '6.0.0.5'
LoginID: '123456-1'
TotalKBsRecv: 42.98
KBsRecvLastSecond: 0.02
AvgKBsPerSecRecv: 0.02
TotalKBsSent: 361.62
KBsSentLastSecond: 0.22
AvgKBsPerSecSent: 0.19
TotalMsgsRcv: 9530
Exchanges: {1×16 cell}
ServerVersion: '6.1.0.20'
ProtocolInUse: 6.1
ServiceType: 'real_time'
IQFeedAccountExpiryDate: ''

The returned data struct includes the following data fields:160

 Timestamp – The timestamp of fetching the stats data

 Datenum – The numeric Matlab datenum value of the Timestamp

 ServerIP – IP address of the least loaded IQFeed Quote Server

 ServerPort – Port number for least loaded IQFeed Quote Server

 MaxSymbols – The maximum # of symbols that can be streamed simultaneously

 NumOfStreamingSymbols – # of symbols that are currently being streamed

 NumOfAvailableSymbols – # of symbols that are available for streaming

 NumOfClientsConnected – # of clients that are currently connected

 SecondsSinceLastUpdate – # of seconds since last update from the Quote Server

 NumOfReconnections – # of times that IQFeed successfully reconnected

160
http://iqfeed.net/dev/api/docs/AdminSystemMessages.cfm
IQML User Guide 155

 NumOfAttemptedReconnections – # of times IQFeed failed to reconnect

 StartTime – Time of latest connection/reconnection to IQFeed (local timezone)

 MarketTime – Current time of the market (market’s time-zone)

 ConnectionStatus – Represents whether IQFeed is connected or not

 IQFeedVersion – Represents the version of IQFeed that is running

 LoginID – The Login ID that is currently logged into IQFeed

 TotalKBsRecv – Total # of Kilobytes received by IQFeed from IQML (i.e.,


IQML commands/requests to IQFeed). Found in the “Internet Bandwidth”
section of the IQConnection Manager. Formula: total bytes received / 1024

 – Found in the “Internet Bandwidth” section of the


KBsRecvLastSecond
IQConnection Manager. Formula: bytes received in the past second / 1024

 – Found in the “Internet Bandwidth” section of the


AvgKBsPerSecRecv
IQConnection Manager. Formula: total KB's received / total seconds

 TotalKBsSent – Total # of Kilobytes sent from IQFeed to IQML (i.e., IQFeed


messages to IQML). Found in the “Local Bandwidth” section of the
IQConnection Manager. Formula: total bytes sent / 1024

 – Found in the “Local Bandwidth” section of the


KBsSentLastSecond
IQConnection Manager. Formula: bytes sent in the past second / 1024

 – Found in the “Local Bandwidth” section of the


AvgKBsPerSecSent
IQConnection Manager. Formula: total KB's sent / total seconds.

 TotalMsgsRcv – Total number of messages received from IQFeed

 Exchanges – A cell-array list of exchanges and news subscriptions for which


this IQFeed account is subscribed. Delayed data has 'DL-' prefix. For example:
{'DL-FTSE', 'EUREXNDX', 'DL-NYMEX', 'CBOENDX', 'BLOOMBERG',
'FOREX_PREMIUM', 'RT_TRADER', 'DTNNEWS', 'BENZINGA', 'INDEX'}

 ServerVersion – The server-recommended version of IQFeed. This version is


typically the same or higher than your locally-installed IQFeedVersion, except
in cases when you run a beta version of IQFeed.

 ProtocolInUse – The protocol version that IQML uses to communicate with


IQFeed (see §9.1 for details)

 ServiceType – Type of data provided for this account (delayed or real-time)

 IQFeedAccountExpiryDate – The IQFeed account expiry date: empty string for


regular IQFeed users; YYYYMMDD format for DTN trial users.
IQML User Guide 156

The 'stats' action has a single settable property: AddPortStats (default=0). If you set
this property to 1 or true, then additional stats will be returned, with extra
information on the connected data channels/ports (see the highlighted fields below):
>> data = IQML('stats', 'AddPortStats',1)
data =
Timestamp: '20210203 12:57:30.653'
Datenum: 738190.539938113
ServerIP: '66.112.148.224'
ServerPort: 60005
MaxSymbols: 1300
NumOfStreamingSymbols: 15
NumOfAvailableSymbols: 1285
NumOfClientsConnected: 4
SecondsSinceLastUpdate: 0
NumOfReconnections: 0
NumOfAttemptedReconnections: 0
StartTime: 'Apr 01 8:21PM'
MarketTime: 'Apr 01 02:12PM'
ConnectionStatus: 'Connected'
IQFeedVersion: '6.0.0.5'
LoginID: '464720-1'
TotalKBsRecv: 69.44
KBsRecvLastSecond: 0.04
AvgKBsPerSecRecv: 0.02
TotalKBsSent: 1470.32
KBsSentLastSecond: 0.47
AvgKBsPerSecSent: 0.48
TotalMsgsRcv: 9530
Exchanges: {1×16 cell}
ServerVersion: '6.1.0.20'
ProtocolInUse: 6.1
ServiceType: 'real_time'
IQFeedAccountExpiryDate: ''
Level2: [1×1 struct]
Level2SymbolsWatched: 2
Lookup: [1×1 struct]
RegionalSymbolsWatched: 2
Admin: [1×1 struct]
Level1: [1×1 struct]
Level1SymbolsWatched: 0

>> data.Level1
ans =
ConnectTime: '20180401 202111'
KBsReceived: 0.74
KBsSent: 70.58
KBsQueued: 0
EventsReceived: 17836
EventsNotified: 17836
EventsProcessed: 15267
EventsIgnored: 2569

Note that it might take a few seconds for the additional port stats to arrive after the
initial command. If you don’t see the expected results immediately (i.e., if the
returned data-struct does not contain the channel/port sub-structs), simply resubmit
the query after 1-2 secs.
IQML User Guide 157

The returned data structs include the following fields for each data channel (port):161
 ConnectTime – Timestamp when this channel to IQFeed was first opened
 KBsReceived – Total # of Kilobytes sent from IQML to IQFeed via this
channel (requests for data queries etc.).
 KBsSent – Total # of Kilobytes sent from IQFeed to IQML via this channel.
This data transfer is typically much larger than KBsReceived – this is normal
and does not indicate a problem.
 KBsQueued – Total # of Kilobytes waiting in IQConnect to be sent to IQML via
this channel for processing. This value should typically be 0 (zero) – a
consistent non-zero value indicates that the Matlab program is unable to keep
up with the inflow of data from IQFeed, perhaps due to a high load on the
computer, or some heavy processing of the incoming data. If the value
increases over time, Matlab and your computer will eventually freeze and
become non-responsive, requiring a hard reset. See §3.6 for ways to speed-up
the processing time, in order to get KBsQueued back to 0.
 EventsReceived – Total # of messages received from IQFeed via this data port.
 EventsNotified – Total # of messages sent to IQML’s Matlab code to process.
This value will typically be the same as EventsReceived, except in cases of high
streaming data load, when OverflowMode=1 (see §6.1 for details).
 EventsProcessed – Total # of IQFeed messages processed by IQML. This value
will be less than EventsNotified in cases of high load, when OverflowMode=2.
 EventsIgnored – Total # of messages thet were ignored due to overflow protection.
This is the same as EventsReceived - EventsProcessed.

Corresponding information (except the fields on overflow handling) can also be seen
in IQConnect’s Diagnostics Utility, which is included in IQFeed’s client installation:

161
See §9.1 for a description of IQFeed’s data channels (ports)
IQML User Guide 158

9.4 Sending a custom command to IQFeed


You can send any custom command to IQFeed’s API, using the 'command' action.
For example, to send the 'S,TIMESTAMPSOFF' command,162 which stops IQFeed
from sending server timestamp messages every second:
>> IQML('command', 'String','S,TIMESTAMPSOFF')

IQFeed expects that users send commands to its API via specific channels (“ports”).
Each command is typically accepted only by the port for which it is defined. For
example, the 'S,TIMESTAMPSOFF' command is defined for the Level1 port,163
whereas the 'S,CLIENTSTATS OFF' command (which stops the IQFeed server from
streaming client stats messages) is defined for the Admin port.164 When you use
IQML’s standard actions you do not need to worry about which port handles which
command – this is automatically handled by IQML. But when you send a custom
command to IQFeed, you need to specify the port, if it is different from the default
('Level1'). In this specific example:
>> IQML('command', 'String','S,CLIENTSTATS OFF', 'PortName','Admin')

IQFeed is very picky about the spelling of the commands, including spaces and
casing. If the spelling is not exactly right, the command will be rejected by IQFeed,
possibly even without an error message. Unfortunately, IQFeed is not always
consistent in the format of the various commands. For example, the
'S,TIMESTAMPSOFF' command has no space, whereas the 'S,CLIENTSTATS OFF'
command does include a space; also, both of these commands are all-uppercase,
whereas the 'S,SET AUTOCONNECT,On' Admin command spells On/Off with
lowercase letters (and uses a comma instead of a second space).
In some cases, the command that is sent to IQFeed may result in data messages that
will be sent back from IQFeed, which should be received and processed. To do this,
you can set the ProcessFunc property to a custom callback function that will handle
these messages (see §10).
The following properties can be specified in IQML with the 'command' action:
ParameterData type Default Description
string or cell-
String (none) The IQFeed command string(s).
array of strings
The IQFeed port that will process the
command(s). Must be one of the following:
PortName string 'Level1'  'Level1' (default)
 'Level2'
 'Lookup'
 'Admin'
Custom user callback function to process
ProcessFunc function handle []
incoming IQFeed data messages (see §10).

162
http://iqfeed.net/dev/api/docs/Level1viaTCPIP.cfm
163
http://iqfeed.net/dev/api/docs/Level1viaTCPIP.cfm
164
http://iqfeed.net/dev/api/docs/AdminviaTCPIP.cfm
IQML User Guide 159

9.5 Modifying IQFeed’s registry settings


IQFeed stores its settings as keys in the HKEY_CURRENT_USER\Software\DTN\ path
of the Windows registry. Most of the important setting keys that a user might want to
modify are located within HKEY_CURRENT_USER\Software\DTN\IQFeed\Startup\.
These registry keys can be reviewed and modified using Window’s built-in Registry
Editor (regedit.exe) utility. As a convenient method to open the Registry Editor at the
correct path, use the IQML 'registry' action, which has no settable parameters:165
>> IQML('registry')

IQFeed’s key names are generally self-explanatory. In most cases you should leave the
settings unchanged. Some circumstances where you might want to modify certain keys
are discussed in §9.1 and §12.2. Key values can be modified by right-clicking the key
name and selecting “Modify…”:

Be EXTREMELY careful when editing the Windows registry: if you make a mistake
it could disable not only a specific program, but possibly even Windows itself,
rendering the computer useless. Never delete or rename keys, only modify their value.
If you are unsure which registry key to modify and how, ask DTN’s technical support.

165
Note: running Windows Registry Editor requires local computer Administrator priviledges (or elevation).
In Mac/Linux, IQML('registry') will naturally work only when Matlab runs under Parallels/Wine, not in native mode.
IQML User Guide 160

10 Attaching user callbacks to IQFeed messages

10.1 Processing IQFeed messages in IQML


IQFeed uses an asynchronous event-based mechanism for sending information to
clients. This means that we do not simply send a request to IQFeed and wait for the
answer. Instead, we send a request, and when IQFeed is ready it will send us one or
more (or zero) messages in response. Each of these messages evoke an event that
carry data (the message content and the originating IQFeed channel/port-name). By
analyzing the event data we (hopefully) receive the answer that we were waiting for.
Matlab has built-in support for asynchronous events, called callbacks in Matlab
jargon.166 Whereas Matlab callbacks are normally used in conjunction with Graphical
User Interfaces (GUI), they are also used with IQML, which automatically converts
all the IQFeed events into a Matlab callback invocation.
The callback that processes incoming IQFeed messages is constantly being “fired”
(i.e., invoked) by asynchronous messages from IQFeed, ranging from client stats and
time messages (once per second, for each of IQFeed’s 3 channels/ports), to system
messages (e.g. connection losses and reconnections), to error messages and responses
to market queries. Some of the events are triggered by user actions (market or
portfolio queries, for example), while others are triggered by IQFeed (e.g., client stats
once a second).
In addition to the regular IQML callback that processes all incoming IQFeed message
events, you can assign your own custom Matlab function that will be triggered
whenever a certain IQFeed message arrives. In all cases, the parameter controlling
this callback in IQML is called ProcessFunc.
There are two types of callbacks that you can use in IQML:
 Generic callback – this is a catch-all callback function that is triggered upon
any IQFeed message event. Within this callback, you would need to write
some code to distinguish between the different event types in order to process
the events’ data. A skeleton for this is given below.
 Specific callback – this is a callback function that is only triggered when the
specific event type is received from IQFeed. Since the event type is known,
you can process its event data more easily than in the generic callback case.
You can specify a different specific callback for each of the event types that
you wish to process, as well as a default callback that will be used for any
other event that was not assigned a specific callback.
When you specify any callback function to IQML, the command/action does not need
to be related to the callback. For example:
data = IQML('time', 'ProcessFunc',@IQML_Callback);

where IQML_Callback() is a Matlab function created by you that accepts two input
arguments, which are automatically populated in run-time:

166
http://www.mathworks.com/help/matlab/creating_guis/writing-code-for-callbacks.html
IQML User Guide 161

 iqObject – this is currently an empty array. Future versions of IQML may


place an actual object in this argument.
 eventData – a Matlab struct that contains the event’s data in separate fields.
This struct includes the following fields:
o Timestamp – local time in Matlab numeric datenum format.
o MessagePort – the name of the IQFeed port that sent the message:
'Level1', 'Level2', 'Lookup' or 'Admin'.
o MessageType – the event type, which corresponds to the custom fields
that can be set in the ProcessFunc parameter for specific callbacks.
o MessageHeader – the first part of the message text string, that identified
the message type. This is typically used to set the MessageType field.
o MessageString – the message text string as received from IQFeed.
o MessageParts – processed parts of MessageString, as a cell-array.
An example of defining a Matlab callback function is:
function IQML_Callback(iqObject, eventData)
% do callback processing here using the info in eventData
end
You can pass external data to your callback functions using the callback cell-array
format.167 For example, to pass two extra data values:
callbackDefinition = {@IQML_Callback, 123, 'abc'};
IQML('time', 'ProcessFunc',callbackDefinition);
function IQML_Callback(iqObject,eventData,extra1,extra2)
% do callback processing here using the info in eventData, extra1, extra2
end

Here are examples of the eventData for two different IQFeed messages – a timestamp
message (sent from IQFeed once every second on the Level1 and Level2 ports), and a
connection stats message (sent from IQFeed once a second on the Admin port):
Timestamp: 737128.675475417
MessagePort: 'Level1'
MessageType: 'Time'
MessageHeader: 'T'
MessageString: 'T,20180309 09:12:39'
MessageParts: {'T' '20180309 09:12:39'}
Timestamp: 737128.675479248
MessagePort: 'Admin'
MessageType: 'System'
MessageHeader: 'S'
MessageString: 'S,STATS,66.112.148.225,60002,1300,0,4,0,0,0,Mar 09
3:10PM,Mar 09 09:12AM,Connected,5.2.7.0,464720-
1,86.43,0.04,0.02,759.37,0.20,0.20'
MessageParts: {1×20 cell}

All IQFeed messages typically begin with a single character followed by ‘,’, which
we call the MessageHeader, that identifies the MessageType. In the examples above, the
MessageHeader of the first message is 'T' (indicating a Time message), and in the
second message it is 'S' (indicating a System message).168

167
http://www.mathworks.com/help/matlab/creating_guis/writing-code-for-callbacks.html#brqow8p
168
An exception to this rule may happen if you send custom commands to IQFeed using the mechanism in §7.4. In such case, it is
possible that MessageHeader will not be a recognized or even a single character. It will have a MessageType of 'Other'.
IQML User Guide 162

All the callbacks examples so far have set a generic callback that is used for all
incoming IQFeed messages. As noted above, you can also set specific callbacks for
specific messages. For example:
% Alternative #1: using the struct() function:
>> callbacks = struct('Time','disp TIME!', ...
'System',@(h,e)disp(e.MessageString));
% Alternative #2: using direct field assignments:
>> callbacks.Time = 'disp TIME!';
>> callbacks.System = @(h,e)disp(e.MessageString);
>> IQML('time','processFunc',callbacks);
TIME!
TIME!
S,STATS,66.112.156.228,60002,1300,0,4,0,0,1,Mar 11 12:36PM,Mar 11
07:14AM,Connected,5.2.7.0,464720-1,51.51,0.04,0.02,516.30,0.23,0.23
TIME!
TIME!
S,STATS,66.112.156.228,60002,1300,0,4,0,0,1,Mar 11 12:36PM,Mar 11
07:14AM,Connected,5.2.7.0,464720-1,51.54,0.04,0.02,516.48,0.23,0.23
TIME!
In this example, we have set two separate custom callbacks for two different IQFeed
messages: the periodic timestamp messages and the periodic system update messages.
In addition to specific callbacks for specific message types, you can also set a
“Default” callback that will be invoked for each incoming IQFeed message that does
not have a specific callback assigned to it.
The following message types can be trapped, corresponding to the eventData’s
MessageType field (e.MessageType):
Message See
MessageType Description
Header section
Fundamental F Fundamental asset data §4.2
Quote_summary P Quote summary message §4.1
Quote_update Q Quote update (tick) message §6.1
Market_depth Z Level2 market-depth update message §4.4, §6.4
Market_maker M Market maker information §4.4, §6.4
History H Historical data (one msg per bar/tick) §5
Regional R Regional update message §6.2
News N News data (one message per item) §7
Indicates end of the data with multiple
End_of_data !ENDMSG! data items (e.g., history or news) §5, §7
Lookup s Lookup information message §8.1
Chain : Options/Futures chain §8.2
Time T Timestamp message (once a second) §9.2
System S System message (stats, once a sec) §9.3
Symbol_not_found_error n Indicates a symbol-not-found error §3.4
General_error E All other IQFeed-generated errors
Other All other IQFeed messages
Any IQFeed message that does not
Default have a specific callback assigned to it
IQML User Guide 163

You can set individual callbacks to any of these MessageType values, by using the
MessageType value as a field-name in the ProcessFunc parameter. For example, to
process quote-update (tick) messages in a dedicated callback function:
>> callbacks.Quote_update = @IQML_Quote_Update_Callback;
>> IQML('time','ProcessFunc',callbacks);

Here is a more elaborate example, were we set different callbacks for different
message types, along with a default callback for all other message types:
% Alternative #1: using the struct() function:
>> callbacks = struct('Time','disp TIME!', ...
'System',[], ... % ignore System messages
'Quote_update',@IQML_Quote_Update_Callback, ...
'Default',@IQML_Default_Callback);
% Alternative #2: using direct field assignments:
>> callbacks.Time = 'disp TIME!';
>> callbacks.System = []; % ignore System messages
>> callbacks.Quote_update = @IQML_Quote_Update_Callback;
>> callbacks.Default = @IQML_Default_Callback);
>> IQML('time','processFunc',callbacks);

When you specify any callback function to IQML, you only need to set it once, in any
IQML command. Unlike most IQML parameters, which are not remembered across
IQML commands and need to be re-specified, callbacks do not need to be re-
specified. They are remembered from the moment they are first set, until such time as
Matlab exits or the callback parameter is changed.
Note that it is not an error to re-specify the callbacks in each IQML command, it is
simply useless and makes the code less readable.
If an error occurs during the evaluation of your specified callback function, an error
message will be displayed in the Matlab console. In blocking mode (data=IQML(…)) a
Matlab exception will then be thrown, which can be trapped in the calling code using a
try-catch block (see §3.4 item 1); in non-blocking mode no exception will be thrown:
>> IQML('quotes','symbol','IBM','processFunc',struct('Quote_Summary',@myFunc))
20200330 11:02:55.510 error in user-defined callback (myFunc) for IQFeed
Quote_Summary message: Invalid argument in myFunc line 123

To reset all callbacks (i.e., remove any callback invocation), simply set the
ProcessFunc parameter value to [] (empty square brackets):
IQML('time', 'ProcessFunc',[]);

You can also set individual message callbacks to an empty value, in order to ignore
just these specific messages but not the other messages:
>> callbacks.Time = 'disp TIME!';
>> callbacks.System = []; % ignore System messages
>> callbacks.Default = @IQML_Default_Callback);
>> IQML('time','ProcessFunc',callbacks);

Matlab callbacks are invoked even if you issue a custom IQFeed command (see §9.4).
This can be very useful: you can send a request to IQFeed, and then process the
results in a Matlab callback function. However, note that in such a case, it is possible
that the returned message will contain a MessageHeader that will not be a recognized.
Such messages will be assigned a MessageType of 'Other'.
IQML User Guide 164

10.2 Run-time performance implications


It is very important to ensure that any callback function that you assign in IQML
completes in the fastest possible time. This is important for programming in general,
but it is especially important for IQML callbacks, which are invoked (executed) every
time that a new message arrives from IQFeed, numerous times each second.
As explained in §3.6, IQML’s standard callback processing has an overhead of 1-2
milliseconds per IQFeed message. This means that without any user-specified
callbacks, and without any other Matlab or other code running, IQML can typically
process up to 500-1000 IQFeed messages per second.
When you add your own user-defined callbacks, their processing time is added to
IQML’s. For example, if your callback takes an average of just 3 msecs to process
(which is quite fast), the total average message processing time will be 4-5 msecs.
This will lower IQML’s effective processing rate from 500-1000 messages/sec to just
200-250 messages/sec. The more callbacks and alerts that you define, and the longer
each of them takes to process, the lower IQML’s message processing rate will be.
The following specific tips may assist you to reduce the callback performance impact:
1. Ensure that you have enough physical memory to avoid memory swapping to
disk. This is probably the single most important tip to improve performance
2. Avoid setting user callbacks and alerts, or at least disable them when not needed.
3. Avoid setting a Default callback or a general ProcessFunc, but rather specific
callbacks only for the messages that you need (e.g. for News or Regional).
4. Limit the streaming data to just those events and symbols that are of interest to
you. For example, if you are only interested in the GOOG symbol, and set a
Quote_update callback, this callback will also be processed for streaming
quotes for other symbols, so it’s better to stop streaming those other symbols.
5. Minimize disk access: disk I/O is much slower than memory access. Save data
to memory and flush it to disk at the end of the trading day, or once in a while
(e.g. every 5 minutes), but not in each callback.
6. If you need to access disk files, use SSD (solid-state disk) rather than a
spinning hard-disk.
7. If you need to load data from disk, do it once and preserve the data in memory
using Matlab persistent or global variables, to be reused in callback calls.
8. Instead of re-computing values that are based on static data in each callback
call, compute once and cache results in Matlab persistent or global variables.
9. Use Matlab’s built-in Profiler tool169 to check your callback code for run-time
performance hotspots that can be optimized to run faster.
10. Read the textbook “Accelerating MATLAB Performance”,170 authored by
IQML’s creator (see §15.2), for numerous tips on improving Matlab run-time.

169
https://mathworks.com/help/matlab/matlab_prog/profiling-for-improving-performance.html
170
https://undocumentedmatlab.com/books/matlab-performance
IQML User Guide 165

10.3 Usage example – using callbacks to parse options/futures chains


In this example, we request IQFeed to send the list of symbols in an options/futures
chain, then parse the incoming results to retrieve the symbols in the chain (see §8.2).

We first send the relevant command to IQFeed using IQML’s custom command
functionality (§9.4), specifying a custom callback function for the 'Chain'
MessageType:171
% Equity options chain for GOOG:
processFunc.Chain = @IQML_Chain_Callback;
>> IQML('command', 'String','CEO,GOOG,p,,1', 'PortName','lookup', ...
'debug',1, 'ProcessFunc',processFunc)
=> 20180405 13:13:00.063 (lookup) CEO,GOOG,p,,1
<= 20180405 13:13:00.574 (lookup) :,GOOG1806P1000,GOOG1806P1002.5,GOOG1806P1
005,GOOG1806P1007.5,GOOG1806P1010,GOOG1806P1012.5,GOOG1806P1015,GOOG1806P1017
.5,GOOG1806P1020,GOOG1806P1022.5,GOOG1806P1025,GOOG1806P1027.5,GOOG1806P1030,
GOOG1806P1032.5,GOOG1806P1035,GOOG1806P1037.5,GOOG1806P1040,GOOG1806P1042.5,G
OOG1806P1045,GOOG1806P1047.5,GOOG1806P1050,…,
<= 20180405 13:13:00.578 (lookup) !ENDMSG!

% Future options chain for C:


>> IQML('command', 'String','CFO,C,p,,9,1', 'PortName','lookup', ...
'debug',1, 'ProcessFunc',processFunc)
=> 20180405 13:31:48.677 (lookup) CFO,C,p,,9,1
<= 20180405 13:31:49.149 (lookup) :,CH19P2000,CH19P2100,CH19P2200,CH19P2300,CH19
P2400,CH19P2500,CH19P2600,CH19P2700,CH19P2800,CH19P2900,CH19P3000,CH19P3100,CH19P
3200,CH19P3300,CH19P3400,CH19P3500,CH19P3600,CH19P3700,CH19P3800,CH19P3900,CH19P4
000,CH19P4100,CH19P4200,CH19P4300,CH19P4400,CH19P4500,CH19P4600,CH19P4700,CH19P48
00,CH19P4900,CH19P5000,CH19P5100,CH19P5200,CH19P5300,CH19P5400,CH19P5500,CH19P560
0,CH19P5700,CH19P5800,CH19P5900,CH19P6000,CH19P6100,CH19P6200,CH19P6300,CH19P6400
<= 20180405 13:31:49.158 (lookup) !ENDMSG!

The custom callback function may look something like this:


function IQML_Chain_Callback(iqObject,eventData)
symbols = eventData.MessageParts(2:end); %discard the ':' message header
% now do something useful with the reported symbols...
end

171
Note that we have set Debug=1 in this example purely to illustrate the incoming IQFeed message format; it would not be
used in a typical run-time program.
IQML User Guide 166

10.4 Usage example – using callbacks for realtime quotes GUI updates
In this example, we wish to update a real-time ticker window with the latest
streaming quotes data. The idea is to create a minimalistic window and update its title
with the symbol name and latest trade price, whenever a new tick arrives.
The code relies on the format of IQFeed’s Quote_update (Q) message, which by default
is a 16-element cell array: {Symbol, Most_Recent_Trade, Most_Recent_Trade_Size,
Most_Recent_Trade_Time, Most_Recent_Trade_Market_Center, Total_Volume, Bid, Bid_Size, Ask,
Ask_Size, Open, High, Low, Close, Message_Contents, Most_Recent_Trade_Conditions }:
>> processFunc = struct('Quote_Update', @Quote_Update_Callback);
>> IQML('quotes', 'symbol','@VX#', 'numofevents',100, ...
'ProcessFunc',processFunc, 'debug',1)
=> 20180411 12:03:40.131 (Level1) w@VX#
<= 20180411 12:03:40.391 (Level1) F,@VX#,20,,,28.05,12.85,,,,,,,,,,,,,,,,,,CBOE …
<= 20180411 12:03:40.409 (Level1) P,@VX#,20.61,,04:52:29.711000,32,5668,20.60,50,
20.65,87,20.20,20.70,20.15,20.18,Cbasohlcv,4D
<= 20180411 12:03:44.887 (Level1) Q,@VX#,20.61,,04:52:29.711000,32,5668,20.60,50,
20.65,86,20.20,20.70,20.15,20.18,a,4D
In our case, we are only interested in the 1st (Symbol) and 2nd (Most_Recent_Trade)
elements of the 'Q' update messages:
eventData =
Timestamp: 737161.502602859
MessagePort: 'Level1'
MessageType: 'Quote_Buffer'
MessageHeader: 'Q'
MessageString: 'Q,@VX#,20.61,,04:52:29.711000,32,5668,20.60,50,20.65,86,
20.20,20.70,20.15,20.18,a,4D'
MessageParts: {'@VX#' 20.61 [] '04:52:29.711000' 32 5668 20.6 50
20.65 86 20.2 20.7 20.15 20.18 'a' '4D'}
The corresponding callback function will be:
function Quote_Update_Callback(iqObject, eventData)
% Symbol is 1st data element of IQFeed 'Q' messages
symbol = eventData.MessageParts{1};
% Last trade price is 2nd data element of the IQFeed 'Q' messages
latestTrade = eventData.MessageParts{2};
% Get the handle for this symbol's ticker window
hFig = findall(0, 'Tag',symbol, '-depth',1);
if isempty(hFig)
% Ticker window not found, so create it
hFig = figure('Tag',symbol, 'Position',[300,300,250,1], ...
'Resize','off', 'NumberTitle','off', ...
'Menu','none', 'Toolbar','none',);
end
% Update the ticker window's title
hFig.Name = sprintf('%s: %.2f', symbol, latestTrade);
end

And the resulting ticker window will look like this:

As noted in §6.1, tick events may be sent at a very high rate from the IQFeed server.
So instead of updating the GUI with each tick, you may want to use a periodic Matlab
timer having a Period of 0.5 [secs], that will invoke a timer callback, which will call
IQML(…,'NumOfEvents',-1) to fetch the latest data and update the GUI.
IQML User Guide 167

10.5 Usage example – using callbacks for realtime order-book GUI updates
In this example, we wish to update a real-time GUI display of the order-book (at least
the top few rows of the book).

Note: Market Depth (Level 2) data is only available in the Professional IQML license.

As noted in §6.4, market-depth events may be sent at a very high rate from the
IQFeed server, and so it is not feasible or useful to update the Matlab GUI for each
update. Instead, we update the GUI with the latest data at a steady rate of 2 Hz (twice
a second). This can be achieved in two different ways: one alternative is to set-up a
periodic timer that will run our GUI-update callback every 0.5 secs, which will call
IQML(…,'NumOfEvents',-1) to fetch the latest data and update the GUI.

Another alternative, shown here below (also downloadable172), is to attach a user


callback function to Level 2 market-depth messages, updating an internal data struct,
but only updating the GUI if 0.5 secs or more have passed since the last GUI update:
% IQML_MktDepth - sample Market-Depth usage function
function IQML_MktDepth(symbol)

% Initialize data
numRows = 10;
depthData = cell(numRows,8);
lastUpdateTime = -1;
GUI_refresh_period = 0.5 * 1/24/60/60; % =0.5 secs

% Prepare the GUI


hFig = figure('Name','IQML market-depth example', ...
'NumberTitle','off','CloseReq',@figClosedCallback,...
'Menubar','none', 'Toolbar','none', ...
'Resize','off', 'Pos',[100,200,660,260]);
color = get(hFig,'Color');
headers = {'Ask valid','Ask time','Ask size','Ask price', ...
'Bid price','Bid size','Bid time','Bid valid'};
formats = {'logical','char','numeric','long', ...
'long','numeric','char','logical'};
hTable = uitable('Parent',hFig, 'Pos',[10,40,635,203], ...
'Data',depthData, 'ColumnName',headers, ...
'ColumnFormat',formats, ...
'ColumnWidth',{60,100,80,80,80,80,100,60});
hButton = uicontrol('Parent',hFig, 'Pos',[50,10,60,20], ...
'String','Start', 'Callback',@buttonCallback);
hLabel1 = uicontrol('Parent',hFig, 'Pos',[120,10,100,17], ...
'Style','text', 'String','Last updated:', ...
'Horizontal','right', 'Background',color);
hLabelTime = uicontrol('Parent',hFig, 'Pos',[225,10,100,17], ...
'Style','text', 'String','(not yet)', ...
'Horizontal','left', 'Background',color);

% Send the market-depth request to IQFeed using IQML


contractParams = {'symbol',symbol}; % symbol='@ES#'
callbacks = struct('Market_depth',@mktDepthCallbackFcn);
IQML('marketdepth', contractParams{:}, 'processFunc',callbacks);

172
https://UndocumentedMatlab.com/files/IQML/IQML_MktDepth.m
IQML User Guide 168

% Figure close callback function - stop market-depth streaming


function figClosedCallback(hFig, ~)
% Delete figure window and stop any pending data streaming
delete(hFig);
IQML('marketdepth', contractParams{:}, 'numofevents',0);
end % figClosedCallback

% Start/stop button callback function


function buttonCallback(hButton, ~)
currentString = get(hButton,'String');
if strcmp(currentString,'Start')
set(hButton,'String','Stop');
else
set(hButton,'String','Start');
end
end % buttonCallback

% Callback functions to handle IQFeed Market Depth update events


function mktDepthCallbackFcn(~, eventData)

% Ensure that it's the correct MktDepth event


allMsgParts = strsplit(eventData.MessageString,',');
allMsgParts(strcmpi(allMsgParts,'T')) = {true};
allMsgParts(strcmpi(allMsgParts,'F')) = {false};
if strcmp(eventData.MessagePort,'Level2') && ...
strcmp(allMsgParts{2},symbol)

% These are the field names of the IQFeed messages


inputParams = {'Intro','Symbol','MMID',...
'Bid','Ask','BidSize','AskSize',...
'BidTime','Date','ConditionCode',...
'AskTime','BidInfoValid',...
'AskInfoValid','EndOfMsgGroup'};

% Get the updated data row


% Note: Java indices start at 0, Matlab starts at 1
mmid = allMsgParts{strcmpi(inputParams,'MMID')};
row = sscanf(mmid,'%*c%*c%d');
% Get the size & price data fields from the event's data
bidValid = allMsgParts{strcmpi(inputParams,'BidInfoValid')};
askValid = allMsgParts{strcmpi(inputParams,'AskInfoValid')};
bidTime = allMsgParts{strcmpi(inputParams,'BidTime')};
askTime = allMsgParts{strcmpi(inputParams,'AskTime')};
bidSize = allMsgParts{strcmpi(inputParams,'BidSize')};
askSize = allMsgParts{strcmpi(inputParams,'AskSize')};
bidPrice = allMsgParts{strcmpi(inputParams,'Bid')};
askPrice = allMsgParts{strcmpi(inputParams,'Ask')};
thisRowsData = {askValid,askTime,askSize,askPrice,...
bidPrice,bidSize,bidTime,bidValid};
depthData(row,:) = thisRowsData;
% Update the GUI if more than 0.5 secs have passed and
% the <Stop> button was not pressed
if ~isvalid(hButton), return, end
isStopped = strcmp(get(hButton,'String'),'Start');
if now - lastUpdateTime > GUI_refresh_period && ~isStopped
set(hTable,'Data',depthData);
set(hLabelTime,'String',datestr(now,'HH:MM:SS'));
lastUpdateTime = now;
end
end
end % mktDepthCallbackFcn
end % IQML_MktDepth
IQML User Guide 169
IQML User Guide 170

11 Alerts

11.1 General Usage


In cases where certain events in steaming data are of interest to the user, IQML can
generate alerts of these events as they arrive from IQFeed. The user can define the
event data type, the trigger condition, and the type of alert to generate when the
condition is met. For example, users may configure an alert on quotes, such that when
a symbol’s bid price is higher than some threshold, an email will be sent.
Each alert contains 3 components:
 Data type – quote, intervalbar, regional or news
 Trigger – a condition (typically a comparison between a field and a value)
 Action – what IQML should do when the trigger condition is met
Alerts are created using the 'alert' action. Each new alert is assigned a unique
numeric ID. Using this ID, users can query, delete or edit the alert after it was created.
The following parameters affect the alerts. Detailed explanations and usage examples
are listed in the following sections.
Parameter Data type Default Description
Limits the alert to the specified symbols
colon or and meta-tags only. Examples:
comma-  'IBM'
Symbol or delimited  'IBM:AAPL:GOOG'
Symbols 173 string or (none)  'IBM,AAPL,GOOG'
cell-array  {'IBM', 'AAPL', 'GOOG'}
of strings Optional parameter for news alerts;
mandatory for quote/intervalbar alerts
A string composed of the data type,
(none) triggering parameter, trigger operator and
string triggering value, separated by spaces.
describing Examples:
the alert – must be
Trigger
 'quote bid >= 102.60'
trigger defined for
new alerts!  'intervalbar close < 80'
 'news text contains IPO'
Type of alert to generate. Options: 174
string, (none)  'display'
function  'popup'
AlertAction handle, or – must be  'email' (requires specifying the
callback defined for EmailRecipients parameter)
cell array new alerts!  @myCallbackFcn
 {@myFcn, data1, data2, …}

173
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
174
Note the performance implications that are discussed in §3.6 and §10.2
IQML User Guide 171

Parameter Data type Default Description


Maximal # of times to be alerted of the
NumOfEvents integer 1 defined event. NumOfEvents = -1 returns
a list of all existing alerts.
If false (default), data streaming needs to be
started by the user in a separate command.
logical
StartStream false If true and relevant data streaming is not
(true/false)
currently active, IQML starts the data
streaming automatically (see §11.2).
Unique ID generated and returned by
integer [] IQML when new alert is defined.
AlertID (scalar or (empty AlertID is relevant (and mandatory) only
array) array) for querying, editing or deletion of
existing alerts. See §11.3 and §11.4.
If true (default), the full story text is
fetched and reported with each news alert
logical via email/callback;
GetStory true if false, only headline data will be reported.
(true/false)
GetStory is relevant only for news alerts
with AlertAction='email' or callback.
Email addresses to which email alerts will
comma- be sent. This parameter is relevant (and
delimited '' mandatory) only for email alerts. Examples:
EmailRecipients string or (empty  'john@doe.com'
cell-array string)  'john@doe.com, jane@doe.com'
of strings
 {'john@doe.com', 'jane@doe.com'}
SMTP e-mail address from which alert
emails will be sent.
'iqml.alerts@ This parameter is relevant only for
SmtpEmail string gmail.com' specifying a non-default email sender.
SmtpEmail only needs to be set once,
and is used by all future IQML alert events.
SMTP server that will send alert emails.
This parameter is relevant only for
SmtpServer string (none) specifying a non-default email sender.
SmtpServer only needs to be set once,
and is used by all future IQML alert events.
Password of the sender’s e-mail account.
This parameter is relevant only for
SmtpPassword string (confidential) specifying a non-default email sender.
SmtpPassword only needs to be set once,
and is used by all future IQML alert events.
Note: Alerts are only available in the Professional IQML license.
IQML User Guide 172

11.2 Alert Configuration


Alerts can be configured by the user using the 'alert' action, using the properties in
the table above. Users can configure the data type, event trigger, maximal number of
alert reports, and the type of alert to generate (email, pop-up message, etc.). For email
alerts, users can also specify the recipients and the sender email account.
The Trigger parameter is the most important input, and is unique to the 'alert'
action. It is a string describing the alert trigger event, so it is very important that it be
composed properly. The Trigger string has 4 elements:
1. Data type ('quote', 'intervalbar', 'news' or 'regional')
2. Trigger field: case-insensitive name of a field in the latestData struct of the
source data specified by the Data type (see §6.1, §6.3). For example: 'bid',
'ask', 'total_volume', 'Most_Recent_Trade', 'intervalVolume', 'text', etc.
3. Trigger operator ('>', '>=', '<', '<=', '=', or 'contains').175
 '>', '<', '>=', '<=' are only relevant for non-news alerts (but not for news)
 '=' and 'contains' are relevant for all alert types (including news)
4. Trigger value: either a scalar number (for a '>', '>=', '<', '<=', or '=' operator) or
a string (for a '=' or 'contains' operator).
For example:
alertId = IQML('alert', 'Symbol','IBM', 'Trigger','quote ask < 145.70', ...);
alertId = IQML('alert', 'Symbol','IBM', 'Trigger','quote Total_Volume >= 10', ...);
alertId = IQML('alert', 'Symbol','IBM', 'Trigger','news text contains IPO', ...);

By default, alerts are only triggered and reported once. This can be changed by setting
the NumOfEvents parameter to an integer value. For example, the following alert
will be reported up to 5 times, and will then be deleted from the list of alerts:
alertId = IQML('alert', 'Symbol','IBM', ..., 'NumOfEvents',5);

IQML does NOT automatically start streaming data when alerts are defined. This
enables users to start and stop streaming data at will, and the alerts will only be
evaluated when streaming data messages arrive from IQFeed.
Note: if you use a Data type of 'quote', then depending on the setting of the Fields
parameter in your latest quotes query (§4.1), the requested alert Trigger field might
not exist in the streaming quotes, causing the alert to become ineffective. IQML does
not automatically update Fields with the requested Trigger field. When such a case is
detected, a warning message will be presented:
Warning: Field 'VWAP' is not currently included in your quotes Fields
parameter, making the requested alert useless

It is sometimes convenient to start streaming immediately when the alert is created.


This can be done by setting the StartStream parameter (default: false). Setting a
value of true starts the streaming for the corresponding data type (e.g., streaming
quotes for a symbol) automatically, unless the streaming is already active.

175
Additional trigger operators may be added in future IQML releases.
IQML User Guide 173

Note that with StartStream=true, the streaming is started automatically, using the
default parameters. If you wish to control the streaming parameters (for example,
NumOfEvents or DataType), leave StartStream in its default false value, and start
the streaming in a separate IQML command.
The AlertAction defines the action to be performed when a triggering event is detected
(i.e., when the trigger condition is met). There are 4 possible AlertAction values:
'popup', 'display', 'email', and callback (note the performance discussion in §3.6, §10.2):
1. 'Popup' announces the triggered event in a pop-up a message-box:
alertId = IQML('alert', 'Symbol','@VX#', 'Trigger','quote bid > 14.75', ...
'AlertAction','popup');

2. 'Display' announces the event in Matlab’s console (Command Window):


alertId = IQML('alert', 'Symbol','@VX#', 'Trigger','quote bid > 14.75', ...
'AlertAction','display');

04:50:11.099000 IQML alert: @VX# bid (14.8) > 14.75

Or, as another example of regional update alert:


alertId = IQML('alert', 'Symbol','IBM', 'AlertAction','display', ...
'Trigger', 'regional regionalbid > 140');

20180524 16:57:13.689 IQML alert: IBM regionalbid (143.75) > 140

3. 'Email' – an email with the alert event’s details will be sent to the specified
EmailRecipients, a mandatory parameter for email alerts. EmailRecipients
must be set as a comma/semi-colon/colon delimited string, or a cell array of
email addresses; it cannot be left empty.
For example, the following alert will send an email to two email recipients:
alertId = IQML('alert', 'Symbol','@VX#', 'Trigger','quote bid > 14.75', ...
'AlertAction','email', ...
'EmailRecipients',{'john@a.com','jane@b.com'});

which results in an email similar to this:


From: iqml.alerts@gmail.com
Subject: IQML alert: @VX# bid (14.8) > 14.75
Body:
Symbol: '@VX#'
Most_Recent_Trade: 14.82
Most_Recent_Trade_Size: 10
Most_Recent_Trade_Time: '08:40:02.926510'
Most_Recent_Trade_Market_Center: 32
Total_Volume: 6890
Bid: 14.8
...
IQML User Guide 174

or similarly, in the case of a news alert:


From: iqml.alerts@gmail.com
Subject: IQML alert: United Technologies Plans To Hire 35,000 People, Make
$15 B... (RTB)
Body:
ID: 22017029634
Symbols: {'UTX'}
Text: '09:31 Wednesday, May 23, 2018. (RTTNews) - United Technologies
Plans To Hire 35,000 People, Make $15 Bln Investment In U.S. Over Next 5 Years
For comments and feedback: contact editorial@rttnews.com. Copyright(c) 2018
RTTNews.com. All Rights Reserved'
For news alerts, the full story text is fetched by default. It is possible to skip
fetching the full story by setting GetStory to false. This speeds up processing
by skipping the news-fetch query, and reports only the headline information:
From: iqml.alerts@gmail.com
Subject: IQML alert: United Technologies Plans To Hire 35,000 People, Make
$15 B... (RTB)
Body:
Source: 'RTB'
ID: 22017029634
Symbols: {'UTX'}
Timestamp: '20180523 093143'
Text: 'United Technologies Plans To Hire 35,000 People, Make $15 B...'
As noted, EmailRecipients can be specified in various manners. For example,
all the following are equivalent:
'EmailRecipients','john@a.com,jane@b.com'
'EmailRecipients','john@a.com;jane@b.com'
'EmailRecipients',{'john@a.com','jane@b.com'}
Alert emails are sent from an IQML email address (iqml.alerts@gmail.com)
by default. To send the alert emails from another sender (for example, a
corporate email account), specify the SmtpEmail, SmtpServer and
SmtpPassword.176 These parameters are saved in your local machine’s
Matlab settings, and will be used by all future IQML email alerts (even after
you restart the computer), so you only need to set them once. For example:
alertId = IQML('alert', 'Symbol','GOOG', 'Trigger','quote ask < 1090', ...
'AlertAction','email', 'Recipients','JohnDoe@gmail.com', ...
'SmtpServer','smtp.gmail.com', ...
'SmtpEmail','senderEmail@gmail.com', ...
'SmtpPassword','mypassword123');
On modern smartphones, text (SMS) messages have generally been replaced
with email push notifications. Still, for some users text alerts may be useful.
Some mobile operators enable users to receive text messages by sending them
to a specially-formed email address.177 For example, to send a text message
alert to T-Mobile number 123-456-7890 in the USA, simply email the alert to
1234567890@tmomail.net. To receive alerts via such text messages, you just
need to determine your mobile carrier’s email gateway for SMS messages,
and set EmailRecipients accordingly. Note that carrier charges might apply.

176
The SMTP port is automatically assumed to be 465. If you use Google’s mail server (smtp.gmail.com), the account must
allow access from "less secure apps" (https://myaccount.google.com/lesssecureapps). Note that anti-virus or firewall
software may possibly block the outgoing emails (in such cases you may see a “PKIX path building” error).
177
https://en.wikipedia.org/wiki/SMS_gateway#Email_clients
IQML User Guide 175

4. Callback: a personalized callback function for an event can be specified using


a Matlab function handle. For example:
alertId = IQML('alert', 'Symbol','GOOG', 'Trigger','…', 'AlertAction',@myFunc);

The callback function (myFunc in this example) should accept two or more
inputs, as customary for Matlab callbacks:178
function myFunc(alertObject, eventData)

 alertObject – a struct with the alert’s configuration (see §11.3)


 eventData– a struct with the triggered event’s local time (in Matlab
datenum format) and the trigger data.

For example, for quote data alerts, eventData might look like this:
>> eventData =
triggerTime: 737202.663148947
triggerData: [1×1 struct]

>> eventData.triggerData
ans =
Symbol: 'GOOG'
Most_Recent_Trade: 1083
Most_Recent_Trade_Size: 30
Most_Recent_Trade_Time: '08:54:53.159809'
Most_Recent_Trade_Market_Center: 11
Total_Volume: 1957
...

To specify additional input parameters to your callback function, set


AlertAction to a cell array in which the first cell is the function handle and
the rest are additional inputs. For example:
callback = {@myFunc, data1, data2};
alertId = IQML('alert', 'Symbol','GOOG', 'Trigger','…', 'AlertAction',callback);

function myFunc(alertObject, eventData, data1, data2)


... % data processing done here
end

178
https://www.mathworks.com/help/matlab/creating_plots/callback-definition.html;
https://www.mathworks.com/help/matlab/creating_guis/write-callbacks-using-the-programmatic-workflow.html#f16-1001315
IQML User Guide 176

11.3 Alerts Query


IQML can be queried for the list of all existing alerts, or just a single specific alert.
Alerts are returned in this case as Matlab structs containing the alerts’ specifications.
Specific alerts may be queried by specifying their unique AlertID (which was
returned by the command that created the alert), and setting NumOfEvents to -1:
>> alertID = IQML('alert', 'Symbol','IBM', 'Trigger','quote bid > 200',…);
>> alert = IQML('alert', 'AlertID',alertID, 'NumOfEvents',-1)
alert =
struct with fields:
AlertID: 22120136109
isActive: 1
DataType: 'quote'
Trigger: 'bid > 200'
TriggerType: 'bid'
TriggerOp: '>'
TriggerValue: '200'
Symbol: {'IBM'}
AlertAction: 'popup'
EmailRecipients: {}
EventsProcessed: 0
EventsToProcess: 1
LatestValue: []

The AlertID parameter can be an array of alert IDs, resulting in an array of structs.
To retrieve the list of all the existing alerts, simply set NumOfEvents to -1, without
specifying the AlertID parameter:
>> allAlerts = IQML('alert', 'NumOfEvents',-1)
allAlerts =
3×1 struct array with fields:
AlertID
isActive
DataType
Trigger
TriggerType
TriggerOp
TriggerValue
Symbol
AlertAction
EmailRecipients
EventsProcessed
EventsToProcess
LatestValue

11.4 Alert Editing or Deletion


An existing alert can be edited or deleted by specifying its AlertID:
To delete an alert, set NumOfEvents to 0 as follows:
IQML('alert', 'AlertID',alertID, 'NumOfEvents',0);

To update/edit an alert, specify AlertID with one or more of the alert configuration
parameters: Symbols, Trigger, AlertAction, EmailRecipients, NumOfEvents (>1).
IQML('alert','AlertID',alertID,'AlertAction','email','EmailRecipients','john@a.com');

As above, the AlertID input can be an array of IDs, affecting multiple alerts at once.
IQML User Guide 177

12 Messages and logging


12.1 IQML messages
To display detailed information on IQML requests and IQFeed messages, set IQML’s
Debug parameter to 1 or true (default=0). IQML will then display in the Matlab console
(Command Window) additional information that may help diagnose problems.
For example, setting Debug to 1 (or true) displays the outgoing commands from
IQML to IQFeed (“=>”), and incoming messages from IQFeed to IQML (“<=”), along
with the message’s local timestamp and port channel:179
>> data = IQML('news' ,'DataType','headlines', 'MaxItems',4, 'debug',1)
=> 20180401 15:14:00.010 (Lookup) NHL,,:,t,5,,
<= 20180401 15:14:01.082 (Lookup) N,CPR,21998204468,,20180401080059,
Following Is a Test Release
<= 20180401 15:14:01.086 (Lookup) N,RTI,10134529069,,20180401080029,
Quarterly Corporate Earnings (04/01/18)
<= 20180401 15:14:01.092 (Lookup) N,CPR,21998201110,,20180401073059,
Following Is a Test Release
<= 20180401 15:14:01.098 (Lookup) N,CPR,21998197500,,20180401070059,
April 1 Alert: Introducing, Duty Not Free: Pay-as-you-go toilet time
<= 20180401 15:14:01.107 (Lookup) !ENDMSG!
>> data = IQML('quotes', 'symbol','FB', 'debug',1)
=> 20180401 17:20:29.189 (Level1) wFB
<= 20180401 17:20:29.450 (Level1)
F,FB,5,29.1,50158000,195.3200,138.8100,195.3200,149.0200,0.0000,,,,,,
,,,,5.49,,2.52,12,,FACEBOOK,FB,47.600,0.63,,48563.0,3760.0,12/31/2017
,,2905001,,,,,,14,4,7375,36.25,1,21,02/01/2018,04/11/2017,02/01/2018,
03/26/2018,176.4600,,,,,519190,,,
<= 20180401 17:20:29.462 (Level1)
P,FB,160.0500,50000,19:59:56.263577,11,0,160.0500,4600,160.0600,200,,
,,159.7900,Cbacv,8801
=> 20180401 17:20:29.471 (Level1) rFB
In order to log such messages in a text file, you can use IQFeed’s built-in logging
facility, as described below (§12.2).
In certain cases, IQML reports messages as red error messages on the Matlab console.
Such messages can be handled by analyzing IQML’s second (optional) output
argument, which is typically an empty string, except when an error is reported:
>> [data, errorMsg] = IQML('quotes', 'Symbol','IBM', 'Timeout',0.1)
IQML timeout: either IQFeed has no data for this query, or the Timeout
parameter should be set to a value larger than 0.1
data =
[]
errorMsg =
'IQML timeout: either IQFeed has no data for this query, or the Timeout
parameter should be set to a value larger than 0.1'

Users can control whether such error messages from IQFeed should raise a Matlab
error (exception) in blocking (non-streaming) mode, using the RaiseErrorMsgs
parameter (default: true).
>> [data, errorMsg] = IQML('quotes', 'Symbol','IBM', 'RaiseErrorMsgs',false);

179
Periodic IQFeed timestamp and client-stats messages (once every second) are not displayed, even when Debug is 1 or true.
For a description of the various port channels used by IQFeed, see §9.1
IQML User Guide 178

When RaiseErrorMsgs is true (the default value) and no second output argument is
requested in the IQML query, then run-time errors that occur during IQML’s
processing will raise a Matlab error (exception). In such cases, the error message will
typically include some context information that may assist you in locating the cause:
Error using IQML
The Symbol parameter is mandatory for 'history' requests.
when calling: IQML('history')
called from: C:\Yair\Utils\Matlab\test.m line 3
Error using IQML
IQFeed error: Symbol 'XXXXX' is invalid/unavailable!
when calling: IQML('quotes','Symbol','XXXXX')
called from: C:\Yair\Utils\Matlab\test.m line 5

In addition to IQFeed messages, your program must handle cases of IQML errors. In
most cases, these are due to invalid IQML input parameters (an invalid action or
parameter name, or an invalid parameter value). Errors might also happen due to
network problems, or even an internal bug due to an unhandled edge-case situation.
To trap and handle such programmatic exceptions, wrap your calls to IQML within a
try-catch block, as follows:
try
data = IQML('action','query', ... );
catch err
% process the error exception here, based on the contents of err
end

Try-catch blocks have very small performance or memory overhead and are a very
effective way to handle programmatic errors. We recommend that you use them in
your program, not just to wrap IQML calls but also for other processing tasks. I/O sections
in particular (reading/writing files) are prone to errors, so they are prime candidates
for such exception handling. The same applies for code that handles user inputs (we
can never really be too sure what invalid junk a user might enter in there, can we?).
Very common causes of errors when using IQML are relying on default parameter
values, and specifying numeric parameter values within string quotes (e.g., ‘1’ rather
than 1). Users of IQML should take extra precaution in their programs to ensure that
these common mistakes do not occur. See the discussion in §3.4.
Matlab “out of memory” errors might occur when receiving and storing a huge
amount of streaming or historic data. They can be fixed by running IQML on a
computer having more memory, or by reducing the amount of stored data.180
Java memory errors are recognized by the message “java.lang.OutOfMemoryError:
Java heap space”. They can be solved by running Matlab with more allocated Java
heap memory than the default value of 64MB or 128MB (depending on Matlab
release). This value can be increased in Matlab’s preferences, or via a java.opts file.181

180
Also see: http://www.mathworks.com/help/matlab/matlab_prog/resolving-out-of-memory-errors.html
181
https://www.mathworks.com/matlabcentral/answers/92813-how-do-i-increase-the-heap-space-for-the-java-vm-in-matlab-6-0-
r12-and-later-versions
IQML User Guide 179

12.2 IQFeed logging


IQFeed requests, messages and events (e.g. connections/disconnections), are logged in
IQFeed’s log. This is a text file called “IQConnect.txt” in the \DTN\IQFeed subfolder of
“My Documents”, e.g. C:\Users\<xyz>\Documents\DTN\IQFeed\IQConnectLog.txt
(replace <xyz> with the actual user name in your computer).
Using IQFeed’s Diagnostic Utility, which is installed as part of IQFeed’s client
installation, you can control the log file’s folder path (but not its IQConnectLog.txt
name, which is fixed), as well as the logged details:

Running IQML('log') without any parameters will return a Matlab struct containing the
current log settings (the struct fields are explained below):182
>> data = IQML('log')
data =
struct with fields:
logDetails: [1 0 0 0 0]
logFile: 'C:\Users\Yair\Documents\DTN\IQFeed\IQConnectLog.txt'
In addition to interactively using the Diagnostic Utility to modify the log file path and
logging details, you can also control them programmatically, via IQML’s 'log' action:
We can modify the log file’s folder path using the Path parameter, for example:
IQML('log', 'path','C:\My Programs\Logs\')
Note: Path sets the log file’s folder – not its name. As mentioned above, IQFeed’s log
file name is fixed (IQConnectLog.txt) and cannot be modified, only its folder can be
changed. As a safety measure, IQML will complain if the specified Path does not exist:
>> IQML('log', 'path','C:\No\Such\Folder')
Error using IQML
Bad log path specified: "C:\No\Such\Folder" is not an existing folder

182
Note: the IQML('log') feature uses IQFeed’s Windows registry. In Mac/Linux, IQML('log') will naturally work only when
Matlab runs under Parallels/Wine, not in native mode.
IQML User Guide 180

When setting the log Path, the IQML command will return a Matlab struct with the log’s
old filename (prior folder name and the fixed name IQConnect.txt). You can use this to
restore the original log path after temporarily redirecting logging to a different folder:
data = IQML('log', 'path',newPath);
oldPath = fileparts(data.logFile); % strip out the IQConnectLog.txt file name
... % logging in this section is temporarily redirected to newPath
IQML('log', 'path',oldPath); % restore the original log file's path
Note that changing the log file’s Path does not affect a currently-running IQFeed
session, only subsequent sessions (IQFeed’s IQConnect client reads the log Path
when it launches). If you need to modify the Path while IQFeed is running, you can
temporarily reconnect IQFeed (see §9.1) to ensure that it loads the new Path value.
Be careful when changing log Path. Its default location is set to the user’s MyDocs folder
since by default IQConnect.exe launches under the user’s permission group and all users
have full access rights to files in their user folder. Ensure that your user account has
appropriate permissions in the choosen folder. Also ensure that the folder is not synced
(to OneDrive, Dropbox etc.), which could drastically reduce system performance.
Also keep in mind that there is only one log file for all applications that use IQFeed
on the computer. If your program might run alongside other software that uses IQFeed,
it is recommended that you do not change the logging location from the default.
We can specify the logging details using the Details parameter, which accepts an array
of up to 5 numeric or logical values. These values correspond to Administrative,183
Level 1, Level 2, Lookup,184 and Debug.185 By default, IQFeed logs only Admin
requests and messages, which corresponds to Details=[1,0,0,0,0] or simply 1 (extra
zeros are assumed, so 1 means the same as [1,0,0] or [1,0,0,0,0]). For example, to also
log Level 1 and Lookup messages (but not Level 2 or Debug), set Details to [1,1,0,1]:
>> data = IQML('log', 'details',[1 1 0 1])
data =
struct with fields:
logDetails: [1 0 0 0 0]
logFile: 'C:\Users\Yair\Documents\DTN\IQFeed\IQConnectLog.txt'
In this example, note how IQML returned the previous Details setting, prior to its change.
A subsequent call to IQML('log') will verify that the Details change was indeed made:
>> data = IQML('log')
data =
struct with fields:
logDetails: [1 1 0 1 0]
logFile: 'C:\Users\Yair\Documents\DTN\IQFeed\IQConnectLog.txt'
Note: IQFeed’s log file can become VERY large VERY fast and potentially reduce
system performance if left unattended. It is intended to be used for troubleshooting
purposes only and not on a constant basis, and should be used very carefully. This is
especially true if you log streaming data, large historic data, and/or Debug data.
Also note that the logging level Details are stored in the computer’s registry and
persist across different sessions of Matlab and IQFeed. So after you have set detailed
logging and no longer need it, it is good practice to immediately set Details back to [1].

183
Admin includes connection/disconnection and other non-data requests and messages
184
Lookup includes history requests/data (§5), news (§7), and symbols/chains lookup (§8)
185
IQFeed’s Debug data provides even more granular logging to aid in troubleshooting issues than the other four log types. This
is not related to the Debug parameter that was discussed in §12.1.
IQML User Guide 181

Note that unlike Path (which does not affect a currently-running IQFeed session),
setting the logging Details DOES indeed affect the current session; no restart of the
IQFeed client is required for the new Details setting to take effect.
In addition to setting log Path and Details, we can also use the 'log' action for several
special requests: The CopyTo parameter copies the current log file into a specified
folder/path. We can also specify the filename, since it is just a copy of the live log file.
Note: if the specified target file already exists, it will be overwritten.
>> IQML('log', 'copyTo','C:\My Programs\Logs\log.txt'); % filename=log.txt
>> IQML('log', 'copyTo','C:\My Programs\Logs\'); % filename=IQConnectLog.txt

We can use the DoThis parameter to reset (empty) the live log file, or to display it in an
external editor (the editor displays a log snapshot, it does not automatically refresh):
>> IQML('log', 'doThis','reset'); % reset (empty) the live log file
>> IQML('log', 'doThis','display'); % display live log file in external editor

Note: Both CopyTo and DoThis only affect the log file at the time of the request, not
continuously. In other words, CopyTo copies a snapshot of the live log file as of the
time of request; DoThis 'reset' (or 'clear' or 'empty') does a one-time reset of the log;
and DoThis 'display' (or 'show') displays the current log file snapshot (the editor’s
refresh of this file is not automatic).
As with other IQML actions, we can combine different parameters in a single IQML
command. For example:
IQML('log', 'details',[1 1 0 1], 'path','C:\Programs\Logs\', 'doThis','reset');

Here is a summary of the IQML parameters that affect IQFeed’s internal logging:
Parameter Data type Default Description
(last-used log
folder path;
Path of the folder in which the IQConnect.txt
Path string initially set to
live log file is to be stored/updated.
My Documents\
\DTN\IQFeed)
(last-used log Array of up to 5 numeric/logical values,
details setting; corresponding to Admin, Level1, Level2,
numeric initially set to Lookup, and Debug requests/messages.
Details or logical [1,0,0,0,0] A value of 1 (or true) indicates that requests/
array meaning only messages belonging to the corresponding
Admin msgs group should be logged; a value of 0 (or false)
are logged) indicates that they should not be logged.
Path of folder or file in which a snapshot copy
''
CopyTo string of the live log file is to be placed, overwriting
(empty string)
existing file if such a file already exists.
One of the following string values:
''
DoThis string  'display' or 'show' – display the log file
(empty string)
 'reset' or 'clear' – empty the live log file
IQML User Guide 182

13 Frequently-asked questions (FAQ)

1. Can IQML be used with other data-feed providers?


IQML only connects to DTN IQFeed. It can be adapted for other data providers, but
some development is obviously required since other providers have different APIs.
Email us to see if we can help.
2. Does IQML impose limitations on historical data or streaming quotes?
No – IQML does not impose any limitations. However, IQFeed’s servers do impose
limitations on the frequency of the requests and the amount of returned data. These
limitations depend on your specific IQFeed subscription. For example, your account
might be limited to some maximum number concurrently-streaming (“watched”)
symbols. These limitations are imposed by the IQFeed server on your account; IQML
supports whatever entitlements your IQFeed account has, it does not limit the
information in any manner.
3. Can I see a demo of IQML?
Yes – you are welcome to download a fully-functional trial version of IQML, to try
the product at no risk for 30 days.
4. How does IQML compare to alternative products?
We believe that of all the currently available alternatives for connecting Matlab to
IQFeed, IQML provides by far the best functionality, value and cost-effectiveness.
You are most welcome to test this yourself, using IQML’s free trial. Several traders
have reviewed IQML and claim that it is the best Matlab-to-IQFeed connector.186
5. Does IQML come with an IQFeed or market subscription?
No – IQML connects to an existing IQFeed account. You will need to purchase the
IQFeed and market subscriptions separately from DTN.

6. Does IQML send you any information?


No – IQML only communicates with IQFeed. The only communication that is done
with IQML’s server is a verification of the license activation (a single hash-code).

7. How can I be sure IQML does not contain bugs that will affect my trades?
The product is rigorously tested, but there is no 100% guarantee. To date, nothing
major has been reported. IQML is rock solid - a very stable and robust product.
8. Is IQML being maintained? supported?
Yes, actively. Features and improvements are added on a regular basis, and we
support the users personally. You can see the list of ongoing improvements in
IQML’s change-log, listed in Appendix B of the IQML User Guide (this document).
You can see the very latest updates in the online version of this guide.187

186
https://UndocumentedMatlab.com/IQML/reviews
187
https://UndocumentedMatlab.com/files/IQML/IQML_User_Guide.pdf
IQML User Guide 183

9. I saw a nice new feature in the online User Guide – can I get it?
Once you install IQML, you will be notified in the Matlab console (Command Window)
whenever a new version is available. You can always update your installation to the
latest version, using a variety of means, as explained in §2.4.

10. What happens when the license term is over?


A short time before your license term is over, you will start to see a notification
message in your Matlab console (Command Window) alerting you about this:
*** Your IQML license will expire in 3 days (10-Mar-2018).
*** To extend your license please email info@undocumentedmatlab.com

This message will only appear during the initial connection to IQFeed, so it will not
affect your regular trading session. When the license term is over, IQML will stop
working. You can always renew or extend your license using the payment links on
https://UndocumentedMatlab.com/IQML. If you wish to be independent of such
annual renewals, you can select a discounted multi-year license. See §2.2 for details.

11. Can I transfer my IQML license to another computer?


Yes, simply email us and we will make the activation switch for you. At any one
time, each IQML license will only be activated on a single computer, unless you
purchase a site license. You can make up to 3 license activations per year at no extra
cost; additional switches will incur a handling fee.

12. I have a laptop and desktop – can I use IQML on both?


Yes, but you will need to purchase two separate IQML licenses. IQML’s license is
tied to a specific computer, unless you purchase a site license.

13. Can IQML be compiled and deployed?


Yes, IQML can be compiled using the Matlab Compiler. Each computer running a
compiled IQML requires an IQML license (just like a non-compiled IQML that runs
in Matlab), unless you get a group license (Site, Deployment, or Development). In
other words, for your deployed computers you have a choice of either buying indivi-
dual licenses (separately for each deployed computer), or a group license which does
not require dedicated license activations. If you wish to deploy IQML on a large scale
for multiple end-user computers, contact us to discuss OEM or other alternatives.

14. Is IQML provided in source-code format?


IQML is provided in encrypted binary form, like any other commercial software. A
source-code license is available for purchase, subject to signing a separate non-
disclosure (NDA) agreement. The source-code version has no license fees and is not
tied to any specific computer – you can install it on as many computers as you wish
within your organization. Contact us for details. Also see related question #15 below.
IQML User Guide 184

15. Do you provide an escrow for IQML’s source-code? Is the source code for sale?
Yes. There are two optional levels of escrow service that you can select:
1. At safe-keeping with a Wall-Street lawyer
2. Using NCC Group’s188 independent escrow service
Escrow services incur a non-negligible annual usage fee, but you may decide that it
may be worth the optional extra cost to ensure business continuity.
Alternatively, a source-code license is available for purchase, subject to a separate
non-disclosure (NDA) agreement. See related question #14 above.
Alternatively, purchasing a multi-year license will ensure independence of renewals,
and a site license will avoid external activation checks during the license duration.
Contact us for details about any of these optional alternatives.

16. Is feature ABC available in IQML?


IQML supports the entire IQFeed API. This means that all the functionality that
IQFeed exposes in its API, is available in IQML using an easy-to-use Matlab wrapper
function. In addition to parametric queries, users can send IQFeed custom API
commands (see §9.4) and then process the raw incoming IQFeed response (see §10).
To check whether a specific feature is available in the IQFeed API (and by extension,
in IQML), please refer to IQML’s User Guide (this document), IQFeed’s online
reference, or contact IQFeed customer service.
17. Can you add feature ABC in IQML for me?
We will be happy to do so, for a reasonable development fee that will be agreed with
you in advance. After the development, this feature will be available to all others who
purchase (or update) the latest version of IQML, at no extra cost. If you have such a
request, contact us by email to get a proposed quote.
18. Can you develop a trading strategy for me?
We will be happy to do so, for a reasonable development fee that will be agreed with
you in advance. Unlike development of IQML features, strategy development will
never be disclosed to others, and will not be integrated in IQML. It will be developed
privately for you, and will be kept secret. See §15 for details about our professional
services. If you have such a request, contact us by email to get a proposed quote.
19. Does IQML include back-testing/charting/data analysis/algo-trading?
No. IQML is only used for communication with the IQFeed server (retrieving data
from IQFeed servers) – it does not include any data analysis, charting or back-testing
functionalities. Matlab is a great platform for data analysis and visualization, so you
can easily develop your own analysis programs in Matlab, using the data from IQML.
We have extensive experience in developing complete backtesting and real-time
trading applications. We will be happy to either develop a new application based on
your specifications, or to integrate IQML into your existing application, under a
separate consulting contract. See §15 for details about our professional services.

188
http://nccgroup.com/en/our-services/software-escrow-and-verification/software-escrow
IQML User Guide 185

14 Troubleshooting
Error Description / solution Section
NullPointerException IQML cannot work properly unless its Java file
com.mathworks.jmi.bean.
MatlabBeanInterface.- (IQML.jar) is added to Matlab’s static Java §2.1
addCallback classpath. Contact us to solve the problem.
IQFeed is not properly IQFeed is not installed properly on the local
installed §2.1
computer so IQML cannot connect to it.
IQFeed cannot be
connected or started IQML cannot connect to an active (running)
or: IQFeed client process, nor start one. Try to start §2.1
Cannot connect to IQFeed’s client manually and then retry.
IQFeed
Some component of your activated computer
IQML is not activated
on this computer fingerprint has changed. Revert this change, or §2.2
contact us to modify the activated fingerprint.
Your IQML license will This is an alert on upcoming license expiration.
expire in 4 days It is not an error, and does not affect IQML’s §2.2
(15-Jun-2018) operation. Contact us to extend your license.
Your IQML license has IQML’s license is limited in duration. When the
expired on 1-Jun-2018 §2.2
license term expires, contact us to renew it.
Cannot connect to IQML validates its license on the IQML server.
undocumentedmatlab.com Your internet connection may be down, or the
to validate your IQML §2.2
domain (undocumentedmatlab.com) may be
license
blocked by your firewall (ask your IT to unblock it)
Action 'xyz' is not [yet] The specified action is not [yet] a valid IQML
supported §2.4
action, although it is planned for a future version.
Unrecognized IQML action The specified action is invalid in IQML. Refer to
'xyz' §3.1
the User Guide for a list of acceptable actions.
Missing parameter value: No value was provided for the specified parameter.
all parameters must have a IQML parameters must be specified as name-value §3.1
value pairs that have both name and value.
Value for parameter 'abc' The specified parameter value provided in your
should be a <xyz> data IQML command has an incorrect data type. Refer §3.1
type to the User Guide for a list of acceptable values.
The specified parameter value must be a single
Value for parameter 'abc'
should be a scalar number scalar value, not a numeric array. Refer to the User §3.1
Guide for a list of acceptable values.
Warning: 'abc' is not a The specified parameter name is not valid for the
valid parameter for the specified IQML action and is ignored. Refer to the §3.1
'xyz' action in IQML User Guide for a list of acceptable parameters.
The 'news' action is not The specified action is only available in the IQML
available in your Standard Professional license and free trial. Contact us to §3.4
license of IQML upgrade your license to access this feature.
Symbol 'XYZ' was not found
Either you have no permission to access this
Symbol, or this symbol is unknown by IQFeed. §3.4
IQML User Guide 186

Error Description / solution Section


(Missing digits in Matlab Matlab’s display format is possibly set to “short”
§3.4
Command Window) instead of “long”.
Undefined function An empty result was returned, and this cannot be
'struct2cell' for input §3.5
arguments of type 'double' converted into a Matlab cell-array.
Error using struct2table
(line 26) - S must be a An empty result was returned, and this cannot be
scalar structure, or a §3.5
converted into a Matlab table object.
structure array ...
The Symbol parameter must Queries that have NumOfEvents>0 must be
be specified for an XYZ §4, §6
query when NumOfEvents>0 specified with a non-empty Symbol/Symbols.
Warning: IQML timeout: The query took longer than expected to return all §4.1,
only partial data is the data; only partial results have arrived from §4.3,
returned. Perhaps the
Timeout parameter should IQFeed before the IQML timed-out. To get all §5.1,
be set to a value larger results, set the Timeout parameter to a larger value §7.2,
than 5 or the NumOfEvents parameter to a smaller value. §8.1
IQML timeout: either
IQFeed has no data for The query took longer than expected to return any
this query, or the Timeout data from IQFeed before IQML timed-out. §12.1
parameter should be set
to a value larger than 5
Try to set the Timeout parameter to a larger value.
Date parameter value must The date/time format of one or more of the query
be either a string
(YYYYMMDD, YYYY-MM-DD or parameters is incorrect. Refer to the User Guide §5
YYYY/MM/DD) or datenum for a description of the acceptable formats.
Symbol "XYZ" is not Start data streaming (by sending a query with
currently streaming NumOfEvents>0) before querying streamed data §6

(IQML stops receiving Try to actively disconnect and reconnect to


§9.1
IQFeed streaming data) IQFeed, or to restart the IQConnect application.
Unable to connect to L2IP IQConnect lost the connection to IQFeed’s servers.
server. Error Code: 10065
Error Msg: A socket
IQConnect will automatically reconnect as soon as
operation was attempted to possible, and in most cases you can ignore this §9.1
an unreachable host. message. You can also try to actively reconnect to
(or a similar variant) IQFeed, or to check your internet connection.
Out of memory This Matlab error might occur when receiving
or:
Maximum variable size huge amounts of streaming/historic data. Different
allowed by the program is Matlab releases display different messages having
exceeded §12.1
or: the same basic idea.
Requested array exceeds Run IQML on a computer with more memory,
maximum array size
preference or reduce the amount of stored/processed data.
Set Matlab to use a larger Java heap memory size
java.lang.OutOfMemory
Error: Java heap space
than the default value. This can be set in Matlab’s §12.1
preferences, or via a java.opts file.
IQML User Guide 187

15 Professional services
In addition to IQML being offered as an off-the-shelf software program, advanced
Matlab consulting, training, and program development are being offered. With close
to 30 years of professional Matlab programming experience, including extensive
finance/trading-related development in the past decade, we offer top-of-class Matlab
consulting, with a particular emphasis on the financial sector.

We have many years of experience integrating quality production-grade Matlab


programs with online brokers (Interactive Brokers (IB), CQG, CFH FIX), data-feed
providers (DTN IQFeed, Bloomberg, Reuters, Trading Physics, End-of-Day Historical
Data), websites (Finviz, Nasdaq), databases (SQL Server, Oracle, MySQL, SQLite),
as well as Excel and raw-format data files. Programs were developed using multiple
Matlab releases, on all platforms that Matlab supports: Windows, MacOS and Linux.

We have completed countless life-cycles of software requirements definition, design,


development, documentation, integration, testing, deployment, handover, maintenance
and support.

Much of our work derives from the financial sector: We developed custom software
for a commodities fund in a Geneva bank; a backtesting and analysis program for a
large bank in Chicago; a currencies trading program for a hedge-fund in Malta; data-
analysis products for financial services firms in New-York; a portfolio risk/exposure
analysis program for an Israeli investment advisor; a charting GUI for a San-
Francisco hedge fund; and semi- and fully-automated algo-trading programs for
multiple clients around the globe.

Development is typically done remotely; onsite consulting/development is also possible


upon request, or a combination of remote work and onsite visits.

You can see a small sample of programs that we have developed below. Additional
samples can be seen on our consulting webpage.189

Anything developed under private consulting will be kept confidential and will not be
disclosed to others. You will retain full IP ownership of anything developed for you.

Most of our revenue comes from returning or long-time clients. We will be happy to
provide references of satisfied clients in US or Europe. With such an impressive track
record, you probably already know some of them.

Contact us by email (info@UndocumentedMatlab.com) to discuss your needs or to


receive a proposal.

189
http://undocumentedmatlab.com/consulting
IQML User Guide 188

15.1 Sample program screenshots


IQML User Guide 189
IQML User Guide 190
IQML User Guide 191

15.2 About the author


With 30 years of professional software programming
experience, Yair Altman offers top-notch Matlab
consulting and training services.
Yair has worked extensively with Matlab and many other
programming languages (Java, C#, C, C++ and others).
He has developed many programs with SQL and a variety
of databases, operating systems and hardware platforms.
Matlab community developers, and even MathWorks themselves, consider Yair a top
Matlab expert, as any simple online search will show. His UndocumentedMatlab.com
website is by far the largest and most active independent Matlab site. Yair is also
well-known from numerous submissions on the Matlab forums and File Exchange; a
MathWorks study determined190 that Yair is the third most influential submitter in the
entire Matlab community. He regularly advises MathWorks, and is a member of both
its Community Advisory Board (CAB) and MATLAB Advisory Board (MAB).
Yair has a specific experience in the finance sector, developing quality professional
Matlab programs that integrate with trading platforms (IB, CQG, CFH FIX); data-
feed providers (DTN IQFeed, Bloomberg, Reuters, Trading Physics); websites (Finviz,
Nasdaq); databases (SQL Server, Oracle, MySQL, SQLite), as well as Excel and raw-
format data files. These programs were developed on multiple Matlab releases and all
Matlab-supported platforms: Windows, MacOS and Linux.
Yair published two extensive and highly-acclaimed Matlab
textbooks: MATLAB-Java programming191 (2011) and
Accelerating MATLAB Performance192 (2014). Both books
are considered the top references in their field.
Yair provides professional, cost
effective consulting and contract
development.193 He can do stuff
that few other Matlab program-
mers know is even possible,
delivering great value: top
quality code at reasonable cost.
Yair also offers custom Matlab
training courses,194 in a variety of topics and levels.
By combining a proven track-record of quality software
programming, decades of professional experience, and
Matlab knowledge that few others possess, Yair provides
clients with superior value and cost-effectiveness.
190
http://blogs.mathworks.com/community/2013/01/15/giving-by-taking-file-exchange-acknowledgment-trees
191
http://undocumentedmatlab.com/books/matlab-java
192
http://undocumentedmatlab.com/books/matlab-performance, now in 2nd edition
193
http://undocumentedmatlab.com/consulting
194
http://undocumentedmatlab.com/training
IQML User Guide 192

16 Spread the word!


Support IQML development by spreading the word about this product to coleagues.
The more people use IQML, the better it becomes over time with improved reliability,
functionality and performance. You will directly benefit from this since you get
immediate access to each new product version as it is published, as explained in §2.4.
The following professional traders have posted a public online review of IQML:195
“Simply put, IQML just works. Having struggled with Matlab’s data feed toolbox and many
frustrated support calls, I found the IQML product. What a night and day experience! Not
only does the product allow you to easily access the entire array of IQfeed’s utility as soon as
you download it, the documentation and support have been superior to the premium enterprise-
level systems that I have worked with in the past. If you use his IB-Matlab product, IQML is
the perfect companion. This is absolutely the gold standard for working with market data.”
– Albert Zhang, professional trader and partner, Auric Investments, USA
“Fantastic product that works flawlessly and has saved me a lot of work, time and money on
developing my trading systems! well done Yair!”
– Rodney Ngone, Data Scientist and Quant Trader, UK
“Yair has been doing a fantastic job implementing the IQfeed API for Matlab, a challenging
API which needed some thorough testing at the beginning (which I was part of, being one of
the first clients). The product has become mature and excellent for algo development for
traders who don’t mind to work in details. Many features are making IQML computationally
attractive and competitive with regards to other options. Mostly, Yair support is first class
and allows to digest the little subtleties of the IQfeed API. With Yair being supportive and
flexible in terms of improvements, updating IQML regularly to fix bugs and implement the
latest API features, I strongly recommend the use of IQML.”
– Pierre R., trading systems researcher, Australia
“We have been cooperating with Yair for 3 years now and he has always been professional
and efficient. Regarding in particular the IQFeed-Matlab interaction, he was able to deeply
understand our needs and to quickly consign us perfectly tuned codes, granting us the
possibility of exploiting the maximum potential of these two platforms combined.”
– Stefano Peron, Chief Investment Officer, Emergent Quant, Italy
“Before IQML, I spent an inordinate amount of time working on code to consistently retrieve
IQFeed data via Matlab, with limited success. IQML works flawlessly, allowing me to focus
on strategy development.”
– Jeff Busse, Emory University, USA
“It would surprise you how many systems out there are still legacy-like. They seem to work
with a few data-points as advertised, but once you want to scale up the whole thing you hit
the wall. And then comes IQML for Matlab: Works out of the box like a charm; uses parallel
execution; and with a few wrapper lines of Matlab code I can send the data I need to a
database. This enabled me to get my project stockmoneyflows.com up and running in a
fraction of the planned time. Yair has been very helpful and responds to requests very fast
and what is even more important, he fixes it!”
– Georgios Karas, owner, Stock Money Flows, Netherlands

195
https://UndocumentedMatlab.com/IQML/reviews
IQML User Guide 193

“I find IQML intuitive and easy to use. I really love your simple intuitive interface! ***
started to build something like this but stopped and left us with nothing (they have a lot more
adapters than they have documentation for but these are mostly non-functioning basic
connections to the third party softwares). IQML blends perfectly into my MATLAB
environment. I am getting 40 quotes per 10 ms using the real time method. The time and
careful consideration you spent on IQML’s development show clearly. I will definitely help
spread the word about your products!”
– Joe Galbraith, Director, Quantitative Asset Management, USA
“IQML, a robust and seamless interface between Matlab and DTN IQFeed’s realtime
financial market data, is the latest automated trading offering from Yair Altman. Yair is a
leading authority on Matlab and the author of two books devoted to Matlab’s technical
intricacies. His IB-Matlab software, which interfaces Matlab with Interactive Broker’s
trading and data platforms, has for many years earned the number one spot among client
reviewed third party software on Interactive Broker’s web site.
IQML builds upon the capacities of IB-Matlab by leveraging the more robust data feed of IQ-
Feed to meet institutional level trading expectations for financial market data coverage, low
latency, and easy reference. Having personally struggled with Matlab’s Datafeed Toolbox
and Trading Toolbox to the point I doubted Matlab’s viability as a trading platform, I have
been overjoyed to find that IB-Matlab and IQML provide the missing pieces of the puzzle.
The interfaces do not require any understanding of the associated API’s and do provide
intuitive and easy to understand Matlab commands and references to the Interactive Brokers
and IQ-Feed platforms. In addition to rock solid code performance, both products are
accompanied by robust documentation and Yair is available to personally tailor their
implementation to client needs. Well done, Mr. Altman!”
– David M., proprietary trading firm, USA
“IQML saved us hundreds of hours in “busy work”. It’s so well designed that it works every
time with the same simplicity and brilliance of execution. Our systems are fully automated
and very sophisticated and to get IQML working so quickly and simply, with such an easy
integration, is truly a gift. Yair is very smart and the most responsive engineer I have seen –
and I have seen a lot. Big companies should learn from Yair’s approach to design and
customer service.”
– Theo Koutras, Chief Investment Officer, OneBrain Technologies, USA
“This year my switch to use your IQML and IB-Matlab connectors was a milestone for my
work. It took me just two days to be fully productive with your connectors. No more messing
with technical details of IQFEED or IBKR for me, I can focus on the essentials. Thanks!”
– Pietro P., trader, Austria
“With IQML/IQFeed and IB-Matlab/Interactive-Brokers, you will be able to build a complete
trading tool from backtesting of the historical data to executing your trading strategies.
These connectors are robust and compatible with the Parallel Toolbox of Matlab. The full
integrated system will allow you to deal with large amounts of data. On top of that, Yair is
always keen to help and provide effective functional and technical support”.
– Jean-Claude H. and Mathieu L., algorithmic trading firm, France
“We first started using Yair’s Matlab-based finance add-ons a number of years ago and it
has been a huge benefit to our trading. Added to this, Yair is always quick to respond to
queries and provide helpful suggestions to assist us in solving any issues we encounter. I
cannot recommend his products and services more highly!”
– Brett Venter, principal, Neural Capital, UK
IQML User Guide 194

Appendix A – online resources


A.1 Official DTN IQFeed resources
 IQFeed homepage – http://iqfeed.net
 IQFeed API homepage – http://www.iqfeed.net/dev/api/docs
 IQFeed symbol guide –
http://iqfeed.net/symbolguide/index.cfm?symbolguide=guide&displayaction=support
&section=guide&web=iqfeed
 IQFeed symbol lookup –
http://iqfeed.net/symbolguide/index.cfm?symbolguide=lookup&displayaction=support
&section=guide&web=iqfeed
 IQFeed users forum – http://forums.iqfeed.net
 IQFeed live chat –
http://iqfeed.net/Fibonacci/index.cfm?displayaction=support&section=chat
 API customer service and technical support – support@iqfeed.net or
http://iqfeed.net/Fibonacci/index.cfm?displayaction=support&section=contact
(please let them know that you are using IQML)
A.2 MathWorks webinars/presentation
 MathWorks algorithmic-trading portal –
http://mathworks.com/discovery/algorithmic-trading.html,
http://mathworks.com/financial-services/algorithmic-trading.html
(includes Yair’s webinar “Real-Time Trading System in MATLAB”)
 Algorithmic Trading Strategies with MATLAB Examples –
https://mathworks.com/videos/algorithmic-trading-strategies-with-matlab-
examples-92899.html
 Energy Trading & Risk Management with MATLAB –
https://mathworks.com/videos/energy-trading-risk-management-with-matlab-
81745.html
 Cointegration and Pairs Trading with the Econometrics Toolbox –
https://mathworks.com/videos/cointegration-and-pairs-trading-with-econometrics-
toolbox-81799.html
 Commodities Trading with MATLAB –
https://mathworks.com/videos/commodities-trading-with-matlab-81986.html
 Creating professional-quality applications with MATLAB –
(Yair’s keynote presentation in the 2016 Munich MATLAB Expo using IQFeed)
https://undocumentedmatlab.com/blog/upcoming-public-matlab-presentations
A.3 Additional open-source Matlab resources
 Spatial Econometrics Toolbox for Matlab – http://spatial-econometrics.com
 Algorithmic trading code in the Matlab File Exchange –
http://www.mathworks.com/matlabcentral/fileexchange/?term=trading
IQML User Guide 195

Appendix B – change log


Cha ngelo g

The following table lists changes done to this document and IQML. Depending on the
date that you have installed IQML, your version may be missing some features
discussed in this document. You can always update to the latest version – see §2.4.

B.1 Complete change log (functional + documentation)


The table below lists both functional changes (in the IQML program) and also
documentation changes (in this User Guide). See §B.2 below for a table of only the
functional change.
* In this table the last column indicates change type: F=fix; I=improvement; D=documentation:
Version Date Section Description *
0.80 2017-10-17 - Beta integration of IQML in a user trading program I
1.00 2018-02-26 - First commercial release of IQML I
Enabled message-specific user callbacks;
1.01 2018-03-11 8.1 I
Added additional information to callback eventData
4.3.2 Clarified filtering meta-symbols such as 'BZRatings' D
1.02 2018-03-12 4.3.3 Added relevant symbols list in returned news story data I
7.1, 11 Clarified automatic connection re-establishment D
3.2 Enabled Symbol and Symbols as synonymous params I
4.1, 6.1 Improved ticks request logic & the returned data fields I
1.03 2018-03-19
Enabled requesting streaming ticks/quotes for multiple
6.1 I
symbols at once, in a single IQML command
Clarified that IQFeed client can run on Linux/Mac via
1, 2.1 D
Parallels/Wine, as well as natively on Windows/Mac
2.1 Added support for native Mac IQFeed client (untested) I
Added new MsgParsingLevel general parameter, for
3.2 I
improved callback run-time performance
5 MaxDataItems input parameter is renamed MaxItems F
Some result output fields renamed for consistency;
6.1 BufferSize input parameter is renamed MaxItems for F
consistency; clarified the documentation text
6.2 Added new streaming regional updates functionality I
1.04 2018-04-01 4.37 Moved the news functionality into a new chapter (§7) D
Added newline characters between separate paragraphs
7.3 I
in the reported news-story text, for better readability
Clarified that default Date is today; clarified that story
7.4 D
count also includes non-subscribed news sources
7.5 Added new streaming news functionality I
Renumbered chapters 7-12 as 8-13, to make room for
8-13 D
the new chapter (§7) on the news functionality (Pro)
8.2 Added new section on callback run-time performance D
10 Added timestamp and channel info to debug printouts I
A.2 Added an online MathWorks resource D
IQML User Guide 196

Version Date Section Description *


Added note that in some cases users may need/want to
2.1 D
specify the IQFeed connection Username, Password
Added new symbols and numeric market codes lookup
3.1, 8 I
functionality
3.2, 4.1
5, 7.2 Modified the default Timeout value from 3 to 5 [secs] F
3.5 Added new section on handling returned data format D
Clarified that micro-sec time resolution depends on the
1.05 2018-04-05 5.5 D
IQFeed client version, the market, and the security type
Added basic support for options-chain and futures-chain
8.2, 10.3 I
symbol lookup (better support is planned for next version)
Renumbered chapters 8-13 as 9-14, to make room for
9-14 D
the new chapter (§8) on the lookup functionality
Enabled specifying IQFeed Username and Password;
9.1 I
Added a 10-sec timeout on IQFeed connection attempts
9.3 Added extra port-specific stats when AddPortStats=1 I
1.06 2018-04-08 8.2 Added options/futures chain lookup functionality I
1.07 2018-04-10 9.1 Added info msgs on server connections/disconnections I
4.1, 6.1 Added the Symbol field to returned quotes data struct I
1.08 2018-04-11
10.4 Added usage example of realtime quotes user callback D
1.09 2018-04-16 6.3 Added Interval Bars functionality I
1.10 2018-05-04 2.4 Added example of update notification on a new version D
4.3, 6.4,
10.5
Added Market Depth (Level 2) functionality I
1.11 2018-05-16 Indicated that IQFeed server may possibly limit reported
6.3 interval bars depending on exchange, data subscriptions; D
Clarified that IntervalSize must be >1 for volume/ticks
3.4, 4.3,
Clarified that news, level 2 (market depth), alerts,
6.2, 6.4,
7, 8.2,
options/futures chain lookup, and regional updates are D
only available in the Professional license and free trial
1.12 2018-05-23 10.5, 12
12 Added alerts functionality I
Renumbered chapters 12-14 as 13-15, to make room
13-15 D
for a new chapter on the alerts functionality
Enabled auto-fetch of full story in news headlines query
7.2 I
(streaming/blocking) using GetStory parameter (Pro)
11-12 Switched between sections 11,12 in the User Guide D
1.13 2018-05-25 Enabled reporting the full news story (in addition to
11.2 I
headline) in news alerts using GetStory parameter
11.1, Added regional updates alert functionality (in addition
11.2
I
to news/quote/intervalbar alerts)
3.1 Fixed bug in accepting struct-based input parameters F
5.4 Clarified that IntervalSize must be >1 for vol/tick bars D
1.131 2018-05-28
6.2 Fixed typo in regional update action (should be 'regional') D
7.2 Fixed bug in news headlines functionality (Pro license) F
IQML User Guide 197

Version Date Section Description *


Enabled specifying multiple Symbols in a single
4.2 I
Fundamental-data query
Enabled specifying multiple Symbols in a single
1.14 2018-05-30 6.2 I
streaming Regional updates query
Enabled specifying multiple news headline ID values
7.3 I
in a single news story query (Pro license)
Cover Updated compatibility notice for Matlab release R2018b D
4.1, 6.1, Enabled querying snapshot (top of market) & streaming
14 data of multiple symbols at once, in a single IQML query
I
Fixed: querying multi-symbol fundamental data
4.2 F
sometimes returned empty results
Fixed: debug data was displayed when streaming queries
6.1-6.3 F
1.15 2018-07-08 were requested (now only displayed if Debug=1)
Enabled querying fundamental data of all symbols in an
8.2 I
options/futures chain at once, in a single IQML query
Enabled querying snapshot (top of market) data of
8.2 I
entire options/futures chain at once, in a single query
Fixed: IQML query during IQFeed connection
9.1 F
sometimes returned empty/error results
3.6 Added new section on general run-time performance D
1.16 2018-07-09 5 Improved performance (speed) of historical data queries I
10.2 Updated the section on callback-related performance D
Clarified that IQFeed limits ticks/interval data to 8 days
5.4, 5.5 D
during US trading hours, 180 calendar days outside them
Clarified that IQFeed allows up to 500 concurrently-
6.1 D
streaming symbols, unless you pay DTN for more symbols
Clarified that IntervalSize must be >1 for interval bars
1.17 2018-07-30 6.3 D
that use IntervalType = 'ticks' or 'volume'
Enabled retrieval and cancellation of streaming data for
6 I
multiple/all streamed symbols in a single IQML command
Clarified that option/future chain name might change
8.2 D
when corporate actions (such as splits) occur
3.1, 3.5 Added optional errorMsg output for IQML commands I
9.1 Fixed problem of duplicate fields during initial connection F
1.18 2018-08-03
Improved the reliability of a programmatic IQFeed
9.1 I
disconnect/reconnect
Added the RaiseErrorMsgs parameter to control
3.2, 12 I
whether IQFeed errors should raise a Matlab error
1.19 2018-08-06
4.1, 5.1, Message about partial data received due to Timeout is
7.2, 8.1 now a Matlab warning message, not an error message
F
Enabled requesting history data for multiple symbols in
5, 14 I
a single IQML command
1.20 2018-08-07
5.1, 5.4, Automatically convert BeginDateBeginDateTime,
5.5 EndDateEndDateTime (i.e. try to fix usage error)
I
IQML User Guide 198

Version Date Section Description *


8.1 Enabled looking up symbols by market(s), sec-type(s) I
1.21 2018-08-10 Clarified that IQFeed only enables lookup of active
(non-expired) options; a list of expired options is
8.2 D
available separately as a downloadable text file.
Enabled NearMonths values of 0-12, not just 0-4, for
8.2 options/futures chain. Note: this is based on undocumented I
1.22 2018-08-13
IQFeed functionality, so might not work in some cases.
3.2 etc. Limited the Timeout parameter values to 0-3000 [secs] I
Clarified regarding historical intervals data limitations;
5.4 Clarified that IQFeed’s interval data typically exclude D
1.23 2018-08-14 irregular “O” trades (see §5.5).
Fixed a problem of possible bad connection to IQFeed
9.1 F
during the initial connection by IQML
Limited the Timeout parameter values to 0-9000 [secs],
3.2 etc. F
with 0 indicating infinite (i.e. no-limit) timeout
Clarified that while IQFeed typically limits historic tick
5.5 data to 180 days (outside trading hours), extended (older) D
tick data can possibly be purchased from DTN
1.24 2018-08-31
Enabled NearMonths values of 0-99, not just 0-12, for
8.2 options/futures chain. Note: this is based on undocumented I
IQFeed functionality, so might not work in some cases.
Enabled multiple Matlab processes on the same computer
9.1 I
to run IQML concurrently (Beta)
IQML User Guide 199

Version Date Section Description *


This is a major update. Highlights: query parallelization
and multiple usability/functionality fixes/improvements
Enabled parallel processing of IQML commands within
(all) parfor/spmd blocks, and parallel internal processing via I
the UseParallel parameter (Professional license only)
2 Added the license type to the output of IQML('version') I
3.1 Clarified the actions available in Pro vs. non-Pro license D
3.5 All returned data arrays are now column vectors F
Using the 2nd (optional) output of IQML (errorMsgs)
3.5
now implies a default value of false for RaiseErrorMsgs I
3.5, Fixed various typos in code snippets, that would have
8.2-8.7 resulted in errors or bad data if used as-is
D
4 Modified reported data format when NumOfEvents >1 I
Issued a warning when requesting more symbol quotes
2.00 2018-09-05 4.1, 8.2 than your IQFeed account limit I
(major 4.3 Added new section on blocking interval bars functionality I
update) 4.3, 5.4, Clarified that IntervalSize must be ≥100 for volume
6.3 bars (a new limitation of IQFeed)
I
4.3, 5, Enabled specifying dates and date-times using Matlab
6.3, 7.4 datetime objects (in addition to datenums and strings)
I
4.34.4 Moved the blocking market-depth section to §4.4 D
5.1, 5.4, Clarified that MaxItems has precedence over BeginDate
D
5.5 /Time when more data items are available than MaxItems
5.4, 5.5 Clarified that in IQFeed and IQML, 'ticks' = 'trades' D
6 Added Symbol field to returned streaming data struct I
Story count for symbols that have no related news story
is reported as 0 (such symbols were previously skipped) I
7.4
Added Exchanges, ServerVersion, ServiceType fields to
9.3 I
the returned client stats data
11 Fixed various issues with the Alerts functionality F
11.2 Reorganized & clarified the Alerts Configuration section D
Clarified that IntervalSize must be < 86400 for secs
4.3, 5.4,
bars (a new limitation of IQFeed); added warning when I
6.3
user attempts to use an invalid IntervalSize value.
Clarified that streaming/latest interval bars are subject to
4.3, 6.3 D
2.02 2018-09-13 the same limitations as those imposed on historical bars
Clarified that full-minute interval bars are excempt from
the 8/180-day limitation imposed by IQFeed’s servers D
5.4
Added detection & report for a case of a non-
9.1
communicative background IQConnect process I
Fixed a problem with the license check that caused
2.03 2018-09-30 9.1
IQFeed disconnections F
5 Improved download speed of historical data queries I
2.04 2018-10-02 6, 7.5, LatestEventTimestamp is now reported in seconds (not
9.2 msecs) resolution by default, unless Debug is 1 or true
F
IQML User Guide 200

Version Date Section Description *


2.05 2018-10-13 4.1, 6.1 Added Fields parameter to enable dynamic fields-set I
4.1 Added some clarifications on the new Fields parameter D
2.06 2018-10-15
6.1 Minor fixes, performance speedup of streaming quotes F
3.4 Minor text clarifications; added timestamp examples D
4.3, 5.4, Clarified that IQFeed’s limitations on live 'secs' interval
D
6.3 bars are stricter than limitations on historical intervals
Enabled using MaxDays as synonym for the Days
5.4
parameter in historic interval queries I
2.07 2018-10-21
Fixed a problem with the license validation that
9.1
prevented connection in certain cases F
Fixed a few small edge-cases with sending custom
9.4
commands to IQFeed F
3.6 Added clarifications on the use of query parallelization D
5.1, 5.4, Enabled parallelized historic data queries (daily/interval/
2.08 2018-10-28
5.5 ticks) that have date/time range (Professional license only)
I
A.1 Added IQFeed’s users forum to list of online resources D
3.1 Fixed a bug in parsing input parameters in struct format F
2.09 2018-11-07 Added explanation on how to use a customized Fields
3.6 D
parameter to improve the query speed of market quotes
Added ability to revert back to the previous IQML
2.4 I
version at any time.
Added a table listing all the available quote data fields
4.1 D
(customizable via the Fields parameter)
Added description fields for the Bid_Market_Center,
4.1 Ask_Market_Center and Last_Market_Center fields, I
when reported in a quotes message from IQFeed.
2.10 2018-11-14 Added a new 'Greeks' action, to calculate Greeks, fair
4.5 value price and implied volatility for options I
(Professional license only)
Clarified that DTN limits historical data retrieval in
5.1 IQFeed’s trial account. Historical data queries in such D
accounts may yield fewer data points than requested.
Clarified that tick (update/quote) messages are streamed
6.1 D
whenever any of the requested Fields gets updated.
DaysPerYear parameter was renamed AnnualFactor;
Duration parameter was renamed DaysToExpiration;
Vega, Rho, Veta, Ultima are no longer divided by 100
(compatibility with Matlab Financial Toolbox, Maple &
NAG); minor fix for Veta (negative value);
2.11 2018-11-22 4.5 F
Added new fields in the reported data struct: Omega +
Lambda (synonyms), CRho, Color, Annual_Factor_Used.
Clarified differences of IQML’s Greek values vs.
Matlab’s Trading Toolbox, NAG, and Maple.
Added a table explaining all the reported Greek values.
IQML User Guide 201

Version Date Section Description *


2.2 Added cross-check for IB-Matlab connector I
2.2 Clarified some license variants; mentioned IB-Matlab bundle D
Added a new 'revert' action, to revert back to a
2.4 I
previous IQML version
2.12 2019-01-16 Fixed: display this User Guide using IQML('doc') even
3.1 F
when the document is not on the Matlab path
Clarified that Greek Vomma is sometimes called Volga;
4.5 D
minor clarifications regarding the foreign (carry) rate.
6.2 Clarified the functionality of streaming regional updates D
Clarified that https://UndocumentedMatlab.com/IQML
2, etc. can be used interchangably with http://iqml.net for any D
IQML document or file resource
Updated licensing alternatives (short-term, bundle);
2.1 D
mentioned option of using the Matlab pathtool command
2.2 Updated and clarified the license reactivation process D
Clarified that IQML’s timestamp data fields use either
3.4 D
2.13 2019-02-28 local or New York time, not the exchange time
3.6, 4.5 Clarified documentation, improved readability D
Added the ClearBuffer parameter for streaming data;
I
6.1-6.3 fixed bug with streaming data when NumOfEvents=inf;
F
fixed the documentation of NumOfEvents default value
Clarified that the streaming market depth mechanism
6.4 D
does not store an internal buffer of quote updates
13.15 Clarified FAQ #15 on business continuity alternatives D
3.1 Fixed a problem specifying parameters via Matlab table F
Added ability to specify parameters using Matlab class
3.1 I
object properties, similar to struct fields
Removed misleading reference to struct array (only a
3.1 D
scalar struct is currently supported, not a struct array)
Invalid parameter names are now ignored (a warning is
3.1, 14 F
2.14 2019-03-14 displayed), rather than raising a Matlab error/exception
3.4 Clarified IQFeed’s sensitivity to valid symbol names D
4.1 etc. Improved handling of multi-symbol queries F
4-7, Symbols, Fields, and news Sources can now be separated
11.1
I
by ':' or ',' (for example, 'IBM:HP' or 'IBM,HP')
Clarified that the TST$Y symbol can be used to test the
6.1 D
streaming data functionality outside trading hours
IQML User Guide 202

Version Date Section Description *


Made all the internal cross-references (e.g. “§4.1”) in the
General D
User Guide linkable, for easier navigation/referencing
Clarified that a reported Bid/Ask Time of 99:99:99 may
4.1 indicate an invalidated quote after extended trading hours; D
IQFeed renamed ‘Last Trade Date’ field  ‘Last Date’
Clarified that IQFeed limits the historic data provided
5.1 - 5.5 D
to its trial accounts vs. regular IQFeed accounts
2.15 2019-03-24 7.2 Clarified IQFeed only stores news items of past 180 days D
Split chapter 12 into two sections: IQML messages (12.1),
12 D
IQFeed logging (12.2)
Added display of a few types of IQFeed system messages
12.1 I
(excluding the periodic stats messages) in Debug mode
12.2 Added programmatic control of IQFeed logging I
B.2 Added new section listing just functional IQML changes D
Added the ability to specify BeginDate for historic
2.16 2019-04-17 5.2, 5.3 I
weekly/monthly data requests, in addition to MaxItems
Added clarifications on possible causes of run-time error;
3.4, 5.4 Display an explanatory message upon an IQFeed I
account authorization error
4.1, 4.3, Clarified warning message in case of partial results
5.1, 7.2, returned due to timeout, by including a suggestion to I
8.1, 14 decrease NumOfEvents parameter value, when relevant
4.2 Clarified splits data aspects in Fundamental info reports D
Added support for equity Level 2 data (in addition to
futures Level 2 which was already supported); Added ID
fields to all returned Level 2 data (futures and equities);
changed default NumOfEvents from inf to 10; IQML
4.4, 6.4 I
now connects to IQFeed L2 servers only as needed, not in
2.17 2019-05-07 startup; Issue error message for each separate failure to
access L2 data, not just during initial connection
attempt; Added the IncludeEmptyQuotes parameter
Clarified that daily/weekly/monthly interval data is
5.4 D
available for the past 15+ years (except in IQFeed trial)
Fixed parallelization when only one of BeginDateTime/
5.4, 5.5 F
EndDateTime is specified but not the other
Clarified that there is no EndDateTime parameter for
6.3 D
streaming interval bars, unlike for historic bars (§5.4)
Improved behavior for users with multiple IQFeed
accounts using the Username/Password parameters;
9.1 I
Improved startup speed in case of multiple connects/
disconnects during the day
IQML User Guide 203

Version Date Section Description *


Clarified that on Mac/Linux, while Matlab and IQML
1, 2.1 can indeed run in native mode, some features (§9.5 etc.) D
are only available if Matlab runs under Parallels/Wine
Added an informative alert when another process is
9.1
using one of IQFeed’s expected connection ports I
2.18 2019-05-14
Added the 'registry' action and functionality, to enable
3.1, 9.5
convenient access to IQFeed’s registry settings I
Clarified that IQML('log') uses the Windows registry, so
12.2 D
will not work if Matlab runs in Mac/Linux native mode
Cover Updated compatibility of supported Matlab releases D
Added an online HTML version of this User Guide:
- http://UndocumentedMatlab.com/files/IQML/IQML_User_Guide
D
Added functionSignatures.json file for easier IQML
-
usage in Live Editor I
- Fixed compatibility issue with Matlab R2008a - R2012b F
Added 'summary' action and functionality, to fetch his-
toric end-of-day market summary (Professional license) I
3.1, 5.6

Improved query responsivity in case of IQFeed error;


4 improved performance of single-symbol queries I
Support for IQFeed client 6.1: new optional Fields (Most
4.1 I
Recent Trade Aggressor, Most Recent Trade Day Code)
Support IQFeed client 6.1: new fundamental data fields
2.19 2019-07-07 (Session_Open_Time, Session_Close_Time, Base_Currency,
4.2 Contract_Size, Contract_Months, Minimum_Tick_Size, I
FIGI, First_Delivery_Date, and Security_SubType).
Added a table describing all the available data fields.
Included today’s partial daily trading data in day/week/
5.1-5.3 I
month history queries, in IQFeed client 6.1 or newer.
Added LabelAtBeginning parameter for historic interval
data queries (requires IQFeed client version 6 or newer) I
5.4

Clarified that sub-daily data may report data from non-


trading days (e.g. Sunday night, when ES starts trading) D
5.4

Clarified that when using ClearBuffer, some streaming


6.1-6.3
data events may be lost D
8.2 Default value for IncludeBinary parameter is now false F
9.1 Added Protocol parameter to customize initial connection I
4.2 Added example of new data fields in IQFeed client 6.1 D
Added the ReportEmptyFields, Filter parameters and
functionality (scanning based on multiple filter criteria) I
5.6
2.20 2019-07-10
8.2 Fixed the description of the IncludeBinary parameter D
9.1 Improved IQConnect startup on Linux/Mac via wine I
IQML User Guide 204

Version Date Section Description *


Enabled fetching latest (current) market summary/scanner
4.6
via a 'summary' query (Professional license) I
5.2, 5.3 Clarified the latest bar has today’s data only in IQFeed 6.1+ D
2.21 2019-07-14
Moved most of the 'summary' query description to §4.6
and clarified the text; left only the history aspects in §5.6 D
5.6

5.6 Default Date parameter value changed (yesterdaynow) F


Fixed bug that caused a “Duplicate field name Reserved”
- error for some queries on some Matlab releases F
Added reference to §10.2 for suggested ways to speed-
3.6 D
up callback processing overhead on data fetches
2.22 2019-07-17 4.2 Added Underlying_Contract field for continuous futures I
Fixed bug in change % fields of 'top' scanner queries;
4.6 F
reordered 'top' results volume fields for better readability
Added information on the client stats port fields and the
9.3 D
importance of KBsQueued field for runtime performance
Improved collection of parallelized results, in case
- F
some of the results returned an error or empty data
4.2 Clarified that Common_Shares_Outstanding is in thousands D
2.23 2019-09-18
4.3 Added UseParallel parameter feature to IntervalBars I
Fixed the implementation of MaxItems=-1, due to an
5 F
IQFeed API behavior change
- Increased processing speed & streaming data throughput I
5.5 Added TradeAggressor, DayOfMonth tick fields (IQFeed 6.1+) I
8.* Fixed duplicate lookup entries after an IQML reconnect F
Indicated that IQFeed has an internal bug that prevents
8.1 D
2.24 2019-10-05 searching for symbols with SIC/NAICS < 10
Indicated that IQFeed has an internal bug that does not
8.5, 8.6 D
report some SIC and NAICS codes
9.4 Enabled multiple custom commands in each IQML query I
12.2 Clarified the usage of redirecting IQFeed log file Path D
- Clarified a few error messages F
2.25 2019-10-06 5.* Fixed bug in historic data introduced in release 2.24 F
9.1 Improved detection of port conflicts with other programs I
2.1 Improved reporting of missing program components I
Fixed bug when multiple symbols are queried together
4.* F
and some symbols have no data (e.g., bad ticker)
Fixed bug of not distinguishing between symbols with
4.*
2.26 2019-10-26 '.' and '-' (e.g., AGM.A, AGM-A) when both are queried F
4.2 Improved fundamental data query using caching I
4.5 Automatically infer UnderlyingSymbol for future option I
4.*, 5.* Small performance speedup of multi-symbol queries I
IQML User Guide 205

Version Date Section Description *


Cover Updated compatibility notice for Matlab release R2020a D
2.1 Improved reporting of a missing IQFeed installation I
Added display of extra clarification messages upon
successful completion of IQML version update or revert I
2.4

Added Exchange_Description field if Exchange_Id field


4.1 I
is reported by IQFeed and MsgParsingLevel=2
2.27 2019-11-08 4.1, 4.2 Fixed bug in Exchange_Description of some exchanges F
Improved auto-infer of UnderlyingSymbol for options;
4.5
added Underlying_Asset_Name field to the returned data I
Added clarifications on filtering parameters limitations;
8.2 Added warning when trying to use the Years parameter I
in an index/equity chain query
9.1 Improved detection of port conflicts with other programs I
Fixed activation issue with compiled IQML on some
2.28 2019-11-09 2.2 F
deployed computers (requires reactivation)
Clarified activation error messages in deployed programs;
2.2 Improved activation resiliency to short network hickups I
and MacOS-induced hostname changes
Skip version update check in deployed (compiled) envs I
2.4
2.29 2019-11-21 Improved processing speed of quotes queries having a
4.1 I
Fields parameter
Added SIC and NAICS sector classification data in
4.2 I
fundamental data queries
9.1 Improved detection of port conflicts with other programs I
4.2 Improved processing speed of fundamental data queries I
4.5 Improved resiliency of Greeks query to some data errors I
Clarified that Greeks data are subject to the most recent
4.5 setting of the Fields parameter value; Clarified cases in D
which IQML cannot auto-infer the UnderlyingSymbol
5.* Improved processing speed of all historic data queries I
8.1 Improved processing speed of symbol lookup queries I
2.30 2019-12-08 8.2 Clarified that returned chain quotes data is subject to
the most recent setting of the Fields parameter value D
9.3 Fixed an edge-case problem with some client stats queries F
Added support for 'regional' data type in alert Trigger;
Added support for 'contains' operator in all alert types;
11.2
Added warning when user requests a trigger field that I
is not included in the latest setting of the quotes Fields
Clarified on setting email alerts from a Google account
11.2 D
and on potential clashes with antivirus/firewall
IQML User Guide 206

Version Date Section Description *


*.* Fixed incompatibility of Matlab releases R2009a or older F
4.2 Fixed a bug in parsing of reported date fields F
2.31 2019-12-12
Added UseImpliedVolatility optional Greeks parameter;
4.5
Added Volatility_Used_By_Greeks field to reported data I
5.* Fixed bug in parsing of reported history Datestamp field F
2.311 2019-12-13
7.2 Fixed bug parsing reported news Timestamp field (Pro) F
2.4 Modified the hyperlinks in the new-version message F
Fixed bug in accumulating multiple quotes when some
4.1
2.32 2019-12-16 fields data is missing/empty in some quotes but not others F
5.* Improved processing speed of all historic data queries I
13 Clarified a few FAQ sections D
Added explanation about IQML’s automatic merging of
3.5
results for queries of multiple symbols (where relevant) D
Displayed warning message when Greeks are requested
4.5
for expired contracts or with contracts with missing data I
4.6 Identified casses of missing summary data from IQFeed I
2.33 2019-12-31
Clarified that BeginDateTime/EndDateTime have
5.4, 5.5 precedence over (override) Days parameter; displayed a I
warning message when trying to use Days in such cases
Clarified the warning message when querying a chain
8.2 I
with DataType='options' and non-default Years
2.2 Minor text clarifications on short and long-term licenses D
Fixed bug in parsing the am time in a BeginDateTime
4.3 F
parameter that is specified in numeric format
Clarified that a real-time IQFeed data subscription is
2.34 2020-01-16 6.* needed for true live streaming quotes, otherwise IQFeed D
delays the streamed data by 10+ minutes
Added MaxUpdateDuration parameter for streaming
6.3 I
intervalbars queries
16 Added new “Spread the word!” section D
2.35 2020-02-05 9.1 Fixed connection conflict with IQFeed’s Excel connector F
Set Timeout to minimum 60 secs for GetStory queries;
7.2 Mentioned that IQFeed has an undocumented limit of F
2.36 2020-03-06 only up to 4000 news headlines per query (Pro).
7.3 Report only unique symbols in a news story query (Pro) F
When an invalid parameter is specified, a list of all valid
3.1
action parameters is displayed in the warning message I
2.37 2020-03-30 7.2 Improved performance of news headlines query (Pro) I
Improved reporting of errors in user-specified callback
10.1 I
function for an IQFeed message event
IQML User Guide 207

Version Date Section Description *


Improved UseParallel robustness in some scenarios /
*.* F
edge-cases (Professional license)
6.1 Clarified the streaming quotes mechanism explanation D
2.38 2020-04-14
Removed IB-Matlab connector cross-check in deployed
2.2 I
programs
7.2 Avoided error when IQFeed sends empty news headlines F
Added informative message when the user specifies an
*.* I
invalid Symbol format
Fixed bug when using custom Fields in UseParallel
2.39 2020-04-16 4.1 F
mode for multiple Symbols
IQConnect’s Diagnostics utility now displays IQML
9.3 I
version and parallel workers in its Client Stats tab
Fixed: enabled "symbol" in addition to 'symbol' in the
*.* F
Symbol parameter (broken in version 2.39)
Explained how using the new Fields parameter in
3.6 D
history queries can speed up run-time processing
Fixed bad results from parallel quotes query of
2.40 2020-04-20 4.1 F
duplicate symbols
Added Fields parameter to history queries for improved
5.1-5.5 I
processing speed and memory usage (Pro license)
Fixed error when parallel historic query of multiple
5.1-5.5 F
symbols returns non-matching data sizes
Detect & handle case of a missing 'Symbol' parameter,
3.4 F
e.g. IQML('quotes','IBM')
Clarified that Bid/Ask fields in returned quotes data are
4.1
typically NBBO (National Best Bid and Offer) quotes D
5.1-5.5 Improved performance of history queries I
Improved speed of IQML commands that start streaming;
2.41 2020-05-03 6.* Added AssignTo parameter to enable assigning stream I
data to base Matlab workspace variables with live update
6.2 Fixed a bug in fetching streaming Regional quotes F
Added BarTypeCode, EventDatenum, EventTimestamp fields to
6.3
intervalbars data; expanded and clarified documentation I
Faster initial connection to IQFeed; Added extra debug
9.1
printouts to assist diagnosing IQFeed connection issues I
4.2 Fixed bug in fundamental data query F
2.42 2020-05-04
5.1-5.5 Fixed bug in history query of multiple symbols at once F
When IQFeed has no history data for a query, IQML
5.1-5.5 F
now returns [], not a 'NO_DATA' error
2.43 2020-05-10
9.1 Fixed bug when disconnecting a non-connected IQFeed F
9.1 Faster initial connection to IQFeed (cached lookups etc.) I
IQML User Guide 208

Version Date Section Description *


3.6 Expanded documentation on parallelization (Pro license) D
5.1-5.5 Fixed empty results in some parallel history queries (Pro) F
2.44 2020-06-05 7.2 Fixed a few edge-cases with news headlines query (Pro) F
Explained how to differentiate between delayed and
9.3 D
real-time subscriptions in the results of IQML('stats')
Cover Updated compatibility notice for Matlab release R2020b D
5.1, 5.4, Added input parameter checks: BeginDate < EndDate,
5.5 BeginDateTime < EndDateTime I
8.* Fixed duplicate lookup entries reported by IQFeed F
Speedup of symbols lookup; enabled searching all
2.45 2020-06-23 8.1
symbols (empty Name parameter) per Market/SecType I
Added reference to listed market’s time-zone and delay
8.3
amount information based on a DTN ProphetX webpage D
Differentiated between modified functionality (Fixes)
B.1
and new functionality (Improvements) in the change-log D
Fixed single-day history query (BeginDate=EndDate),
5.1 F
broken in version 2.45
2.46 2020-06-30
5.1-5.5 Added the Progress input parameter to history queries I
8.3-8.7 Added the ID filtering parameter to lookup queries I
Fixed occasional errors during the initial connection of
3.6 F
parallel workers to IQFeed (Professional license)
3.6 Clarified the issue of maximal parallel pool size D
Clarified the effects of IQFeed’s log file on run-time
3.6, 12.2 D
performance, and ways to mitigate these effects
Added Fiscal_Year_End_Description field to the
4.2 fundamental data results – a textual description of the I
numeric Fiscal_Year_End field
Clarified that the Short_Interest field carries valid
4.2 D
information values only for some exchanges/sec-types.
2.47 2020-11-29 Clarified that some rare tick types (basis codes) are not
5.5 D
reported by IQFeed
Clarified error message when market summary data is
5.6 F
unavailable (Professional license)
5.6 Clarified that summary data is only available for trading days D
Improved the performance of fetching streaming quotes
6.* I
during live (real-time) streaming
Handled cases of IQFeed server error when requesting
8.2 F
options chain (Professional license)
Fixed error in case the IQFeed client has not yet set a
12.2
logging-level registry value F
IQML User Guide 209

Version Date Section Description *


*.* Fixed bug when trying to display PDF docs on MacOS F
Fixed edge-case when retrieving data in parallel with
*.* the UseParallel parameter (Professional license) F
3.6, 4.1, Added MaxWorkers input parameter to limit the
4.3, 4.5,
number of active parallel workers when using the I
2.48 2020-12-02 5.1-5.5,
UseParallel parameter for parallel queries (Pro license)
7.2, 8.2
Increased default maximal number of parallel workers
5.1-5.5
in parallelized history queries from 1415 (Pro license) F
Fixed bug in filtering numeric summary data when
5.6
MsgParsingLevel = 0 (Professional license) F
Added new OutputFormat parameter to enable easy
3.2, 3.5
reporting of results in cell/struct/table/timetable formats I
Clarified that IQFeed changed its throttling mechanism
3.6, of historical data queries in Dec. 2020 to 50 queries/sec.
5.1-5.5 To avoid the new limit and a throttling error, use Max- D
Workers param to limit the number of parallel workers.
Clarified the calculation that IQFeed uses for the
2.49 2021-01-03 4.2
Historic Volatility field in Fundamental data queries D
Fixed certain problems with parallel download of
5.1-5.5 F
historic data (Pro license)
Clarified that IQFeed provides static downloadable text
5.6, 8.2 files for both expired IEOPTION contracts and delisted D
EQUITY symbols
12.1 Added display of context information in run-time errors I
4.6 Added reference link for 'top' summary data D
8.1 Fixed symbols lookup query with empty/unspecified
Name filter parameter F
8.1 Added new Progress parameter to display lookup query
progress (same as in history queries) I
2.50 2021-01-24
Added ability to filter symbols lookup query by Market
group (e.g. 'NYSE') not just specific market names/ids I
8.1

Fixed: chain symbols query did not report some equity


options unless NearMonths param was set (Pro license) F
8.2
Fixed a problem with news query without a Symbol
7.*
filter due to a DTN server-side change (Pro license) F
Added Datenum field to news headlines query;
7.2
Fixed Timestamp field to standard format (Pro license) I
2.51 2021-02-03
Auto-reconnect IQML to IQFeed when IQConnect is
9.1
not communicating for a long time I
Added Datenum, Timestamp, TotalMsgsRcv fields to
9.3 I
client stats data
IQML User Guide 210

Version Date Section Description *


Added support for new IQFeed client 6.2, including
new Level 2 functionality (Market-by-price/order);
Added BidSizeRatio, AskSizeRatio fields to results; I
4.4, 6.4
Added Detailed, MaxLevels parameters. (Pro license)
Fetch previous day's summary data if data for requested
4.6 I
date is unavailable (Pro license)
2.52 2021-02-23 Handled edge case of news headlines that are reported
7.2
with missing/invalid timestamp F
Avoid repeated attempts to launch the IQFeed client on
9.1
startup, in case it is not detected in the expected location F
Added alert in case the installed IQFeed client appears
9.1
to be older than the latest available stable IQFeed client I
9.1, 9.5 Added support for IQFeed client 6.2’s new registry hive I
Added new OverflowMode, MaxEventsBacklog
3.6, 6.1 I
parameters for message overflow handling
4.1 Sorted the fields table by alphabetical field-name order D
Improved support for new IQFeed client 6.2 Level 2
4.4, 6.4
functionality; added market-maker description (Pro license) I
2.53 2021-04-06 Added description fields for Exchange/Markets/SIC/
4.6 I
NAICS codes in summary query results (Pro license)
Clarified that IQFeed does not report some trade types
5.5
as separate tick events, and just updates TotalVolume D
9.3 Added messages overflow data to reported client stats I
11 Fixed: alert ID was not properly returned in alert queries F
4.5 Fixed: implied volatility was sometimes reported as ±inf F
Added EndDate parameter for weekly/monthly history
5.2, 5.3 I
2.54 2021-05-03 queries, as in daily/interval history queries
Fixed some BeginDate/EndDate/MaxItems parameter
5.1-5.4 F
inconsistencies in history queries
Added Filepath field to the output of IQML('version') I
2.1
4.6 Clarified some aspects about the data staleness D
2.55 2021-05-10
5.1-5.4 Fixed issue of empty data reported when MaxItems = -1 F
9.1 Added Timeout parameter to IQML('reconnect') actions I
Fixed occasional “corrupt P-file” errors in parallel
*.* F
setups (Pro license)
Automatically disconnect from IQFeed when installing
2.4 I
2.56 2021-06-23 an IQML update
Fixed: summary data query sometimes reported
4.6 F
missing data (Pro license)
12.1 Simplified error message in case of IQML run-time error I
IQML User Guide 211

Version Date Section Description *


Fixed: Timeout parameter was not used by news story
7.2 F
queries when GetStory=true (Pro license)
Fixed edge cases of some news stories reported as
7.3 F
errors by IQFeed client version 6.1 (Pro license)
Added URL field to reported news stories, if a URL is
2.57 2021-07-11 7.3 I
detected in the story text (Pro license)
Improved performance (reduced run-time) of news
7.* I
story queries, especially story texts (Pro license)
Removed some harmless warning messages when
9.1 I
connecting IQML to IQConnect in certain cases
Replaced all references to iqml.net with
*.*
undocumentedmatlab.com F
Clarified difference between “Last”, “Most recent trade”.
4.1
See http://forums.dtn.com/?page=topic&topicID=5906 D
4.4 Fixed duplicate section number 4.4.2 D
Fixed display of the market-maker description in
4.4
MarketDepth (Level2) queries (Pro license) F
2.58 2021-11-21 Clarified warning when requesting streaming quotes for
6.1
more symbols than IQFeed allows I
Added display of client and protocol versions in
9.1 connection success message I
Handled unsolicited changes of MacBookPro computer
9.1
name by MacOS, affecting IQML's activation I
Added NumOfAvailableSymbols, ProtocolInUse,
9.3
IQFeedAccountExpiryDate fields to client stats data
I
Added 'validate' action: returns true if IQML license is
2.2
ok, and an error (or an error message) if it is not. I

4.3, 5.*, Added support for additional formats of date parameters,


I
2.59 2021-12-14 6.3 such as '21/11/15', 'Nov 15', '15-Nov-2021'
4.5, 8.2 Fixed incorrect reference to quotes query section (4.1) D
Fixed: News headlines request returned partial results
7.2 on Matlab R2021b (Pro license) F
Added the reported field names column to the fields
4.1 D
table; added the auto-generated description fields
4.3, 5.*, Fixed bug in parsing default BeginDate parameter value;
F
2.60 2021-12-31 6.3 Improved reporting of invalid date/time parameter values
Added settable Fields parameter to option chains query
8.2 (Pro license); Clarified that requesting options quotes I
data requires a corresponding DTN data subscription
IQML User Guide 212

Version Date Section Description *


Fixed IQML activation problem on a Matlab pre-
2.2 release F
Removed harmless warning message during version
2.4
update about overwriting files F
2.61 2022-02-07
Added clarification about performance of options-chain
8.2
queries with market market data D
Automatically reconnect bad IQFeed connection
9.1
(misleading “no data for query” error) I
4.3, 5.*, Fixed processing of various non-standard date
F
6.3, 7.4 parameters formats/variants
Fixed the reported symbol in error message about a
5.* F
failed history query
Noted that in the few seconds following an initial con-
3.4, 9.1
2.62 2022-02-27 nection to IQFeed, some queries may return empty data D

5.2, 5.3
Fixed weekly/monthly historic data when MaxItems=-1
F
(all data points) and non-default BeginDate
8.3-8.7 Added ForcedRefresh parameter to most lookup queries I
Fixed: lookup queries sometimes returned cell array
8.*
instead of struct array F
4.3, 5.4, Fixed a parsing problem with DateTime parameters that
5.5, 6.3 contain spaces (e.g. '20220324 123456')
F
Clarified that IQFeed market summary data is only
5.6 D
available for dates after May 20, 2018
2.63 2022-03-26
Updated download locations of files on DTN’s website;
Added references to DTN’s updated symbology guide. D
5.6, 8.2

Fixed a possible error when requesting streaming quotes


6.1
with non-default Fields during IQML connection F
4.3, 6.3 Fixed field name typo CummlativeVolumeCumulativeVolume F
Added explanation about IQFeed’s market indices and
4.6
calculated breadth/indicator stats D
Added warning when setting Fields in an ongoing data-
fetch query instead of in the initial streaming request. I
2.64 2022-10-11 6.1

Fixed: symbol lookup query returned empty when


8.1
IQFeed reported just a single result F
*.* Small speedup of IQFeed messages processing I
IQML User Guide 213

B.2 Functional change log (excluding documentation changes)


The table below is a subset of the table in §B.1, listing just functional IQML changes:
Version Date Section Description
0.80 2017-10-17 - Beta integration of IQML in a user trading program
1.00 2018-02-26 - First commercial release of IQML
Enabled message-specific user callbacks;
1.01 2018-03-11 8.1
Added additional information to callback eventData
1.02 2018-03-12 4.3.3 Added relevant symbols list in returned news story data
3.2 Enabled Symbol and Symbols as synonymous params
4.1, 6.1 Improved ticks request logic & the returned data fields
1.03 2018-03-19
Enabled requesting streaming ticks/quotes for multiple
6.1
symbols at once, in a single IQML command
2.1 Added support for native Mac IQFeed client (untested)
Added new MsgParsingLevel general parameter, for
3.2
improved callback run-time performance
5 MaxDataItems input parameter is renamed MaxItems
Some result output fields renamed for consistency;
6.1 BufferSize input parameter is renamed MaxItems for
1.04 2018-04-01
consistency; clarified the documentation text
6.2 Added new streaming regional updates functionality
Added newline characters between separate paragraphs in
7.3
reported news-story text, for better readability (Pro license)
7.5 Added new streaming news functionality (Pro license)
10 Added timestamp and channel info to debug printouts
Added new symbols and numeric market codes lookup
3.1, 8
functionality
3.2, 4.1
5, 7.2
Modified the default Timeout value from 3 to 5 [secs]
1.05 2018-04-05 Added basic support for options-chain and futures-chain
8.2, 10.3
symbol lookup (better support is planned for next version)
Enabled specifying IQFeed Username and Password;
9.1
Added a 10-sec timeout on IQFeed connection attempts
9.3 Added extra port-specific stats when AddPortStats=1
1.06 2018-04-08 8.2 Added options/futures chain lookup functionality
1.07 2018-04-10 9.1 Added info msgs on server connections/disconnections
1.08 2018-04-11 4.1, 6.1 Added the Symbol field to returned quotes data struct
1.09 2018-04-16 6.3 Added Interval Bars functionality
4.4, 6.4,
1.11 2018-05-16
10.5
Added Market Depth (Level 2) functionality
1.12 2018-05-23 12 Added alerts functionality
IQML User Guide 214

Version Date Section Description


Enabled auto-fetch of full story in news headlines query
7.2
(streaming/blocking) using GetStory parameter (Pro)
Enabled reporting the full news story (in addition to
1.13 2018-05-25 11.2
headline) in news alerts using GetStory parameter
11.1, Added regional updates alert functionality (in addition to
11.2 news/quote/intervalbar alerts)
3.1 Fixed bug in accepting struct-based input parameters
1.131 2018-05-28
7.2 Fixed bug in the news headlines functionality (Pro license)
Enabled specifying multiple Symbols in a single
4.2
Fundamental-data query
Enabled specifying multiple Symbols in a single
1.14 2018-05-30 6.2
streaming Regional updates query
Enabled specifying multiple news headline ID values in a
7.3
single news story query (Pro license)
4.1, 6.1, Enabled querying snapshot (top of market) & streaming
14 data of multiple symbols at once, in a single IQML query
Fixed: querying multi-symbol fundamental data
4.2
sometimes returned empty results
Fixed: debug data was displayed when streaming queries
6.1-6.3
were requested (now only displayed if Debug=1)
1.15 2018-07-08
Enabled querying fundamental data of all symbols in an
8.2
options/futures chain at once, in a single IQML query
Enabled querying snapshot (top of market) data of entire
8.2
options/futures chain at once, in a single query
Fixed: IQML query during IQFeed connection sometimes
9.1
returned empty/error results
1.16 2018-07-09 5 Improved performance (speed) of historical data queries
Enabled retrieval and cancellation of streaming data for
1.17 2018-07-30 6
multiple/all streamed symbols in a single IQML command
3.1, 3.5 Added optional errorMsg output for IQML commands
9.1 Fixed problem of duplicate fields during initial connection
1.18 2018-08-03
Improved the reliability of a programmatic IQFeed
9.1
disconnect/reconnect
Added the RaiseErrorMsgs parameter to control whether
3.2, 12
IQFeed errors should raise a Matlab error
1.19 2018-08-06
4.1, 5.1, Message about partial data received due to Timeout is
7.2, 8.1 now a Matlab warning message, not an error message
Enabled requesting history data for multiple symbols in a
5, 14
single IQML command
1.20 2018-08-07
5.1, 5.4, Automatically convert BeginDateBeginDateTime,
5.5 EndDateEndDateTime (i.e. try to fix usage error)
IQML User Guide 215

Version Date Section Description


1.21 2018-08-10 8.1 Enabled looking up symbols by market(s), sec-type(s)
Enabled NearMonths values of 0-12, not just 0-4, for
8.2 options/futures chain. Note: this is based on undocumented
1.22 2018-08-13 IQFeed functionality, so might not work in some cases.
3.2 etc. Limited the Timeout parameter values to 0-3000 [secs]
Fixed a problem of possible bad connection to IQFeed
1.23 2018-08-14 9.1
during the initial connection by IQML
Limited the Timeout parameter values to 0-9000 [secs],
3.2 etc.
with 0 indicating infinite (i.e. no-limit) timeout
Enabled NearMonths values of 0-99, not just 0-12, for
1.24 2018-08-31 8.2 options/futures chain. Note: this is based on undocumented
IQFeed functionality, so might not work in some cases.
Enabled multiple Matlab processes on the same computer to
9.1
run IQML concurrently (Beta)
This is a major update. Highlights: query parallelization
and multiple usability/functionality fixes/improvements
Enabled parallel processing of IQML commands within
(all) parfor/spmd blocks, and parallel internal processing via
the UseParallel parameter (Professional license only)
2 Added the license type to the output of IQML('version')
3.5 All returned data arrays are now column vectors
Using the 2nd (optional) output of IQML (errorMsgs) now
3.5
implies a default value of false for RaiseErrorMsgs
4 Modified reported data format when NumOfEvents >1
2.00 2018-09-05 Issued a warning when requesting more symbol quotes
4.1, 8.2
(major than your IQFeed account limit
update) 4.3 Added new section on blocking interval bars functionality
4.3, 5.4, Clarified that IntervalSize must be ≥100 for volume bars
6.3 (a new limitation of IQFeed)
4.3, 5, Enabled specifying dates and date-times using Matlab
6.3, 7.4 datetime objects (in addition to datenums and strings)
6 Added Symbol field to returned streaming data struct
Story count for symbols that have no related news story is
7.4
reported as 0 (such symbols were previously skipped; Pro)
Added Exchanges, ServerVersion, ServiceType fields to
9.3
the returned client stats data
11 Fixed various things with the Alerts functionality
Clarified that IntervalSize must be < 86400 for secs bars
4.3, 5.4,
(a new limitation of IQFeed); added warning when user
6.3
2.02 2018-09-13 attempts to use an invalid IntervalSize value.
Added detection & report for a case of a non-
9.1
communicative background IQConnect process
Fixed a problem with the license check that caused
2.03 2018-09-30 9.1
IQFeed disconnections
IQML User Guide 216

Version Date Section Description


5 Improved download speed of historical data queries
2.04 2018-10-02 6, 7.5, LatestEventTimestamp is now reported in seconds (not
9.2 msecs) resolution by default, unless Debug is 1 or true
2.05 2018-10-13 4.1, 6.1 Added Fields parameter to enable dynamic fields-set
2.06 2018-10-15 6.1 Minor fixes, performance speedup of streaming quotes
Enabled using MaxDays as synonym for the Days
5.4
parameter in historic interval queries
Fixed a problem with the license validation that prevented
2.07 2018-10-21 9.1
connection in certain cases
Fixed a few small edge-cases with sending custom
9.4
commands to IQFeed
5.1, 5.4, Enabled parallelized historic data queries (daily/interval/
2.08 2018-10-28
5.5 ticks) that have date/time range (Professional license only)
2.09 2018-11-07 3.1 Fixed a bug in parsing input parameters in struct format
Added ability to revert back to the previous IQML version
2.4
at any time.
Added description fields for the Bid_Market_Center,
4.1 Ask_Market_Center and Last_Market_Center fields, when
2.10 2018-11-14
reported in a quotes message from IQFeed.
Added a new 'Greeks' action, to calculate Greeks, fair
4.5 value price and implied volatility for options (Professional
license only)
DaysPerYear parameter was renamed AnnualFactor;
Duration parameter was renamed DaysToExpiration;
Vega, Rho, Veta, Ultima are no longer divided by 100
(compatibility with Matlab Financial Toolbox, Maple &
NAG); minor fix for Veta (negative value);
2.11 2018-11-22 4.5
Added new fields in the reported data struct: Omega +
Lambda (synonyms), CRho, Color, Annual_Factor_Used.
Clarified differences of IQML’s Greek values vs. Matlab’s
Trading Toolbox, NAG, and Maple.
Added a table explaining all the reported Greek values.
2.2 Added cross-check for IB-Matlab connector
Added a new 'revert' action, to revert back to a previous
2.4
2.12 2019-01-16 IQML version
Fixed: display this User Guide using IQML('doc') even
3.1
when the document is not on the Matlab path
Added the ClearBuffer parameter for streaming data;
2.13 2019-02-28 6.1-6.3 fixed bug with streaming data when NumOfEvents=inf;
fixed the documentation of NumOfEvents default value
IQML User Guide 217

Version Date Section Description


3.1 Fixed a problem specifying parameters via Matlab table
Added ability to specify parameters using Matlab class
3.1
object properties, similar to struct fields
Invalid parameter names are now ignored (a warning is
2.14 2019-03-14 3.1, 14
displayed), rather than raising a Matlab error/exception
4.1 etc. Improved handling of multi-symbol queries
4-7, Symbols, Fields, and news Sources can now be separated
11.1 by ':' or ',' (for example, 'IBM:HP' or 'IBM,HP')
Added display of a few types of IQFeed system messages
12.1
2.15 2019-03-24 (excluding the periodic stats messages) in Debug mode
12.2 Added programmatic control of IQFeed logging
Added the ability to specify BeginDate for historic
2.16 2019-04-17 5.2, 5.3
weekly/monthly data requests, in addition to MaxItems
Display an explanatory message upon an IQFeed account
3.4, 5.4
authorization error
4.1, 4.3, Clarified warning message in case of partial results returned
5.1, 7.2, due to timeout, by including a suggestion to decrease the
8.1, 14 NumOfEvents parameter value, where this is relevant
Added support for equity Level 2 data (in addition to
futures Level 2, which was already supported); Added ID
fields to all returned Level 2 data (futures and equities);
changed default NumOfEvents from inf to 10; IQML now
4.4, 6.4
2.17 2019-05-07 connects to IQFeed L2 servers only as needed, not in startup;
Issue an error message for each separate failure to access
L2 data, not just during the initial connection attempt;
Added the IncludeEmptyQuotes parameter
Fixed parallelization when only one of BeginDateTime /
5.4, 5.5
EndDateTime is specified but not the other
Improved behavior for users with multiple IQFeed
accounts using the Username/Password parameters;
9.1
Improved startup speed in case of multiple connects/
disconnects during the day
Added an informative alert when another process is using
9.1
one of IQFeed’s expected connection ports
2.18 2019-05-14
Added the 'registry' action and functionality, to enable
3.1, 9.5
convenient access to IQFeed’s registry settings
IQML User Guide 218

Version Date Section Description


Added functionSignatures.json file for easier IQML usage
-
in Live Editor
Fixed compatibility problem with old Matlab releases
-
(R2008a - R2012b)
Added the 'summary' action and functionality, to fetch
3.1, 5.6
historic end-of-day market summary (Professional license)
Improved query responsivity in case of IQFeed error;
4 improved performance of single-symbol queries
Support IQFeed client 6.1: new quotes data Fields (Most
4.1
Recent Trade Aggressor, Most Recent Trade Day Code)
2.19 2019-07-07
Support IQFeed client 6.1: new fundamental data fields
(Session_Open_Time, Session_Close_Time, Base_Currency,
4.2 Contract_Size, Contract_Months, Minimum_Tick_Size,
FIGI, First_Delivery_Date, and Security_SubType)
Included today’s partial daily trading data in day/week/
5.1-5.3
month history queries, in IQFeed client 6.1 or newer.
Added LabelAtBeginning parameter for historic interval
5.4
data queries (requires IQFeed client version 6 or newer)
8.2 Default value for IncludeBinary parameter is now false
9.1 Added Protocol parameter to customize initial connection
Added the ReportEmptyFields, Filter parameters and
5.6
2.20 2019-07-10 functionality (scanning based on multiple filter criteria)
9.1 Improved IQConnect startup on Linux/Mac via wine
Enabled fetching latest (current) market summary/scanner
4.6
2.21 2019-07-14 via a 'summary' query (Professional license)
5.6 Default Date parameter value changed (yesterdaynow)
Fixed a bug that caused a “Duplicate field name Reserved”
- error for some queries on some Matlab releases
2.22 2019-07-17 4.2 Added Underlying_Contract field for continuous futures
Fixed bug in change % fields of 'top' scanner queries;
4.6
reordered 'top' results volume fields for improved readability
Improved collection of parallelized results, in case some
- of the results returned an error or empty data
2.23 2019-09-18 4.3 Added UseParallel parameter functionality to IntervalBars
Fixed the implementation of MaxItems=-1, due to an
5
IQFeed API behavior change
- Improved processing speed and streaming data throughput
Added TradeAggressor, DayOfMonth fields to reported ticks
5.5
2.24 2019-10-05 data (IQFeed client 6.1 or newer)
8.* Fixed duplicate lookup entries after an IQML reconnect
9.4 Enabled multiple custom commands in single IQML query
IQML User Guide 219

Version Date Section Description


- Clarified a few error messages
2.25 2019-10-06 5.* Fixed bug in historic data that was introduced in release 2.24
9.1 Improved detection of port conflicts with other programs
2.1 Improved reporting of missing program components
Fixed bug when multiple symbols are queried together
4.*
and some symbols have no data (e.g., bad ticker)
Fixed bug of not distinguishing between symbols with '.'
2.26 2019-10-25 4.* and '-' (e.g., AGM.A, AGM-A) when they are both queried
4.2 Added fundamental data caching for improved performance
4.5 Automatically infer UnderlyingSymbol for future options
4.*, 5.* Small performance speedup of multi-symbol queries
2.1 Improved reporting of a missing IQFeed installation
Added display of extra clarification messages upon
2.4
successful completion of IQML version update or revert
Added Exchange_Description field if Exchange_Id field is
4.1
reported by IQFeed and MsgParsingLevel=2
2.27 2019-11-08 4.1, 4.2 Fixed bug decoding Exchange_Description of some markets
Improved auto-infer of UnderlyingSymbol for options;
4.5
added Underlying_Asset_Name field to the returned data.
Added warning when trying to use the Years parameter in
8.2
an index/equity chain query
9.1 Improved detection of port conflicts with other programs
Fixed activation issue with compiled IQML on some
2.28 2019-11-09 2.2
deployed computers (requires reactivation)
Clarified activation error messages in deployed programs;
2.2 Improved activation resiliency to short network hickups
and MacOS-induced hostname changes
2.4 Skip version update check in deployed (compiled) program
2.29 2019-11-21
4.1 Improved processing speed of quotes queries using Fields
Added SIC and NAICS sector classification data in
4.2
fundamental data queries
9.1 Improved detection of port conflicts with other programs
4.2 Improved processing speed of fundamental data queries
4.5 Improved resiliency of Greeks query to some data errors
5.* Improved processing speed of all historic data queries
8.1 Improved processing speed of symbol lookup queries
2.30 2019-12-08 9.3 Fixed an edge-case problem with some client stats queries
Added support for 'regional' data type in the alert Trigger;
Added support for 'contains' operator in all alert types;
11.2
Added warning when user requests a trigger field that is
not included in the latest setting of the quotes Fields
IQML User Guide 220

Version Date Section Description


*.* Fixed incompatibility with Matlab releases R2009a or older
4.2 Fixed a bug in parsing of reported date fields
2.31 2019-12-12
Added UseImpliedVolatility optional Greeks parameter;
4.5
Added Volatility_Used_By_Greeks field to reported data
5.* Fixed bug in parsing of reported history Datestamp field
2.311 2019-12-13
7.2 Fixed bug in parsing reported news Timestamp field (Pro)
2.4 Modified the hyperlinks in the new-version message
Fixed bug in accumulating multiple quotes when some
2.32 2019-12-16 4.1
fields data is missing/empty in some quotes but not others
5.* Improved processing speed of all historic data queries
Displayed warning message when Greeks are requested
4.5
for expired contracts or with contracts with missing data
4.6 Identified casses of missing summary data from IQFeed
Clarified that BeginDateTime/EndDateTime have
2.33 2019-12-31
5.4, 5.5 precedence over (override) the Days parameter; displayed
a warning message when trying to use Days in such cases
Clarified the warning message when querying a chain
8.2
with DataType='options' and non-default Years
Fixed bug in parsing the am time part in a BeginDateTime
4.3
parameter that is specified in numeric format
2.34 2020-01-16
Added MaxUpdateDuration parameter for streaming
6.3
intervalbars queries
2.35 2020-02-05 9.1 Fixed a connection conflict with IQFeed’s Excel connector
7.2 Minimal Timeout of 60 secs for GetStory queries (Pro)
2.36 2020-03-06
7.3 Report only unique symbols in a news story query (Pro)
When an invalid parameter is specified, the list of all valid
3.1
action parameters is displayed in the warning message
2.37 2020-03-30 7.2 Improved performance of news headlines query (Pro)
Improved reporting of errors in user-specified callback
10.1
function for an IQFeed message event
Improved UseParallel robustness in some scenarios/edge-
*.*
cases (Professional license)
2.38 2020-04-14
2.2 Removed IB-Matlab connector cross-check in deployed apps
7.2 Fixed error when IQFeed sends empty news headlines (Pro)
Added informative message when the user specifies an
*.*
invalid Symbol format
Fixed bug when using custom Fields in UseParallel mode
2.39 2020-04-16 4.1
for multiple Symbols
IQConnect’s Diagnostics utility now displays IQML
9.3
version and parallel workers in its Client Stats tab
IQML User Guide 221

Version Date Section Description


Fixed: enabled "symbol" in addition to 'symbol' in the
*.* Symbol parameter (broken in version 2.39)
4.1 Fixed bad data in parallel quotes query of duplicate symbols
2.40 2020-04-20 Added Fields parameter to history queries for improved
5.1-5.5 processing speed and memory usage (Professional license)

Fixed error when parallel historic query of multiple


5.1-5.5 symbols returns non-matching data sizes

Detect & handle case of a missing 'Symbol' parameter,


3.4 e.g. IQML('quotes','IBM')
5.1-5.5 Improved performance of history queries
Improved speed of IQML commands that start streaming;
6.* Added AssignTo parameter to enable assigning streaming
2.41 2020-05-03 data to base Matlab workspace variables, with live updates
6.2 Fixed a bug in fetching streaming Regional quotes
Added BarTypeCode, EventDatenum, EventTimestamp
6.3 fields to streaming intervalbars data
Faster initial connection to IQFeed; Added extra debug
9.1 printouts to assist diagnosing IQFeed connection problems
4.2 Fixed bug in fundamental data query
2.42 2020-05-04
5.1-5.5 Fixed bug in history query of multiple symbols at once
When IQFeed has no history data for a query, IQML now
5.1-5.5 returns [], not a 'NO_DATA' error
2.43 2020-05-10 Fixed bug when disconnecting from non-connected IQFeed
9.1
9.1 Faster initial connection to IQFeed (cached lookups etc.)
5.1-5.5 Fixed empty results in some parallel history queries (Pro)
2.44 2020-06-05
7.2 Fixed various edge-cases with news headlines query (Pro)
5.1, 5.4, Added input parameter checks: BeginDate < EndDate,
5.5 BeginDateTime < EndDateTime
2.45 2020-06-23 8.* Fixed duplicate lookup entries reported by IQFeed
Speedup of symbols lookup; enabled searching all symbols
8.1 (empty Name parameter) for the specified Market/SecType
Fixed single-day history query (BeginDate=EndDate),
5.1 broken in version 2.45
2.46 2020-06-30
5.1-5.5 Added the Progress input parameter to history queries
8.3-8.7 Added the ID filtering parameter to lookup queries
IQML User Guide 222

Version Date Section Description


Fixed occasional errors that might occur during the initial
3.6
connection of parallel workers to IQFeed (Pro license)
Added Fiscal_Year_End_Description field to the
4.2 fundamental data results – a textual description of the
numeric Fiscal_Year_End field
Clarified error message when market summary data is
5.6
2.47 2020-11-29 unavailable (Professional license)
Improved the performance of fetching streaming quotes
6.*
during live (real-time) streaming
Handled cases of IQFeed server error when requesting
8.2
options chain (Professional license)
Fixed error in case the IQFeed client has not yet set a
12.2
logging-level registry value
*.* Fixed bug when trying to display PDF docs on MacOS
Fixed edge-case when retrieving data in parallel with the
*.* UseParallel parameter (Professional license)
3.6, 4.1,
Added MaxWorkers input parameter to limit the number
4.3, 4.5,
of active parallel workers when using the UseParallel
2.48 2020-12-02 5.1-5.5,
parameter for parallelized queries (Professional license)
7.2, 8.2
Increased default maximal number of parallel workers in
5.1-5.5 parallelized history queries from 1415 (Pro license)
Fixed bug in filtering numeric summary data when
5.6
MsgParsingLevel = 0 (Professional license)
Added new OutputFormat parameter to enable easy
3.2, 3.5 reporting of results in cell/struct/table/timetable formats
2.49 2021-01-03 Fixed certain problems with parallel download of historic
5.1-5.5
data (Pro license)
12.1 Added display of context information in run-time errors
Fixed symbols lookup query with empty/unspecified
Name filter parameter;
Added new Progress parameter to display lookup query
8.1 progress (same as in history queries);
2.50 2021-01-24 Added ability to filter symbols lookup query by Market
group (e.g. 'NYSE'), not just specific market name(s)/id(s)
Fixed: chain symbols query did not report some equity
8.2
options unless NearMonths parameter was set (Pro license)
Fixed a problem with news query without a Symbol filter
7.*
due to a DTN server-side change (Pro license)
Added Datenum field to news headlines query;
7.2
Fixed Timestamp field to standard format (Pro license)
2.51 2021-02-03
Auto-reconnect IQML to IQFeed when IQConnect is not
9.1
communicating for a long time
Added Datenum, Timestamp, TotalMsgsRcv fields to
9.3
client stats data
IQML User Guide 223

Version Date Section Description


Added support for new IQFeed client 6.2, including new
Level 2 functionality (Market-by-Price, Market-by-Order);
4.4, 6.4
Added BidSizeRatio, AskSizeRatio fields to results;
Added Detailed, MaxLevels parameters. (Pro license)
Fetch previous day's summary data if data for requested
4.6 date is unavailable (Pro license)
2.52 2021-02-23 Handled edge case of news headlines that are reported
7.2
with missing/invalid timestamp
Avoid repeated attempts to launch the IQFeed client on
startup, in case it is not detected in the expected location;
9.1
Added alert in case the installed IQFeed client appears to
be older than the latest available stable IQFeed client.
9.1, 9.5 Added support for IQFeed client 6.2’s new registry hive
Added new OverflowMode, MaxEventsBacklog
3.6, 6.1
parameters for message overflow handling
Improved support for new IQFeed client 6.2 Level 2
4.4, 6.4
functionality; added market-maker description (Pro license)
2.53 2021-04-06
Added description fields for Exchange/Markets/SIC/
4.6
NAICS codes in summary query results (Pro license)
9.3 Added msg overflow handling data to reported client stats
11 Fixed: alert ID was not properly returned in alert queries
4.5 Fixed: implied volatility was sometimes reported as ±inf
Added EndDate parameter for weekly/monthly history
5.2, 5.3
2.54 2021-05-03 queries, as in daily/interval history queries
Fixed some BeginDate/EndDate/MaxItems parameter
5.1-5.4
inconsistencies in history queries
Added Filepath field to the output of IQML('version')
2.1
2.55 2021-05-10 5.1-5.4 Fixed problem of empty data reported when MaxItems = -1
9.1 Added Timeout parameter to IQML('reconnect') actions
Fixed occasional “corrupt P-file” errors in parallel setups
*.*
(Pro license)
Automatically disconnect from IQFeed when installing an
2.4
2.56 2021-06-23 IQML update
Fixed: summary data query sometimes reported missing
4.6
data (Pro license)
12.1 Simplified error message in case of IQML run-time error
IQML User Guide 224

Version Date Section Description


Fixed: Timeout parameter was not used by news story
7.2
queries when GetStory=true (Pro license)
Fixed edge cases of some news stories reported as errors
7.3
by IQFeed client version 6.1 (Pro license)
Added URL field to reported news stories, if a URL is
2.57 2021-07-11 7.3
detected in the story text (Pro license)
Improved performance (reduced run-time) of news story
7.*
queries, especially story texts (Pro license)
Removed some harmless warning messages when
9.1
connecting IQML to IQConnect in certain cases
Replaced all references to iqml.net with
*.*
undocumentedmatlab.com
Fixed display of the market-maker description in
4.4
MarketDepth (Level2) queries (Pro license)
Clarified warning when requesting streaming quotes for
6.1
2.58 2021-11-21 more symbols than IQFeed allows
9.1 Display client, protocol versions in connection success msg
Handled unsolicited changes of MacBookPro computer
9.1
name by MacOS, affecting IQML’s activation
Added NumOfAvailableSymbols, ProtocolInUse,
9.3
IQFeedAccountExpiryDate fields to client stats data
Added 'validate' action: returns true if IQML license is ok,
2.2
and an error (or an error message) if it is not.
4.3, 5.*, Added support for a few additional formats of date
2.59 2021-12-14
6.3, 7.4 parameters, such as '21/11/15', 'Nov 15', '15-Nov-2021'
Fixed: News headlines request returned partial results on
7.2
Matlab R2021b (Pro license)
4.3, 5.*, Fixed bug in parsing of default BeginDate parameter value;
2.60 2021-12-31 6.3, 7.4 Improved reporting of invalid date/time parameter values
8.2 Added Fields parameter to option chains query (Pro license)
2.2 Fixed IQML activation problem on a Matlab pre-release
Removed harmless warning message during version
2.4
2.61 2022-02-07 update about overwriting files
Automatically reconnect bad IQFeed connection
9.1
(misleading “no data for query” error)
4.3, 5.*, Fixed processing of various non-standard date parameters
6.3, 7.4 formats/variants
5.* Fixed reported symbol in error msg of a failed history query
Fixed weekly/monthly historic data when MaxItems = -1
2.62 2022-02-27 5.2, 5.3
(all data points) and non-default BeginDate
8.3-8.7 Added ForcedRefresh parameter to most lookup queries
Fixed: lookup queries sometimes returned cell array
8.*
instead of struct array
IQML User Guide 225

Version Date Section Description


4.3, 5.4, Fixed a parsing problem with DateTime parameters that
5.5, 6.3 contain spaces (e.g. '20220324 123456')
2.63 2022-03-26
Fixed a possible error when requesting streaming quotes
6.1
with non-default Fields during IQML connection
4.3, 6.3 Fixed field name typo: CummlativeVolumeCumulativeVolume
Added warning when setting Fields in an ongoing data-
6.1
fetch query instead of in the initial streaming request
2.64 2022-10-11
Fixed: symbol lookup query returned empty when IQFeed
8.1
reported just a single result
*.* Small speedup of IQFeed messages processing

You might also like