Unexpected Timestamp on TickHistoryInstradaySummaries extract

Hi, I'm trying to download some prices at a single point in time 28-Jun-2019 16:30. However the results I'm getting are timestamped 2019-06-28T04:30:00.000000000Z.
My code is attached below :
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThomsonReuters.Dss.Api;
using ThomsonReuters.Dss.Api.Content;
using ThomsonReuters.Dss.Api.Extractions;
using ThomsonReuters.Dss.Api.Extractions.ExtractionRequests;
using ThomsonReuters.Dss.Api.Extractions.ReportExtractions;
using ThomsonReuters.Dss.Api.Extractions.ReportTemplates;
using ThomsonReuters.Dss.Api.Extractions.Schedules;
using ThomsonReuters.Dss.Api.Extractions.SubjectLists;
using ThomsonReuters.Dss.Api.Search;
using ThomsonReuters.Dss.Api.Users;
using ThomsonReuters.Dss.Core.RestApi;
namespace Reuters
{
class Program
{
static void Main(string[] args)
//string password, string UserID, string instruments,string startDateTime,string endDateTime, string path, string FileName
{
// Set Variables
int numOfArgs = args.Length;
string password = (numOfArgs > 0) ? args[0] : "******";
string UserID = (numOfArgs > 1) ? args[1] : "******";
string instruments = (numOfArgs > 2) ? args[2] : "NZD=, EUR=, AUD=";
string DTStart = (numOfArgs > 3) ? args[3] : "20190628 1630";
string DTEnd = (numOfArgs > 4) ? args[4] : "20190628 1630";
string path = (numOfArgs > 5) ? args[5] : @S:\Financial Risk\FRM\MVD OTC\Datascope\Output\;
string fileName = (numOfArgs > 6) ? args[6] : DTStart.Replace(" ","") + "_" + DTEnd.Replace(" ", "") + "_" + DateTime.Now.ToString("yyyyMMddHmmss") + ".csv";
//if multiple instruments provided create an array
string[] instrumentSplit = instruments.Split(',');
DateTime startDateTime = DateTime.ParseExact(DTStart, "yyyyMMdd HHmm", CultureInfo.InvariantCulture);
DateTime endDateTime = DateTime.ParseExact(DTEnd, "yyyyMMdd HHmm", CultureInfo.InvariantCulture);
string fullFilePath = path + fileName;
//Console.WriteLine(password + ", " + UserID + ", " + instruments + ", " + yyymmdd.ToString() + ", " + time.ToString() + ", " + fullFilePath);
//Console.WriteLine(startDate + " - " + endDate);
///////////////////////////////////////////////////////////// Authenticate connection /////////////////////////////////////////////////////////
var extractionsContext = new ExtractionsContext(new Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), UserID, password);
//Reduce the poll time for the purposes of the example
//extractionsContext.Preferences.WaitSeconds = 5;
var sessionToken = extractionsContext.SessionToken;
//create the available fields (From example)
var availableFields = extractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryIntradaySummaries);
Array fieldNames = availableFields.Select(x => x.Name).ToArray();
int fieldNamesCount = availableFields.Select(x => x.Name).ToArray().Count();
extractionsContext.Options.AutomaticDecompression = true; //Decompress gzip to plain text
// create the list of Identifier
var instrumentIdentifierList = new DssCollection<InstrumentIdentifier> { };
foreach (string ins in instrumentSplit)
{
instrumentIdentifierList.Add(InstrumentIdentifier.Create(IdentifierType.Ric, ins.Trim()));
};
//Console.WriteLine("authentication process done at " + DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
/////////////////////////////////////////////////////////// Request an extraction (loop through Instruments) //////////////////////////////////////////
//Console.WriteLine("request started at " + DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
var result = extractionsContext.ExtractRaw(
new TickHistoryIntradaySummariesExtractionRequest
{
Condition = new TickHistoryIntradaySummariesCondition
{
SortBy = TickHistorySort.SingleByRic,
MessageTimeStampIn = TickHistoryTimeOptions.GmtUtc,
ReportDateRangeType = ReportDateRangeType.Range,
TimeRangeMode = TickHistoryTimeRangeMode.Inclusive,
QueryStartDate = startDateTime,
QueryEndDate = endDateTime,
DateRangeTimeZone = "UTC",
//Possible values: OneSecond, FiveSeconds, OneMinute, FiveMinutes, TenMinutes, FifteenMinutes, OneHour
SummaryInterval = TickHistorySummaryInterval.FifteenMinutes,
Preview = PreviewMode.None,
ExtractBy = TickHistoryExtractByMode.Ric,
TimebarPersistence = false,
DisplaySourceRIC = false
},
ContentFieldNames = availableFields.Select(x => x.Name).ToArray(),
IdentifierList = new InstrumentIdentifierList
{
InstrumentIdentifiers = instrumentIdentifierList
},
}
);
//Console.WriteLine("request completed at " + DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
/////////////////////////////////////////////////////////// Download the results /////////////////////////////////////////////////////////
using (var response = extractionsContext.RawExtractionResultOperations.GetReadStream(result))
using (var stream = response.Stream)
using (var reader = new StreamReader(stream))
{
while (!reader.EndOfStream) //Limit to ten rows for the example. Remove when prod ready.&& lineCount++ < 10
{
string records = reader.ReadToEnd();
string[] RecordsList = records.Split(new string[] { "\\n", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
File.AppendAllText(fullFilePath, records);
}
}
//Console.WriteLine("File completed for: in " + fullFilePath + " at " + DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
//foreach (var note in result.Notes)
// Console.WriteLine(note);
//Console.ReadLine();
}
}
}
Best Answer
-
This could be similar issue with this question. The QueryStartDate and QueryEndDate is DateTimeOffset object. If you want to specify the query dates in UTC, you can use the following code to convert DateTime to DateTimeOffset.
DateTime startDateTimeLocal = DateTime.ParseExact(DTStart, "yyyyMMdd HHmm", CultureInfo.InvariantCulture);
startDateTimeLocal = DateTime.SpecifyKind(startDateTimeLocal, DateTimeKind.Utc);
DateTimeOffset startDateTime = startDateTimeLocal;
DateTime endDateTimeLocal = DateTime.ParseExact(DTEnd, "yyyyMMdd HHmm", CultureInfo.InvariantCulture);
endDateTimeLocal = DateTime.SpecifyKind(endDateTimeLocal, DateTimeKind.Utc);
DateTimeOffset endDateTime = startDateTimeLocal;0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 37 Alpha
- 167 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 705 Datastream
- 1.5K DSS
- 633 Eikon COM
- 5.2K Eikon Data APIs
- 14 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 6 Trading API
- 3K Elektron
- 1.5K EMA
- 259 ETA
- 569 WebSocket API
- 40 FX Venues
- 16 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 4 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 284 Open PermID
- 47 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 24 RDMS
- 2.2K Refinitiv Data Platform
- 879 Refinitiv Data Platform Libraries
- 5 LSEG Due Diligence
- 1 LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 123 Open DACS
- 1.1K RFA
- 108 UPA
- 196 TREP Infrastructure
- 232 TRKD
- 919 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 103 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛