I'm building a mean variance optimizer for a portfolio of FX, commodity and bond futures. The input data is hourly returns for each underlying. Given each underlying has different market opening hours, this results in data with lots of null returns.
An example return table follows:
┌──────────────────┬─────────┬─────────┬───────────┐ │ DateTime (UTC) │ EURUSD │ SOYBNSD │ USB10YUSD │ ├──────────────────┼─────────┼─────────┼───────────┤ │ 2005-03-02 07:00 │ 0.0035 │ 0.0 │ 0.0 │ │ 2005-03-02 08:00 │ -0.0044 │ 0.0 │ 0.0 │ │ 2005-03-02 09:00 │ 0.0019 │ 0.0 │ 0.0 │ │ 2005-03-02 10:00 │ 0.0041 │ 0.0082 │ -0.00002 │ │ 2005-03-02 11:00 │ -0.0053 │ 0.0074 │ 0.00003 │ └──────────────────┴─────────┴─────────┴───────────┘
There are probably a multitude of problems with this, including mis-representing volatility and correlation (in particular during periods that overlap with many market holidays).
I can think of several approaches to working around my particular scenario:
Do nothing.
- This is what I've tried, and it seems to cause a headache for the optimizer as many rebalances simply end up with the initial guess (equal weight). I have yet to dig into exactly why this happens but my guess is that the correlation between the commodity and bond underlyings is greatly overstated and the volatility of the same understated.
Only keep rows where all assets have had returns.
- Not a good idea because there may legitimately be days with zero return, and this also severely limits the data used for FX pairs that trade nearly 24/5.
For each underlying, convert returns during closed market hours to
NaN
.- For volatility this would make sense but calculating Pearson's correlation would be trickier. I can see on https://stats.stackexchange.com/a/7945 that a 1-dimensional cross-variogram is suggested, however I'm not sure this would work for my case as I'm dealing with "gap distances" that vary greatly (from 0 (during opening hours) to 16 hours (overnight) to many more hours (weekends/holidays)). Am I right in thinking this?
I have sought to find how this is dealt with in academia but found only examples of MVO on daily data, where it seems you typically cull the null rows and use only days where all assets have had returns.
Is anyone able to share insight into how they would tackle this problem?