HOLIDAY LIST using Eikon API in Python Dataframe

I tried to get the Holiday List using Eikon API in Python but no help, can we get in Python pandas dataframe so that we can use it and play with it ? Please see attached my query in python script.

Best Answer

  • m.bunkowski
    Answer ✓

    Hi anonymous user

    You can get the similar output using one of the endpoints and refinitiv-data library

    import refinitiv.data as rd
    import pandas as pd

    rd.open_session()
    url = "https://api.refinitiv.com/analytics/functions/v1/common/list-holidays"
    body = {
    "universe": [
    {"startDate": "2023-01-01",
    "endDate": "2023-12-29",
    "calendarCodes": ["USA"]}
    ]
    }

    request = rd.delivery.endpoint_request.Definition(
    method=rd.delivery.endpoint_request.RequestMethod.POST,
    url=url,
    body_parameters=body,
    )
    response = request.get_data()
    pd.DataFrame(response.data.raw["data"][0]["holidays"])

    To get the calendarCodes from currency code:

    url = "https://api.refinitiv.com/analytics/functions/v1/fx/fx-info"
    body = {"universe":
    [{"currencyCodes":
    ["USD"]}]}

    request = rd.delivery.endpoint_request.Definition(
    method=rd.delivery.endpoint_request.RequestMethod.POST,
    url=url,
    body_parameters=body,
    )
    response = request.get_data()
    response.data.raw

Answers