5 CLS
8 GOSUB 30000
10 PRINT"THIS PROGRAM WILL GIVE THE VALUE OF A CALL OPTION VIA THE
20 PRINT"BLACK SCHOLES OPTION VALUATION FORMULA. NECESSARY INPUT
30 PRINT"CONSISTS OF PRESENT STOCK PRICE, EXERCISE PRICE OF THE
40 PRINT"OPTION,INTEREST RATE,# OF DAYS TO EXPIRATION OF THE OPTION
50 PRINT"AND STOCK VOLATILITY. OUTPUT IS THE VALUE OF THE OPTION
60 PRINT"AND THE HEDGE RATIO."
70 PRINT:INPUT"PRESS ENTER TO CONTINUE";Z9
1000 PRINT"STOCK PRICE,EXERCISE PR.,INT.RATE(%),DAYS TO EXP,VOLATILITY(%)"
1010 INPUT ST,EX,IN,TM,VL
1015 TI=TM/365:IN=IN/100:VL=VL/100
1020 PRINT:INPUT"ARE OPTIONS PUTS(P) OR CALLS(C)";Z9$
1030 IF Z9$<>"P" AND Z9$<>"C" THEN PRINT"INPUT ERROR":GOTO 1020
1100 D1=(LOG(ST/EX)+(IN + 1/2*VL[2)*TI)/(VL*SQR(TI))
1110 D2=(LOG(ST/EX)+(IN - 1/2*VL[2)*TI)/(VL*SQR(TI))
1120 IF Z9$="P" THEN GOTO 1200
1150 X1=D1:GOSUB 9000:N1=N
1160 X1=D2:GOSUB 9000:N2=N
1170 W= ST*N1 - EX*EXP(-IN*TI)*N2
1180 GOTO 1500
1200 REM VALUE OF PUT
1210 X1=-D1:GOSUB 9000:N1=N
1220 X1=-D2:GOSUB 9000:N2=N
1230 W=-ST*N1+EX*EXP(-IN*TI)*N2
1240 GOTO 1500
1500 CLS:PRINT F$(1)
1510 PRINT:PRINT USING F$(2);ST,EX,IN,TM,VL,W,N1
1520 PRINT:INPUT"PRESS ENTER FOR MORE";Z9
1530 IF Z9 = -1 THEN END
1540 CLS:GOTO 1000
1600 GOTO 1000
9000 ' PI=3.141592654
9005 X = ABS(X1)
9015   Z = 1/SQR(2*PI)*EXP(-X[2/2)
9020 B1=.319381530 :B2=-.356563782:B3=1.781477937
9025 B4= -1.821255978:B5=1.330274429:P=.2316419
9030 T=1/(1+P*X)
9040 Q=Z*(B1*T+B2*T[2+B3*T[3+B4*T[4+B5*T[5)
9050 IF X1>0 THEN N=1-Q ELSE N=Q
9060 RETURN
30000 REM FORMAT VARIABLES
30010 F$(1)="ST.PR.   EX.PR.    INT.RT.   D.T.EXP.     VOL.    VALUE  HEDGE"
30020 F$(2)="###.##   ###.##    ###.##      ###       ##.##  ###.##  ##.##"
30030 RETURN
