Using RDMS API CurveValues Endpoint and need to convert €/Mwh to €/kwh (multiplied by 1000)
Appreciate to help with script. example curve ID 112790485
Hi @vinaya.shetty0 ,
The code below can be used
import datetimeimport requestsimport jsonapi = 'https://xxxx.rdms.refinitiv.com/api/v1';headers = { 'Authorization' : 'apikey-v1 xxxx'}#paramscurveid = 112790485scenarioID = 0minValueDate = '2018-01-01 00:00:00'maxValueDate = '2018-01-01 02:00:00'resultTimezone = 'Central Europe Standard Time'unitConversion = 1000#curve dataprint('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
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.
Hi Raksinsa
Many thanks for looking into it.
Attached is the body of the script appreciate if you can help with it.
FetchCurveValueconversion.txt