Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

New answers tagged

0

If your label data contains any zeroes, the MAPE of any prediction when the label is 0 is infinite...


0

Sorry to be the bearer of bad news, but this approach is not guaranteed to be the MinVol solution ;-( The problem is that the long weights are only MV and weighted thus alongside the shorts (which the model thinks it can short-sell to hedge). If you ignore the shorts, then the longs won't then be MV in isolation. There is probably a long-only portfolio with ...


1

"Dates must be sorted unique", that is, you have repeated dates in the inputs you're passing. You have two copies of 1Y. You probably wanted the second to be 2Y.


2

The error arises because the first element of rets is NA (which is expected behavior as ROC calculates the rate of change of a series, but a previous value prior to the first element is naturally not available). To avoid this, add the optional argument na.pad = FALSE, i.e. rets = ROC(SPY$SPY.Close, na.pad = FALSE): > rets=ROC(SPY$SPY.Close) > head(...


1

AlphaVantage returns all the DAX (and FTSE, CAC, MIB etc.) components fine, you just have to add the appropriate suffix i.e. BMW.FRK (BMW) and AIR.PAR (Airbus). Best way to use it is to install the free Excel/Google Sheets add-on and then use the =AVSearchEquitySymbol(search string) function. I do all my AlphaVantage testing on Google Sheets, before ...


1

You're not going "wrong" anywhere. When you say the regression runs poorly it is a sign that the returns for your portfolio are not that well explained by the fama french factors (which is a positive thing for your risk factors, idk why you call it poor). When you long-short the two stocks you create a portfolio that has lesser risk that the individual ...


5

Why choose? C++ is perfectly integrated into R via the excellent Rcpp package (on CRAN). And you can use complex numbers there too: library(Rcpp) cppFunction("ComplexVector doubleMe(ComplexVector x) { return x+x; }") doubleMe(1+1i) ## [1] 2+2i doubleMe(c(1+1i, 2+2i)) ## [1] 2+2i 4+4i I would suggest starting out with R and if you run into performance ...


2

@Dhruv Mahajan makes a good point in my opinion. @LuigiBallabio in the comments is speaking from a position of authority here as he is the lead developer of QuantLib. If you want to learn C++ and Pricing at the same time you can try C++ Design Patterns and Derivatives Pricing (Mathematics, Finance and Risk) by Mark Joshi. However, since that books has been ...


5

I think it's best to learn generic C++. Most of the firms hiring for quant Dev roles usually need good general programming skills and interest in the markets. If you're learning for personal trading I'd say learn Python and for that any Data Science course that includes coding algorithms from the scratch (not through libraries) would suffice.


2

You need to remove the call to range. In Python it’s necessary but here it just returns the smallest and largest element of the vector.


Top 50 recent answers are included