home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
MISC
/
FINANCE
/
INVEST.LBR
/
CSRKOPT.BZS
/
CSRKOPT.BAS
Wrap
BASIC Source File
|
2000-06-30
|
3KB
|
109 lines
10 REM AAII PROGRAM 1-STOCK OPTIONS LAST REVISION 3/16/83
20 PRINT CHR$(26)
30 PRINT "THIS PROGRAM EVALUATES STOCK CALLS AND PUTS WITH SAME"
40 PRINT "EXERCISE PRICE AND EXPIRATION DATE"
50 PRINT "FIGURES IN() ARE EXAMPLES ON INPUT FORM"
60 PRINT "ENTER STOCK PRICE (25.25)"
70 INPUT P
80 PRINT "STOCK VOLATILITY (.35)"
90 INPUT V9
100 PRINT "RISK FREE INTEREST RATE %(12)"
110 INPUT R9
120 R9 = R9/100
130 V = V9 /19.1
140 R = R9 / 365
150 E = 2.71828
160 W8 = 0
170 PRINT "DOES THIS STOCK PAY DIVIDEND YES=1 NO=2 (IE. 1)"
180 INPUT C1
190 IF C1 = 2 THEN 240
200 PRINT "INPUT QUARTERLY DIVD PER SHARE( .25)"
210 INPUT C2
220 PRINT "DAYS TO NEXT EX DIV DATE (30)"
230 INPUT C3
240 PRINT "OPTION EXERCISE PRICE (25.00)"
250 INPUT S
260 PRINT "DAYS (CALENDAR) UNTIL EXPIRATION (90)"
270 INPUT T
280 PRINT:PRINT
290 G2 = 0
300 P1 = P
310 IF C3 >= T THEN 420
320 G2 = 1
330 IF (T - C3) > 182 THEN 360
340 IF (T - C3) > 91 THEN 380
350 GOTO 390
360 G2 = 3
370 GOTO 390
380 G2 = 2
390 FOR C4 = 1 TO G2
400 P1 = P1 - (C2 / (1 + (C3 + (C4 - 1) * 91) * R))
410 NEXT C4
420 D1 = (LOG(P1 / S) + (R + .5 * V ^ 2) * T) / (V * T ^ (.5))
430 D2 = (LOG(P1 / S) + (R - .5 * V ^ 2) * T) / (V * T ^ (.5))
440 Z = D1
450 GOSUB 1030
460 A = F
470 Z = D2
480 GOSUB 1030
490 B = F
500 V6 = P1 * A - S * E ^ (- R * T) * B
510 IF W8 = 0 THEN 560
520 IF V6 > W6 THEN 790
530 V6 = W6
540 A = W7
550 GOTO 790
560 P2 = P1
570 D4 = ( - LOG(P2 / S) + (R + .5 * V ^ 2) * T) / (V * T ^ (.5))
580 D3 = (- LOG(P2 / S) - (R + .5 * V ^ 2) * T) / (V * T ^ (.5))
590 Z = D3
600 GOSUB 1030
610 A1 = F
620 Z = D4
630 GOSUB 1030
640 A2 = F
650 V1 = V6 - P1 * E ^ (- R * T) + S * E ^ (- R * T)
660 V2 = V6 - P1 + (S * E ^ ( - R * T))
670 IF C1 = 2 THEN 690
680 GOTO 700
690 G2 = 0
700 PRINT "PRICE=";P;" EXERCISE PRICE=";S;" INTEREST=";R9
710 PRINT "VOLA=";V9;" TIME LEFT=";T;" NO. DIVD=";G2
720 PRINT "AMT EACH DIVD=";C2;" DAYS TIL 1ST DIVD=";C3
730 IF C1 = 2 THEN 790
740 W6 = V6
750 W7 = A
760 T = (G2 - 1) * 90 + C3 - 1
770 W8 = 1
780 GOTO 280
790 V6 = INT(V6 * 1000.5) / 1000
800 A = INT(A * 1000 + .5) / 1000
810 PRINT
820 PRINT "CALL OUTPUT"
830 PRINT
840 PRINT "ESTIMATE VALUE=";V6
850 PRINT "DELTA VALUE=";A
860 PRINT
870 PRINT "PUT OUTPUT"
880 PRINT
890 V1 = INT(V1 * 1000 + .5) / 1000
900 V2 = INT(V2 * 1000 + .5) / 1000
910 A2 = INT(A2 * 1000 + .5) / 1000
920 A1 = INT(A1 * 1000 + .5) / 1000
930 PRINT "ESTIMATED VALUE=";V1
940 PRINT "OR CONVERSION=";V2
950 PRINT "DELTA VALUE=";A2;" OR CONVERSION=";A1
960 PRINT
970 PRINT "ANOTHER OPTION SAME STOCK(1) OR NOT(2)"
980 INPUT G4
990 W8 = 0
1000 IF G4 = 1 THEN 240
1020 END
1030 Z1 = Z
1040 IF Z >= 0 THEN 1060
1050 Z = ABS(Z)
1060 F = 1 - .5 * (1 + .1969 * Z + .1152 * Z ^ 2 + .00034 * Z ^ 3 + .0195 * Z ^ 4) ^ ( - 4)
1070 IF Z1 >= 0 THEN 1090
1080 F = 1 - F
1090 RETURN
.1969 * Z + .1152 * Z ^ 2 + .00034 * Z ^