Introduction I am a big passionate of the tidyverse packages: I think they make the code very clean and clear. In particular, I like the lubridate packages for managing and making operations with dates but its major drawback is that it doesn’t manage financial holidays, which are key when projecting financial cashflows linked to instruments like interest rte swaps.
In this case, I prefer to use the RQuantLib package.
One of the most common problems when dealign with financial data is to have assets (or liabilities) denominated in a currency that is different from the domestic one.
I propose a tidy solution to this problem that involves no use of for cycles.
The principle of the solution is that converting each currency can be done in parallel using the map function while the consolidation of the results will be done using the reduce logic.
In quantitative finance we often look at simulations of some market risk factors like equity returns or interest rate changes.
There are many third party companies who specialize in the historical calibration of such variables and provide simulations of future expected outcomes to the companies who require them.
For example, let’s suppose that we receive the expected returns of the Google shares as per the following distribution
# This modelling is given by the third party and in theory we don't know it google <- rnorm(10000, mean = 0.