4 Querying the latest market data

4.1 Snapshot (top of book) quotes

We start with a simple example to retrieve the latest market information for Alphabet Inc. Class C, which trades using the GOOG symbol, using IQML’s 'quotes' action:

>> data = IQML('quotes', 'Symbol','GOOG')
data =
Symbol: 'GOOG'
Most_Recent_Trade: 1092.14
Most_Recent_Trade_Size: 1
Most_Recent_Trade_Time: '09:46:31.960276'
Most_Recent_Trade_Market_Center: 25
Total_Volume: 113677
Bid: 1092.13
Bid_Size: 100
Ask: 1092.99
Ask_Size: 100
Open: 1099.22
High: 1099.22
Low: 1092.38
Close: 1090.93
Message_Contents: 'Cbaohlc'
Message_Description: 'Last qualified trade; A bid update
occurred, An ask update occurred; An open
declaration occurred; A high declaration
occurred; A low declaration occurred; A
close declaration occurred'
Most_Recent_Trade_Conditions: '3D87'
Trade_Conditions_Description: 'Intramaket Sweep; Odd lot trade'
Most_Recent_Market_Name: 'Direct Edge A (EDGA)'

As can be seen, the returned data object is a Matlab struct with self-explanatory fields.19 To access any specific field, use the standard Matlab dot-notation:

>> bidPrice = data.Bid; %=1092.13 in this specific case

If the symbol is not currently trading, some fields return empty values:

>> data = IQML('quotes', 'Symbol','GOOG')
data =
Symbol: 'GOOG'
Most_Recent_Trade: 1078.99
Most_Recent_Trade_Size: 1
Most_Recent_Trade_Time: '19:58:47.052099'
Most_Recent_Trade_Market_Center: 26
Total_Volume: 0
Bid: 1077.6
Bid_Size: 100
Ask: 1079.89
Ask_Size: 200
Open: []
High: []
Low: []
Close: 1078.92
Message_Contents: 'Cbav'
Message_Description: 'Last qualified trade; A bid update
occurred; An ask update occurred;
A volume update occurred'
Most_Recent_Trade_Conditions: '0517'
Trade_Conditions_Description: 'Average Price Trade; Form-T Trade'
Most_Recent_Market_Name: 'Direct Edge X (EDGX)'

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);

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!

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 more than 50 additional 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 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 of 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','Bid, Ask, Last, Symbol')
data =
Symbol: 'AAPL'
Bid: 222.71
Ask: 222.91
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, ...

warningNote: 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.

The following parameters affect quotes data queries:

Parameter

Data type

Default

Description

Symbol or Symbols 24

colon or comma-delimited string, or cell-array of strings

(none)

Limits the query to the specified symbol(s). Examples:

'@VX#'

'IBM:AAPL:GOOG'

'IBM,AAPL,GOOG'

{'IBM', 'AAPL', 'GOOG'}

This parameter must be set to valid symbol name(s). Multiple symbols can be parallelized using the UseParallel parameter (see below).

NumOfEvents

integer

1

Returns up to the specified number of quotes

Timeout

number

5.0

Max number of seconds to wait for incoming data (0-9000, where 0 means infinite)

UseParallel

logical (true/false)

false

If set to true or 1, and the Parallel Toolbox is installed, querying multiple symbols is done in parallel (see §3.6; Pro IQML license only)

MaxWorkers

integer

(current parallel pool size)

Max number of parallel workers to use (up to the current pool size) when UseParallel=1

Fields

colon or comma-separated string, or cell-array of strings

'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'

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 (a detailed list of fields is provided below).

If Fields is set to an empty value ({} or ''), the list of current, available fields is returned.

If Fields is not empty, subsequent quotes queries will return the specified fields, in the specified order (Professional IQML license only). The Symbol field is always returned first, even if not specified.

Examples:

'Bid:Ask:Last'

'Bid, Ask, Last'

{'Bid', 'Ask', 'Last'}

'All' (indicates all available fields)

The full list of available fields in IQFeed as of July 2019 is listed below. Note that some of these fields may not be available, and IQFeed may also add/modify this list at any time. The list of fields that are actually available cen be retrieved in IQML using the IQML('quotes','fields',{}) command, as explained above. For details about any of these fields, please contact your DTN/IQFeed representative (IQML just reports the data, it has no control over the reported values or definition of the data fields).

In the table below, the 16 default data fields are marked with a bold font-face:

Field Name

Field Type

Description

Data origin 25

7 Day Yield

float

Value of a Money Market fund over past 7 days.

Exchange/other

Ask

float

Min price a market maker/broker accepts for a security.

Exchange/other

Ask Change

float

Change in Ask since last offer.

IQConnect

Ask Market Center

integer

Market Center that sent the ask information (see §8.3).

Exchange/other

Ask Size

integer

The share size available for the ask price

Exchange/other

Ask Time

hh:mm:ss.ffffff

The time of the last ask. May be reported as 99:99:99 outside trading hours to indicate an invalidated quote.26

Exchange/other

Available Regions

string

Dash-delimited list of available regional exchanges.

IQConnect

Average Maturity

float

Average number of days until maturity of a Money Market Fund’s assets.

Exchange/other

Bid

float

Max price a market maker/broker will pay for a security.

Exchange/other

Bid Change

float

Change in Bid since last offer.

IQConnect

Bid Market Center

integer

Market Center that sent the bid information (see §8.3).

Exchange/other

Bid Size

integer

The share size available for the bid price.

Exchange/other

Bid Time

hh:mm:ss.ffffff

The time of the last bid. May be reported as 99:99:99 outside trading hours to indicate an invalidated quote.27

Exchange/other

Change

float

Today's change (Last - Close)

IQConnect

Change From Open

float

Change in last price since last open.

IQConnect

Close

float

The closing price of the day. For commodities this will be the last trade price of the session.

Exchange/other

Close Range 1

float

For commodities only. Range value for closing trades that aren’t reported individually.

Exchange/other

Close Range 2

float

For commodities only. Range value for closing trades that aren’t reported individually.

Exchange/other

Days to Expiration

string

Number of days to contract expiration.

IQConnect

Decimal Precision

string

Last Precision used.

DTN

Delay

integer

The number of minutes a quote is delayed when not authorized for real-time data.28

Exchange/other

Exchange ID

hexadecimal

The Exchange Group ID.

DTN

Extended Trade

float

Price of the most recent extended trade (last qualified trades + Form T trades).

Exchange/other

Extended Trade Date

MM/DD/CCYY

Date of the extended trade.

Exchange/other

Extended Trade Market Center

integer

Market Center of the most recent extended trade (last qualified trades + Form T trades); see §8.3.

Exchange/other

Extended Trade Size

integer

Size of the most recent extended trade (last qualified trades + Form T trades).

Exchange/other

Extended Trade Time

hh:mm:ss.ffffff

Time (including microseconds) of the most recent extended trade (last qualified trades + Form T trades).

Exchange/other

Extended Trading Change

float

Extended Trade minus Yesterday's close.

IQConnect

Extended Trading Difference

float

Extended Trade minus Last.

IQConnect

Financial Status Indicator

char

Denotes if an issuer has failed to submit its regulatory filings on a timely basis, has failed to meet the exchange's continuing listing standards and/or filed for bankruptcy. A corresponding description field will be generated by IQML for this field when MsgParsingLevel ≥ 2 (see §3.2)

Exchange/other

Fraction Display Code

string

Display formatting code. A corresponding description field will be generated by IQML for this field when MsgParsingLevel ≥ 2 (see §3.2)

DTN

High

float

Today's highest trade price.

Exchange/other

Last

float

Last trade price from the regular trading session.

Exchange/other

Last Date

MM/DD/CCYY

Date of the last qualified trade.

Exchange/other

Last Market Center

integer

Market Center of most recent last qualified trade.

Exchange/other

Last Size

integer

Size of the most recent last qualified trade.

Exchange/other

Last Time

hh:mm:ss.ffffff

Time (including microseconds) of the most recent last qualified trade.

Exchange/other

Low

float

Today's lowest trade price.

Exchange/other

Market Capitalization

float

Real-time calculated market cap (Last price * Common Shares Outstanding).

IQConnect

Market Open

integer

1 = market open, 0 = market closed.
Note: valid for Futures and Future Options only.

DTN

Message Contents

non-delimited string of single characters of message identification code

Possible single character values include:
C – Last Qualified Trade
E – Extended Trade = Form T trade
O – Other Trade = Any trade not
accounted for by C or E
b – A bid update occurred
a – An ask update occurred
o – An Open occurred
h – A High occurred
l – A Low occurred
c – A Close occurred
s – A Settlement occurred
v – A volume update occurred

Notes: you can get multiple codes in a single message but you will only get one trade identifier per message. It is also possible to receive no codes in a message if the fields that updated were not trade or quote related.

A corresponding description field is generated by IQML for this field when MsgParsingLevel ≥ 2 (see §3.2)

IQConnect

Most Recent Trade

float

Price of most recent trade (inc. non-last-qualified trades).

Exchange/other

Most Recent Trade Aggressor

integer

Identifies if the trade was executed at the bid or the ask price. As of IQFeed 6.1, this feature is only supported for CME and ICE exchanges; unsupported symbols return [].

Possible values:

0 – invalid or unsupported

1 – most recent trade was executed at the Ask price

2 – most recent trade was executed at the Bid price

3 – most recent trade was executed at some other price

[] – unknown or unsupported

(requires IQFeed client 6.1 or newer)

Exchange/other

(only provided by some exchanges)

Most Recent Trade Conditions

string of 2-digit hex numbers

Conditions that identify the type of most recent trade. A corresponding description field is generated by IQML for this field when MsgParsingLevel ≥ 2 (see §3.2, §8.7)

Exchange/other

Most Recent Trade Date

MM/DD/CCYY

Date of most recent trade.

Exchange/other

Most Recent Trade Day Code

integer

The day of month (1-31) in which the most recent trade occurred. (requires IQFeed client 6.1 or newer)

Exchange/other

Most Recent Trade Market Center

integer

Market Center of most recent trade. A corresponding description field will be generated by IQML for this field when MsgParsingLevel ≥ 2 (see §3.2, §8.3)

Exchange/other

Most Recent Trade Size

integer

Size of most recent trade.

Exchange/other

Most Recent Trade Time

hh:mm:ss.ffffff

Time (including microseconds) of most recent trade.

Exchange/other

Net Asset Value

float

The market value of a mutual fund share. Equal to net assets / total number of shares outstanding. Duplicates the Bid field. Valid for Mutual Funds only.

Exchange/other

Number of Trades Today

integer

The number of trades for the current day.

IQConnect/DTN

Open

float

The opening price of the day. For commodities this will be the first trade of the session.

Exchange/other

Open Interest

integer

IEOptions, Futures, FutureOptions, SSFutures only.

Exchange/other

Open Range 1

float

For commodities only. Range value for opening trades that aren’t reported individually.

Exchange/other

Open Range 2

float

For commodities only. Range value for opening trades that aren’t reported individually.

Exchange/other

Percent Change

float

= Change / Close

IQConnect

Percent Off Average Volume

float

Current Total Volume / Average Volume

IQConnect

Previous Day Volume

integer

Previous Day's Volume.

Exchange/other

Price-Earnings Ratio

float

Real-time calculated PE (Last / Earnings Per Share).

IQConnect

Range

float

Trading range for the current day (high - low)

IQConnect

Restricted Code

string

"N"=Short Sale is not restricted, "R"=Restricted.

Exchange/other

Settle

float

Settle price (Futures or FutureOptions only).

Exchange/other

Settlement Date

MM/DD/YYYY

The date that the Settle field is valid for.

Exchange/other

Spread

float

The difference between Bid and Ask prices.

IQConnect

Symbol

string

The symbol name of the security

IQConnect

Tick

integer

173=Up, 175=Down, 183=No Change. Based on the previous trade. Only valid for Last qualified trades.

IQConnect

TickID

integer

Identifier for tick (not necessarily sequential).

DTN

Total Volume

integer

Today's cumulative volume in number of shares.

IQConnect, DTN or exchange

Type

string

“Q”=Update message, “P”=Summary Message.

IQConnect

Volatility

float

Real-time calculated volatility: (High - Low) / Last.

IQConnect

VWAP

float

Volume Weighted Average Price.

IQConnect/DTN

4.2 Fundamental information

Fundamental data on a symbol can be fetched using a 'fundamental' action, as follows:

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

the naming, interpretation and order of returned data fields is controlled by IQFeed, not by IQML – DTN might change these fields in the future.

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

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.

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'

To improve run-time performance, fundamental data is cached in Matlab memory for each symbol. IQFeed is queried for fundamental data for a symbol only if the symbol was not previously queried in the current Matlab session. This is typically a good thing, because fundamental data is relatively stable. To force IQML to re-query IQFeed for fundamental data even when it is cached, set the Debug parameter:

>> data = IQML('fundamental', 'symbol','AAPL', 'debug',true);

>> data = IQML('debug',false); % exit debug mode

It is possible to fetch fundamental data of multiple symbols in a single IQML command, by specifying a colon-delimited or cell-array list of symbols: 31

>> data = IQML('fundamental', 'symbols','AAPL:GOOG') %or: {'AAPL','GOOG'}

data =
1×2 struct array with fields:
Symbol
Exchange_ID
PE
...

>> data(1)
ans =
Symbol: 'AAPL'
Exchange_ID: 5
PE: 20.4
Average_Volume: 26900000
x52_Week_High: 228.87
x52_Week_Low: 149.16
...

>> data(2)
ans =
Symbol: 'GOOG'
Exchange_ID: 5
PE: 51.9
Average_Volume: 1239000
x52_Week_High: 1273.89
x52_Week_Low: 909.7
Calendar_Year_High: 1273.89
...

The list of fundamental data fields in IQFeed as of 1/7/2019 is listed below. Note that IQFeed may modify this list at any time (for example, IQFeed client 6.1 has added several fields). For details about any of these fields, please ask DTN/IQFeed. IQML just reports the data, it has no control over the reported values or definition of data fields. Note that the fundamental data fields cannot be modified, unlike quotes fields.

Field Name

Field Type

Description

Data origin 32

52 Week High

float

Highest price of last 52 weeks. For futures: contract High

DTN

52 Week High Date

MM/DD/YYYY

The date of the highest price of the last 52 weeks. For futures, this is the contract High Date.

DTN

52 Week Low

float

Lowest price of last 52 weeks. For futures: contract Low

DTN

52 Week Low Date

MM/DD/YYYY

The date of the lowest price of the last 52 weeks. For futures, this is the contract Low Date.

DTN

Average Volume

integer

Average daily volume (4 week average)

DTN

Balance sheet date

MM/DD/YYYY

Last date that a company issued their quarterly report.

Exchange/other

Base Currency

string

Futures and Future Options Only (IQFeed 6.1 or newer)

3rd party

Beta

float

A coefficient measuring a security’s relative volatility:
the covariance of this security’s price in relation to the rest of the market. 30 day historical volatility.

Exchange/other

Cal. Year High Date

MM/DD/YYYY

Date at which High price for current calendar year occurred

DTN

Cal. Year Low Date

MM/DD/YYYY

Date at which Low price for current calendar year occurred

DTN

Calendar year high

float

High price for the current calendar year.

DTN

Calendar year low

float

Low price for the current calendar year.

DTN

Common shares outstanding

float

The amount of common shares outstanding (in thousands).

Exchange/other

Company name

string

Company name or contract description

DTN

Contract Months

string

non-delimited string of upper-case single character month codes (IQFeed 6.1 or newer)

3rd party

Contract Size

string

Deliverable quantitiy of a future or option contract. (IQFeed 6.1 or newer)

3rd party

Coupon Rate

float

Interest Rate for a Bond.

Exchange/other

Current assets

float

The amount of total current assets held by a company as of a specific date in Millions (lastADate)

Exchange/other

Current liabilities

float

The amount of total current liabilities held by a company as of a specific date in Millions (lastADate).

Exchange/other

Current year earnings per share

float

The portion of a company's profit allocated to each outstanding share of common stock

Exchange/other

Dividend amount

float

The current quarter actual dividend

Exchange/other

Dividend rate

float

The annualized dividend expected to be paid by company

Exchange/other

Dividend yield

float

The annual dividends per share paid by the company divided by current market price per share of stock, as a % value.

Exchange/other

Exchange ID

hexadecimal

This is the Exchange Group ID (code). Convert to decimal and use the Listed Markets lookup to decode this value.

DTN

Exchange Root

string

The root symbol under which the exchange lists this symbol

Exchange

Ex-dividend date

MM/DD/YYYY

The actual date in which a stock goes ex-dividend, typically about 3 weeks before the dividend is paid to shareholders of record. The amount of the dividend is reflected in a reduction of the share price on this date.

Exchange/other

Expiration Date

MM/DD/YYYY

IEOptions, Futures, FutureOptions, and SSFutures only

IEOptions by the exchange;
others by DTN

FIGI

string

Financial Instrument Global Identifier 33 (IQFeed 6.1 or newer). For example: 'BBG000BLNNH6' (IBM)

3rd party

First Delivery Date

MM/DD/YYYY

Futures and Future Options Only (IQFeed 6.1 or newer)

3rd party

Fiscal year end

integer

The numeric month in which the company’s fiscal year ends. For example, 4=April, 10=October.

Exchange/other

Five-year growth percentage

float

Earnings Per Share growth rate over a five year period

Exchange/other

Format Code

string

Display format code

DTN

Historical Volatility

float

Volatility of daily close prices in the last 30 trading days 34

DTN

Leaps (there may be more than one)

string

Long term equity anticipation securities

Exchange/other

Listed Market

string

The listing market ID

DTN

Long-term debt

float

The amount of long term debt held by a company as of a specific date in Millions (lastADate).

Exchange/other

Maturity Date

MM/DD/YYYY

Date of maturity for a Bond.

DTN

Minimum Tick Size

float

Minimum price movement. (IQFeed 6.1 or newer)

3rd party

NAICS

integer

North American Industry Classification System code 35

3rd party

Next year earnings per share

float

Total amount of earnings per share a company is estimated to accumulate over the next 4 quarters of current fiscal year

Exchange/other

Options Multiple Deliverables

integer

IEOptions only. 1 means they exist, 0 means they do not.

3rd party

Options Premium Multiplier

float

IEOptions only

3rd party

Pay date

MM/DD/YYYY

Date on which a company made its last dividend payment

Exchange/other

PE

float

Price/Earnings ratio

Exchange/other

Percent held by institutions

float

A percentage of outstanding shares held by banks and institutions.

Exchange/other

Precision

integer

Number of decimal digits

DTN

Root Option symbol

string

A space separated list (there may be more than one)

Exchange/other

Security SubType

integer

The security’s SubType code (IQFeed 6.1 or newer).
1=Binary option, 2=weekly option, 3=ETF, []=other

DTN

Security Type

string

The security type code

DTN

Session Close Time

hh:mm:ss

Futures and Future Options Only (IQFeed 6.1 or newer)

3rd party

Session Open Time

hh:mm:ss

Futures and Future Options Only (IQFeed 6.1 or newer)

3rd party

Short Interest

integer

Total number of shares that were sold short and were not repurchased to settle outstanding short market positions. Valid data is only available for some exchanges/sec-types.36

3rd party

SIC

integer

Standard Industrial Classification – a 4-digit federal code that identifies the security’s specific industry.

Exchange/other

Split factor 1

string

A float a space, then MM/DD/YYYY.
For example: '0.5 12/20/2013'

Exchange/other

Split factor 2

string

A float a space, then MM/DD/YYYY.
For example: '0.5 12/20/2013'

Exchange/other

Strike Price

float

IEOptions only

Exchange/other

Symbol

string

The Symbol ID to match with watch request

DTN

Underlying Contract

string

The specific future contract that underlies a continuous future. For example, for @ES# this might be '@ESU19' 37

IQML

Year End Close

float

Price of Year End Close (Equities Only)

DTN

4.3 Interval bars

Interval bars data for one or more symbols can be fetched using the 'intervalbars' action. For example, to fetch the latest 60-second interval bar for the current E-Mini contract:

>> data = IQML('intervalbars', 'Symbol','@ES#')
data =
Symbol: '@ES#'
BarType: 'Complete interval bar from history'
Timestamp: '2018-09-05 12:57:00'
Open: 2887.75
High: 2888.25
Low: 2887.5
Close: 2888.25
CummlativeVolume: 1117565
IntervalVolume: 913
NumberOfTrades: 0

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

Symbol – the requested Symbol.

BarType – typically ‘Complete interval bar from history’, but in some cases might be ‘Complete interval bar from stream’ or ‘Updated interval bar’.

Timestamp – server timestamp (string format) for this interval bar. The timestamp is of the end of the bar, not the beginning.

Open – price at the start of this interval bar.

High – highest price during this interval bar.

Low – lowest price during this interval bar.

Close – price at the end of this interval bar.

CummlativeVolume – total trade volume since start of the current trading day.

IntervalVolume – trade volume during this interval bar.

NumberOfTrades – number of trades during this interval bar. Relevant only when IntervalType is set to 'ticks'/'trades'.

The IntervalType (default: 'secs') and IntervalSize (default: 60) parameters should typically be specified together. Note that IntervalSize must be a positive integer value (i.e. its value cannot be 4.5 or 0). If IntervalType is 'ticks'/'trades', IntervalSize must be 2 or higher. If IntervalType is 'volume', IntervalSize must be 100 or higher. If IntervalType is 'secs', IntervalSize must be any integer between 1-300 (5 minutes), or any multiple of 60 (1 minute) between 300-3600 (1 hour), or 7200 (2 hours).38

We can ask for multiple bars by setting NumOfEvents or MaxItems to a positive integer, resulting in an array of structs in the format above (empty array if no data is available):

>> data = IQML('intervalbars', 'Symbol','@VX#', 'NumOfEvents',4)
data =
4×1 struct array with fields:
Symbol
BarType
...

>> 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
CummlativeVolume: 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.

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
CummlativeVolume
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:39

>> data = IQML('intervalbars', 'Symbol','IBM:GOOG:XXX', 'UseParallel',true)
data =
1×3 cell array
{100×1 struct} {100×1 struct} {0×0 double}

If you have the Professional license of IQML and also Matlab’s Parallel Computing Toolbox, then setting the UseParallel parameter to true (or 1) will process the quotes query for all the specified symbols in parallel (see discussion in §3.6):

>> data = IQML('intervalbars', 'symbols',{'IBM','GOOG','AAPL'}, ...
'UseParallel',1);

The following parameters affect interval bars data queries:

Parameter

Data type

Default

Description

Symbol or Symbols 40

colon or comma-delimited string or cell-array of strings

(none)

Limits the request to the specified symbol(s). Examples:

'@VX#'

'IBM:AAPL:GOOG'

'IBM,AAPL,GOOG'

{'IBM', 'AAPL', 'GOOG'}

This parameter must be set to valid symbol name(s) when NumOfEvents>0. Multiple symbols can be parallelized using the UseParallel parameter (see below).

UseParallel

logical (true/false)

false

If set to true or 1, and if Parallel Computing Toolbox is installed, then querying multiple symbols will be done in parallel (see §3.6; Professional IQML license only).

MaxWorkers

integer

(the current parallel pool size)

Maximal number of parallel workers to use (up to the current pool size) when UseParallel=true

NumOfEvents

integer

Inf

One of:

inf – continuous endless streaming interval bars for specified symbol(s)

N>1 – stream only N interval bars

1 – get only a single interval bar

0 – stop streaming interval bars

-1 – return latest interval bars data while continuing to stream new bars

MaxItems

integer

100

Returns up to the specified number of bars (if available).

MaxDays

integer

1

Max number of trading days to retrieve

IntervalType

string

'secs'

Sets the type of interval size. One of the following values:

's' or 'secs' – time [seconds] (default)

'v' or 'volume' – traded volume

't' or 'ticks' – number of ticks

IntervalSize

integer

60

Size of bars in IntervalType units. Must be ≥1 for secs, ≥2 for ticks, ≥100 for volume.

BeginFilterTime

string

'00:00:00'

Only return bars that begin after this time of day (US Eastern time-zone). Format: 'hhmm', 'hh:mm', 'hhmmss' or 'hh:mm:ss'.

EndFilterTime

string

'23:59:59'

Only return bars that end before this time of day (US Eastern time-zone). Format: 'hhmm', 'hh:mm', 'hhmmss' or 'hh:mm:ss'.

BeginDateTime

integer or string or datetime object

''
(empty string) meaning today at 00:00:00

Only return bars that begin after this date/time (US Eastern time-zone).
Format: Matlab datenum, or 'yyyymmdd hhmmss', or 'yyyy-mm-dd hh:mm:ss' etc.

Timeout

number

5.0

Max number of seconds to wait (0-9000) for data in blocking mode (0 means infinite)

4.4 Market depth (Level 2)

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

4.4.1 Common functionality

The following example fetches Level 2 data for the S&P E-Mini continuous future:

>> data = IQML('marketdepth', 'symbol','@ES#')
data =
10×1 struct array with fields:
Symbol
Bid
Ask
BidSize
AskSize
BidTime
AskDate
AskTime
BidInfoValid
AskInfoValid
BidCount
AskCount
Condition
Condition_Description
ID
ID_Description
BidSizeRatio
AskSizeRatio

The latest data (i.e., state of the market-depth table) is returned as a Matlab struct array, whose elements correspond to the market-depth rows. For example, to see the data for row #3 (i.e., 2 rows below the top-of-book row), you can access array element #3:

>> data(3)
ans =
struct with fields:
Symbol: '@ES#'
Bid: 3878
Ask: 3879.25
BidSize: 86
AskSize: 103
BidTime: '10:51:27.753961'
AskDate: '2021-02-22'
AskTime: '10:51:28.411595'
BidInfoValid: 1
AskInfoValid: 1
BidCount: 44
AskCount: 50
Condition: 52
Condition_Description: 'regular'
ID: 'MD03'
ID_Description: 'Order book row #3'
BidSizeRatio: 0.231182795698925
AskSizeRatio: 0.207243460764588

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:41

>> 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');

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

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!

warningNote: IQFeed often reports an error that the requested symbol was not found, even when this is not the case! This is probably due to a bug on IQFeed’s servers. In such cases, if you are certain that you are indeed subscribed to the corresponding Level 2 data and that it should exist for the requested symbol, simply pause a few seconds and then resubmit your query. Here is a code snippet for retrying the query up to 5 times:

tries = 5;
while tries > 0
try
data = IQML(
'marketdepth', ...);
break % successful fetch – exit the retry loop
catch err
if tries == 1 % failed 5 attempts
rethrow(err);
% give up and rethrow the original error
end
tries = tries – 1;
pause(2.0);
% pause 2 secs before retrying the fetch query
end
end

4.4.2 Detailed quotes in IQFeed 6.2 or newer

If you are using IQFeed client/protocol 6.2 or newer, you can request detailed insight into the various price levels using the Detailed parameter (default: false). When Detailed is set to true or 1, the price levels’ components are reported: the constituent orders (for futures), or the top market maker quotes (for equities):

>> data = IQML('marketdepth', 'Symbol','@ES#', 'Detailed',1, ...
'OutputFormat','table', 'MaxLevels',999)
data =
211×18 table
Symbol Bid Ask BidSize AskSize BidTime ...
______ _______ _______ _______ _______ _________________
'@ES#' 3868.25 3871.5 2 1 '08:01:21.390568'
'@ES#' 3867.75 3871.5 2 1 '07:53:00.399083'
'@ES#' 3867.25 3874.5 1 10 '08:04:28.829508'
'@ES#' 3865.75 3876 1 1 '07:44:45.468775'
'@ES#' 3865.5 3876.25 2 2 '04:06:45.172317'
'@ES#' 3864 3879.25 3 1 '04:06:36.324680'
'@ES#' 3862.25 3880.75 2 1 '03:56:05.241568'
'@ES#' 3862.25 3881 2 2 '04:23:28.283821'
'@ES#' 3860 3881.25 1 10 '03:37:42.519913'
'@ES#' 3860 3882.5 2 2 '03:55:39.598845'
'@ES#' 3860 3887.25 5 1 '21:53:56.596841'

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):43

>> 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

Note that the rows are sorted by descending Bid and ascending Ask, such that BATS may appear as the top price level for Bid (as in the snippet above), but only in row #2 for Ask. This can be understood by viewing the data in table format:

>> data = IQML('marketdepth', 'Symbol','MSFT', 'Detailed',1, ...
'OutputFormat','table', 'MaxLevels',999)
data =
32×18 table
Symbol Bid Ask BidSize AskSize ... BidMMID AskMMID ...
_______ ______ ______ _______ _______ _______ _______
'MSFT' 234.13 234.15 100 227 'BATS' 'NSDQ'
'MSFT' 234.13 234.16 200 100 'NSDQ' 'BATS'
'MSFT' 234.11 234.49 1000 100 'IEXX' 'BOSX'
'MSFT' 225.22 235.44 100 100 'BOSX' 'IEXX'
'MSFT' 225.22 242.38 100 100 'VIRT' 'SSUS'
'MSFT' 225.19 244.63 100 100 'SSUS' 'CINN'
'MSFT' 224.96 245.14 100 100 'CINN' 'VIRT'
'MSFT' 220.74 247.08 100 100 'SGAS' 'SGAS'
'MSFT' 218.41 252.91 1000 1000 'ADAM' 'ADAM'
'MSFT' 218.41 252.91 100 100 'BARD' 'BARD'
'MSFT' 218.41 252.91 100 100 'BMOC' 'BMOC'
'MSFT' 218.41 252.91 100 100 'CSTI' 'CSTI'
...

Also note that for equities, IQFeed returns market width (not depth) data – the top bid/ask row (but not order-book depth) for each market maker that trades the equity.

Using the reported Level 2 data from different market makers enables arbitrage trading: buying a security from market maker A (who offers the lowest Ask price) and selling to market maker B (who offers the highest Bid price).

Note that depending on the time of your query you may receive a different set of market-makers, between 0 and dozens of market maker rows. Market makers who do not have any valid Bid/Ask are not reported by default. If you wish to receive Level 2 quotes even when they are empty (invalid Bid and Ask), set the IncludeEmptyQuotes parameter to true or 1 (default value: false). For example:

>> IQML('marketdepth', 'symbol','MSFT', 'NumOfEvents',70, ...
'IncludeEmptyQuotes'
,true, 'OutputFormat','table')
ans =
67×14 table
Symbol Bid Ask BidSize AskSize BidTime Date ...
______ ______ _______ _______ _______ _________________ ____________
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 129.39 0 600 '18:29:49.000347' '2019-05-01'
'MSFT' 127.91 130.09 100 100 '04:03:41.004392' '2019-05-02'
...

4.4.2 Detailed quotes in IQFeed 6.1 or older

In IQFeed client/protocol 6.1 or older, the Detailed parameter is ignored:

Futures are always reported without detail. In other words, each price level displays the summary of all constituent trade orders for that price, without details of the constituent orders (market depth).

Equities are always reported with detail. In other words, each price level displays the top bid/ask quotes of a different market maker (market width).44

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.45

As noted above, depending on the time of your query you may receive a different set of market-makers, between 0 and dozens of market maker rows. Market makers who do not have any valid Bid/Ask are not reported by default. If you wish to receive Level 2 quotes even when they are empty (invalid Bid and Ask), set the IncludeEmptyQuotes parameter to true or 1 (default value: false). For example:

>> IQML('marketdepth', 'symbol','MSFT', 'NumOfEvents',70, ...
'IncludeEmptyQuotes'
,true, 'OutputFormat','table')
ans =
67×16 table
Symbol Bid Ask BidSize AskSize BidTime Date ...
______ ______ _______ _______ _______ _________________ ____________
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 0 0 0 '99:99:99.000000' '2019-05-01'
'MSFT' 0 129.39 0 600 '18:29:49.000347' '2019-05-01'
'MSFT' 127.91 130.09 100 100 '04:03:41.004392' '2019-05-02'
...

4.4.4 Common parameters

The following parameters affect market depth queries with all IQFeed client versions:

Parameter

Data type

Default

Description

Symbol or Symbols 46

colon or comma-delimited string, or cell-array of strings

(none)

Limits the request to the specified symbol(s). Examples:

'@ES#'

'IBM:AAPL:GOOG'

'IBM,AAPL,GOOG'

{'IBM', 'AAPL', 'GOOG'}

This parameter must be set to valid symbol name(s) when NumOfEvents>0

NumOfEvents

integer

10

One of:

inf – continuous endless streaming Level 2 data for specified symbol(s)

N>1 – only process N incoming quotes

1 – get only a single quote

0 – stop streaming market depth data

-1 – return the latest Level 2 data while continuing to stream new data updates

MaxLevels

integer

5

Max number of price levels (rows) to return

IncludeEmptyQuotes

logical (true/false)

false

If set to true or 1, empty Level 2 quotes (with neither a valid Bid nor valid Ask) will also be returned. By default (false), they will not be.

Detailed

logical (true/false)

false

If set to true or 1, each price level’s components will be reported: trade order IDs for futures; market makers for equities. This parameter is ignored in IQFeed client/protocol 6.1 or older.

Timeout

number

5.0

Max number of seconds to wait (0-9000) for data in blocking mode (0 means infinite)

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

4.5 Greeks, fair value, and implied volatility

Extra data can be fetched (calculated) for asset options using the 'greeks' action:

Greeks (Delta, Vega, Theta, Rho, Gamma etc.)

Fair value for the derivative and the difference vs. actual trading price

Implied volatility based on the fair vs. trading prices

>> data = IQML('greeks', 'symbol','IBM1814L116')
data =
Symbol: 'IBM1814L116'
Asset_Name: 'IBM DEC 2018 C 116.00'
Strike_Price: 116
Expiration_Date: '12/14/2018'
Days_To_Expiration: 30
Inferred_Asset_Side: 'Call'
Underlying_Symbol: 'IBM'
Underlying_Asset_Name: 'INTERNATIONAL BUSINESS MACHINE'
Underlying_Spot: 121.3
Underlying_Historic_Volatility: 37.1
Assumed_Risk_Free_Rate: 0
Assumed_Dividend_Yield: 0
Asset_Fair_Value: 8.1193
Asset_Latest_Price: 7.05
Asset_Price_Diff: 1.0693
Implied_Volatility: 0.28242
Volatility_Used_By_Greeks: 0.371
Delta: 0.68197
Vega: 0.12404
Theta: -0.076697
Rho: 6.1318
CRho: 6.7992
Omega: 10.189
Lambda: 10.189
Gamma: 0.027646
Vanna: -0.3527
Charm: 0.0021809
Vomma: 5.8043
Veta: 2.4262
Speed: -0.0012419
Zomma: -0.061581
Color: -0.00038078
Ultima: -45.238
Annual_Factor_Used: 365
This_Asset_Latest_Quote: [1×1 struct]
Underlying_Latest_Quote: [1×1 struct]
This_Asset_Fundamentals: [1×1 struct]
Underlying_Fundamentals: [1×1 struct]

The reported Matlab struct contains a few fields with basic information on the derivative and its underlying, followed by fair-value, implied volatility and Greek values.

At the bottom of the returned data-struct, four sub-structs provide direct access to the latest quotes data (§4.1, for example data.This_Asset_Latest_Quote.Total_Volume) and fundamenta data (§4.2, for example data.Underlying_Fundamentals.Average_Volume), for both the option asset and its underlying stock.

Note that the returned quotes data is subject to the Fields parameter value that was set in the most recent quotes data query (see §4.2). If the most recent Fields value does not include pricing data (Most_Recent_Trade, Bid, Ask, Last, or Close fields), then some returned data fields (for example Asset_Price_Diff and Implied_Volatility) will be empty.

The following Greek values are reported by IQML:

Field

Symbol

Derivative order

Definition

Description

Delta

Δ

1

∂V/∂S

Sensitivity of fair value to changes in the underlying asset’s spot price

Vega

ν

1

∂V/∂σ

Sensitivity of fair value to changes in the underlying asset’s volatility; also called Kappa

Theta

Θ

1

-∂V/∂τ

Sensitivity of fair value to maturity time (decay)

Rho

ρ

1

∂V/∂r

Sensitivity of fair value to risk-free rate

CRho

-

1

∂V/∂b

Sensitivity of fair value to the carry-rate

Omega, Lambda

Ω
λ

1

Δ × S/V

% change in fair value due to a 1% change in the underlying asset price (these are synonym fields, both are reported for convenience)

Gamma

Γ

2

∂Δ/∂S

Sensitivity of Delta to changes in the underlying asset’s spot price

Vanna

-

2

∂Δ/∂σ

Sensitivity of Delta to changes in the underlying asset’s volatility

Charm

-

2

-∂Δ/∂τ

Sensitivity of Delta to maturity time (decay)

Vomma

-

2

ν/∂σ

Sensitivity of Vega to changes in underlying asset’s volatility; also sometimes called Volga

Veta

-

2

ν/∂τ

Sensitivity of Vega to the maturity time

Speed

-

3

∂Γ/∂S

Sensitivity of Gamma to changes in the underlying asset’s spot price

Zomma

-

3

∂Γ/∂σ

Sensitivity of Gamma to changes in the underlying asset’s volatility

Color

-

3

∂Γ/∂τ

Sensitivity of Gamma to maturity time (decay)

Ultima

-

3

3V/∂σ3

Sensitivity of Vomma (Volga) to changes in the underlying asset’s volatility

You can request data for multiple symbols at the same time, in a single IQML command, by specifying the symbols using a colon-delimited string or a cell-array. For example:

>> data = IQML('greeks', 'symbols',{'IBM1814L116','IBM1814X116'});

>> data = IQML('greeks', 'symbols','IBM1814L116:IBM1814X116'); % equivalent

The result will be an array of Matlab structs that correspond to the requested symbols:

data =
2×1 struct array with fields:
Symbol
Asset_Name
Strike_Price
...

If you have Matlab’s Parallel Computing Toolbox, set the UseParallel parameter to true (or 1) to process the Greeks query for the specified symbols in parallel (see §3.6):

>> data = IQML('greeks', 'symbols',{'IBM1814L116','IBM1814X116'}, ...
'UseParallel',true);

warningNotes:

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.

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.

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.

The calculations assume vanilla European-style options using Black-Scholes-Merton’s model.47 Using IQML’s calculations with other derivatives (American/ Asian/barrier/exotic options etc.) may result in incorrect/misleading values.

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.

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).

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.

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);48 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.49 In addition, some sources apparently have buggy math implementations.50 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.51 Unfortunately, IQFeed’s standalone Option Chains utility reports different values. IQML adheres to the core math formulae52 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.

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).53 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. LIBOR54 or T-bill55).

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.

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

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

The following parameters affect Greeks data queries:

Parameter

Data type

Default

Description

Symbol or Symbols 56

colon-delimited string, or cell-array of strings

(none)

Limits the query to the specified symbol(s). Examples:

'GOOG1816K1000'

'IBM1814L116:GOOG1816K1000'

{'IBM1814L116', 'GOOG1816K1000'}

This parameter must be set to valid symbol name(s). Multiple symbols can be parallelized using the UseParallel parameter (see below).

UseParallel

logical (true/false)

false

If set to true or 1, and if Parallel Computing Toolbox is installed, then querying multiple symbols will be done in parallel (see §3.6).

MaxWorkers

integer

(current parallel pool size)

Max number of parallel workers to use (up to the current pool size) when UseParallel=1

UnderlyingSymbol

string

'' (i.e. taken from the contract name)

Symbol of the derivative’s underlying asset

Side

string

'' (i.e. taken from the contract name)

Either 'Call' or 'Put'

HistoricVolatility

number

-1 (i.e. taken from the underlying asset’s reported historic volatility)

Value that represents the underlying’s price volatility (in percent). 1.0 means 1%;
-1 means a dynamic value based on the underlying asset’s reported historic volatility.

UseImpliedVolatility

logical (true/false)

false

If set to true or 1, the Implied_Volatility (not HistoricVolatility) will be used for Greeks

RiskFreeRate

number

0.0

Domestic risk-free rate
Specified in percent; 1.0 means 1%.

DividendsYield

number

0.0

Underlying stock’s dividends yield, or the foreign currency risk-free (carry) rate.
Specified in percent; 1.0 means 1%.

DaysToExpiration

number

-1 (i.e. taken from the contract’s expiration date)

Number of days until the contract expires (matures)

AnnualFactor

number

365

The computed Theta, Charm, Veta and Color values are divided by this factor before being reported. Typical values are 365, 364, 360, 253, 252, 12, 4 or 1.

warningNote: The Greeks functionality is only available in the Professional and trial IQML licenses, not in the Standard license.

4.6 Market summary data and scanner

All the queries described so far in this chapter return data for individually-specified Symbols. We can retrieve a complete market snapshot of all traded securities of a specific SecType and Exchange, using a 'summary' query:

>> data = IQML('summary') % latest 5-minute data for all NYSE equities
data =
4749×1 struct array with fields:
Symbol
Exchange
Type
Last
TradeSize
TradedMarket
TradeDate
TradeTime
Open
High
Low
Close
...
(total of 28 data fields)

>> data(1)
ans =
struct with fields:
Symbol: 'A'
Exchange: 7
Type: 1
Last: 72.5315
TradeSize: 5
TradedMarket: 5
TradeDate: 20190711
TradeTime: 103502
Open: 73.77
High: 73.78
Low: 72.5315
Close: 73.37
Bid: 72.51
BidMarket: 18
BidSize: 200
Ask: 72.54
AskMarket: 5
AskSize: 100
Volume: 257497
PDayVolume: 1785225
UpVolume: 84799
DownVolume: 80276
NeutralVolume: 92422
TradeCount: 2371
UpTrades: 733
DownTrades: 832
NeutralTrades: 806
VWAP: 73.1309

This query shows that 4749 equities are currently trading on NYSE.57 This data is daily (i.e., the cummulative day’s Open/High/Low/Volume etc.), and is updated on IQFeed’s servers every 5 minutes. DTN says that “the timing of the snapshot is not guaranteed, but data will be gathered every 5 minutes”. Therefore, you should assume for safety that the data is up to 5 minutes old. To get the latest data, use real-time snapshot (§4.1) and fundamental (§4.2) queries, or streaming quotes (§6.1).

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');

>> 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).

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, Strike.58 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);59 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).

warningMarket 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.

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 symbols60 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

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.61 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'

Date

Latest (intra-day) or
historic (end of day)

Only latest (updated every 5 minutes during the trading day)

Filter type

Any Matlab function of any combination of data fields

Only one of 13 predefined 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)

IQFeed connection

Requires an active IQFeed connection (IQConnect login)

Does not require an active IQFeed connection

Result data fields

Up to 35 fields

Up to 47 fields

Only 11-13 data fields

Result records

All securities that fit the parameters (many thousands)

Only up to the top 50 securities

Data refresh time

Every 5 minutes during the trading day 62

The following parameters affect market summary data queries:

Parameter

Data type

Default

Description

DataType

string

'snapshot'

Either 'snapshot', 'fundamental' or 'top'

Exchange

string

'NYSE'

One of the markets listed in §8.3

SecType

string

'Equity'

One of the security types listed in §8.4. SecType is ignored when DataType='top'

Date

integer or string or datetime object

now

(latest available data)

Date for which to fetch the end-of-day data. Examples:

737089 (Matlab datenum format)

datetime('Jan 29, 2018')

20180129 (yyyymmdd format)

'20180129'

'2018/01/29'

'2018-01-29'

Date is ignored when DataType='top'

ReportEmptyFields

logical

false or 0

If true, then irrelevant data fields (which contain empty [] values for all securities) are reported; if false (default), they are not

Filter

string

'active'

When DataType='top', one of:63

'active' – most active (highest volume)

'gainer' highest positive price $ change

'loser' – lowest negative price $ change

'% gainer' highest pos. price % change

'% loser' – lowest neg. price % change

'52 week high' – daily high > 52-week

'52 week low' – daily low < 52-week

'volume up' – compared to previous

'volume spike' – compared to average

'VWAP up' – last price > VWAP

'VWAP down' – last price < VWAP

'VWAP % up' – % above VWAP

'VWAP % down' – % below VWAP

string or cell-array of strings

{}

When DataType='snapshot','fundamental':

Zero or more filter criteria (condition strings) – Matlab expression(s) involving the reported data fields, which result in a logical (true/false) value. Examples:

'MaturityDate > 20241231'

'MarketCap > 5000 & PeRatio < 9'

{'MarketCap > 5000', 'Beta >= 1.2'}

Timeout

number

300

Max number of seconds to wait for incoming data (0-9000, where 0 means infinite)

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


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.

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).

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.

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

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.

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

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.

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 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 calculation 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#).

38 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

39 The UseParallel parameter is set here in order to avoid the run-time error of “Symbol ‘XXX’ was not found”

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

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

42 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.

43 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).

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).

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

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

47 Support for American options is planned in a future release of IQML; there are no current plans to support Asian/exotic options.

48 Matlab’s Financial Toolbox, NAG and Maple report annualized values; for annual values in IQML, set the AnnualFactor to 1.

49 For example, the reported Color value is negative in NAG compared to IQML and Maple.

50 This does not imply that there are no calculation bugs in IQML’s implementation; the Greeks calculation is not trivial.

51 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

52 John Hull, Options, Futures, and Other Derivatives (ISBN 9780134472089); https://en.wikipedia.org/wiki/Greeks_(finance)

53 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.

54 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.

55 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.

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

57 This query was run on July 11, 2019 at 11am EDT

58 Additional fields (for example, Open, High, Low) are missing when the query is run early in the day, before start of trading.

59 The EstEps field was reported by IQFeed in some runs but not others; the reason for this is unclear.

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

61 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

62 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

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