I have generated code by AI-Chatsonic in Opera Browser.
I don't know if the code is correct.
cf = {{{2024, 1, 16}, 324.67`}, {{2024, 2, 6},
634.09`}, {{2024, 11, 20}, 356.27`}, {{2023, 12, 31}, 0}};
discountRate = 0.05;
presentValue = 0;
referenceDate = DateObject[{2023, 1, 1}];
numEntries = Length[cf];
For[i = 1, i <= numEntries, i++, date = DateObject[cf[[i, 1]]];
amount = cf[[i, 2]];
timeDifference = DateDifference[referenceDate, date, "Day"];
presentValue +=
amount/(1 + discountRate)^QuantityMagnitude[timeDifference/365];]
presentValue
(*1234.51*)
Using Cashflow:
TimeValue[ Cashflow[{{{2024, 1, 16}, 324.67`}, {{2024, 2, 6}, 634.09`}, {{2024, 11, 20}, 356.27`},
{{2023, 12, 31}, 0}}], .05, {2023, 1, 1}]
(*1234.56*)
Regards M.I.