question

Upvotes
Accepted
5 0 0 1

Rounding price index data

Hi there - I am trying the below code and see all the prices as .1 for the first ticker and as 0 for the second ticker; believe because the prices are very small in US dollar terms and so rounding of 1 decimal is not helping. Would you be able to advise how to change the code to see 3 or 4 decimals?

ds.fetch(tickers=['UKB23X1H3','UKBGHWH98','UKB064SH8'], fields=['X(PI)~U$'], date_from= '2021-01-31', date_to= '2021-04-14', freq= 'W')

datastream-apidsws-api
ds-price.jpg (55.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.

1 Answer

Upvote
Accepted
38.1k 71 35 53

@Avik Saha

You can use the number of decimal places (DPL#) expression.

The code looks like this:

DS.fetch(tickers=['UKB23X1H3','UKBGHWH98','UKB064SH8'], fields=['DPL#(X(PI)~U$,4)'], date_from= '2021-01-31', date_to= '2021-04-14', freq= 'W')
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.

Thanks, @jirapongse.phuriphanvichai, exactly what i was looking for.

Click below to post an Idea Post Idea