DSS Rest API .Net Example Needed
Please can you provide me with a .net sample that will return the below fields for a list of Instruments using the Rest API for .Net.
Security
ID
Security
Description
Close
Price as at x Date
Volume
Traded as at x Date
Option
Delta as at x Date
RawBeta
as at x Date
I code in VB.net but C# would also be fine.
Many thanks
Francois
Best Answer
-
Let me clarify.
The Time Series tutorial (Tutorial 4) is for an On Demand request (executed immediately), not a scheduled request (executed at a defined point in the future). That said, this difference is not important here, because what differs between an On Demand and a scheduled request is the overall workflow of the request, especially the way the extraction request is actually triggered and starts to extract the data you want. If the date range of the query is the same, On Demand or scheduled will deliver the same data. For more info on these 2 approaches, see here.
The Time Series tutorial (Tutorial 4) shows an On Demand Time Series extraction. It retrieves data for a date range (it therefore covers historical data), delivering one value per field per day. In the tutorial the data is for 1 week in 2015, but you can set the range as you like:
"Condition": {
"LastPriceOnly": false,
"StartDate": "2015-05-24T00:00:00.000Z",
"EndDate": "2015-05-31T00:00:00.000Z"
}For your use case the requested data field names list would be something like this:
"ContentFieldNames": [ "RIC", "Security Description", "Trade Date",
"Close Price", "Volume" ],Delta field:
I mentioned in my previous response that it was available from a Composite call, but that call does not deliver historical data and cannot use a date range, my mistake. I will edit my previous response to correct that.
Going back to the Data Content Guide, we see that Delta is also available from a Price History request, and that call uses a date range. There is no tutorial on the Price History call, but there is a sample in the C# example application (described in the Quick Start). The Price History call is similar to the Time Series call, except for the initial @odata.type parameter (which defines the nature of the call), and the condition (which for historical reasons uses different field names for the date range):
"Condition": {
"QueryStartDate": "2015-05-24T00:00:00.000+01:00",
"QueryEndDate": "2015-05-31T00:00:00.000+01:00",
"AdjustedPrices": false
}The Price History call can actually deliver most of the fields that could be of interest to you: "Security Description", "Trade Date", "Universal Close Price", "Official Close Price",
"Volume", "Delta". So maybe you could dispense with the Time Series call and use this one instead, but this needs to be tested with some of your instruments before making a choice.Beta field: it is not available from a Time Series call, but a separate Terms and Conditions call could deliver that field. The T&C Tutorial (Tutorial 7) illustrates this, again with an On Demand request that executes immediately, but the tutorial does not contain any date condition. You can add one, but for this call, which returns 1 value per field (not 1 per day) the date setting works differently: you only set a start date, no end date, like this:
"Condition": {
"ExcludeWarrants": true,
"StartDate": "2015-05-24T00:00:00.000Z",
"FixedIncomeRatingSources": "Fitch",
"UseRelativeAnalytics": true
}The field list for this second call would include the Beta field you want, for instance "Beta - 1 Year".
Conclusion
This might be a lot of information ... but I wanted to give you the whole picture, hope it helps.
If you post a list of a few RICs of instruments you want to query data for, I can test those and post the appropriate requests to you.
0
Answers
-
Note: this answer was edited after posting.
When you want to find a specific data field, you should check the Data Content Guide (the latest one is available here). Open tab "Field Descriptions", and use a text filter on column D or E to display only the rows that "contain" a keyword that defines what you are looking for.
To the exact fields you list:
- Security ID: which ID are you after ? Usually the security ID is an input, i.e. the instrument identifier for which you want to retrieve data. We recommend using RICs. The API allows retrieving other IDs, like ISIN, Cusip, etc.
- Security Description: this is delivered by many data requests, for instance a "Terms & Conditions" , "Time Series" or "Price History" request.
- Close Price as at x Date: a "Time Series" request will deliver the close price for a range of dates, in field "Close Price". There are many other fields for close prices, like the "Universal Close Price", "Official Close Price" fields of the "Price History" call. For details please also see the Appendixes in the Data Content Guide.
- Volume Traded as at x Date: a "Time Series" or "Price History" request will deliver the traded volume for a range of dates, in field "Volume".
- Option Delta as at x Date: a "Price History" request will deliver the Delta for an option for a range of dates, in field "Delta".
- RawBeta as at x Date: there are several fields available related to Beta, see the screenshot below. Depending on the one you need you will probably need to use a "Terms and Conditions" request.
Considering the list of fields you are interested in, you will need to perform several data requests to get them all. The "Time Series" request is described in DSS REST Tutorial 4, the "Terms and Conditions" request in DSS REST Tutorial 7 and in the DSS .Net SDK Tutorial 8. Those tutorials are just examples, where you can vary the input parameters (in particular the list of retrieved fields) depending on your needs. Our C# .Net samples are all available for download, they should help you build what you need.
Side note: you might also find the methods described here interesting.
0 -
Many thanks for your concise reply. For the Time Series Tutorial you refer to (Tutorial 4) it does not seem to cover my request. I am looking to Return the Price / Volume / Option Delta and Beta for a historical Date . This tutorial seems to create a schedule and executes at a point in time . (Not historical). If you could provide me with a Tutorial that accomplishes this it would be most appreciated.
Regards
Francois
0 -
Many thanks for the detailed reply.
I'm working through the Price History example but I'm receiving the attached error. I'm setting up all the parameters as per example so I'm not sure which object the error refers to ? Would you be able to assist ?
Regardsreuters-example-error.png
0 -
your screenshot does not reveal the details of the error, which could be useful.
As a first analysis I cannot see the definition of "requestedPriceHistoryCondition"; could that be the cause of the null reference ?
0 -
Hi. That's the only error message I see. I do not see any more details than that. Please find attached highlighted Definition you are referring to.
0 -
Oh sorry, my mistake, I don't know how I did not see that definition, it was right there !
Let me investigate further.
0 -
No worries. I'm stumped as from what I can see I've declared all defenitions and populated it according to the examples shown. Thanks!
0 -
This C# version of your VB .Net code works fine:
string[] requestedFieldNames = CreateRequestedFieldNames();
PriceHistoryCondition requestedPriceHistoryCondition = new PriceHistoryCondition
{
QueryStartDate = StartDate,
QueryEndDate = EndDate,
AdjustedPrices = false
};
PriceHistoryExtractionRequest extractionEod = new PriceHistoryExtractionRequest
{
IdentifierList = InstrumentIdentifierList.Create(instrumentIdentifiers),
ContentFieldNames = requestedFieldNames,
Condition = requestedPriceHistoryCondition
};I think that the error you see is not related to the API but to the code itself. I am familiar with C# .Net, not VB .Net, but I'd suggest you check all the objects you use in the 'Create a Historical Price Extraction section (instrumentIdentifiers, requestedFieldNames, StartDate, EndDate), one of them is probably null.
Hope this helps.
0 -
Thanks for the response. Would you be able to publish your sample that you got working? I've gone through everything and all objects are passed with populated values so I really can't find out the issue. Many thanks
0 -
Hi . I feel a bit stupid because I did not connect to the API prior to running the code so that was what the NULL was referring to, apologies. I am now receiving the below permission error. Who can I chat with to grant me access for this ? Thanks again for your assist here.
0 -
@FrancoisC, no worry, this can happen to anyone :-)
For account permissioning changes you need to talk to your Refinitiv Account Manager.
0 -
Awesome thanks! Will contact her.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.5K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 560 WebSocket API
- 39 FX Venues
- 15 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
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 281 Open PermID
- 46 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 724 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- 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
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛