Enrico Schumann
• Member for 8 years
• Last seen more than a month ago

You may want to browse the Task View for empirical finance, which lists many options-related packages. As for concrete suggestions: I have worked a lot with RQuantLib in the past, and I have found it ...

IB has something called "Flex Web Service", which allows you to download flex queries without being logged in; see Using the Flex Web Service. The R package IButils, which I maintain, has a function ...

When we worked with that model several years go, we used Differential Evolution and it worked very well. See Calibrating the Nelson-Siegel-Svensson Model. At least in the standard version, a best-of-...

Following the comments and the edits to the question, I'll try to show how conditional Value-at-Risk (aka Expected Tail Loss) can be minimised for a portfolio. We start with the implementation ...

You do not need zero rates to estimate a parametric model of the yield curve, such as Nelson-Siegel. Suppose for instance that you have a cross-section of bond prices. Then: For given parameters for ...

I don't use fPortfolio but when I run your code example, I first get an error: ## Error in add.constraint() : could not find function "add.constraint" Nevertheless, after that, I can ...

(I take it that 5 out of 10 assets is just an example, because in this case all combinations could easily be checked.) Here would be an example how to do it in R with an algorithm called Threshold ...

When returns follow an elliptical distribution (e.g. the Gaussian distribution), then minimising VaR and ES is equivalent to minimising variance. See https://people.math.ethz.ch/~embrecht/ftp/pitfalls....

The function reqHistoricalData has an argument useRTH ("use regular trading hours"). Set useRTH = "0" to get data outside those hours. This can only work for the futures, not for the index, which is ...

It is indeed no rounding error, but follows from the way Yahoo computes the adjusted price: it does not reflect the actual returns of the investor. Just look at August 17 and 20. The actual close ...

Strictly speaking, you cannot aggregate (i.e. sum) deltas. However, equity traders often provide their net exposure in currency units, which is a useful number. The same reasoning is possible with ...

Perhaps the PMwR package does some of the things you want. Disclosure: I am the package author. PMwR is not on CRAN (yet), but is on GitHub (https://github.com/enricoschumann/PMwR) and can also be ...

A test for arbitrage opportunities with an LP is to minimize the cost of setting up the portfolio, subject to the restriction that the portfolio loses money in no state of the world. (Note that in ...

You add 1 to every monthly return of a given quarter, take the product of those returns, and then subtract 1. In R (without any package): Suppose r are the monthly returns, and dt are the timestamps. ...

The Fama-French factors follow from simple sorting procedures, so they do not explicitly control correlation. But if you have access to the underlying stocks, you could replace this sorting procedure ...

It would have been helpful had you provided links to those papers. But in general, you need to distinguish between the optimisation model, and the numerical technique used to solve the model. ...

As Chris already wrote in his comments: your description is not complete. But I would suggest to write a simple loop over your data matrix. There is no need for working with zoo/xts while doing these ...

Here is one recipe, in case you can live with Spearman rank correlation. (Which you should: linear correlation is often not appropriate in the non-normal case. And in the normal case, there is almost ...

Have you checked the performance of the particular stocks? library("quantmod") library("PMwR") cmp <- "AAPL" aapl <- getSymbols(Symbols = cmp, auto.assign = FALSE)$AAPL.Adjusted cmp <- "FB"... View answer Accepted answer 3 votes As indicated in my comment, the function mvFrontier in the development version of the NMOF package may help you. (Disclosure: I am the package maintainer.) You may get the latest version from GitHub. ... View answer 3 votes A simple, though somewhat inflexible, way would be to regress$\bar{P}$on the$I\$ series only (no constant). This will minimise squared differences instead of absolute ones, though. R example; I ...

As commented by Alex C, the R package PMwR, which I maintain, may offer some useful functionality. A small example: I create a journal of three trades. (Note that a journal here is simply a collection ...

Create a new price series that has a value for every minute, e.g. by carrying the last observation forward. Then compute returns from this new price series. (There are simpler approaches for this ...

A useful decomposition is, in R's matrix notation, V = S %*% C %*% S, in which S is a matrix with the standard deviations on the main diagonal and zeros elsewhere, and C is the correlation matrix. (...

For such a problem ("selecting n out of m") you can use optimisation heuristics. These algorithms work well even for large n and m, and they are flexible: you may as well select a portfolio that ...

If using R is an option: With package PMwR, which I maintain, you could compute a time-series of returns for such a portfolio in one line of code: ## P -- a matrix of prices: each column holds the ...

The third approach is the correct one. In general, one cannot aggregate partial moments of single assets into partial moments of the portfolio, as discussed for instance in this paper: @ARTICLE{...

To add another possibility: Here is how such a model could be run in the PMwR package (which I maintain). It seems that sig holds the desired position. Suppose we have a time series of prices P. sig &...