実際の株価データを用いたオプション料の計算

Similar documents
comment.dvi

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

ex14.dvi

1.ppt

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

tuat1.dvi

ex01.dvi

第7章 有限要素法のプログラミング

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

r07.dvi

ohp07.dvi

1 4 2 EP) (EP) (EP)

2008 ( 13 ) C LAPACK 2008 ( 13 )C LAPACK p. 1

BW BW

スライド 1

新版明解C言語 実践編

C言語によるアルゴリズムとデータ構造

#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main

DKA ( 1) 1 n i=1 α i c n 1 = 0 ( 1) 2 n i 1 <i 2 α i1 α i2 c n 2 = 0 ( 1) 3 n i 1 <i 2 <i 3 α i1 α i2 α i3 c n 3 = 0. ( 1) n 1 n i 1 <i 2 < <i

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

r08.dvi

C

Krylov (b) x k+1 := x k + α k p k (c) r k+1 := r k α k Ap k ( := b Ax k+1 ) (d) β k := r k r k 2 2 (e) : r k 2 / r 0 2 < ε R (f) p k+1 :=

ex01.dvi

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru

double float

P06.ppt

Microsoft PowerPoint - program.ppt [互換モード]

新・明解C言語 ポインタ完全攻略

橡Pro PDF

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

2 P.S.P.T. P.S.P.T. wiki 26

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r,

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

Taro-数値計算の基礎Ⅱ(公開版)

memo

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose


115 9 MPIBNCpack 9.1 BNCpack 1CPU X = , B =

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル

PowerPoint Presentation

‚æ2›ñ C„¾„ê‡Ìš|

$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena

sim0004.dvi

P02.ppt

Microsoft Word - no14.docx

Microsoft Word - no15.docx

PowerPoint Presentation

joho07-1.ppt

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

(K&R 2.9) ~, &,, >>, << 2. (K&R 5.7) 3. (K&R 5.9) 4. (K&R 5.10) (argc argv atoi(), atof() ) 5. (K&R 7.5) (K&R 7.6) - FILE, stdin, stdout, std

USB ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E

2301/1     目次・広告

A 30 A A ( ) 2 C C (, machine language) C (C compiler) ( ) Mac Apple Xcode Clan

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

kiso2-06.key

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Microsoft Word - C.....u.K...doc

1 ( ) 1.1 (convert.sh) (18GHz 26GHz) C (convert.c, convert1.c) mesure-ryudai convert.sh #!/bin/sh # file1 file1= ls -1 $1 # file1 data for data in $fi

Transcription:

2002 2 20 1

1 3 2 3 2.1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : 5 2.1.1 : : : : : : : : : : : : : : : : : : : : 5 2.1.2 : : : : : : : : : : : : : : : : : : : : 6 2.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 2.3 : : : : : : : : : : : : : : : : : : : : : : : : : : : : 7 3 8 3.1 : : : : : : : : : : : : : : : : : : : : : 8 3.2 : : : : : : : : : : : : : : : : : : : : : : : : 8 4 11 4.1 : : : : : : : 11 4.2 : : : : : : : : : : : : : : : : : : : : : : : : 11 4.3 : : : : : : : : : : : : : : : : : : 12 5 13 5.1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 13 5.2 : : : : : : : : : : : : : : : : : : : : : : : : : : 20 6 23 A 24 B 25 C 27 D 29 E 33 2

1 1970 F.Black, M.Scholes, R.Merton 3 [1] 2 3 4 5 2 [1] A 1000 10 1000 10 A 50 50 50 A 1020 50 A 1000 3

50 A 1000 4 4

2.1 2.1.1 A K =100 S 98 T 4 1 5 100 100 100 5 100 115 100 15 10 1 10 5 0-5 90 C 100 110 1: K = 100 5 5

2.1.2 B 70 S 65 T 3 5 70 55 55 70 15 10 70 2 10 5 0-5 70 60 C 80 2: K =70 5 2.2 C(S T T) C(S T T) = e ;rt E[max(S T ; K 0)] 6

= e ;rt Z 1 ;1 max(s T ; K 0)P (S T )ds T (1) [2] S T T K P (S T ) S T E[max(S T ; K 0)] P r 2.3 C(S T T) r n n n = rn n!1 lim n!1 1+ r n n = lim 1 1+ n r n (2) N!1 = lim N!1 1+ 1 N ( 1+ 1 N [3] e r rn N ) r = e r (3) 7

3 1970 Fischer Black, Myron Scholes, Robert Merton 3.1 T S T ( 3) ln S T ( 4) 3.2 (1) [3] (1) P (S T )= 1 p p 1 T 2 e; 2 ( ln S T ;(ln S+(r; 2 p 2 )T ) T ) 2 (4) Z 1 C(S T T)=e ;rt ;1 max(eln S T 1 ; K 0) p p 1 T 2 e; v = ln S T ;(ln S+(r; 2 2 )T ) p T C(S T T) = e ;rt Z 1 ;1 Z Z = e ;rt ;1 2 (r; max(se 2 ( ln S T ;(ln S+(r; 2 p 2 )T ) T 2 )T +ptv 1 ; K 0) p e ; v2 2 dv 2 ) 2 d(ln S T ) (5) Z 2 (r; Se 2 )T +p Tv 1 Z p e ; v2 2 dv ; K p 1 e ; v2 2 dv (6) 2 ;1 2 2 ; ln S=T ;(r; 2 Z = )T ) p T c c = SN(d 1 ) ; Ke ;T N(d 2 ) (7) 8

1 0.8 0.6 0.4 0.2 0 0 1 2 3 4 5 3: 1 0.8 0.6 0.4 0.2 0 5 0 5 4: 9

d 1 d 2 d 1 = ln(s=k)+( + 2 =2)T p T (8) d 2 = ln(s=k)+( ; 2 =2)T p p = d 1 ; T T (9) N(x) (0 1) x S K T [1] 10

4 X(t) X(t) 4.1 C(S T T) S T ~ S T ~ S T = S T e ;T (10) ln ~ S T =lns T ; T (11) (10) (11) ln ~ S T 4.2 X(t) X(t) X T (t) =ln S ~ T +t ; ln S ~ t (12) T t t + T T =1 T =100 11

4.3 C(S T T) (1) e ;rt ~ S T K C(S T T) C(S T T)= Z 1 ;1 max( ~ S T ; K 0)P ( ~ S T )d ~ S T (13) x = S T =S 0 C(S T T)=S 0 Z max(x ; K S 0 0)P (x)dx (14) v =lnx Z = K=S 0 C(S T T) Z 1 C(S T T)=S 0 (e ln x ; Z)e ln x P ~ (ln x)d(ln x) (15) ln Z ~ P (ln x) T =1 T = 100 12

2 (T =1) 2 (T =100) 2.4810 ;4 1.9710 ;2 1.4210 ;1 3.2810 ;4 2.1710 ;2 1.7810 ;1 5 1: 2 1977 2001 5.1 5(a) 6(a) ln ~ S T 5(b) 6(b) T =1 T = 100 (12) ( 7 8) 2 ( 1) T = 1 T = 100 T =1 ( 9)[4, 5] P L (x) = 1 Z 1 0 e ;jqj cos(qx)dq (16) 13

9 (a) 8 logs T 7 6 0 1000 2000 3000 4000 5000 6000 T( ) 0.8 (b) 0.4 ~ logs T 0 0.4 0.8 0 1000 2000 3000 4000 5000 6000 day T( ) 5: (1977 2001 ) (a) e t (b) 14

9 (a) 8 logs T 7 6 0 1000 2000 3000 4000 5000 6000 day T T( ) 0.8 (b) 0.4 ~ logs T 0 0.4 0.8 0 1000 2000 3000 4000 5000 6000 day T( ) 6: (1977 2001 ) (a) e t (b) 15

T = 1 T = 100 ( 7 8) X 100 (t) X 1 X 100 (t) = ln ~ S t+100 ; ln ~ S t (17) = = 99X p=0 99X p=0 ln ~ S t+p+1 ; ln ~ S t+p (18) X 1 (t + p) (19) X 1 16

100 10 (a) Gauss real data 1 0 0.2 0.1 0 0.1 0.2 10 (b) Gauss real data 1 0 0.75 0.25 0.25 0.75 7: X T (a) T = 1 (b) T =100 17

10 2 10 1 (a) Gauss real data 10 0 10 1 0.2 0.1 0 0.1 0.2 10 1 (b) Gauss real data 10 0 10 1 1 0.5 0 0.5 1 8: X T (a) T = 1 (b) T =100 18

100 10 Gauss real data Levy 1 0 0.2 0.1 0 0.1 0.2 9: T = 1 =1:6 =0:35 19

5.2 (15) ( 10 11) T =1 T = 100 20

(a) 20 BS theory real data C(S1,1) 10 0 1 1.1 1.2 1.3 1.4 1.5 1.6 K / So K/S0 C(S100,100) (b) 200 BS theory real data 100 0 1 1.1 1.2 1.3 1.4 1.5 1.6 K / So K/S0 10: C(S T T) (15) (a) T = 1 (b) T = 100 ~ P (ln x) S 0 = 3000 K K=S 0. 21

30 20 (a) BS theory real data C(S1,1) 10 0 1 1.05 1.1 1.15 K / So K/S0 300 (b) BS theory real data C(S100,100) 200 100 0 1 1.2 1.4 1.6 1.8 2 2.2 K / So K/S0 11: C(S T T) (15) (a) T =1 (b) T =100 P ~ (ln x) S 0 = 3000 K K=S 0. 22

6 T =1 [1] John C. Hull: Futures and Options Markets, 3rd Ed (Prentice Hall, 1998) [2] : (, 2000) [3] : (, 2000) [4] R. N. Mantegna and H. E. Stanley: An Introduction to Econophysics (Cambridge University Press, Cambridge, 2000) [5] J.Voit: The Statistical Mechanics of Financial Markets (Springer, Berlin, 2001) 23

A #include <stdio.h> #include <stdlib.h> #include <math.h> #define N_data 6558 main(int argc, char *argv[]) { FILE *fin,*fout int i double sumy,sumxy,sumx1,sumx2,d0,a10,a20 static double X1[N_data],X2[N_data],Y[N_data],XY[N_data],F0[N_data] static double X[N_data],Y0[N_data] if(argc!=3){ printf("hikisu number is difference.\n") exit(1) /*file open*/ if((fin=fopen(argv[1],"r"))==null){ printf("the read file dosen't open.\n") exit(1) if((fout=fopen(argv[2],"w"))==null){ printf("the write file doesn't open.\n") exit(1) for(i=0 i<n_data i++){ X1[i]=(float)i+1 X2[i]=(float)(i+1)*(i+1) for(i=0 i<n_data i++){ fscanf(fin,"%lf",&y[i]) /*reading data*/ 24

for(i=0 i<n_data i++){ XY[i]=X1[i]*Y[i] sumx1=0. sumx2=0. sumy=0. sumxy=0. for(i=0 i<n_data i++){ sumx1+= X1[i] sumx2+= X2[i] sumy+= Y[i] sumxy+= XY[i] printf("%d %d %lf %lf\n",sumx1,sumx2,sumy,sumxy) d0=n_data*sumx2-sumx1*sumx1 A10=(sumY*sumX2-sumX1*sumXY)/d0 A20=(N_data*sumXY-sumX1*sumY)/d0 for(i=0 i<n_data i++){ F0[i]=(float)(A10+A20*i) fprintf(fout,"%lf\n",f0[i]) printf("%lf\n",f0[i]) printf(" myu=%15.8e\n b=%lf\n d0=%lf\n",a20,a10,d0) fclose(fin) fclose(fout) B #include <stdio.h> #include <stdlib.h> #include <math.h> #define N_data 6558 25

main(int argc, char *argv[]) { FILE *fin,*fout int i double sumy,sumxy,sumx1,sumx2,d0,a10,a20 static double X1[N_data],X2[N_data],Y[N_data],XY[N_data],F0[N_data] static double X[N_data],Y0[N_data] if(argc!=3){ printf("hikisu number is difference.\n") exit(1) /*file open*/ if((fin=fopen(argv[1],"r"))==null){ printf("the read file dosen't open.\n") exit(1) if((fout=fopen(argv[2],"w"))==null){ printf("the write file doesn't open.\n") exit(1) for(i=0 i<n_data i++){ X1[i]=(float)i+1 X2[i]=(float)(i+1)*(i+1) for(i=0 i<n_data i++){ fscanf(fin,"%lf",&y0[i]) /*reading data*/ for(i=0 i<n_data i++){ Y[i]=(float)log(Y0[i]) for(i=0 i<n_data i++){ XY[i]=X1[i]*Y[i] 26

sumx1=0. sumx2=0. sumy=0. sumxy=0. for(i=0 i<n_data i++){ sumx1+= X1[i] sumx2+= X2[i] sumy+= Y[i] sumxy+= XY[i] printf("%d %d %lf %lf\n",sumx1,sumx2,sumy,sumxy) d0=n_data*sumx2-sumx1*sumx1 A10=(sumY*sumX2-sumX1*sumXY)/d0 A20=(N_data*sumXY-sumX1*sumY)/d0 for(i=0 i<n_data i++){ F0[i]=(float)(A10+A20*i) X[i]=Y[i]-F0[i] fprintf(fout,"%lf\n",x[i]) printf("%lf\n",x[i]) printf(" myu=%15.8e\n b=%lf\n d0=%lf\n",a20,a10,d0) fclose(fin) fclose(fout) C #include <stdio.h> #include <stdlib.h> #include <math.h> #define N_data 6558 #define hist_range 300 #define day 100 main(int argc, char *argv[]) { FILE *fin,*fout 27

int i,j,hist[hist_range+1] static double X[N_data-day],X1[N_data],d_x,Xmax,Xmin static double myu,sum1,sum2,sigma1,sigma2 if(argc!=3){ printf("hikisu number is difference.\n") exit(1) /*file open*/ if((fin=fopen(argv[1],"r"))==null){ printf("the read file dosen't open.\n") exit(1) if((fout=fopen(argv[2],"w"))==null){ printf("the write file doesn't open.\n") exit(1) for(j=0 j<=hist_range j++){ hist[j]=0 for(i=0 i<n_data i++){ fscanf(fin,"%lf",&x1[i]) for(i=0 i<n_data-day i++){ X[i]=X1[i+day]-X1[i] /*reading data*/ Xmin=X[0] Xmax=X[0] for(i=1 i<n_data-day i++){ if(x[i]<xmin){xmin=x[i] if(x[i]>xmax){xmax=x[i] d_x=(float)((xmax-xmin)/hist_range) /*hist*/ for(i=0 i<n_data-day i++){ 28

hist[(int)((x[i]-xmin)/d_x)]++ for(j=0 j<=hist_range j++){ /*out put*/ if(hist[j]!=0){ fprintf(fout,"%lf %lf\n",(xmin+d_x*(0.5+j)), (float)hist[j]/((n_data-day)*d_x)) printf("%lf %lf\n",(xmin+d_x*(0.5+j)), (float)hist[j]/((n_data-day)*d_x) ) myu=0., sum1=0., sum2=0., sigma1=0., sigma2=0. for(i=0 i<n_data-day i++){ sum1+=x[i] myu = (float)sum1/n_data for(i=0 i<n_data-day i++){ sum2+= ( X[i]-myu )*( X[i]-myu ) sigma2 = sum2/(n_data-day-1) sigma1 = sqrt(sigma2) printf(" sigma1=%lf\n sigma2=%lf\n",sigma1,sigma2) fclose(fin) fclose(fout) D #include <stdio.h> #include <stdlib.h> #include <math.h> 29

#define N_data 6558 #define hist_range 300 #define x0 2 #define day 100 #define So 3000 #define dz 0.0005 #define myu 0.00 #define Pai 3.141592 main(int argc, char *argv[]) { FILE *fin,*fout1,*fout2 int i,j,hist[hist_range+1],s static double X1[N_data],dp,Pmax,Pmin,S1 static double P[N_data-day] static double Z,kitaichi,Gauss,kitaichi_G static double G,x,E1[hist_range+1],E2[hist_range+1] static double kitaichi_1,kitaichi_2,myu2,myu4,sum_myu2,sum_myu4 static double myu_0,sum1,sum2,sigma1,sigma2 if(argc!=4){ /* file open */ printf("hikisu number is difference.\n") exit(1) if((fin=fopen(argv[1],"r"))==null){ printf("the read file dosen't open.\n") exit(1) if((fout1=fopen(argv[2],"w"))==null){ printf("the write file doesn't open.\n") exit(1) if((fout2=fopen(argv[3],"w"))==null){ printf("the write file doesn't open.\n") exit(1) 30

for(i=0 i<n_data i++){ fscanf(fin,"%lf",&x1[i]) for(i=0 i<n_data-day i++){ P[i]=X1[i+day]-X1[i] for(j=0 j<=hist_range j++){ /* for kitaichi */ hist[j]=0, E1[j]=0., E2[j]=0. Pmax=P[0] Pmin=P[0] for(i=1 i<n_data-day i++){ if(p[i]>pmax) {Pmax=P[i] if(p[i]<pmin) {Pmin=P[i] dp=(pmax-pmin)/hist_range for(i=0 i<n_data-day i++){ hist[(int)((p[i]-pmin)/dp)]++ myu_0=0., sum1=0., sum2=0., sigma1=0., sigma2=0. /* for Gamma */ myu2=0., myu4=0., sum_myu2=0., sum_myu4=0. /* for moment */ for(i=0 i<n_data-day i++){ sum1 += P[i] sum_myu2 += P[i] * P[i] sum_myu4 += P[i] * P[i] * P[i] * P[i] 31

myu_0 = (float)sum1/(n_data-day) for(i=0 i<n_data-day i++){ sum2+= ( P[i]-myu_0 )*( P[i]-myu_0 ) sigma2 = sum2/(n_data-day-1) sigma1 = sqrt(sigma2) myu2 = sum_myu2/(n_data-day) /* for moment */ myu4 = sum_myu4/(n_data-day) /* for moment */ for(j=0 j<=hist_range j++){ E1[j] = exp( Pmin+dp*(0.5+j) ) for( Z=1 Z<2.5 Z+=dz ){ kitaichi=0., kitaichi_1=0. if( log(z)<=pmax ){ for( j=0 j<=hist_range j++ ){ if( j >= (log(z)-pmin)/dp-0.5 ){ kitaichi_1+= ( E1[j] - Z )* E1[j] * ((double)hist[j]/(n_data-day)/dp) * dp kitaichi = So * kitaichi_1 printf(" Z=%5.8e kitaichi=%10.8e\n ", Z, kitaichi) fprintf(fout1," %5.8e %10.8e\n ", Z, kitaichi) else{ kitaichi=0. printf( " Z=%5.8e kitaichi=%10.8e\n ", Z, kitaichi ) fprintf( fout1," %5.8e %10.8e\n ", Z, kitaichi ) Gauss=0., kitaichi_g=0. 32

for( x=-x0 x<x0 x+=dp ){ if( x >= log(z) ){ G=exp( -(x-myu)*(x-myu)/(2*sigma2) ) / (sigma1*sqrt(2*pai)) kitaichi_g += ( exp(x)-z ) * exp(x) * G * dp Gauss = So * kitaichi_g printf( " Gauss=%20.15e\n", Gauss ) fprintf( fout2, " %5.8e %20.15e\n", Z, Gauss ) printf( " Pmax=%lf\n dp=%lf\n", Pmax, dp ) printf(" sigma1=%lf\n sigma2=%lf\n", sigma1, sigma2 ) printf(" myu_0=%lf\n\n ", myu_0 ) printf(" myu4=%10.8e\n 3*myu2^2=%10.8e\n", myu4, 3*myu2*myu2 ) fclose(fin) fclose(fout1) fclose(fout2) E #include <stdio.h> #include <math.h> #include <stdlib.h> #include "intde2.c" /* C */ /* x ^(beta) */ double f1( double x) void intdeiini( int lenaw, double tiny, double eps, double *aw ) void intdei(double (*f)(double), double a, double *aw, double *i, double *err) double A, beta, n, Pai=3.141592 int nfunc 33

main(int argc,char *argv[]) { FILE *fout int lenaw extern int nfunc double tiny, aw[8000], i, err if(argc!=2){ printf("hikisu number is difference.\n") exit(1) if((fout=fopen(argv[1],"w"))==null){ printf("the write file doesn't open.\n") exit(1) /*file open*/ printf(" 0 < beta <2 \n") printf(" beta = ") scanf("%lf",&beta) printf(" 0 < A \n") printf(" A = ") scanf("%lf",&a) lenaw = 8000 tiny = 1.0e-307 for(n=-10.0 n<=10.0 n+=0.01){ intdeiini( lenaw, tiny, 1.0e-15, aw) nfunc = 0 intdei( f1, 0.0, aw, &i, &err) printf("n= %lf\t, I_1= %lg\t, err= %lg\t, N= %d\n", n, i/pai, err, nfunc) fprintf(fout," %lf\t %lg\t %lg\t %d\n", n, i/pai) fclose(fout) double f1( double x) { extern int nfunc 34

nfunc++ return exp( -A * pow( fabs(x), beta)) * cos( n * x) 35