Why do I get uncompressed data ?
I am using the .NET SDK to make on demand extractions.
Because I set the AutomaticDecompression option to false, I would expect to receive compressed data (gzipped).
Instead :
1/ Without the "X-Direct-Download"
header:
- TimeAndSalesExtractionRequest : I receive
uncompressed data
- CorporateActionsStandardExtractionRequest : I receive
uncompressed data
2/ With the "X-Direct-Download" header:
- TimeAndSalesExtractionRequest : I receive gzipped
data (as expected)
- CorporateActionsStandardExtractionRequest : I receive
uncompressed data
Here is my code :
public static class Cases
{
public static void Run()
{
Uri dssUri = new Uri("https://hosted.datascopeapi.reuters.com/RestApi/1/");
string dssUserName = "myUsername";
string dssUserPassword = "myPassword";
ExtractionsContext extractionsContext = new ExtractionsContext(dssUri, dssUserName, dssUserPassword);
//extractionsContext.DefaultRequestHeaders.Add("X-Direct-Download", "true");
extractionsContext.Options.AutomaticDecompression = false;
//-----------------------------------------------------------------
//Define Extraction Request
//-----------------------------------------------------------------
ExtractionRequestBase extractionRequest = GetTimeAndSalesExtractionRequest();
//ExtractionRequestBase extractionRequest = GetCorporateActionsStandardExtractionRequest();
//-----------------------------------------------------------------
//Extraction
//NOTE: if the extraction request takes more than 30 seconds the async mechanism will be used,
//the SDK handles this automatically for you.
//-----------------------------------------------------------------
RawExtractionResult extractionResult = extractionsContext.ExtractRaw(extractionRequest);
//-----------------------------------------------------------------
//Write data to file:
//-----------------------------------------------------------------
DssStreamResponse response = extractionsContext.GetReadStream(extractionResult);
using (var fileStream = File.Create("data.csv.gz"))
{
response.Stream.CopyTo(fileStream);
}
}
public static ExtractionRequestBase GetTimeAndSalesExtractionRequest()
{
var instru1 = InstrumentIdentifier.Create(IdentifierType.Ric, "SOGN.PA");
var instru2 = InstrumentIdentifier.Create(IdentifierType.Ric, "BNPP.PA");
var instru3 = InstrumentIdentifier.Create(IdentifierType.Ric, "CAGR.PA");
var instru4 = InstrumentIdentifier.Create(IdentifierType.Ric, "HSBA.L");
InstrumentIdentifier[] instrumentIdentifierArray = new InstrumentIdentifier[] { instru1, instru2, instru3, instru4 };
string[] requestedFieldNames = {
"Trade - Price", "Trade - Volume", "Trade - Qualifiers",
"Quote - Bid Price", "Quote - Bid Size", "Quote - Number of Buyers",
"Quote - Ask Price", "Quote - Ask Size", "Quote - Number of Sellers",
"Auction - Price", "Auction - Volume"
};
TickHistoryTimeAndSalesCondition condition = new TickHistoryTimeAndSalesCondition
{
ReportDateRangeType = ReportDateRangeType.Range,
QueryStartDate = new DateTimeOffset(2017, 01, 10, 6, 0, 0, TimeSpan.FromHours(0)),
QueryEndDate = new DateTimeOffset(2017, 01, 10, 10, 0, 0, TimeSpan.FromHours(0)),
ApplyCorrectionsAndCancellations = false,
ExtractBy = TickHistoryExtractByMode.Ric,
MessageTimeStampIn = TickHistoryTimeOptions.LocalExchangeTime,
SortBy = TickHistorySort.SingleByTimestamp,
DisplaySourceRIC = false
};
TickHistoryTimeAndSalesExtractionRequest extractionRequest = new TickHistoryTimeAndSalesExtractionRequest
{
IdentifierList = InstrumentIdentifierList.Create(instrumentIdentifierArray),
ContentFieldNames = requestedFieldNames,
Condition = condition
};
return extractionRequest;
}
public static ExtractionRequestBase GetCorporateActionsStandardExtractionRequest()
{
var instru1 = InstrumentIdentifier.Create(IdentifierType.Ric, "SOGN.PA");
var instru2 = InstrumentIdentifier.Create(IdentifierType.Ric, "BNPP.PA");
var instru3 = InstrumentIdentifier.Create(IdentifierType.Ric, "CAGR.PA");
var instru4 = InstrumentIdentifier.Create(IdentifierType.Ric, "HSBA.L");
InstrumentIdentifier[] instrumentIdentifierArray = new InstrumentIdentifier[] { instru1, instru2, instru3, instru4 };
string[] requestedFieldNames = {
"RIC", "Dividend Ex Date", "Dividend Rate", "Dividend Currency"
};
CorporateActionsStandardCondition condition = new CorporateActionsStandardCondition
{
PreviousDays = 90,
ReportDateRangeType = ReportDateRangeType.Delta,
CorporateActionsCapitalChangeType = CorporateActionsCapitalChangeType.CapitalChangeExDate,
CorporateActionsDividendsType = CorporateActionsDividendsType.DividendPayDate,
CorporateActionsEarningsType = CorporateActionsEarningsType.PeriodEndDate,
CorporateActionsEquityOfferingsType = CorporateActionsEquityOfferingsType.AllPendingDeals,
CorporateActionsMergersAcquisitionsType = CorporateActionsMergersAcquisitionsType.DealAnnouncementDate,
CorporateActionsNominalValueType = CorporateActionsNominalValueType.NominalValueDate,
CorporateActionsSharesType = CorporateActionsSharesType.SharesAmountDate,
CorporateActionsStandardEventsType = CorporateActionsStandardEventsType.None,
CorporateActionsVotingRightsType = CorporateActionsVotingRightsType.VotingRightsDate,
QueryStartDate = null,
NextDays = null,
QueryEndDate = null,
PendingEventsHours = null,
PendingEventsMinutes = null,
IncludeInstrumentsWithNoEvents = null,
IncludeNullDates = null,
ExcludeDeletedEvents = true,
IncludeCapitalChangeEvents = true,
IncludeDividendEvents = true,
IncludeEarningsEvents = true,
IncludeMergersAndAcquisitionsEvents = true,
IncludeNominalValueEvents = true,
IncludePublicEquityOfferingsEvents = true,
IncludeSharesOutstandingEvents = true,
IncludeVotingRightsEvents = true
};
CorporateActionsStandardExtractionRequest extractionRequest = new CorporateActionsStandardExtractionRequest
{
IdentifierList = InstrumentIdentifierList.Create(instrumentIdentifierArray),
ContentFieldNames = requestedFieldNames,
Condition = condition
};
return extractionRequest;
}
}
Best Answer
-
When not using X-Direct-Download: False, the response from DSS usually contains Content-Encoding: gzip which causes the proxy server decompresses the data and sends CSV to the application.
On the other hand, when using X-Direct-Download: True, the response from AWS doesn't have this header so the proxy server will not decompress the data and send raw gzip to the application.
For CorporateActionsStandardExtractionRequest with X-Direct-Download: True, currently this feature is available for the following custom Tick History reports: Tick History Time and Sales, Tick History Market Depth, Tick History Intraday Summaries, and Tick History Raw reports.
Therefore, when using CorporateActionsStandardExtractionRequest, it will always get the data from DSS server which contains Content-Encoding: gzip in the response.
This Content-Encoding: gzip in the response from DSS has been reported to the DSS team to verify the problem. For more information, please refer to this question.
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 中文论坛