Join the 80,000 other DTN customers who enjoy the fastest, most reliable data available. There is no better value than DTN!

(Move your cursor to this area to pause scrolling)




"Very impressed with the quality of your feed - ******* is a real donkey in comparison." - Comment from A.C. via Email
"If you are serious about your trading I would not rely on IB data for serious daytrading. Took me a while to justify the cost of IQ Feed and in the end, it's just a 2 point stop on ES. Better safe than sorry" - Comment from Public Forum
"I like you guys better than *******...much more stable and a whole lot fewer issues." - Comment from Philip
"As a past ******* customer(and not a happy one), IQ Feed by DTN is a much better and cheaper product with great customer support. I have had no problems at all since switching over." - Comment from Public Forum
"Version 4.0.0.2 has been working well for me and I appreciate that it is now a much tighter client to work with. I feel I can go to press with my own application and rely on a stable platform" - Comment from David in IA.
"You are much better than lawyers or the phone company because you answer the phone when I call! I just love your customer service." - Comment from Isreal
"I've been using IQFeed 4 in a multi-threaded situation for the last week or two on 2600 symbols or so with 100 simultaneous daily charts, and I have had 100% responsiveness." - Comment from Scott
"I've been using Neoticker RT with IQFeed for two months, and I'm very happy with both of the products (I've had IQFeed for two years with very few complaints). The service from both companies is exceptional." - Comment from Public Forum
"It’s so nice to be working with real professionals!" - Comment from Len
"I ran your IQFeed DDE vs. my broker vs. a level II window for some slow-moving options. I would see the level II quote change, then your feed update instantaneously. My broker's DDE, however, would take as much as 30 seconds to update. I am not chasing milliseconds, but half a minute is unacceptable." - Comment from Rob
Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »IQFeed Developer »IQFeed Developer Support »Full options chain command?
Author Topic: Full options chain command? (11 messages, Page 1 of 1)

andrewm
-Interested User-
Posts: 45
Joined: Feb 23, 2015


Posted: May 4, 2021 05:33 PM          Msg. 1 of 11
A command to get a current snapshot of the full options chain for one expiration date like yahoo shows would be nice:

https://finance.yahoo.com/quote/AAPL/options?p=AAPL

They give:
Contract Name
Last Trade Date
Strike
Last Price
Bid
Ask
Change
% Change
Volume
Open Interest
implied vol <- probably not needed

Currently with IQ Feed I think you have to query the whole chain, then iterate over it, subscribing and unsubscribing to each symbol. Right?

mk
-Interested User-
Posts: 9
Joined: Jan 1, 2022


Posted: Jan 1, 2022 08:50 AM          Msg. 2 of 11
No responses since May. Did you figure out how to do this? I have the same exact question.

andrewm
-Interested User-
Posts: 45
Joined: Feb 23, 2015


Posted: Jan 1, 2022 09:33 AM          Msg. 3 of 11
No reply.



I believe it's not supported

stargrazer
-DTN Guru-
Posts: 296
Joined: Jun 13, 2005

Right Here & Now


Posted: Jan 1, 2022 03:26 PM          Msg. 4 of 11
Quote: Currently with IQ Feed I think you have to query the whole chain, then iterate over it, subscribing and unsubscribing to each symbol. Right?

That is what I do.
Edited by stargrazer on Jan 1, 2022 at 03:27 PM

DTN_Gary_Stephen
-DTN Guru-
Posts: 281
Joined: Jul 3, 2019


Posted: Jan 3, 2022 01:51 PM          Msg. 5 of 11
Quote: Currently with IQ Feed I think you have to query the whole chain, then iterate over it, subscribing and unsubscribing to each symbol. Right?


What you can do is request one of the market summary reports. There are three different reports which will give you two different sets of data, for all symbols of a certain type on a certain exchange. You can't limit it to just one root symbol, but you can get a comprehensive report and then pick out the symbols you want. This is a lot faster and more efficient than the process you described it.

5MS, (symbol type), (exchange ID)
or
EDS, (symbol type), (exchange ID), (date in YYYYMMDD format)

Symbol,Exchange,Type,Last,TradeSize,TradedMarket,TradeDate,TradeTime, Open,High,Low,Close,Bid,BidMarket,BidSize,Ask,AskMarket,AskSize,Volume, PDayVolume,UpVolume,DownVolume,NeutralVolume,TradeCount,UpTrades, DownTrades,NeutralTrades,VWAP,MutualDiv,SevenDayYield,OpenInterest, Settlement,SettlementDate,ExpirationDate,Strike

5MS Is a 5-minute report, while EDS is an end-of-day report. So pick the one that matches the scope you want. There is also an end of day fundamental data report:

FDS, (symbol type), (exchange ID), (date in YYYYMMDD format)

Symbol,Description,PeRatio,AvgVolume,DivYield,DivAmount,DivRate,PayDate, ExDivDate,CurrentEps,EstEps,SIC,Precision,Display,GrowthPercent,FiscalYearEnd, Volatility,ListedMarket,MaturityDate,OptionRoots,CouponRate,InstitutionalPercent, YearEndClose,Beta,LEAPs,WRAPs,Assets,Liabilities,BalanceSheetDate, LongTermDebt,CommonSharesOutstanding,MarketCap,52WeekHigh, 52WeekHighDate,52WeekLow,52WeekLowDate,CalHigh,CalHighDate,CalLow, CalLowDate,Expiration,LastSplit,LastSplitDate,PrevSplit,PrevSplitDate,NAICS,ShortInterest

I believe all the fields you asked about will be in one of those two reports.

The commands SST and SLM, respectively, will give you a list of all the symbol types and exchange ideas you would want to use. The exchange ID, make sure you use the Group ID, Not the number of the beginning of the line:

1,NGM,Nasdaq Global Market,5,NASDAQ,

For NGM you would use 5, because it's a part of the NASDAQ group of exchanges.

You can also get the symbol type and exchange codes from a specific symbol via the SBF command (note reversed order):

SBF,s,QQQ2216I383
QQQ2216I383,14,2,QQQ SEP 2022 C 383.00,

I hope that helps with your performance. Let me know if this does not answer your question or if you have any other questions on this!

Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist

ChainsawDR
-Interested User-
Posts: 29
Joined: Jan 4, 2019


Posted: Nov 22, 2022 09:46 AM          Msg. 6 of 11
Hi Gary,

I came across this thread while trying to obtain latest bid/ask offers on equity options (ideally a snapshot of latest bid/ask on all option chains for all S&P500 component stocks). I've tried looking into the 5MS report but haven't been able to retrieve equity options data - do you have an example 5MS request please that would return a list of options with bid/ask?

Currently a request for "5MS,2,5" (which is I think '2,IEOPTION,Index/Equity Option,' & '5,NASDAQ,Nasdaq,5,NASDAQ') is returning a 'E,50007,No file available' error.

Otherwise, if there isn't an overall report that shows option chains I'll likely proceed down the OP's original path of retrieving the whole chain for various stock tickers, then iterate over them - subscribing and unsubscribing to each option.

Many thanks in advance

ChainsawDR

DTN_Gary_Stephen
-DTN Guru-
Posts: 281
Joined: Jul 3, 2019


Posted: Nov 22, 2022 10:21 AM          Msg. 7 of 11
Equity options are listed on the OPRA exchange, not NASDAQ (even if the root equity symbol is NASDAQ). The command you're looking for is:

5MS,2,14

14 being the OPRA exchange group ID. But you must also be subscribed to the OPRA exchange, and have the "RT Options" product, or you will get "E,50007,No file available" reply again.

"E,50007,No file available" can mean either "this combination of symbol type and exchange group don't exist", or "you do not have the necessary subscriptions to view this report." 5MS,2,5 is the former; 5MS,2,14 would be the latter if you are not subscribed to OPRA.

Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist

andrewm
-Interested User-
Posts: 45
Joined: Feb 23, 2015


Posted: Nov 22, 2022 11:02 AM          Msg. 8 of 11
Here's a couple python files that will collect the OPRA snapshots and compress them to 7z format. I put this in a windows scheduled task. You can replace opra.py values with other markets. I collect several.

opra.py:


from main import start
from datetime import datetime

print('starting opra at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\opra'
TEMP_FILE = 'c:\\temp\\opra.csv'
COMPRESSED_FILE = "opra.7z"
SECURITY_TYPE = 2 # equity options
MARKET = 14 # OPRA
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)


main.py:


import shutil
import socket
from datetime import datetime
from pathlib import Path
import subprocess
from os import makedirs

ZIP_EXE = 'c:\\util\\7z\\7z.exe'
HOST = '127.0.0.1'
PORT = 9100

def getDirectory(data_path):
today = datetime.today().strftime('%Y-%m-%d')
todaysPath = data_path + '\\' + today
Path(todaysPath).mkdir(parents=True, exist_ok=True)
return todaysPath

def get7zFilename():
now = datetime.now()
print("now =", now)
today = datetime.today().strftime('%Y-%m-%d')
dt_string = today + "_" + now.strftime("%H%M")
print("date and time =", dt_string)
filename = dt_string + ".7z";
print("filename = "+filename);
return filename

def start(data_path, temp_file, compressed_file, security_type, market):
print('start sec type ' + str(security_type) + ' market ' + str(market))
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
s.sendall(b'S,SET PROTOCOL,6.2\n')
s.sendall(bytes('5MS,' + str(security_type) + "," + str(market) + '\n', 'ascii'))
f = s.makefile()
line = f.readline()
# for line in f.readline():
print("line="+repr(line))
line = ''
outfile = open(temp_file, "w");
while not line.startswith('!ENDMSG!'):
line = f.readline()
outfile.write(line)
#print("line=" + repr(line))
outfile.close()
f.close()
dir = getDirectory(data_path)
fn = dir + "\\" + get7zFilename()
subprocess.call([ZIP_EXE, 'a', fn, temp_file])
# shutil.copy2(fn, dir + "\\" + compressed_file)
print("done")
# print('Received', repr(data))

ChainsawDR
-Interested User-
Posts: 29
Joined: Jan 4, 2019


Posted: Nov 22, 2022 01:31 PM          Msg. 9 of 11
Wow! Thank you both very much for your help!

@AndrewM - I was expecting to spend the next ~2 days chewing through this problem and you generously posting your code has just solved it completely. Thank you so much

andrewm
-Interested User-
Posts: 45
Joined: Feb 23, 2015


Posted: Nov 22, 2022 02:38 PM          Msg. 10 of 11
You're welcome. Glad it helps. It's a little rough around the edges. getDirectory should be made functional instead of having the side effect of also creating the dir. Some logging would be nice, etc. But it works...

andrewm
-Interested User-
Posts: 45
Joined: Feb 23, 2015


Posted: Nov 22, 2022 03:18 PM          Msg. 11 of 11
Here's the others I collect:

cboe_index.py:

from main import start
from datetime import datetime

print('starting cboe index at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\cboe_index'
TEMP_FILE = 'c:\\temp\\cboe_index.csv'
COMPRESSED_FILE = "cboe_index.7z"
SECURITY_TYPE = 6 # CBOE
MARKET = 13 # index
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)



cbot_futures.py

from main import start
from datetime import datetime

print('starting cbot futures at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\cbot_futures'
TEMP_FILE = 'c:\\temp\\cbot_futures.csv'
COMPRESSED_FILE = "cbot_futures.7z"
SECURITY_TYPE = 8 # futures
MARKET = 30 # CBOT
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)


cme_futures.py

from main import start
from datetime import datetime

print('starting cme futures at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\cme_futures'
TEMP_FILE = 'c:\\temp\\cme_futures.csv'
COMPRESSED_FILE = "cme_futures.7z"
SECURITY_TYPE = 8 # futures
MARKET = 34 # CME
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)



cme_options.py

from main import start
from datetime import datetime

print('starting cme options at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\cme_options'
TEMP_FILE = 'c:\\temp\\cme_options.csv'
COMPRESSED_FILE = "cme_options.7z"
SECURITY_TYPE = 9 # options
MARKET = 34 # CME
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)


nasdaq_equities.py

from main import start
from datetime import datetime

print('starting nasdaq at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\nasdaq'
TEMP_FILE = 'c:\\temp\\nasdaq.csv'
COMPRESSED_FILE = "nasdaq.7z"
SECURITY_TYPE = 1 # equities
MARKET = 5 # NASDAQ
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)


nyse_equities.py

from main import start
from datetime import datetime

print('starting nyse at ' + str(datetime.now()))
DATA_PATH = 'c:\\data\\nyse'
TEMP_FILE = 'c:\\temp\\nyse.csv'
COMPRESSED_FILE = "nyse.7z"
SECURITY_TYPE = 1 # stock
MARKET = 7 # NYSE
start(DATA_PATH, TEMP_FILE, COMPRESSED_FILE, SECURITY_TYPE, MARKET)
 

 

Time: Sat December 3, 2022 5:34 AM CFBB v1.2.0 15 ms.
© AderSoftware 2002-2003