[Python] How to accurately calculate Gilt clean/dirty price, modified duration, and accrued...

Discussão em 'Python' iniciado por Stack, Maio 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm a student in software development currently working on a task that involves some financial concepts. Specifically, I need to replicate the Gilt data (e.g., clean price, dirty price, modified duration, accrued interest, etc.) as shown on platforms like Tradeweb. Like Taking inputs data such as Coupon, Issue date, Maturity date... From these, I need to calculate the other relevant values mentioned above.

    I've tried multiple sources and attempted to write code to perform the calculations, but I still can't get results that consistently match the Tradeweb data. In some cases, my results are close (off by 0.1 to 0.9), but they still vary depending on the implementation.

    I also exported the Bank of England spot rate data from their Excel file into a JSON file and used it to fetch the relevant rates and spot dates for my calculation dates. However, I'm still seeing discrepancies.

    My main issue is that I’m not confident which approach or code is correct, even when some outputs are close. Could anyone help clarify the right methodology or share sample code that accurately calculates these Gilt metrics?

    Any help is greatly appreciated.

    Continue reading...

Compartilhe esta Página