question

Upvotes
Accepted
24 3 1 5

Using Local Exchange Timezone to query TRTH

Hi,

I am doing Range query through C# api. I want to request data between two times expressed in the timezone of the exchange. Same as Datascope with this option :

Do you know how I can set this option ?

I know that C# has `DateRangeTimeZone` option but that doesn't allow me to have the local exchange timezone

Thanks

dss-rest-apitick-history-rest-apitime-zone
capture.png (14.5 KiB)
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
13.7k 26 8 12

@webmastertux1,

In a nutshell, use this condition:

DateRangeTimeZone = "Local Exchange Time Zone",

Let me add a bit more detail:

I made an On Demand query for 1 hour Intraday summaries (bars), for RICs on Hong Kong, Germany and New York. The conditions included the following; I varied the value of DateRangeTimeZone based on what can be seen in the GUI:

Then I looked at the time stamps of the results:

MessageTimeStampIn = TickHistoryTimeOptions.GmtUtc,
DateRangeTimeZone = "UTC+01:00",
QueryStartDate = new DateTimeOffset(2016, 09, 29, 0, 0, 0, TimeSpan.FromHours(0)),
QueryEndDate = new DateTimeOffset(2016, 09, 30, 0, 0, 0, TimeSpan.FromHours(0)),
ReportDateRangeType = ReportDateRangeType.Range,

Test 1:

DateRangeTimeZone = "UTC+01:00"

Result: timestamps range from 22:00 to 21:00, i.e. range is UTC+1

Test 2:

DateRangeTimeZone = "UTC+02:00"

Result: timestamps range from 21:00 to 20:00, i.e. range is UTC+2

Test 3:

DateRangeTimeZone = "Athens, Bucharest"

Result: timestamps range from 21:00 to 20:00, i.e. range is UTC+2

Test 4:

Not setting parameter DateRangeTimeZone

Result: timestamps range from 22:00 to 21:00, range is UTC+1 (i.e. the default is my own TimeZone).


tz.png (28.1 KiB)
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
24 3 1 5

Hi @Christiaan Meihsl,

Thanks a lot for your help. What happens in your test if you set "Local Exchange Time Zone" ? Personnaly, on my side I still have weird results.

For instance, I ask BAC.N (US stock) from 2011-08-11 00:00:00.000 to 2011-08-11 23:59:59.999 with the option `DateRangeTimeZone = "Local Exchange Time Zone"`

I should get only data on 2011-08-11 utc-4. but no I get that :

`BAC.N,Market Price,2011-08-10T16:00:00.178635000-04,Raw,UPDATE,UNSPECIFIED,,,,62,,24848,,10"`

Did I make a mistake somewhere ?

EDIT :

It looks like I don't have the same behavior between C# API and DataScope Select.

It works as expected in Datascope. Not in C#

Thanks

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
24 3 1 5

I found. it was because I set QueryStartDate with a `DateTime` instead of `DateTimeOffset`, so somewhere a local machine time zone conversion was done in .Net

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.

@webmastertux1, glad you found it !

Click below to post an Idea Post Idea