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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
7 2 2 6

Making multiple Timeseries requests

Hi,

I need to know what the open price is of various assets. I can get that by making a simple timeseries request to test this.

public void Launch(String ric)
{
	Console.WriteLine("Get RIC: "+ ric);
	//Console.WriteLine("");
 
	request = timeSeries.SetupDataRequest(ric)
		//.WithView("BID")
		.WithAllFields()
		.WithInterval(CommonInterval.Daily)
		//.From(dt)
		.WithNumberOfPoints(1)
		.OnDataReceived(DataReceivedCallback)
		.CreateAndSend();
 
 
 
}

This request is made within a second after the exchange opens. The issue now is that sometimes there isn't a quote yet (especially for illiquid markets). In that case I have to query again and again until I get a good open.

To test this I changed .Daily to Intradat1Minute and made 2 requests with a Thread Sleep of 61 seconds. However, the return values I get are for the same timestamp.

This is what I do (sd.RIC+s is just the RIC)

TimeSeriesRequest(sd.RIC + s);
Thread.Sleep(61000);
TimeSeriesRequest(sd.RIC + s);
 
private static void TimeSeriesRequest(String ric)
{
	(new TimeSeriesRequestExample(timeSeries)).Launch(ric);
}

The output is:

ESc1: 2 (new!!!)

16-Jul-2019 18:17:00,3007.00,3007.25,3006.50,3006.50,549,1

16-Jul-2019 18:17:00,3007.00,3007.25,3006.50,3006.50,549,1

As you can see, even though I expect a different time stamp, they are indeed the same.

How can I solve this?

Thank you

Jerome

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythontime-seriesc#
icon clock
10 |1500

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

Upvotes
Accepted
39.2k 75 11 27

This is pretty simple. You created two objects (two subscriptions) and assigned them to the same variable. This means your variable refers only to the last object you assigned to it. When you stop the subscription using this variable, only that subscription is stopped. All the other subscription objects you created and assigned to this variable are now orphans that continue to merrily chug along. You could keep all of your subscriptions in a list and stop them when you no longer need them. Or you could call DataServices.Reset(), which will uninitialize the connection to Eikon and terminate any subscriptions.

icon clock
10 |1500

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

Upvotes
23k 22 9 14

Hello @jerome,

Warning, I may be off on this. My line of thought:

You appear to be interested in obtaining open price, in realtime, as soon as it becomes available, OPEN_PRC, or ASK and BID?

You would like to determine, if the market has opened, quoted or traded, yet?

Seems to me that Realtime Subscription may be more suitable for this purpose then Time Series?

OPEN_PRC should reflect the opening price. QUOTIM or QUOTIM_MS should reflect after the market open time, if the market has quoted, TRDTIM_MS should reflect after the market open time, if it has traded?

Will this work for your requirement?

icon clock
10 |1500

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

Upvotes
7 2 2 6

Hi Zoya,

Thanks for your reply. This would indeed work for Daily rates, but how would that work for hourly rates? I also need the open quote for an asset on an hourly basis? So what is the open quote for E-mini from 10:00-11:00 taken at 10:00:01, and for 11:00-12:00 taken on 11:00:01?

Thank you

icon clock
10 |1500

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

Upvotes
39.2k 75 11 27

@jerome
It's a bit hard to say what's going on with your example without seeing the full code including the event handling. My guess is that you get the same result because Sleep function suspends the thread including the processing of messages from Windows message pump, which prevents the COM layer underlying this .NET interface from raising COM events and delivering event notification to the application. Hence the response to your first request is actually never received by the application. But this is just a guess.
In any case for your purposes I suggest you try timeseries subscription rather than timeseries request. With timeseries subscription you'll get notification each time the data updates on the current (most recent) bar being built in real-time, you'll get notification when the new bar is started once the time interval corresponding to bar lapses (also signifying that the previous bar is now closed). It seems to me that listening to these events better answers your workflow than sending a request every minute.
If however you prefer sending the request for an update, then try scheduling the requests using a timer that doesn't suspend the thread and the processing of COM events.

icon clock
10 |1500

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

Upvotes
7 2 2 6

Thank you - Time series Subscription might actually work better. Is there a C# sample code for that?

icon clock
10 |1500

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

Upvotes
39.2k 75 11 27

There's an example in the Timeseries Tutorial for Eikon .NET API.

icon clock
10 |1500

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

Upvotes
7 2 2 6

Thanks vm. I worked on that yesterday. However, one question. If I start multiple subscriptions in the Launch() function:

public void Launch()
{
	Console.WriteLine("[3] Time series subscription example");
	Console.WriteLine("");
	
	subscription = timeSeries.SetupDataSubscription("EUR=")
		.WithView("BID")
		.WithAllFields()
		.WithInterval(CommonInterval.Intraday1Minute)
		.WithNumberOfPoints(1)
		.OnDataReceived(DataReceivedCallback)
		.OnDataUpdated(DataUpdatedCallback)
		.CreateAndStart();
 
	subscription = timeSeries.SetupDataSubscription("ESU9")
		.WithView("BID")
		.WithAllFields()
		.WithInterval(CommonInterval.Intraday1Minute)
		.WithNumberOfPoints(1)
		.OnDataReceived(DataReceivedCallback)
		.OnDataUpdated(DataUpdatedCallback)
		.CreateAndStart();
 
 
}

the system does not stop properly when I hit any key since one of the subscriptions continues(see below). How can I stop all subscriptions? Or should I create an array of

private ITimeSeriesDataSubscription subscription;

What is the best way to handle this?

Thank you

Up: Successfully registered to Time Series service.

[3] Time series subscription example

EUR=,17-Jul-2019 13:16:00,1.1216,1.1217,1.1215,1.1216,1,1

ESU9,17-Jul-2019 13:06:00,3006.25,3006.25,3005.75,3005.75,1,1

New point at ESU9 07/17/19 13:15:00 3006.5

New point at ESU9 07/17/19 13:16:00 3006.25

Updated point at EUR= 07/17/19 13:16:00 1.1216

Updated point at EUR= 07/17/19 13:16:00 1.1215

Updated point at EUR= 07/17/19 13:16:00 1.1216

Updated point at EUR= 07/17/19 13:16:00 1.1215

Updated point at EUR= 07/17/19 13:16:00 1.1215

For other usage examples please uncomment the required method call in timeSeries_ServiceInformationChanged().

Press any key to exit...

Updated point at EUR= 07/17/19 13:16:00 1.1216

For other usage examples please uncomment the required method call in timeSeries_ServiceInformationChanged().

Press any key to exit...

Updated point at EUR= 07/17/19 13:16:00 1.1216

For other usage examples please uncomment the required method call in timeSeries_ServiceInformationChanged().

Press any key to exit...

icon clock
10 |1500

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

Upvotes
7 2 2 6

Thank you!

icon clock
10 |1500

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

Click below to post an Idea Post Idea