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

Options

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

Appreciate to help with script. example curve ID 112790485

Best Answer

  • raksina.samasiri
    Answer ✓

    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

Answers

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.