EOD Implied volatility of equity stock options
I tried to follow the tutorial https://developers.thomsonreuters.com/thomson-reuters-tick-history-trth/thomson-reuters-tick-history-trth-rest-api/learning?content=11268&type=learning_material_item in python and managed to retrieve the field list for EOD data but i don't see any fields to retrieve the implied volatility.
Is is possible ?
Best Answer
-
Refer to DATA DICTIONARY - CUSTOM REPORTING FOR TICK HISTORY 11.3, the implied volatility fields are available in the Tick History Time and Sales report template.
- Quote - Ask Implied Volatility
- Quote - Bid Implied Volatility
- Quote - Implied Volatility
- Trade - Implied Volatility
{
"Code": "THT.Quote - Ask Implied Volatility",
"Name": "Quote - Ask Implied Volatility",
"Description": "Expected ask volatility that the market is pricing into the option, where ask volatility is the measure of the rate and magnitude of the change in the underlying instrument's ask price",
"FormatType": "Number",
"FieldGroup": "Quote"
},
{
"Code": "THT.Quote - Bid Implied Volatility",
"Name": "Quote - Bid Implied Volatility",
"Description": "Expected bid volatility that the market is pricing into the option, where bid volatility is the measure of the rate and magnitude of the change in the underlying instrument's bid price",
"FormatType": "Number",
"FieldGroup": "Quote"
},
{
"Code": "THT.Quote - Implied Volatility",
"Name": "Quote - Implied Volatility",
"Description": "Expected volatility that the market is pricing into the option, where volatility is the measure of the rate and magnitude of the change in the underlying instrument's price",
"FormatType": "Number",
"FieldGroup": "Quote"
},
{
"Code": "THT.Trade - Implied Volatility",
"Name": "Trade - Implied Volatility",
"Description": "Expected volatility that the market is pricing into the option, where volatility is the measure of the rate and magnitude of the change in the underlying instrument's price",
"FormatType": "Number",
"FieldGroup": "Trade"
},To extract Tick History Time and Sales data, please refer to REST API Tutorial 4: On Demand tick data extraction.
0
Answers
-
@jirapongse.phuriphanvichai
Thank you, but it seems a little inconvenient to go though the tick data endpoint when i just need the EOD data. I used to use the EOD Realtime on TRTH v1 via the GUI, is there an equivalent here to retrieve the EOD needed to build an equity volatility surface on a stock (for each option ric, i need the bid/ask close, settlement price and the volatility at the end of day) ?
Here is the python code i have at this moment (i removed my password and username):
import requests, json
from requests import Request, Session
from collections import OrderedDict
import pprint as pp
import pandas as pd
class TRTH:
def __init__(self):
self._auth_token = self.get_auth_token()
def get_auth_token(self):
urlGetToken = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken'
header = {'Content-Type': 'application/json'}
body = json.dumps({'Credentials':{'Password':'#######','Username':'#######'}})
response = requests.post(urlGetToken, body, headers=header)
return response.json()['value']
def resolve_historical_optionchain(self, chain, start_date, end_date):
url = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Search/HistoricalChainResolution'
header = {'Content-Type': 'application/json', 'Authorization': 'Token ' + self._auth_token }
body = json.dumps({'Request' : {'ChainRics': [chain], 'Range':{'Start':start_date, 'End':end_date} } } )
response = requests.post(url, body, headers=header).json()['value'][0]['Constituents']
output_rics = [{'Identifier':ric['Identifier'], 'IdentifierType':ric['IdentifierType']} for ric in response]
return output_rics[0], output_rics[1:]
def retrieve_historical_ref_data_fields(self):
url = "https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/GetValidContentFieldTypes(ReportTemplateType=ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ReportTemplateTypes'HistoricalReference')"
header = {'Content-Type': 'application/json', 'Authorization': 'Token ' + self._auth_token }
body = json.dumps({})
response = requests.get(url, body, headers=header).json()['value']
return response
#https://developers.thomsonreuters.com/thomson-reuters-tick-history-trth/thomson-reuters-tick-history-trth-rest-api/learning?content=13675&type=learning_material_item
def retrieve_historical_ref_data(self, rics, fields, start_date, end_date):
url = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/Extract'
header = {'Content-Type': 'application/json', 'Authorization': 'Token ' + self._auth_token }
body = json.dumps(
{
"ExtractionRequest": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.HistoricalReferenceExtractionRequest",
"ContentFieldNames": fields,
"IdentifierList": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": rics,
"ValidationOptions": {"AllowHistoricalInstruments": True},
"UseUserPreferencesForValidationOptions": False
},
"Condition": {
"ReportDateRangeType": "Range",
"QueryStartDate": start_date,
"QueryEndDate": end_date
}
}
}
)
response = requests.post(url, body, headers=header)
try:
response = response.json()['value']
except KeyError:
print(response, response.text)
return response
def retrieve_historical_eod_data_fields(self):
url = "https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/GetValidContentFieldTypes(ReportTemplateType=ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ReportTemplateTypes'ElektronTimeseries')"
header = {'Content-Type': 'application/json', 'Authorization': 'Token ' + self._auth_token }
body = json.dumps({})
response = requests.get(url, body, headers=header).json()['value']
return response
trth = TRTH()
date = '2018-02-27'
underlying_ric, options_rics = trth.resolve_historical_optionchain(chain='0#DTEGn*.EX', start_date=date, end_date=date)
pp.pprint(underlying_ric)
#pp.pprint(options_rics)
#print(pd.DataFrame(data=underlying_ric).head())
#pp.pprint(trth.retrieve_historical_ref_data_fields())
ref_data = trth.retrieve_historical_ref_data(rics=options_rics, fields=['Strike Price', 'Expiration Date', 'Exercise Style', 'Put Call Flag'], start_date=date, end_date=date)
print(pd.DataFrame(data=ref_data).head())
pp.pprint(trth.retrieve_historical_eod_data_fields())
### Retrieve bid, ask, settlement price, implied vol at EOD for each option rics of the option chain0 -
The DATA DICTIONARY - CUSTOM REPORTING FOR TICK HISTORY 11.3 is your best tool to determine what templates will deliver what data fields. If you filter the field name column to display only those that contain the word Volatility, you will see that only the Tick History Time and Sales template delivers what you need. You will therefore have to make a separate request for that.
0 -
@Christiaan Meihsl I haven't got the time to implement the data retrieval needed to build historical equity volatility surface. I can mark an answer as accepted, but I assume a client might be interested in a sample code that shows how to do that, but right now i retrieve manually the data using the TRTH v1 csv extraction.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛