get_data function not returning timestamps/dates? (eikon data api / python)

Hi,
I'm trying to get historical options data but unable to get timestamps when I run the query below, I tried a few different fields instead of "CF_DATE" but none of them worked, 'Rh': 'date' parameter also doesn't seem to do anything. What is the right way to make this query?
e = dt.datetime(2020, 1, 17)
df_opt, err = ek.get_data('SPXm172029000.U', ['CF_DATE', 'TR.BIDPRICE', 'TR.ASKPRICE',
'TR.IMPLIEDVOLATILITYOFBIDPRICE', 'TR.IMPLIEDVOLATILITYOFASKPRICE'],
{'Rh': 'date', 'SDate': '{:%Y%m%d}'.format(e - dt.timedelta(days=365)),
'EDate': '{:%Y%m%d}'.format(e)})
I also tried get_timeseries query, but that doesn't like the ric and returns the error below.
df_opt, err = ek.get_timeseries(
[ric], ['STRIKE_PRC', 'AQ_ASK', 'AQ_BID', 'BID', 'ASK', 'EXPIR_DATE', 'PUTCALLIND'],
start_date=start_dt, end_date=end_dt)
Error with SPXm172029000.U: Invalid RIC
SPXm172029000.U: Invalid RIC |
Traceback (most recent call last):
File "C:\Users\Eren\source\.venv\meleti\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-44-cbda5db7f2c9>", line 3, in <module>
start_date=start_dt, end_date=end_dt)
File "C:\Users\Eren\source\.venv\meleti\lib\site-packages\eikon\time_series.py", line 197, in get_timeseries
raise EikonError(-1, message=ts_error_messages)
eikon.eikonError.EikonError: Error code -1 | SPXm172029000.U: Invalid RIC |
Thanks,
E
Best Answer
-
Hi @eb_13
I tried to retrieve all option from this sample code:
df,e = ek.get_data(['0#SPX*.U'],['PUTCALLIND','STRIKE_PRC','EXPIR_DATE','CF_CLOSE','IMP_VOLT']) df.head(5)
Here is the result:
So I selected SPXb212010000.U as a sample.
0
Answers
-
0
-
Hi @chavalit-jintamalit, thanks for your response!
I believe It is...
I tried many different contracts, same issue, field cannot be found, here's with a different one.Here's another one, I think it's a different field for options, but don't know which one.
end_dt = e if e < today else today
# ric is 'SPXm172033000.U' in this case
df_opt, err = ek.get_data(ric, ['CF_DATE', 'TR.BIDPRICE', 'TR.ASKPRICE',
'TR.IMPLIEDVOLATILITYOFBIDPRICE', 'TR.IMPLIEDVOLATILITYOFASKPRICE'],
{'Rh': 'date', 'SDate': '{:%Y%m%d}'.format(end_dt - dt.timedelta(days=365)),
'EDate': '{:%Y%m%d}'.format(end_dt)})0 -
Hi @eb_13
Code <SPXm172029000.U> is for an expired 2020 Jan option that is no longer on a feed. When you are typing that at your end it gives you the info from your local search history cache as you were probably using this code when it was live and active.
Compare that with the RIC that is active now:
0 -
It's an expired option so it won't be part of the current option chain you got there, but regardless, you answered my question, I did not know that you could do "[field name],DATE" to get the timestamp. Thanks!
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 629 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 86 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛