question

Upvotes
Accepted
1 0 0 0

Setting TickHistoryTimeAndSalesExtractionRequest.Condition.DateRangeTimeZone="UTC" has no effect on SFCJ0

Hello,


I am requesting TickHistoryTimeAndSalesExtractionRequest for SFCJ0 for time range between 2020-04-01T00:00:00.000000000Z and 2020-04-01T23:59:59.999999999Z:

The data I receive starts at 2020-04-01T04:00:01.012562364Z and end at 2020-04-02T03:59:58.911651052Z, I would expect it to start at or after (near) 2020-04-01T00:00:00.000000000Z and end before (near) 2020-04-02T00:00:00.000000000Z, because I set DateRangeTimeZone = "UTC", ReportDateRangeType = ReportDateRangeType.Range, MessageTimeStampIn = TickHistoryTimeOptions.GmtUtc.


Am I doing anything wrong? I use the latest available version of RESTAPIToolkit for .NET.

var extractionRequest = new TickHistoryTimeAndSalesExtractionRequest
                {
                    IdentifierList = new InstrumentIdentifierList
                    {
                        InstrumentIdentifiers = new[]
                        {
                            new InstrumentIdentifier
                            {
                                Identifier = "SFCJ0",
                                IdentifierType = IdentifierType.Ric
                            }
                        },
                        ValidationOptions = new InstrumentValidationOptions
                        {
                            AllowHistoricalInstruments = true
                        },
                        UseUserPreferencesForValidationOptions = false
                    },
                    Condition = new TickHistoryTimeAndSalesCondition
                    {
                        ReportDateRangeType = ReportDateRangeType.Range,
                        TimeRangeMode = TickHistoryTimeRangeMode.Inclusive,
                        DateRangeTimeZone = "UTC",
                        QueryStartDate = DateTime.Parse("2020-04-01"),
                        QueryEndDate = DateTime.Parse("2020-04-01").AddDays(1).AddTicks(-1),
                        ApplyCorrectionsAndCancellations = false,
                        ExtractBy = TickHistoryExtractByMode.Ric,
                        MessageTimeStampIn = TickHistoryTimeOptions.GmtUtc,
                        SortBy = TickHistorySort.SingleByRic,
                        DisplaySourceRIC = false
                    },
                    ContentFieldNames = fields
                };
tick-history-rest-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
Accepted
11.3k 25 8 13

Hi @hrayr,

It could be due to the DateTime object you used for the QueryStartDate and QueryEndDate. The DateTime object somehow is converted using local timezone. The similar issue has been found here.

Please use DateTimeOffset instead.

QueryStartDate = new DateTimeOffset(2020, 4, 1, 0,0,0,System.TimeSpan.Zero), 
QueryEndDate = new DateTimeOffset(2020, 4, 1, 23, 23, 59, System.TimeSpan.Zero),
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 @hrayr,

I have retested with TRTH C# .Net Example Application,

Replaced IBM.N with SFCJ0 midified fields

 ContentFieldNames = new[]
                {
                    "Trade - Price",
                    "Trade - Volume",
                    "Trade - Exchange Tim
                }

and extended printed data.

I see result data T01:00:00 - T21:14:39. This is consistent with result I get via Postmen, testing same request for SFCJ0.

MessageTimeStampIn in your request is same as in example. The difference must be elsewhere in code, as the result you describe differs.

I think example is easy to try on your side and should allow to see if you get the expected result on your side, then can copy into your custom request?



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