IQML User Guide
IQML User Guide
IQML User Guide
Version 2.64
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
DISCLAIMER
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.
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
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
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
3 Using 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
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
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
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
...
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
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.
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
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
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
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
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
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
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
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
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);
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
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
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'
...
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'
...
47
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 51
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
57
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 56
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
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
67
http://iqfeed.net/dev/api/docs/HistoricalviaTCPIP.cfm
IQML User Guide 65
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
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
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
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);
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}
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
81
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 82
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}
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
91
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 88
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 10080.
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 800.
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
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
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
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
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]
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
119
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 108
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
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
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
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
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
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
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
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
130
In IQML, the Symbol and Symbols parameters are synonymous – you can use either of them, in any capitalization
IQML User Guide 123
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
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
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]);
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
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
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
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
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
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'
...
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
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'
...
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
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'
...
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
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
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
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.
160
http://iqfeed.net/dev/api/docs/AdminSystemMessages.cfm
IQML User Guide 155
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
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
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
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
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
169
https://mathworks.com/help/matlab/matlab_prog/profiling-for-improving-performance.html
170
https://undocumentedmatlab.com/books/matlab-performance
IQML User Guide 165
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!
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
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.
% Initialize data
numRows = 10;
depthData = cell(numRows,8);
lastUpdateTime = -1;
GUI_refresh_period = 0.5 * 1/24/60/60; % =0.5 secs
172
https://UndocumentedMatlab.com/files/IQML/IQML_MktDepth.m
IQML User Guide 168
11 Alerts
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
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
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');
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'});
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
The callback function (myFunc in this example) should accept two or more
inputs, as customary for Matlab callbacks:178
function myFunc(alertObject, eventData)
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
...
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
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
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
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
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
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.
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.
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.
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
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.
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.
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.
189
http://undocumentedmatlab.com/consulting
IQML User Guide 188
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
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.
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