13.07.2015 Views

BERND PAPE Asset Allocation, Multivariate Position Based Trading ...

BERND PAPE Asset Allocation, Multivariate Position Based Trading ...

BERND PAPE Asset Allocation, Multivariate Position Based Trading ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

176 ACTA WASAENSIA275276 figure;277 subplot(2,1,1), plot(-(hchist+hfhist)), title(’Market maker holdings’);278 subplot(2,1,2), plot(-(cwealth+fwealth)), title(’Market maker wealth’);279280281 % Produce function output282283 returns = rhist; %(T*1) simulated logreturns284285 toc %end clock286287288 function k = fastbin(n,p)289 %FASTBIN generates binomial random variates optimized for speed290 %K = FASTBIN(N,P) generates a random number from the291 %binomial distribution with sample size N and probability P.292 %Uses the BINV algorithm described in:293 %Voratas Kachitvichyanukul and Bruce W. Schmeiser (1988):294 %Binomial Random Variate Generation295 %Communications of the ACM 31, 216-222296 %297 % written by Bernd Pape298299 %BINV algorithm starts here300 %Step 1301 q = 1-p; s = p/q; a = (n+1)*s; r = q^n;302303 %Step 2304 u = rand; k = 0;305306 %Step 3 + 4307 while u > r308 u = u - r;309 k = k + 1;310 r = ((a/k)-s)*r;311 end312 %end of BINV algorithm

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!