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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
2 0 2 5

DSS - REST API - Decimal Places set up

Question from the client, who is using REST API, HTTP, Intraday Report Template:

Fields impacted: Bid Price, Ask Price, Last Price

'The number of decimals that is returned for rates by TR is inconsistent, see example in attachment (SAREUR=R.png). Is there any way to specify the number of decimals that should be returned?'

Like it is possible to set decimals in GUI? If so, could you please explain how?

Thank you.
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.

Upvotes
Accepted
11.3k 25 8 13

Hi,

You can use ContentFieldNumberFormat for specifying custom number formatting for the numeric fields, when you create the IntradayPricing report template. The related properties are DecimalPlaces and UseTrailingZero. I have tried the DecimalPlaces: 10 and UseTrailingZero: true and get the .2351000000 for bid price.

For example of usage, please see this link

For detailed information about the properties, please see this link

You can also do it in GUI by edit the selected fields in report template page.

Hope this helps.


edit.png (27.3 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.

Hi Veerapath,

Could you share your program ?

regards,

Hi @kazuhisa.matsuda,

The example of custom field can be found here. You can also find the workflow of Schedule extraction on this tutorial. You can modify the "Create a report template" section to customize decimal place of fields. Let me know if you need further information.

Zuka avatar image Zuka veerapath.rungruengrayubkul

Hi Veerapath,

Thank you very much for your response. I am trying to use On Demand in this time. According to Rick's comment, I can get raw data using ExtractWithNotes(). I used 'US0268741560', 'Isin', US1491501128', 'Isin and Fields are 'Asset Ratio For', 'Asset Ratio Against'.

I supposed to get non 1 for 'Asset Ratio For' field but still getting 1. Can I have a hint to find a solution?

regards,

Kaz


Show more comments
Upvote
1.1k 4 3 5

The REST API follows the OData spec, which follows the JSON spec (http://www.json.org/). The OData spec is a raw-data, data-transport spec and so the data is sent in the most minimal (and mostly un-formatted) fashion. I have to check with our internal expert, but trailing zeros look to violate the JSON number spec as only a leading 0 for fully fractional numbers is specified:

It is not the most minimal for data transport.


json-numberspec.png (55.6 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
462 9 7 14

Hi,

Looks as though you'd want something similar on DSS to the equivelent of TRD_UNIT (FID: 53) on Eikon, so the Developer can combine this to force the number to include trailing zeros correctly, is that the case?

If so in DSS try combining with the "Price Decimals" field on the Intraday extraction.

Best regards,

Gareth

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.

Upvote
1.1k 4 3 5

There is really 2 ways to get results from the REST API: Legacy (or scheduled extractions) and On Demand.

In a scheduled extraction, the results are all formatted via the Report Template Field Definitions, but then what you get via the REST API are file references to the results of the extraction, which as I say, are formatted per the Report Template. You are fetching a file stored on our system.

For On Demand, there is no place to specify formatting, there is just a field list, and the results are returned as the REST content of the ExtractWithNotes() request. This result is a JSON result and not formatted, but is intended to be a raw feed of the raw data that matches the request.

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