Hi,
I need to use in python some function that I currently use in excel , for example DfAddPeriod.
Do you know if there is a way to use eikon dates and calendar tools in python API ?
Thanks in advance.
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Hi,
I need to use in python some function that I currently use in excel , for example DfAddPeriod.
Do you know if there is a way to use eikon dates and calendar tools in python API ?
Thanks in advance.
Hi @antoineperrin.pro1 The Adfin libraries are not really usable in Python - we are building similar types of service on our platform - some of which you can access now such as vol surfaces and forward curves etc using the Refinitiv Data Platform Libraries and opening a desktop session with an Eikon App Key. That said the date manipulations and calendrical functions piece is very well handled in python already. Personally I find these really simple and effective to use:
import datetime from datetime import datetime import dateutil.relativedelta now = datetime.now() earlier_date = now - dateutil.relativedelta.relativedelta(months=5) later_date = now + dateutil.relativedelta.relativedelta(days=5, hours=-5) print("Now: " + str(now), "Earlier: " + str(earlier_date), "Later: " + str(later_date))
Thanks but in fact with python classic datetime method we can't use a calendar. For example in your ScreenShot November 11, is a public holiday in France and the USA so DfAddPeriod in excel will return November 12...
You can use Refinitiv Data Platform Library for this purpose. See an example on this thread. The example calculates swap points and outright for an FX forward, but it can also be used to perform calendar calculations: it returns start and end dates for an FX swap given valuation date and swap tenor.