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 »NEW IQFEED FORUMS »Data Questions »How do I get real-time options greeks using web sockets?
Author Topic: How do I get real-time options greeks using web sockets? (8 messages, Page 1 of 1)

gnosis
-Interested User-
Posts: 3
Joined: Feb 19, 2021


Posted: Feb 20, 2021 12:11 PM          Msg. 1 of 8
Hi,

I am able to get the real-time options data, like the last price, bid, and ask, but can't seem to find a way get the greeks using web sockets. Can someone please help?

Thanks

-Irfan

altmany
-Interested User-
Posts: 73
Joined: Jul 30, 2018

IQML - IQFeed-MATLAB connector


Posted: Feb 20, 2021 12:36 PM          Msg. 2 of 8
I do not believe that IQFeed has a dedicated query for requesting greeks, nor are the greeks reported by IQFeed in the standard market-data query.

Some of the software that connects to IQFeed (for example, my IQML connector for Matlab) calculate the greeks internally and report them to the user. If you are developing your own program, you can calculate the greeks using the information reported for the options and their underlying asset, and the standard Mathematical definitions: https://en.wikipedia.org/wiki/Greeks_(finance).

Yair Altman
IQML - IQFeed-MATLAB connector
https://UndocumentedMatlab.com/IQML

I am not a DTN employee; my post reflects my personal opinion

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

Right Here & Now


Posted: Feb 20, 2021 03:24 PM          Msg. 3 of 8
hi altmany:

Quote: my IQML connector for Matlab) calculate the greeks internally and report them to the user


What do you use as a source of interest rate?

----

https://github.com/rburkholder/trade-frame/tree/master/lib/TFIQFeed
Edited by stargrazer on Feb 20, 2021 at 03:25 PM

gnosis
-Interested User-
Posts: 3
Joined: Feb 19, 2021


Posted: Feb 20, 2021 04:41 PM          Msg. 4 of 8
The delta can be calculated using the following five values:

1. Stock Price
2. Option Strike Price
3. Time to Expiration
4. Risk-Free Rate
5. Implied Volatility

I am not sure how to get #4 and #5.

Does anyone know?

Thanks

-Irfan

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

Right Here & Now


Posted: Feb 20, 2021 05:23 PM          Msg. 5 of 8

altmany
-Interested User-
Posts: 73
Joined: Jul 30, 2018

IQML - IQFeed-MATLAB connector


Posted: Feb 21, 2021 02:48 AM          Msg. 6 of 8
For the volatility value you can use the Historical_Volatility field from the underlying asset's fundamental data. DTN's official description of this field is: “30-trading day volatility, calculated using Black-Scholes”. Apparently, the actual calculation (which is updated once a day, after midnight) for options 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(close(i+1)/close(i)))
, rounded to the nearest 0.01. For futures, the calculation is similar but apparently based on 90 (not 30) values. When a contract is newly-listed, fewer values are used, with a minimum of 4 values.

You can also calculate the historic volatility yourself, using historic prices of the underlying asset (use IQFeed's historic bars query for this). In this case, you can use a different number of historic prices for the calculation, ignore outlier values etc., without relying on DTN's built-in opaque calculation.

As an alternative to using the historic volatility, you can also calculate the implied volatility using Black-Scholes. This will typically be easier for European derivatives than for American/Asian/exotic ones.

In my IQML connector I enable the user to choose whether to use IQFeed's built-in Historical_Volatility field, or a calculated Implied Volatility, or a fixed value.

For the risk-free rate, you can either set a fixed rate (in the current financial situation, a simple value of 0 may be close enough for practical purposes), or use the current value of assets such as LIBOR/IRX.XO.

See http://forums.iqfeed.net/index.cfm?page=topic&topicID=4387 for some detailed discussion of these matters.


Yair Altman
IQML - IQFeed-MATLAB connector
https://UndocumentedMatlab.com/IQML

I am not a DTN employee; my post reflects my personal opinion

Edited by altmany on Feb 21, 2021 at 02:58 AM

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


Posted: Feb 22, 2021 07:12 AM          Msg. 7 of 8
For the record, altmany is correct that the IQFeed API will not give you the Greeks correctly; you will have to calculate them yourself using data that it does provide.

The "Fundamental Message" and "Update/Summary Messages" pages of the online IQFeed help will list of all data points that are available via the IQFeed API.

Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist

gnosis
-Interested User-
Posts: 3
Joined: Feb 19, 2021


Posted: Feb 25, 2021 09:35 AM          Msg. 8 of 8
Thank you all.

It would be great to provide greeks along with other options data.

I have put in a wishlist request for a future release.

-Irfan
 

 

Time: Tue March 18, 2025 3:56 PM CFBB v1.2.0 12 ms.
© AderSoftware 2002-2003