Looking for dss rest api examples in visual basic (dot net)
Hi
I'm a newbie with the REST API, my past experience is with a competitor's web service. I'm a VB man, so any Visual Basic code would be welcome. What I have to achieve is retrieving ratings for securities and issuers and their parent companies.
Any help / hints welcome
Bernard
Best Answer
-
I have tried to convert the C# code extracting Ratings to VB code using the code converters provided by Grupeet. The VB code works properly with a few changes. The code is attached.sample.zip You also need to add references to all DSS libraries (i.e. ThomsonReuters.Dss.RestApi.Client.dll, ThomsonReuters.Dss.Core.RestApi.Common.dll, etc)
If you still got error, please provide the code and error message.
0
Answers
-
@BTh The DSS API come with a .NET library and example application with code snippets in C#. You can use one of the code converters to convert that code to VB.NET.
I would recommend downloading the sample application from DSS website and try out various API calls..
0 -
Hello @BTh,
In addition to the solid approach suggested by Gurpreet, here is some more info to code in VB against DSS REST service:
1. As you have dealt with REST web service before, from VB, the mechanics of making a REST request are likely familiar, however, online there are lots of materials discussing REST from VB, for example REST Example.
2. In terms of our Datascope rest web service, once you have your valid credentials assigned, there will be two steps:
a. First, pass to rest access point you assigned login and password, and get back a valid 'authentication token'.
b. Next, pass to rest access point your specific request (ratings request) with valid token and get back the requested content (ratings results).
These steps are fully covered in our online tutorials, I would recommend REST API Tutorials section for a quick and solid introduction.
3. Lastly, how to pinpoint and request ratings content. All the available requests, with parameters required and elaborated in REST API Reference Tree. Specifically, for Ratings, please review
Extractions -> Extraction Raw -> RatingsExtractionRequest
... to summarize, the tutorials have the complete request approach covered, while API Reference Tree will have the specifics on all the available requests, while Datascope Data Content Guide offers the complete reference of available content, fields and templates.
0 -
Sorry, should have mentioned that I DID look at all sample applications, selected one (bond ratings), and tried to "convert" that one to VB... but quickly got stuck on the InstrumentIdentifierList.Create C# statement, where the code converter gets stuck with errors...:(
But I realize that, most probably, I would have to convert a lot of the underlying standard code to VB for the whole thing to work, so that looks that a never-ending attempt
0 -
Thanks for the hints, especially about the REST API Reference Tree, which looks helpful.
As mentioned in my comment to the first answer, I'm getting unsure about using VB.net, as it looks a bit "mission impossible" to me to convert the example's code from C# to VB.
0 -
Hi guys
Thanks to @veerapath.rungruengrayubkul, I have a VB.Net version of the "Create Ratings" DSS example, and it works fine (after finding out how to add references to the Microsoft.OData.* DLLs...). However, the slightly anticlimax experience is that the example, which uses IBM.N as identifier (which is a stock, and not a bond, I think) is returning NO data whatsoever, neither from my VB code, nor from the sample example... (which hopefully indirectly proves that the VB code works fine
).
Now, I'd like to see some data returned, so what shall I use as a bond RIC that might return some useful data ?
Thanks for help
Bernard
0 -
You can search for bond RICs using the Gov/Corp Search UI. However, in this case, data likely is not returned because of the ReportDateRangeType.Range which is to identify the issuers/issues ratings that have updated during the specified date range. If the ReportDateRangeType is changed to ReportDateRangeType.Last, the extraction returns some data.
0 -
Hi again
Thanks for the tip, I'll use that. I have, however, a problem with the
row.DynamicProperties.[Select](Function(dp) dp.Key & "=" + dp.Value) code. It throws an error on the only row returned:
System.InvalidCastException: 'Conversion from string " (" to type 'Double' is not valid.'
The only thing I changed Is the Ric code, I used US10YT, the US 10 year treasury bill.
Any idea what the cause could be ?
Regards
Bernard
0 -
The issue is that row.IdentifierType returns Double data type, so VB tries to convert " (" string to double. To fix this issue, please add ToString() on row.IdentifierType to get String instead. Below is the sample code.
Debug.WriteLine(row.Identifier & " (" + row.IdentifierType.ToString() & ") " + String.Join(", ", row.DynamicProperties.[Select](Function(dp) dp.Key & "=" + dp.Value)))
0 -
Thanks, it works, I should have thought about looking at the data type of the IdentifierType, but I thought the problem was in the dp function...
Now I'll try to make a more professional output so that I can save the fields and their values ultimately in an output table
Next step will be to build the identifier list from an input table. Is there some kind of Add InstrumentIdentifier to
InstrumentIdentifierList method, or how shall I go about that problem ?
0 -
The Add function is available. Below is the sample for adding two RICs. Your application can read identifiers from table and use the function to add them to the list.
Dim instrummentList = New InstrumentIdentifierList
instrummentList.InstrumentIdentifiers.Add(New InstrumentIdentifier With {.Identifier = "IBM", .IdentifierType = IdentifierType.Ric})
instrummentList.InstrumentIdentifiers.Add(New InstrumentIdentifier With {.Identifier = "TRI", .IdentifierType = IdentifierType.Ric})
Dim extractionRequest = New RatingsExtractionRequest With {
.IdentifierList = instrummentList0 -
Hi
My problem is that the 3 correct answers I needed have been given by @veerapath.rungruengrayubkul in comments to answers to my questions, so how can I accept his 3 comments as the proper answers to my problems ???
0 -
Thanks for your last answer about filling the instrument list, that was the last missing piece (for the moment
) !
regards
Bernard
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 167 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 688 Datastream
- 1.4K DSS
- 624 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
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 692 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
- 105 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 10 Wealth Management Web Services
- 91 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛