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
/
CSTATS.BZS
/
CSTATS.BAS
Wrap
BASIC Source File
|
2000-06-30
|
3KB
|
101 lines
10 REM AAII PROGRAM 3-STOCK STATISTICS REVISED 3-15-83
20 G6 = .5
30 DIM A(50),B(50),C(50),D(50)
40 FOR I = 1 TO 50
50 A(I) = 0!:B(I) = 0!:C(I) = 0!:D(I) = 0!
60 NEXT I
70 PRINT CHR$(26)
80 PRINT "STOCK STATISTICS -- FIGURES IN ( ) ARE EXAMPLES OF INPUT FORM"
90 PRINT "PROGRAM CAN GIVE ANNUAL SD,VAR,G,M FOR A SINGLE STOCK"
100 PRINT "OR THE ABOVE PLUS A,B,R,R^2 FOR A STOCK VS THE MARKET"
110 PRINT "OR VS A SECOND STOCK."
120 PRINT:PRINT "DO YOU WANT 1 STOCK(1) OR COMPARISON(2)"
130 INPUT G1
140 PRINT "ARE PRICES MONTHLY(1), QUARTERLY(2) OR YEARLY(3)"
150 INPUT G2
160 C1 = 1
170 IF G2 = 2 THEN 200
180 IF G2 = 1 THEN 220
190 GOTO 230
200 C1 = 4
210 GOTO 230
220 C1 = 12
230 PRINT "NUMBER OF PRICES OR PRICE PAIRS YOU ARE GIVING"
240 PRINT "SUGGEST FIVE MINIMUM FOR VALIDITY"
250 INPUT G3
260 IF G1 > 1 THEN 320
270 FOR J = 1 TO G3
280 PRINT "PRICE AT DATE";J
290 INPUT A(J)
300 NEXT J
310 GOTO 360
320 FOR J = 1 TO G3
330 PRINT "STOCK, MARKET OR SECOND STOCK (27.125,1001.50) AT DATE";J
340 INPUT A(J),B(J)
350 NEXT J
360 S = 0
370 S2 = 0
380 S3 = 0
390 S4 = 0
400 S5 = 1
410 S6 = 1
420 S7 = 0
430 G4 = G3 - 1
440 FOR J = 1 TO G4
450 J1 = J + 1
460 C(J) = (A(J1) - A(J)) / A(J)
470 S = S + C(J)
480 S2 = S2 + C(J) ^ 2
490 S5 = S5 * (1 + C(J))
500 IF G1 = 1 THEN 570
510 D(J) = (B(J1) - B(J)) / B(J)
520 S3 = S3 + D(J)
530 S4 = S4 + D(J) ^ 2
540 S7 = S7 + C(J) * D(J)
550 S6 = S6 * (1 + D(J))
560 PRINT
570 NEXT J
580 W3 = (S / G4) * C1
590 G5 = 1 / G4
600 W4 = (S5 ^ G5 - 1) * C1
610 W1 = (S2 / G4 - (W3 / C1) ^ 2) * C1
620 IF G1 = 1 THEN 750
630 W7 = (S3 / G4) * C1
640 W8 = (S6 ^ G5 - 1) * C1
650 W5 = (S4 / G4 - (W7 / C1) ^ 2) * C1
660 IF (G4 * S4 - S3 ^ 2) = 0 THEN 970
670 V2 = (G4 * S7 - S * S3) / (G4 * S4 - S3 ^ 2)
680 V1 = (S - V2 * S3) / G4
690 D1 = V2 * (S7 - (S3 * S) / G4)
700 D2 = S2 - S ^ 2 / G4
710 V2 = .337 + .663 * V2
720 V4 = D1 / D2
730 V3 = V4 ^ G6
740 W6 = W5 ^ G6
750 W2 = W1 ^ G6
760 IF V2 >= 0 THEN 780
770 V3 = - V3
780 W3 = INT(W3 * 1000 + .5) / 1000
790 W4 = INT(W4 * 1000 + .5) / 1000
800 W1 = INT(W1 * 1000 + .5) / 1000
810 W2 = INT(W2 * 1000 + .5) / 1000
820 PRINT "STOCK 1 M=";(W3);" G=";(W4);" AV=";(W1);" ASD=";(W2)
830 PRINT
840 IF G1 = 1 THEN 980
850 W7 = INT(W7 * 1000 + .5) / 1000
860 W8 = INT(W8 * 1000 + .5) / 1000
870 W5 = INT(W5 * 1000 + .5) / 1000
880 W6 = INT(W6 * 1000 + .5) / 1000
890 V1 = INT(V1 * 1000 + .5) / 1000
900 V2 = INT(V2 * 1000 + .5) / 1000
910 V3 = INT(V3 * 1000 + .5) / 1000
920 V4 = INT(V4 * 1000 + .5) / 1000
930 PRINT "MARKET OR STK2 M=";(W7);" G=";(W8);" AV=";(W5);" ASD=";W6
940 PRINT
950 PRINT "A=";(V1);" B=";(V2);" R=";(V3);" R^ 2=";(V4)
960 GOTO 980
970 PRINT "VARIANCE=0 COMPARISON UNDEFINED. DO STOCK(S) SEPERATELY"
980 PRINT:PRINT:PRINT "WANT TO RUN STOCK STATISTICS AGAIN? (YES OR NO)"
990 INPUT L1$:IF MID$(L1$,1,1) = "Y" THEN GOTO 70
1010 END
NT:PRINT:PRINT