Workflow created for the KNIME forum ...
https://forum.knime.com/t/r-script-calculate-npv-irr-and-xnpv-xirr-workflows/37634
DESCRIPTION:
The challenge in this project was to calculate in KNIME, XNPV and XIRR for spaced cash flows; these incomes do not need to occur at regular intervals, then a time vector reference is needed.
R Script is the approach selected for this challenge, by using the R jrvFinance packace's algorithms. The code is not sensitive to column names; however the second column feeding the 'Tabe to R' has to be Time in 'Decimal Years' (Numeric), and 'Dates' has to be placed in the first column.
"This R package implements the basic financial analysis functions similar to (but not identical to) what is available in most spreadsheet software." (Jayanth Varma @ https://github.com/jrvarma/jrvFinance)
A cross-check of the workflow results vs function implemented in Google Sheets is available at Links section in this description; returning a XNPV difference in the range of ~10E-4. These differences may occur because of the Time conversion.
For any comment or bug realted to the workflow, please do not hesitate to leave your comment.
DISCLAIMER:
The sharing of knowledge in KNIME Hub by using these examples and models, have only demonstration purposes in the advantage of the KNIME community.
These are meant to clarify theoretical background of mentioned subjects in caption.
I will not be held responsibility for any damages arising from the use of these models in your investment/valuation related work, without taking formal advise.
Workflow
Financial _ R Script _ XNPV - XIRR Calculation
External resources
Used extensions & nodes
Created with KNIME Analytics Platform version 4.4.2
Legal
By using or downloading the workflow, you agree to our terms and conditions.