I need to calculate the XIRR at the end of each month considering all inflows that occurred on previous dates, but considering a single outflow.
Logic in Excel: syntax (Excel) xirr function
My dataframe:
data = ({'movement': ['inflow', 'outflow', 'outflow', 'inflow', 'outflow', 'outflow', 'outflow', 'outflow', 'outflow', 'outflow', 'outflow', 'inflow', 'outflow', 'outflow', 'outflow'],
'date': pd.to_datetime(['2022-01-10', '2022-01-31', '2022-02-28', '2022-03-15', '2022-03-31', '2022-04-30', '2022-05-31', '2022-06-30', '2022-07-31', '2022-08-31', '2022-09-30', '2022-10-20', '2022-10-31', '2022-11-30', '2022-12-31']),
'amount': [100, -89, -88, 200, -305, -308, -302, -307, -306, -314, -322, 300, -619, -626, -634]})
df = pd.DataFrame(data)
df