Hot answers tagged

13

Of course it is fast enough. But what is fast enough? I know guys who trade off Excel sheets and they make millions, but those guys are clearly not active in high frequency space. So, it entirely depends on your trading frequency and average holding period. I also know of shops that run live trading systems by calling R functions, so, obviously Matlab ...


5

A website that replicates partially some quant papers is: http://www.volopta.com/


4

If I understand you right, you are talking specifically about Matlab's embedded code generation facility (see here: http://www.mathworks.ch/embedded-code-generation/). In my view, the answer to your question is clearly yes. This feature allows you to generate hardware specific code, e.g. for deployment on GPU's (video cards). It's used for aerospace ...


4

Write the equation as $\sigma_{MF} \to G(\sigma_{MF}) = 0$ (by subtracting $\sigma_{MF}^2$) and use a root finder. As how to solve $G(\sigma_{MF}) = 0$ in MatLab check the MatLab documentation (see e.g. "solver" there).


4

I found these nice lecture note by Karl Sigman on the web. On page three you see if $X\sim N(\mu,\sigma)$ then the moment generating function (mgf) of $X$ is given by $$M_X(s) = E(exp(sX)) = \exp( \mu s + \sigma^2 s^2 /2)$$ Thus for Brownian motion with drift $X_t$ you get $$ M_{X_t}(s) = E(exp(s X_t)) = \exp( \mu t s + \sigma^2 s^2 t /2). $$ Finally for ...


4

If I understand you correctly, then you have a filter defined for your portfolio that is defined by "1.". A) So you either filter out these bonds before you start anything that has to do with the optimization. This should be the way to go if you are interested in speeding up your program. B) If you want to do everything in the optimization, then you need ...


4

The corresponding process would be fractional brownian motion (see here) It is parametrized by the Hurst Exponent. On the referenced site you find a link to some matlab code for simulating realizations of fractional BM. If you want to see some fractional Gaussian Noise in action (Matlab) you can do so here. Further more you might want to look into ...


4

The general idea For equity securities, a simple backtest will typically consist of two steps: Computation of the portfolio return resulting from your portfolio formation rule (or trading strategy) Risk-adjustment of portfolio returns using an asset pricing model Step 2 is simply a regression and computationally very simple in Matlab. What's trickier is ...


3

I would use a Metropolis Monte Carlo / simulated annealing approach to solve your problem. Start with an arbitrary fully invested portfolio which satisfies constraints (2), (3) and the cardinality constraint $N \le K$. Then choose one of the following trial moves: Select two bonds $i,j$ at random and perform a random weight shift $w_i \rightarrow w_i + ...


3

About the integration problem: Your integrand is highly oscillatory, and the adaptive quadrature of Matlab doesn't handle such integrands very well. In general, I would recommend Mathematica when Matlab's standard procedures don't perform well. In this case, a Levin-type method would perform much better. The reason that quadv produces NaN values is because ...


3

work you way from GARCH(4,4) to GARCH(0,0) removing the intercept too. 5*5*2-1 = 49 estimations Make sure your coefficients are all statistically significant at least to 95% confidence. Make sure you have no autocorrelation in your error terms. pacf and acf should be clean. Likelihood ratio tests assess whether you lose explaining power from ...


3

No, rng does not do the same as rand. rng sets the seed for the random number generator and rand generates random numbers. Also it can be seen in documentation that the rng function only accepts positive integers. Usually random number generator algorithms start with integers for the seed. For various examples: C random function takes the system clock as ...


3

To identify the number of AR and MA terms you still need to look at the ACF and PACF. To identify the orders of differencing, the easiest way is run an ARIMA model on the data with different orders of differencing (0,1,2) and with only a constant (no AR or MA term). Look at the standard deviation of these models, as well as the ACF plot - the optimal model ...


3

EDIT : I read more about it and I get some help with someone else, here is the correct answer : The density forecast is the predictive likelihood value of the process estimated at the realized value computed in a one step ahead way. Thus for instance for a standard arma garch process with normal errors: You forecast the mean $u^{f}_{t|t-1}$ and ...


3

You might want to set $a= \epsilon - d$ and write $\epsilon>0$ as a constraint. I guess $\textbf{lsqnonlin}$ is the suitable fonction for what you intend to do. I personnally like to use and play around with $\textbf{fmincon}$, which allows more flexibility and performs well, if you are willing to provide Jacobian and/or Hessian in algorithms options


3

Find below a link for a dummy implementation in excel using VBA, which I did couple of years ago. http://www.speedyshare.com/xJZJ8/PPPs-Copy.xlsm On this implementation I am allocating between Dax returns and a German bond using as state variables the dividend yield, the inflation and the ECB interest rate. The implementation is out of sample, and simply ...


2

To the best of my knowledge there is no public implementation in matlab. However both R and Ox have some packages devoted to this end : -Ox - see G@rch package -R - see rugarch package


2

I'm not that familiar with MATLAB. However, in quadratic programming the main issue I've found is setting up the problem correctly and then the coding becomes much easier. As you noted this problem can be expressed as a quadratic cone problem and solved by quadprog but a good amount of more work needs to be done to get this in the correct form. You ...


2

You can express the Normal distribution by Sklar's Theorem in terms of Gaussian Marginals and Gaussian Copula as follows: $$F(x_1,...,x_n)=C(F(x_1),...,F(x_n))=C^{Gau}(N(x_1),...,N(x_n))$$ So the distribution equals the copula function with the respective inverse marginals as arguments. You can aswell combine any types of Copula and (continuous) different ...


2

It seems that implicitly you have a multi-objective optimization in mind, hence of course it may happen that you are not able to achieve all the objectives simultaneously. Let's say that output of a more general model is $f(x,y)$ so that the output of the first model is $f(x,0) = f_0(x)$. Denoting market prices by $m_k$ which in your case means $m_1 = A$ and ...


2

The code is function v = portvar(asset,ws) %PORTVAR Portfolio variance. % V = PORTVAR(ASSET,WS) returns the variance for a portfolio of assets % where ASSET is a matrix of asset data and WS are the corresponding % weights of each asset. ASSET is an MxN matrix of N securities and % WS is a 1xN vector where each column of ASSET is a time series ...


2

Try fmincon for solving (1)-(4).


2

The clearest and most intuitive article I have seen so far is Kritzman et al., Regime Shifts: Implications for Dynamic Strategies in FAJ (May / June 2012) It not only shows how you can use HMM for financial modelling but it also goes through the actual estimation algorithm (Baum-Welch) step-by-step and even gives full Matlab-code. From the abstract: ...


2

It is difficult to say what is not working with your code. Try Matlab's quadratic programming function quadprog() instead. This function specializes in solving this optimization problem. The syntax is: $$ x = quadprog(H,f,A,b,Aeq,beq,lb,ub) $$


2

You should write some kernel functions in CUDA (Nvidia language) for your matlab code. Arrayfun is quite restrictive and not appropriate. Look at this link http://fr.mathworks.com/help/distcomp/run-cuda-or-ptx-code-on-gpu.html for more details about matlab and parallel computing.


2

http://replication.uni-goettingen.de/ (The below text was added by Jan Höffler who founded the wiki.) This site is a replication project for papers, so far mainly in economics but open to any field. It serves as a database of empirical studies, the availability of replication material for them and of replication studies. It can help teaching replication ...


2

Why do you think this is not apropriate? Matlabs documentation for 1-D Data interpolation states that interpl1 using method spline is the right way to go: Spline interpolation using not-a-knot end conditions. The interpolated value at a query point is based on a cubic interpolation of the values at neighboring grid points in each respective dimension. ...


1

I have found the slides from Yollin very useful for portfolio optimization using R such as mean-variance, max-sharpe ratio portfolio etc. http://www.rinfinance.com/RinFinance2009/presentations/yollin_slides.pdf Also, there are some packages in R for this such as $PortfolioAnalytics$ I believe : http://www.rinfinance.com/agenda/2014/workshop/RossBennett.pdf ...


1

So in short: in place of the input where you have cost of carry in usual Black Scholes you need the traded VIX-Futures price instead (which is not (!) the result of an application of the cost of carry formula) from the market and apply Black 76 -right? EDIT: Just like Gabriele wrote in the comment. The futures price is not (!) just the spot with interest ...



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