question

Upvote
Accepted
46 8 12 16

Requesting HistoricalPricing.Summaries does not work for RICs containing "/" when using Eikon

When requesting RICs that contain "/" characters e.g. "aUSCCORYE/A" the result is a "404 page not found" error. This works using Workspace but does not work when using Eikon (4.0.64012)

I Modified Example "2.1.01-HistoricalPricing-Summaries" to reproduce this:

var response = Summaries.Definition("aUSCCORYE/A")
.Interval(Summaries.Interval.P3M)
.GetDataAsync().Result;

The RDP.log shows encoded instrument name

Method: GET, RequestUri: 'http://localhost:9060/api/rdp/data/historical-pricing/v1/views/interday-summaries/aUSCCORYE%2FA?interval=P3M'

Tested with "Refinitiv.Data Library beta 5" for .net.

eikon#technology.netrefinitiv-data-platform-librariesrefinitiv-data-libraries
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.

Upvote
Accepted
11.1k 22 6 9

@martin.grunwald Thanks for your question and sorry to hear about your issue. It is infact an escaping issue as the historical pricing endpoint is being hit which is a URL with some querystring parameters - obviously such rics with a / character are not being interpreted correctly so we need to use the escaped charset for the / which is %2F - please see the following

rd.get_history("aUSCCORYE%2FA")

1697557675246.png

I hope this can help.


1697557675246.png (74.0 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.

I tried the to manually "pre encode" the RIC and got the corrected result.


This obviously raises the question, how can I find out whether the RDP library is connected via Workspace or Eikon?

Upvote
19.2k 86 39 63

Hi @martin.grunwald

I just tested against my Desktop Session using the following

response = Summaries.Definition("aUSCCORYE/A").Interval(Summaries.Interval.P3M)
                                              .GetData();

And received the following response:
1698093903379.png


I reported this to the desktop team awhile back and based on what I can now see, the fix is in. However, the fix may have been applicable only to the Workspace proxy. I will confirm.

The Data Library does not distinguish between desktop connections into Workspace vs Eikon. It comes down to what you are running. I assume you are running Eikon given your original post.


1698093903379.png (18.2 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.

I tested with both comparing the example with the exact parameters I was using in my application. Looking at the RDP.log I noticed the logged requests still differed. The only possible explanation I have for this behavior is that I am using the .net framework 4.8 and the example is using .net 6 and some underlying .net class behaves slightly different when it comes to encoding or stringifying the url.


For now I implemented a workaround where I always try the encoded version in case the non encoded version failed.

Hello @martin.grunwald

I have created a console app using .NET Framework 4.8 and called the same instrument with the same parameters in the example above. Here is the endpoint URL right before the call is made by the library to retrieve the data:

http://localhost:9001/api/rdp/data/historical-pricing/v1/views/interday-summaries/aUSCCORYE%2FA?interval=P3M

I can see that "/A" becomes "%2FA" in the request URL, just like in Jason's example above. The call is made successfully to the backend (HTTP Status 200).

Throughout this exercise, I am running the Refinitiv Workspace.


I am running out of ideas where the difference could be. The last idea was the custom web socket handler installed via RegisterWebSocketImpl, but it is pretty much exactly the same as the default implementation (plus some code to make it thread safe). Unless I am expected to encode the json passed in via IWebSocket.SendAsync, which does not seem to make sense to me and is not done in the default implementation either.

Show more comments
Upvote
19.2k 86 39 63

Hi @martin.grunwald,

Thanks for the logs.

In short, I was unable to replicate the issue you found. To make sure we're on the same page, I created a brand new .Net 4.8 project. I'm testing with Refinitiv Workspace, however, I don't think the issue is related to the session but rather the failing of escaping the embedded slash (/).

For example, here is my .Net 4.8 code:

var response = Events.Definition().Universe("aUSCCORYE/A")
                                  .Count(10)
                                  .EventTypes(Events.EventType.quote, Events.EventType.trade)
                                  .GetData();

Before the request is sent into the backend, this is what my URL looks like in the logs:

http://localhost:9001/api/rdp/data/historical-pricing/v1/views/events/aUSCCORYE%2FA?count=10&eventTypes=quote%2Ctrade

In preparation for this URL, the actual code that is escaping the slash looks like this:

var result = System.Uri.EscapeDataString("aUSCCORYE/A");  // Returns: aUSCCORYE%2FA

Comparing our logs, we're both using the same version:

Me:

2023-10-26 10:50:14.8368|Info|Refinitiv.Data.Initializer|1|Library version: 1.0.0-beta5
2023-10-26 10:50:14.8368|Info|Refinitiv.Data.Initializer|1|.Net runtime: 4.0.30319.42000
2023-10-26 10:50:14.8368|Info|Refinitiv.Data.Initializer|1|.Net version: 4.8.4645.0

You:

2023-10-25T17:48:44InfoRefinitiv.Data.InitializerLibrary version: 1.0.0-beta5
2023-10-25T17:48:44InfoRefinitiv.Data.Initializer.Net runtime: 4.0.30319.42000
2023-10-25T17:48:44InfoRefinitiv.Data.Initializer.Net version: 4.8.9181.0

The only thing I can suggest you try is the above code segment that escapes the (/) just to make sure it responds as expected - you should be getting the slash properly expanded. Please confirm.

You do have a workaround and you should be able to do something like this:

var response = Events.Definition().Universe(System.Uri.EscapeDataString("aUSCCORYE/A"))
                                  .Count(10)
                                  .EventTypes(Events.EventType.quote, Events.EventType.trade)
                                  .GetData();

One this that is confusing to me is when you explicitly request for "aUSCCORYE%2FA", it properly expands within the logs! That is:

http://localhost:9001/api/rdp/data/historical-pricing/v1/views/interday-summaries/aUSCCORYE%252FA?interval=P1D&count=10&sessions=normal'

%2FA successfully expands to %252FA! Yet "/" didn't expand.

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.

I also find this "double encoding" confusing. I think it is not a language setting. I am running windows using the german local, but I don't see how the "/" would make a difference.

The System.Uri.EscapeDataString() suggestions is the fallback I am currently using.

Hi @martin.grunwald,

Just to confirm, if you were to inject this line of code within your application, what returns:

var result = System.Uri.EscapeDataString("aUSCCORYE/A"); 
That is exactly what has been used in the logs posted before. First the code tries to use the RIC "as-is" and if that fails EscapeDataString() is called and if the encoded string differs from the original it does a second request with the pre-encoded RIC. The second call will then finish successfully.

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.