question

Upvotes
Accepted
12 4 4 9

Time & Sales data with .NET API

I would like to use the .NET API to get a stream of Time & Sales data in my console, like the one visible in the Eikon TAS app ( see "t-s Eikon.png" screenshot attached).

I downloaded and installed the " .NET API for Custom application " , and download the Usage Example for real time data. I tried to adapt it for my needs.

In particular I'm interested in the fields

1) "Traded Volume"

2) "Bid Size"

3) "Ask Size"

4) "Trade Flags"

I guess I need to use the "ComplexRequestAndSubscriptionExample" (is this the case?) and I tried to modify it but when I launch it, the console opens up and only one data point is displayed.

Another problem is that I cannot visualize the Traded Volume field nor the Traded Flags (shown in the EIKON TAS screenshot attached).

Thanks for your help.

ts-eikon.png

screenshot-2.png

eikoneikon-com-api.net
ts-eikon.png (177.0 KiB)
screenshot-2.png (52.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.

@davide.costanzo

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvotes
Accepted
39.4k 77 11 27

As far as I can see your Eikon retrieves real-time market data from the distribution infrastructure known as TREP, which is managed by market data department of your organization. I think missing updates on the real-time data stream are likely the result of conflation of real-time data implemented by your market data department in the TREP infra they manage. I suggest you reach out to your market data folks and ask if they implement any conflation on the streaming data going into your Eikon. And if you need to receive every tick, whether they could switch your Eikon to the source on TREP infra that provides every tick.

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
39.4k 77 11 27

If you need a backfill of the Time & Sales timeseries, then you need to use Timeseries interface as opposed to Real-time Data interface.
If you don't need a backfill of Time & Sales timeseries and you just want to receive real-time data updates from the moment you create your real-time data subscriptions, then ComplexRequestAndSubscriptionExample is the right example for you to look at.
The field names you want to use in your subscriptions may vary by RIC depending on the asset class, geography, market data source etc. For LCOc1 the fields you're interested in are mapped as follows:
"Traded Volume": TRDVOL_1
"Bid Size": BIDSIZE
"Ask Size": ASKSIZE
"Trade Flags": Trade flags have very complicated representation on the datafeed. You cannot get the user friendly trade flag descriptions that you see in Time & Sales app in Eikon using the API.
I very strongly suggest you review the relevant tutorials (either Real-time Data or Timeseries) on this portal before trying to run the examples you downloaded. The reason why the modified example you ran displayed only one datapoint is likely that the logic in the DataReceivedCallback procedure you modified stops the subscription and Windows message pump immediately after the initial data image is retrieved.

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
12 4 4 9

Thank you for your reply.

I read the Timeseries manual and tried to run the example. I indeed need a time series + subscription for my purposes. In that regards I still have a couple of questions:

1) I run the "views and Intervals" on "LCOc1" to have an overview of the available fields (attachment "Views LCOc1" ).

Why don't I see the fields BIDSIZE, ASKSIZE , ... that you mentioned above?

2) I tried to run my code for (e.g.) TOT_VOLUME in LCOc1 field but it doesnt return anything besides the empty console (I attach the code of the TimeSeriesSubscription class : "subscription.png" ). Do you know why? I tried also to replace the "CLOSE" field in the "DataReceivedCallback" with TOT_VOLUME too, but it wont work

Would it be possible to organize a phone call with some support for this, I guess it would speed up things very much.

views-lcoc1.png

subscription.png


views-lcoc1.png (44.9 KiB)
subscription.png (28.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.

Upvotes
39.4k 77 11 27

1. The data model for timeseries is different from the data model for streaming market data. ViewsAndIntervalsExample returns the list of timeseries views available for the RIC. For time & sales data the view you want to use is TRDPRC_1, which is the default view, so you don't need to specify it.
For the retrieval of time & sales instead of ViewsAndIntervalsExample you want to look at TimeSeriesSubscriptionExample, where with the ITimeSeriesDataSubscriptionSetup object returned by ITimeSeriesDataService.SetupDataSubscription method you want to use

.WithInterval(CommonInterval.Trades)
.WithAllFields()
2. You're not properly traversing through the content of DataChunk object returned to DataReceivedCallback. The best way to familiarize with the structure of the data retrieved is by putting a breakpoint on DataReceivedCallback and examining the content of the variables.
When you retrieve timeseries for daily interval you want to either convert the records in chunk.Records to bar records using chunk.Records.ToBarRecords() or you want to use AllFields property for each IData object in chunk.Records.
When you use .WithInterval(CommonInterval.Trades) to retrieve time & sales data you want to iterate over the IEnumerable<ITradeData> returned by chunk.Records.ToTradeRecords(). To get the bid size of the top of the book when the trade occurred use BidSize property of ITradeData interface.
foreach (ITradeData trade in chunk.Records.ToTradeRecords())
{
	if (trade.BidSize.HasValue)
        {
              Console.WriteLine("Bid size:" + trade.BidSize.Value.ToString());
        }
}
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
12 4 4 9

thanks, it was very helpful and now everything works.

I am wondering how one can reconstruct the "Trade Flags" , I really need that information. Is it a function of the other fields or can I reconstruct using the "Tag" string of the ITradeData?

I actually only need to know if it's Buy, Sell or Implied trade.

Thank you very much

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
39.4k 77 11 27

I'm afraid trade flags are not provided by the timeseries interface at all.
It may be possible to pick up trade flags using Real-time data interface, but only for new trades that will have occured after you've created real-time data subscriptions. And again creating the rules that would work across various markets would be unrealistic. But for a single future (or a small handful) it may be possible.
I'm not the best person to advise you on what rules you'd need to implement to interpret trade flags from the real-time data stream. I think for LCOc1 you can probably pick it up from field TRD_TYPE. But I'm not confident about it, and there may be a lot more to it. If you'd like to learn how to identify buy, sell or implied trade for a specific future from updates on the real-time feed, your best bet is to contact Refinitiv Helpdesk and pose this question. The Helpdesk can reach out to the content specialist for the exchange, who should have the answer.

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
12 4 4 9

Thanks, I did contact the Refinitiv helpdesk. They just got back to me with a list of FID that I should be able to use to retrieve the data I need (see 'FIDs' attached).

1) I dont know how to use these FIDs with the .NET API though (I think I'd need the fields BID_TONE and ASK_TONE).

2) Regarding your previous message, about the field "TRD_TYPE" in the RealTimeDataInterface, I tried to input it but nothing is returned (see 'screenshot' attached for the code).

3) Also, besides "TRD_TYPE" , where do I get a list and a description of the fields available for the RealTimeData (analogous to "ViewsAndIntervals" for the TimeSeries interface?) . In the tutorials there is no mention.

fids.png

screenshot.png


fids.png (18.3 KiB)
screenshot.png (31.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.

Upvotes
39.4k 77 11 27

1. Based on the list of fields you got from Refinitiv Helpdesk, as far as I can see, the Buy side vs. Sell side trade can be inferred from field ACT_FLAG1. It appears that if the value of the field is "s", it's a sell side trade. If the value is "b" it's a buy side trade. You may want to verify this logic with the Helpdesk. I'm afraid I'm not an expert in the ICE futures content. I can't say how you can infer implied trade. I suggest you continue working with Refinitiv Helpdesk and pose this very specific question to them: from the real-time data stream how can you determine if the trade is implied.
2. My mention of the TRD_TYPE field was just a wild guess, and now I see that it was wrong. It looks like for LCOc1 this field is empty most of the time, and this is why nothing was returned by the example. Regarding the code sample I should also add that you typically want to use either real-time data request or real-time data subscription, but not both. You use request when you want to retrieve data as a snapshot. You use subscription when you want to retrieve real-time data stream, i.e. when you want to continuously receive updates for the RIC.
3. You can view the list of fields for a given RIC using Quote app in Eikon. Launch a Quote app in Eikon application, type in the RIC to display the quote, then right click within the Quote app and select Template - Display All Fields. This will display the raw representation of the real-time data record, which is a vector of field name/value pairs. The list of fields available varies by the RIC.

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
12 4 4 9

thanks a lot. The ACT_FLAG1 is all I need, I observed that when the trade is implied it returns a blank field , and otherwise "b" or "s".

There is one very last detail. When I launch the RealTimeAPI (Complex request and subscription) and I compare its output with the Time&Sales APP in EIKON they should match. And they do most of the time.

However sometime there is a big block of trades in Time & Sales that occur at the same time and in the RealTimeAPI are seen as ONE trade only.

I took a screenshot of both Time&Sales APP ("screen1") and the output of RealTimeAPI ("screen2") , where one can see that the last 7 trades occurred all the same time (11:26:26:817) in the Time&Sales APP whereas in the console output of the RealTimeAPI it is marked as only one.

Do you know how one can avoid this kind of inconsistencies?

Thanks a lot.

screen1.png

screen2.png


screen1.png (46.4 KiB)
screen2.png (7.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.

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.