ConPA uses as calculation backend

[This article was first published on » R-project, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

ConPA is an asset allocation application using the classic Markowitz approach. For the calculations the open-source statistical programming language R is used. R scripts are executed on’s computer clusters in the Cloud and the results are displayed by ConPA frontend.

ConPA allows to set the investment date of the portfolio, the target return and the constraints for each asset. The result are the optimal weights of the assets and the portfolio performance, if the investment date is in the past. Furthermore, ConPA can retrieve the key statistics and calculate the implied volatility of the stocks.

Imitating a well-known concept of the open source model, ConPA makes a transparent process: the user can reproduce the results by himself. To check the figures, the user can click on the script icon, close to the help icon, and an R script, corresponding to the optimal portfolio calculated, is displayed. It is the same script executed on with the results displayed by ConPA frontend. The user can compare those results with the output of the script, running it, for instance, on a local R installation. De facto, an “Open Finance” paradigm. fits perfectly to ConPA, because it cuts the backend complexity and the development time.

Technical details:
At the beginning the asset allocation algorithm was ported to JavaScript from Fortran. Executing directly the same R script used to develop the algorithm is simpler: it avoids the porting mistakes and it reduces the development lifecycle.

The key component between and Node.js instance, the backend framework ConPA is based on, is the module node-rio: it is an R serve adapter. It injects the R code in a remote instance of Rserve, running on session. The session is configured with the following packages: RJSONIO, tseries, Rserve. The package tseries contains the implementation of mean-variance algorithm. The package RJSONIO serializes the inputs and the outputs of the script to a JSON format, a data format easy to handle for the JavaScript backend of ConPA. The package Rserve is configured to enable authenticated remote connections.

The roundtrip between ConPA frontend and is straightforward: the frontend collects the user choices, the backend dispatches the request to, retrieving the historical asset prices, calculating the optimal portfolio, finally the performance and returning the results.

To leave a comment for the author, please follow the link and comment on their blog: » R-project. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)