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
4 4 7 11

Data Missing in API, available in Excel

Here's some sample working code, just have to set your variable for the Eikon API key:

from typing import Union, List 
import pandas as pd 
import eikon as ek
import os

os.environ['HTTP_PROXY'] = ''
os.environ['HTTPS_PROXY'] = ''

def get_bid_ask(id_list: Union[List[str], str], start_date: str, end_date: str, api_key: str) -> pd.DataFrame:                          

  ek.set_app_key(api_key)

  if isinstance(id_list, str):
      id_list = [id_list]
  
  fields = ['TR.BIDPRICE', 'TR.ASKPRICE', 'TR.ASKPRICE.calcdate', 'TR.FiCurrency']
  parameters = {'Frq': 'D', 'Sdate': start_date, 'Edate': end_date}
  
  df, _ = ek.get_data(instruments = id_list, fields = fields, parameters = parameters)

  # Broadcast currency since currency is only returned on first date
  df['Currency'] = df.groupby('Instrument')['Currency'].transform('first')

  # Drop rows with NA
  df = df.dropna()

  # Filter for dates - there is a bug where more dates than those inputted are returned.
  # Example: id_list = 'XS2078642183', start_date = '2022-07-22', end_date = '2022-07-22'
  df = df.loc[ (df['Calc Date'] >= start_date) & (df['Calc Date'] <= end_date) ]

  return df


id_list = "XS1713193586"
asofdate = "2022-10-05"
test = get_bid_ask(id_list, start_date=asofdate, end_date=asofdate, api_key=api_key)

Here's the output:

1665644101731.png


Here's the available Bid/Ask price in Excel:

1665644145876.png

Using the formula:

=@TR("HK171319358=","TR.BIDPRICE; TR.ASKPRICE","SDate=2022-10-05 CH=Fd RH=IN",B2)

Might be a mapping issue, please advice.

Many thanks.

eikoneikon-data-apidata
1665644101731.png (3.5 KiB)
1665644145876.png (3.8 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.

<AHS>

Extending triage while @h.aramyan01 is following up with dev team


Hi @wesley.ng ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text on the left side of the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

@wesley.ng

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

Upvote
Accepted
4.9k 16 2 7

Hi @wesley.ng ,


Just received confirmation from the Dev team that this is indeed an issue, and will be solved in 1.65 release that goes live in mid Feb 2023.


Best regards,

Haykaz

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.

Hi @h.aramyan01, thanks for the update. Appreciated.
Upvotes
4.9k 16 2 7

Dear @wesley.ng ,


Thank you for your question. I have tried to debug your code by adding a couple of prints in the function and what I have found is that the request is returning the value you are looking for. The data is then lost when you filter for dates (df = df.loc[ (df['Calc Date'] >= start_date) & (df['Calc Date'] <= end_date) ]). The Ask.Calcdate is 2022-09-28 while you are filtering for 2022-10-05.

Please find the details below:

screen-shot-2022-10-14-at-111737.png

Hope this was helpful and let me know should you have any further questions.


Best regards,

Haykaz


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
4 4 7 11

Hi @h.aramyan01,

Thanks for debugging - apologies that the issue seems to be caused on my side. But the results begs the question of why the bid / ask data is not updated, both in the Excel and the API?

I can clearly see the price history beyond 28 Sept 22 for the security in question:

1665732463791.png


Many thanks.

Cheers,
Wesley


1665732463791.png (131.7 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.

Hi @wesley.ng ,


It does shoe the newest values when you provide a range in parameters, rather than using same value for Sdate and Edate. See below:

screen-shot-2022-10-14-at-125258.png

However, I believe it should show the latest when a same date is specified, which is not the case for this instrument. It works for other instruments (eg AAPL.O) for instance. Let me check this with the Product team and I'll come back to you with an answer.

In the meantime you could probably work with range values.


Best regards,

Haykaz

Hi @h.aramyan01,

It doesn't make much sense to work with range values for my use cases, or even put in a range just to filter it down again, which increases query time and the number of requests. Also would like to highlight another bug present in the example you showed, which is that the returned date rate (2022-09-29 to 2022-10-05) is larger than the queried date range.

Appreciate you following up with your product team, will await your answer.

Many thanks.

Cheers,
Wesley


Hi @h.aramyan01

I think that your inputs are a bit different. You are comparing RIC HK171319358= or directly ISIN XS1713193586 with the HK171319358=RRPS as seen on your screenshot from Eikon. Please use the RRPS RIC to get the same through API or Excel.

Hi @marcin.bunkowski01 ,


Thanks for your input. In my comments (code examples) I am using only XS1713193586 though and still can spot the problem with the date range and incompatibility between requested and returned dates.

Show more comments
Upvotes
4.9k 16 2 7

Hi @wesley.ng ,


I have already raised the issue related to the difference in requested and returned dates to the respective team and will update the thread accordingly.

In the meantime, please note that to get the datestamp of a datapoint you should use .date suffix as noted by @marcin.bunkowski01 .


Best regards,

Haykaz

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 Haykaz - do you have a rough estimate for how long it will take to roll out the fix?

Hi @h.aramyan01,

Just wanted to add, I'm getting similar issues (i.e. correct data not being returned when it's available in the desktop application, weird date ranges) for the following ISINs as well:

  • US88032XBB91
  • USG6S94TAG83
  • XS2193950271
  • XS1713193586
  • XS1955077596

Please forward these to your product team.

Many thanks.

Cheers,
Wesley

Hi @wesley.ng ,


Followed up the team, will come back to you as soon as get an answer. In the meantime, have you checked the response from @frank.ling1 ?


Best regards,

Haykaz

Hi @h.aramyan01,

The workaround provided by @frank.ling1 will not work because I'm working with thousands of ISINs here, and would not be able to map the RICs individually for each security that doesn't return the requested fields.

Cheers,
Wesley

Show more comments
Show more comments
Hi @h.aramyan01,

Is it possible for me to follow up on this enquiry outside of the forum?

Would very much appreciate an update on this.

Cheers,
Wesley

Hi @wesley.ng ,


I am in communication with the Dev Team and we are trying to understand if it is actually a bug or an expected behavior which might be handled differently. In any case, if that would be a bug, you can expect the fix 2023 Q1, if not, I will provide an option to handle it.


Thank you very much for your patience.


Best regards,

Haykaz

Upvotes
166 2 1 3

You may use the ric 'HK171319358=RRPS' instead of 'HK171319358= ' to replicate what you saw on price history page.
1666023749100.pngThe bid/ask yield are the same as above displayed.

1666023849731.png


1666023749100.png (125.5 KiB)
1666023849731.png (82.8 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.

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.