Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
0 1 4 7

SALTIM field returns the time of the last trade today but it returns 19:23:34 when its 2pm. What timezone is and how to convert it in Easter timezone? Thanks

helpdesk
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
32.2k 40 11 19

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


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks so much Zoya, spasibo. I would convert this to Eastern I guess to get the time of the last SPX Option trade. How would I get the price of an underlying (SPX) at that time? Thanks so much !!!!
Upvote
32.2k 40 11 19

Hello @vlad.dimanshteyn ,

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:

ticks.gif

however, is this what you are looking for or something different?


ticks.gif (64.4 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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

Upvote
32.2k 40 11 19

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?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks Zoya. I'll take a look at your surfaces. I developed the code to create surfaces already, so that is not an issue. I just need to get the SPX Index price at a time of the last Option trade for all SPX options. How would I do that? I'm getting all the other data already. Thanks so much.

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.

Upvote
32.2k 40 11 19

Hello @vlad.dimanshteyn ,

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:

saltim.gif

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:

points.gif

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.



saltim.gif (5.5 KiB)
points.gif (10.5 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks so much Zoya, you are a great help and really smart. The reason some TRADE_DATES & SALTIM not populated is because I did not send you one line code that goes between two lined I've sent you. That line filters out everything where the date is not today and Volume < some number. If those are filtered out, you do not get <NA>s for TRADE_DATE & SALTIM. You want to pick most liquid options (Volume > 250 or so) to construct the surface. Let me think about your solution, I think it's great & I will most likely implement it. I will also look at all you references and let you know. Thanks so much for your help. Have a great weekend, Vlad

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

Upvotes
32.2k 40 11 19

Hello @vlad.dimanshteyn ,

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.