Hello @vlad.dimanshteyn ,
The response should be in UTC.
Please see this previous discussion thread for more information on EDAPI usage, and this external discussion for more on converting to the required time zone.
Hope this information helps
If I understand the requirement correctly, would it be easier to get all ticks and therefore the last price tick, per day?
ek.get_timeseries('SPXWe202240200.U', start_date = '2022-05-12', end_date = '2022-05-13',interval='tick')
result:
however, is this what you are looking for or something different?
This is great Zoya. May be very time consuming. Tell me what you think. I'm trying to get the last trading price/time for all options in SPX option chain. In addition, at the time of those trades I need the price for underlying (SPX) so I can calculate volatility surface. So I'm getting option chain using:
option_chain, err = ek.get_data('0#SPXW*.U', ['TRADE_DATE', 'ACVOL_1'])
then getting rid of some options based on volume and get the last trading price using:
option_data_block, err =ek.get_data(instruments=option_chain['Instrument'].tolist()[lower_limit:upper_limit], fields=['PUTCALLIND', 'TRDPRC_1', 'CF_BID', 'CF_ASK', 'TRADE_DATE', 'SALTIM', 'STRIKE_PRC', 'EXPIR_DATE'])
I was going to convert SALTIM time to Eastern ....
But I still need to get the price of underlying (SXP Index) at the time of those trades. I was hoping to get that using converted time of those last option trades in the chain. Can this makes sense and you have a good sulution.
Thanks so much Zoya !!!!
Vlad
Hello @vlad.dimanshteyn,
It may be worthwhile to take a look at RD Library and quantitative analytics that are part of it, and IPA volatility surface examples that are part CodeBook example deck:
Eikon/Workspace-> CodeBook
_Examples_->Quantitative Analytics-> Surfaces
If this is something that you are able to reuse, you will undoubtedly need modifications, but should still be significantly less time and effort that building fully on your own with just eikon prices, so may be worth reviewing?
If I could just get the data, I should be in great shape. I will check out your vol surface code but I developed code to do pretty complex vol surface. All I need is the data I'm getting already + SPX Index price at the time of the last option trade. Thank so much for your help.
I think you are very much on top of what needs to be done.
I'd like to discuss what I think could be the approach to use.
I notice from running your code that not all the requested instruments have TRADE_DATE and SALTIM populated. From what is populated you can select the latest available.
I do not believe you have to convert it. It can be used that to define the request interval. As you can not request price at exact specific point of time, but you can request full price ticks as bordered by timestamp, you can use the returned timestamp as end_date and define start_date as a couple of minutes before end_date.
For example, I am looking at the following line in option_data_block result, let us assume that this is the latest SALTIM = 14:40:52:
You could go:
ek.get_timeseries('.SPX',start_date='2022-05-12T14:40:50', end_date='2022-05-12T14:40:52', interval='tick')
And receive:
The latest value that falls within the interval defined should be what you are looking for.
The interval may have to be further tuned up, to ensure that at least one update of .SPX falls within the interval and you are able to use the last data point returned in the interval.
I would lastly like to mention, that RD libraries and RD quantitative analytics examples use RDP IPA analytics that are quite sophisticated, and where I can not be sure is, if this strategy will be equally precise and account for all requirements, or if there is more to the calculations that are part of RDP IPA. I will, just in case, include IPA Volatility Surfaces - Getting Started dev guide link, and right after it you will find the more detailed guides to the three types of surfaces that are calculated by IPA, so you could perhaps judge for yourself, if this is something that could be of value to your organization.
Just took a look at the link you sent, pretty cool stuff. I'll have to look deeper to see what algorithms you guys use because we do use exotic options (Asians, Cliquets, etc) but it seems you have a lot of good things there that I may be able to use. I also had a quick question that you may know the answer to. When I installed your package with PIP yesterday, there were some conflicts with Spyder (Anaconda default) Now when I run any script, there are all these exceptions in the Console window. Is there a place where can find out compatibilities and how to fix this issue. Thanks so much again Zoya. Vlad
On compatibilities, there is usually more then one compatible set, but for the latest library's installed modules would see:
Eikon/Workspace-> Codebook
file:
__Libraries&Extensions.md
To troubleshoot the specific issue you are facing, you can ether search these forums for your error message- you are likely to find many posts with helpful answers or review the helpful article Eikon Data API(Python) Troubleshooting | Refinitiv.
Please try asking a new question as a separate new question, rather then a comment, as this allows for each question to have one "best" answer" that very easy to find for the next users with the same or similar question, contributing toward the usefulness and helpfulness of these developers forums. Thanks