question

Upvotes
Accepted
27 0 0 2

RDMS API Code to convert €/Mwh to €/kwh (multiplied by 1000)

Using RDMS API CurveValues Endpoint and need to convert €/Mwh to €/kwh (multiplied by 1000)

Appreciate to help with script. example curve ID 112790485

#productpython api
icon clock
10 |1500

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

Upvotes
Accepted
14.9k 32 5 10

Hi @vinaya.shetty0 ,

The code below can be used

1716911713188.png

import datetime
import requests
import json

api = 'https://xxxx.rdms.refinitiv.com/api/v1'
headers = { 'Authorization' : 'apikey-v1 xxxx'}

#params
curveid = 112790485
scenarioID = 0
minValueDate = '2018-01-01 00:00:00'
maxValueDate = '2018-01-01 02:00:00'
resultTimezone = 'Central Europe Standard Time'
unitConversion = 1000

#curve data
print('requesting curve ' + str(curveid) + ' data..')
result = requests.get(api + '/CurveValues/'+str(curveid)+'?/ScenarioID='+str(scenarioID)+'&MinValueDate='+minValueDate+'&MaxValueDate='+maxValueDate+'&ResultTimezone='+resultTimezone, headers=headers, verify=True)


if result.status_code == 200:
    values = result.json()
    print(str(len(values)) + ' curve data points returned')
    for value in values:
        value['convertedValue'] = value['value']*unitConversion 
else:
    print('Request failed: ' + str(result.status_code))
    
print(values)

and here's the result

1716911786109.png


1716911713188.png (52.3 KiB)
1716911786109.png (65.0 KiB)
icon clock
10 |1500

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

Upvotes
14.9k 32 5 10

Hi @vinaya.shetty0 ,

Regarding the available parameters shown in swagger (https://xxxx.rdms.refinitiv.com/api/swagger/index.html) on this endpoint, there aren't any parameter than can use to specify the unit returned in the response.

However, you can use Python script to adjust the value by miltiplied by 1000

I can also help you write an example code to do so if you provide the example response body.

icon clock
10 |1500

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

Upvotes
27 0 0 2

Hi Raksinsa

Many thanks for looking into it.

Attached is the body of the script appreciate if you can help with it.

FetchCurveValueconversion.txt


icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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