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
43 2 4 7

How to filter out certain trade types

We are using the DataAccess.TimeSeries - in fact our code comes from the TimeSeriesDailyIntervalDemo. Our client has discovered that there are several unwanted trade types that are returned by the API that are not displayed in the standard EIKON price charts. Upon request from Eikon we were advised that:

"Below are the criteria for the FID 1003 to exclude or to filtered out trades from TAS application.

Unique ID IDN Value Description

152526 1_N Next Day Trade

152540 4_B Average Price Trade

152542 4_M Market Center Official Close

152543 4_Q Market Center Official Open

152544 4_H Price Variation Trade

154580 2_9 Official Consolidated Close

152549 4_I Odd Lot trades

152525 1_C Cash Trade (Same Day Clearing)

152527 1_R Seller

152536 3_T Extended Hours Trade

152537 3_U Extended Hours Sold (Out of Sequence)


Can anyone advise how this should be coded in the API. We see a "WithFilter", but do not know the syntax to construct a filter to remove the above.

Thank you



eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apitime-series
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.

@dgarrard

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 reply that best answers your question. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

-AHS

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

AHS

Upvotes
Accepted
78.8k 250 52 74

FID 1003 is a real-time field.

GV4_TEXT   "GV4 TEXT"            1003  NULL        ALPHANUMERIC        6  RMTES_STRING     6

It is available when subscribing to a real-time service (IDataService.Realtime).


However, it may not be available in the times series service. You can verify it by checking all fields returned from the time series service. If it is not available, you can't filter it.

According to the response from the Eikon support team, I assume the RHistory function can't return the trade type. Therefore, you are unable to retrieve or filter it via IDataServices.TimeSeries.

Regarding the 5-minute candle charts, please use the CommonInterval.Intraday5Minutes instead to verify the returned data.


1585030937747.png (20.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.

Upvotes
78.8k 250 52 74

@dgarrard

Refer to the Time series API tutorial, the WithFilter property of either requests or subscriptions can be used to filter results based on numeric or string value of specified fields, or built-in filters for price sources. This functionality is only available for Quotes, Trades and TradeAndQuotes intervals.

For example:

private void Subscribe()
{
    _subscription = _timeSeries.SetupDataSubscription("EUR=")
        .WithView("BID")
        .WithAllFields()
        .WithInterval(CommonInterval.Quotes)
        .WithNumberOfPoints(50)

        .WithFilter(filter => filter.ContributorIn(new[] {"RBSN"}))
        .WithFilter(filter => filter.NumericValueOfField("BID").GreaterOrEqual(1.1342))

        .OnDataReceived(DataReceivedCallback)
        .CreateAndStart();
}

The methods of IRequestFilter are:

Could you please share RICs, Interval, View and code used to retreive the data?


1584431219196.png (233.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.

Upvotes
43 2 4 7

Hi @jirapongse.phuriphanvichai ,

The code which you share above is same what we are calling to get the data. Now we want to know the syntax to filter the list which is mentioned above. can you share us the syntax with Filter to exclude those results. we just want to exclude those results from data.

_subscription = _timeSeries.SetupDataSubscription("EUR=")
        .WithView("BID")
        .WithAllFields()
        .WithInterval(CommonInterval.Quotes)
        .WithNumberOfPoints(50)
 
        .WithFilter(filter => filter.ContributorIn(new[] {"RBSN"}))
        .WithFilter(filter => filter.NumericValueOfField("BID").GreaterOrEqual(1.1342))
 
        .OnDataReceived(DataReceivedCallback)
        .CreateAndStart();
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
78.8k 250 52 74

@dgarrard

The WithFilter can be used to filter results based on numeric or string value of specified fields, or built-in filters for price sources. There is no built-in filter for trade types.

Moreover, if the trade type field is not available in the returned data, you can't filter it by field values.

I think you should contact the Eikon Excel support team via MyRefinitiv to verify if it is possible to use the RHistory function in Eikon Excel to retrieve the required data or if there is any field returned from the RHistory function which can be used to filter by trade types.

The data returned from ITimeSeriesDataService is similar to the RHistory function.

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
43 2 4 7

We contacted Eikon Excel support, but have been advised that it is best to repost our issue here.

As added information, our application is for US and Canadian equities. So we are typically passing RIC’s such as:

AGU.TO

HON.N

AAPL.O

Our customer has complained that the price data returned by the DataAccess.TimeSeries service is not the same data that is being used in the preparation of day price candle charts such as 5 minute bars on their Eikon terminal.

After reviewing the raw price data we pull, Eikon Support did agree that the data is different. They advised us that to ensure we only perform our custom analysis on the same prices that are used in the price charts for a particular day (say 5 minute candle charts) then we need to impose filters for certain trade types (see the table below)

We are using ThomsonReuters.Desktop.SDK.DataAccess.TimeSeries in a C# application we have written.

Here is the code which we are using to get the data through this SDK ThomsonReuters.Desktop.SDK.DataAccess.TimeSeries.

// DateTime dt = DateTime.ParseExact(argument[1], "yyyy-MM-dd ", CultureInfo.InvariantCulture);
dtStart = DateTime.Parse(string.Format("{0} " + StartingTime , startDate),
CultureInfo.InvariantCulture);
dtEnd = DateTime.Parse(string.Format("{0} " + EndingTime, EndDate),
CultureInfo.InvariantCulture);

this.dataSubscription = DataServices.Instance.TimeSeries.SetupDataSubscription(this.Ric)
.WithInterval(CommonInterval.Trades)
.From(dtStart)
.To(dtEnd)
.OnDataReceived(this.OnSubscriptionDataReceived)
.OnDataUpdated(this.OnSubscriptionDataUpdated)
.OnStatusUpdated(status => this.Title = string.Format("Status: {0} Error: {1}", status.State, status.Error))
.CreateAndStart();

This is the same code which you have in your Eikon desktop API section on the developer support website. As you can see there is no withFilter in this basic sample.

Add code to filter out these trade types: We have been advised that these FID 1003 criteria in the table below need to be filtered using the withFilter capability in the above mentioned API.

Unique ID IDN Value Description

152526 1_N Next Day Trade

152540 4_B Average Price Trade

152542 4_M Market Center Official Close

152543 4_Q Market Center Official Open

152544 4_H Price Variation Trade

154580 2_9 Official Consolidated Close

152549 4_I Odd Lot trades

152525 1_C Cash Trade (Same Day Clearing)

152527 1_R Seller

152536 3_T Extended Hours Trade

152537 3_U Extended Hours Sold (Out of Sequence)

-------------------------------------------------------------------------------------


We are assuming we would need to add:

.WithFilter(filter => filter.stringValueOfField("TRADETYPE").Equal(“X_X”))

or perhaps

.WithFilter(filter => filter.stringValueOfField("FID 1003").Equal(“X_X”))

I have used the placeholder "X_X" above because I do not know the correct FID 1003 that defines common session trades in any day that would be used to build the candles such as 5 minute bars ofn an Eikon price chart? If such a single FID 1003 exists then we would want to apply that filter only – keeping only those trades and excluding the other ones that are returned by the TimeSeries service.

If a single FID 1003 value for common session trades does not exist this would mean we will have to build a multiple criteria filter. What is the syntax to construct a multi-line query to remove all of the above IDN values listed in the table?

.WithFilter(filter => filter.stringValueOfField("FID 1003").NotEqual(“1_N”))

.WithFilter(filter => filter.stringValueOfField("FID 1003").NotEqual(“4_B”))

etc., etc.


Thank you again.

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.