@WhiteCoat I'll give it a crack and hopefully avoid getting in too deep!
The APR reflects the total cost of credit expressed as an annual percentage rate, hence the name, allowing you to compare finance offers with potentially different characteristics.
The beauty of the APR for comparison purposes is you do not need to know the lender's effective interest rate, the interval of interest compounding e.g. monthly repayments with quarterly compounding, the day count convention used to measure time intervals between cash flows, etc. used in the original calculation. It is all irrelevant;
All you do need to know to compute an APR are the value and dates of the credit agreement cash flows (the amount/s advanced and repayments), and the day count convention to apply, which determines the method used in computing the time interval between each cash flow and the initial draw down (first amount advanced), expressed as a fraction of a whole year.
If you are familiar with the Microsoft Excel XIRR function you can compute an APR the way everyone else seems to do outside the European Union. That is you define the cash flow dates and values, and internally Excel determines the XIRR result using time intervals computed using the Actual/365 day count convention (
https://en.wikipedia.org/wiki/Day_count_convention#Actual/365_Fixed).
In the EU, the directive you refer to defines yet a different method for computing time intervals, which is why the Excel XIRR may not produce the exact the same result as the EU APR formula (it does for most straightforward calculations though). Without getting bogged down too much in the details, time intervals are defined in whole weeks, months or years (determined by the contract repayment frequency), and any remainder in days. For example if you sign a contract today 25th March 2019 and your first payment is 25th April 2019 the time period as a fraction of a year is 1/12 (0.8333). If it were 30th April it would be 1 month + 5 days or 1/12 + 5/365 (0.0970).
This got quite technical very quickly so hopefully it made some sense.
This is a cheeky plug... I recently open-sourced a
Typescript/JavaScript financial calculator library which you are all free to use in your own projects.