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.

Best Answer

  • 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.

Answers

  • 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:

    image

    It is not the most minimal for data transport.

  • 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

  • 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.

  • Hi @Zuka1,

    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.

  • 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


  • Hi @Zuka1,

    The custom field format currently is not supported on On Demand extraction. You need to use Schedule Extraction.

    I have tried to increase decimal place for the fields and extract data with Schedule extraction. I can get ',9425071' and '1' on 'Asset Ratio For', and 'Asset Ratio Against' respectively for the US0268741560.