Sourcing historical 30D Volatilities with Python

dimchan
dimchan Newcomer

Dear Team,

What is the python code to source historical 30D volatilities for a ticker?

I have tried with the below code with the lseg-data package, but it's only returning the current 30d vola:

df = ld.get_history(
    universe=['AAPL.O'],
    fields=['TR.VOLATILITY30D'],
    interval= "1D",
    end = datetime.datetime.today().strftime("%Y-%m-%d"),
    start = (datetime.datetime.today() - timedelta(4*365)).strftime("%Y-%m-%d"))

Thank you

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @dimchan

    Thank you for reaching out to us.

    I checked with the Data Item Browser tool and found that this field (TR.VOLATILITY30D) doesn't support timeseries data.

    image.png

    The moderators on this forum do not have deep expertise in every bit of content available through LSEG products, which is required to answer content questions such as this one.

    The best resource for content questions is the Helpdesk support team, which can be reached by submitting queries through LSEG Support. The support team will either have the required content expertise ready available or can reach out to relevant content experts to get the answer for you.

    You need to ask for the Excel formula, such as =RDP.Data, that can be used to retrieve the required data.

    Then, we can help you converting that formula to Python code.