3

First of all, Sharpe Ratio (SR) is meant to assess the uncertainty surrounding the expected returns of your PnL. In short: you divide by the standard deviation of the returns because you trust less a time series of PnL with a large standard deviation than with a small one. Nevertheless it is in fact not the best indicator; the best one is the t-test, that ...


1

Adding on to Japser's answer, to address the division by 0, we can set a very small value for the lower bound for mu and sigma (e.g. 1x10^-5). To see the algorithm in action, see this


1

That is because of sigma_tilde_squared == 0, You could add 0.01 at the add to avoid it == 0


1

If you want yeild for a given rating then FRED (https://fred.stlouisfed.org/series/DBAA) has great data. Most of the others are in Bloomberg or other payment data sources...


1

You are almost there! The annual variance is the sum of the daily variance: $$\sigma_y^2 t_y = \sum_{i=1}^{252}{\sigma_d(i)^2 t_d}$$ where $t_d=\frac{1}{252}$ and $t_y=1$ hence the $\sqrt{252}$ term you get if you assume that the volatility is expected to be the same every day. The daily variance is related to average 10min bar variances $\sigma_m$: $$\...


1

You could try to do regression analysis, where you sub-divide the day into time windows and then try to fit a seasonality by saying that x% of daily variance will accrue in the first hour of trading etc.


1

The issue here is that when you call the bondYield method, if you don't specify a settlement date, QuantLib will calculate the discount factors based on the global evaluation date. By default that will be the system date. So either define the settlement date in the method, as the parameter after the frequency: start = ql.Date(16,3,2020) maturity = ql.Date(21,...


1

There is no closed-form analytical solution for the long-only minimum-variance portfolio. Only the the unconstrained (short-sales allowed) portfolio. See here. Modifying the unconstrained portfolio to become the constrained portfolio in the manner you described is not going to be equal to the true constrained portfolio solution, which must be obtained by ...


1

getSymbols("^GSPC", env = sp500, src = "yahoo",from = as.Date("1960-01-04"), to = as.Date("2009-01-01")) this code not gonna work until you create a new environment which you used, sp500. you need to create this new environment using sp500 = new.env(). or you can not creat it but you need to change your code to ...


1

Alternatively you could check this link: https://finance.yahoo.com/quote/%5EGSPC/history?period1=1479945600&period2=1606176000&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true Also this code worked for me. Directly loading data using getSymbols. getSymbols("^GSPC", src = "yahoo", from = as.Date("...


Only top voted, non community-wiki answers of a minimum length are eligible