question

Upvotes
Accepted
3 1 2 3

.NET SDK GetReadStream truncates the data of a RawExtractionResult?

I use the .NET SDK, and followed the extraction example: "Tick History / Request Time and Sales for RICs" available in the API Examples sample application.The suggested way to unpack the results following the sample application is to get the ReadStream:

//Download the results
using (var response = ExtractionsContext.RawExtractionResultOperations.GetReadStream(result))
using (var stream = response.Stream)
using (var reader = newStreamReader(stream))
{
	var lineCount = 0;
	while (!reader.EndOfStream) 
	{
		Debug.WriteLine(reader.ReadLine());
		lineCount++;
	}
}   

It appears this method works fine only as long as the data extracted is small. As soon as I try to retrieve a few RICs the response.Stream seems to be truncated. Is that limited? I have run a couple of extractions, and by the Notes in the RawExtractionResults I should have received about 20,000 updates. However when I read the stream extracted like above it always seem to cap it at 5314 lines.

I assume I am hitting a limitation placed on the stream? Can you confirm please? If that is so, could you please:

a) point me to any documentation or sample code comments that states that such limitation exists,

b) point me to the alternative way to retrieve the extracted data.

Many thanks.

tick-history-rest-api.net
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
Accepted
17.1k 47 13 19

@development2 It could be the issue where most common libraries are unable to handle the compression algorithm used for Tick History delivery. Please follow the advisory - Advisory: Avoid Incomplete Output - Download then Decompress

Try to use the code snippets suggested for .NET and let us know if the problem is not resolved.

All the documentation and limits etc are available in the documents tab in the TRTH API page.

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
3 1 2 3

thanks @Gurpeet, that worked.

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.