For a deeper look into our DataScope Select SOAP API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
3 0 0 2

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

dss-rest-apidatascope-selectdss
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

10 Answers

Upvotes
Accepted
13.7k 26 8 12

@Francois.Coetzee1,

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13.7k 26 8 12

@Francois.Coetzee1,

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.


dss-beta.png (89.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 2

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 2

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


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

@Francois.Coetzee1,

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 ?

Upvotes
3 0 0 2

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.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

@Francois.Coetzee1,

Oh sorry, my mistake, I don't know how I did not see that definition, it was right there !

Let me investigate further.

Upvotes
3 0 0 2

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!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13.7k 26 8 12

@Francois.Coetzee1,

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 2

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 2

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.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

@Francois.Coetzee1, no worry, this can happen to anyone :-)

For account permissioning changes you need to talk to your Refinitiv Account Manager.

Upvotes
3 0 0 2

Awesome thanks! Will contact her.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea