Trying to download ZFU8 I get the following response
Chain Identifier: ChainRIC 0#ZFU8, Constituents: 2
RIC 1FVU8^0,
Start date 29.08.2008 0:00:00,
Change Date 31.05.2014 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC 1FVU8^0,
Start date 29.08.2008 0:00:00,
Change Date 01.10.2016 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC 1FVU8^0,
Start date 29.08.2008 0:00:00,
Change Date 31.08.2017 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 02.07.2006 0:00:00,
Expiration Date 19.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 06.07.2006 0:00:00,
Expiration Date 19.09.2008 0:00:00,
RIC ZFU8,
Start date 29.08.2008 0:00:00,
Change Date 02.06.2007 0:00:00,
Expiration Date 19.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 15.06.2007 0:00:00,
Expiration Date ,
RIC ZFU8,
Start date ,
Change Date 01.07.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 07.07.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 26.07.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 04.08.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date ,
Change Date 17.08.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date 29.08.2008 0:00:00,
Change Date 24.08.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8,
Start date 29.08.2008 0:00:00,
Change Date 06.10.2007 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8^0,
Start date 29.08.2008 0:00:00,
Change Date 04.10.2008 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8^0,
Start date 29.08.2008 0:00:00,
Change Date 06.12.2008 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8^0,
Start date 29.08.2008 0:00:00,
Change Date 04.07.2009 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8^0,
Start date 29.08.2008 0:00:00,
Change Date 23.11.2009 0:00:00,
Expiration Date 30.09.2008 0:00:00,
RIC ZFU8^0,
Start date 29.08.2008 0:00:00,
Change Date 26.11.2011 0:00:00,
Expiration Date 30.09.2008 0:00:00,
ZFU8, Ric, 03.07.2008 0:00:00 +00:00, 30.09.2008 0:00:00 +00:00, 6
ExtractionID: 2000000665078075
Waiting for file size...
Waiting for file size...
Waiting for file size...
Waiting for file size...
Waiting for file size...
ERROR: processing did not complete successfully !
WARNING messages:
Waiting for file size...
Waiting for file size...
Waiting for file size...
Waiting for file size...
Waiting for file size...
Press Enter to exit
Here is the code I use to access historical data
using System;
using System.Linq;
using System.Diagnostics;
using System.IO;
using DataScope.Select.Api.Extractions;
using DataScope.Select.Api.Extractions.ExtractionRequests;
using DataScope.Select.Api.Extractions.ReportExtractions;
using DataScope.Select.Api.Extractions.ReportTemplates;
using DataScope.Select.Api.Extractions.Schedules;
using DataScope.Select.Api.Extractions.SubjectLists;
using DataScope.Select.Api.Content;
using DataScope.Select.Core.RestApi;
using DataScope.Select.Api.Search;
using DataScope.Select.Api;
using System.Text;
using ICSharpCode.SharpZipLib.GZip;
using System.Text.RegularExpressions;
namespace RefinitivHistoryTesting
{
class Program
{
public static string getExtractionID(string note)
{
string pattern = @Extraction ID: ([0-9]+);
string extractionID = "";
Regex rgx = new Regex(pattern);
Match match = rgx.Match(note);
if (match.Success)
{
string[] words = match.Value.Split(':');
extractionID = words[1].ToString().Trim();
Console.WriteLine("ExtractionID: {0}", extractionID);
}
return extractionID;
}
static void Main(string[] args)
{
//-----------------------------------------------------------------
//Connect and authenticate to the DSS server:
//-----------------------------------------------------------------
Uri dssUri = new Uri("https://selectapi.datascope.refinitiv.com/RestApi/v1/");
string dssUserName = "****";
string dssUserPassword = "****";
//var out_dir = @.\Storage\;
//var out_dir = @E:\TimeTick\;
var out_dir = @C:\Users\Manuchar\Refinitiv_history\;
var SearchContext = new SearchContext(dssUri, dssUserName, dssUserPassword);
var ExtractionsContext = new ExtractionsContext(dssUri, dssUserName, dssUserPassword);
ExtractionsContext.Options.AutomaticDecompression = false;
try
{
ExtractionsContext.DefaultRequestHeaders.Add("x -direct-download", "true");
}
catch (Exception)
{ }
var availableMbPFields = ExtractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryRaw);
var availableTnSFields = ExtractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryTimeAndSales);
var dateRange = DateTimeRange.Create(
new DateTimeOffset(2000, 08, 01, 00, 00, 0, TimeSpan.Zero),
new DateTimeOffset(2026, 02, 20, 00, 00, 0, TimeSpan.Zero));
var request = new HistoricalChainResolutionRequest
{
ChainRics = new[] { "0#ZFU8" },
Range = dateRange
};
var chain_results = SearchContext.HistoricalChainResolution(request);
foreach (var chain in chain_results)
{
Console.WriteLine("Chain Identifier: {0} {1}, Constituents: {2}", chain.IdentifierType, chain.Identifier, chain.Constituents.Count());
foreach (var constituent in chain.Constituents)
{
var searchResults = SearchContext.HistoricalSearch(
HistoricalSearchRequest.Create(
constituent.Identifier, constituent.IdentifierType, dateRange, HistoricalResultsBy.Ric, null));
var result = searchResults.FirstOrDefault(pos => pos.Identifier.Equals("ZFU8"));
if (result != null)
{
var extractionDatesResult = ExtractionsContext.Extract(
new HistoricalReferenceExtractionRequest
{
ContentFieldNames = new DssCollection<string>()
{
"RIC", "Start date", "Change Date", "Expiration Date"
},
Condition = new HistoricalReferenceCondition
{
StartDate = result.FirstDate,
EndDate = result.LastDate
},
IdentifierList = new InstrumentIdentifierList
{
InstrumentIdentifiers = new[]
{
InstrumentIdentifier.Create(result.IdentifierType, result.Identifier)
},
ValidationOptions = new InstrumentValidationOptions
{
AllowHistoricalInstruments = true
},
UseUserPreferencesForValidationOptions = false
}
});
dynamic srcLastDate = null;
foreach (var content in extractionDatesResult)
foreach (var prop in content.DynamicProperties)
{
Console.WriteLine("{0}\t {1},\r", prop.Key, prop.Value);
if (srcLastDate == null && prop.Key == "Expiration Date" && prop.Value != null) srcLastDate = prop.Value;
}
dynamic lastDate = new DateTimeOffset(2008, 09, 30, 00, 00, 00, TimeSpan.Zero);//result.LastDate;
dynamic startDate = new DateTimeOffset(2008, 07, 03, 00, 00, 00, TimeSpan.Zero); //result.FirstDate;
Console.WriteLine("{0},\t {1},\t {2},\t {3},\t {4}", result.Identifier, result.IdentifierType, startDate, lastDate, result.DomainCode);
var extractionResult = ExtractionsContext.ExtractRaw(
new TickHistoryRawExtractionRequest
{
Condition = new TickHistoryRawCondition
{
ReportDateRangeType = ReportDateRangeType.Range,
QueryStartDate = startDate,// new DateTimeOffset(2023, 03, 21, 20, 0, 0, TimeSpan.Zero),
QueryEndDate = lastDate,// new DateTimeOffset(2023, 03, 21, 19, 59, 59, TimeSpan.Zero),
ExtractBy = TickHistoryExtractByMode.Ric,
MessageTimeStampIn = TickHistoryTimeOptions.LocalExchangeTime,
SortBy = TickHistorySort.SingleByRic,
DomainCode = TickHistoryRawDomain.MarketPrice,
DisplaySourceRIC = true
},
IdentifierList = new InstrumentIdentifierList
{
InstrumentIdentifiers = new[]
{
InstrumentIdentifier.Create(result.IdentifierType, result.Identifier)
},
ValidationOptions = new InstrumentValidationOptions
{
AllowHistoricalInstruments = true
},
UseUserPreferencesForValidationOptions = false
},
});
string extractionID = getExtractionID(extractionResult.Notes[0]);
ReportExtraction resultsize = null;
long fileSize = 0;
Boolean success = false;
string errorMsgs = "";
string warningMsgs = "";
string permissionMsgs = "";
int attempts = 0;
while ((resultsize == null || resultsize.FullFile == null) && attempts < 5)
{
System.Threading.Thread.Sleep(5000);
try
{
resultsize = ExtractionsContext.ReportExtractionOperations.Get(extractionID);
ExtractionsContext.LoadProperty(resultsize, "FullFile");
if (resultsize.FullFile != null)
{
fileSize = resultsize.FullFile.Size;
Console.WriteLine("File Size: {0}", fileSize);
success = true;
}
else
{
Console.WriteLine("Waiting for file size...");
warningMsgs += "Waiting for file size...\n";
}
}
catch (NullReferenceException ex)
{
Console.WriteLine("FullFile is not yet available, continuing to wait...");
errorMsgs += "FullFile is not yet available, continuing to wait...\n";
errorMsgs += "Exception message: " + ex.Message + "\n";
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
errorMsgs += "An error occurred: " + ex.Message + "\n";
}
attempts++;
}
if (!success)
{
Console.WriteLine("ERROR: processing did not complete successfully !\n" + errorMsgs);
}
if (warningMsgs != "")
{
Console.WriteLine("WARNING messages:\n" + warningMsgs);
}
if (permissionMsgs != "")
{
Console.WriteLine("PERMISSION ISSUES messages:\n" + permissionMsgs);
}
var fileName = out_dir + "_" + result.Identifier + "_" + startDate.DateTime.ToString("dd.MM.yyyy") + "_" + lastDate.DateTime.ToString("dd.MM.yyyy") + "_RawMarketPrice.gzip";
using (var response = ExtractionsContext.RawExtractionResultOperations.GetReadStream(extractionResult))
using (var fileStream = File.Create(fileName))
response.Stream.CopyTo(fileStream);
}
}
}
try
{
ExtractionsContext.DefaultRequestHeaders.Remove("x-direct-download");
}
catch (Exception)
{ }
Console.WriteLine("Press Enter to exit");
Console.ReadLine();
}
}
}
Can anyone help me with the problem without sending me to the A documentation?
I've read everything and tried different options.
I have a problem with the following files
ZFU8
startDate = new DateTimeOffset(2008, 07, 03, 00, 00, 00, TimeSpan.Zero)
lastDate = new DateTimeOffset(2008, 09, 30, 00, 00, 00, TimeSpan.Zero)
ZFZ8
startDate = new DateTimeOffset(2008, 08, 16, 00, 00, 00, TimeSpan.Zero)
lastDate = new DateTimeOffset(2008, 12, 31, 00, 00, 00, TimeSpan.Zero)
ZFU9
startDate = new DateTimeOffset(2009, 05, 23, 00, 00, 00, TimeSpan.Zero)
lastDate = new DateTimeOffset(2009, 09, 30, 00, 00, 00, TimeSpan.Zero)
ZFU1
startDate = new DateTimeOffset(2011, 05, 21, 00, 00, 00, TimeSpan.Zero)
lastDate = new DateTimeOffset(2011, 09, 30, 00, 00, 00, TimeSpan.Zero)
ZFM2
startDate = new DateTimeOffset(2012, 02, 18, 00, 00, 00, TimeSpan.Zero)
lastDate = new DateTimeOffset(2012, 06, 29, 00, 00, 00, TimeSpan.Zero)
ZFU3
startDate = new DateTimeOffset(2013, 05, 18, 00, 00, 00, TimeSpan.Zero)
lastDate = new DateTimeOffset(2013, 09, 30, 00, 00, 00, TimeSpan.Zero)
Who can, please give some good code advice.
What could be the problem
I know for sure that the code is 100% functional
With this code I have downloaded all chainRIC: ZF except those with error:
ERROR: processing did not complete successfully !