I'm importing a data frame from a csv file that looks like the below, however with hundreds of strategies and thousands of cash flows for each strategy:
TRADE_STRATEGY EVENT_DATE BOOK_VALUE_USD
A 1/1/2021 -1.5
A 2/28/2021 -2
A 3/31/2021 4
B 2/1/2021 -1.75
B 3/31/2021 -1.25
B 4/30/2021 5.75
How can I loop through the XIRR function that would save results in a data frame? I.e.
TRADE_STRATEGY IRR
A 1.357539928
B 2.48654511