BLACKSCH –
453 bytes
Fix 4¿
”BLACK-SCHOLES…”¿
Lbl 1¿
“S”?®S¿
“X”?®X¿
“T(1=YEAR)”?®T¿
“R”?®R¿
“DIV”?®D¿
“SD”?®V¿
“CONTINUOUS Y=1,N=0”?®Q¿
If Q=1¿
Then Prog “CONTINUE”:Else Goto 2:IfEnd¿
Lbl 2¿
R-D®B¿
“D1=”¿
(ln (S÷X)+(B+V2÷2)xT)÷Ö(V2xT)®E∆
“N(D1)= DELTA #STOCKS”¿
P(E)∆
“N(-D1)=”¿
P(-E)∆
“D2=”¿
E-Ö(V2xT)®E∆
“N(D2)= -#BONDS”¿
P(F)∆
“BORROW AMT(-)=”:P(F)xXe(-RxT)∆
Lbl 3¿
“CALL=”¿
Se((B-R)xT)xP(E)-Xe(-RxT)xP(F)®C∆
“PUT=”¿
Xe(-RxT)xP(-F)-Se((B-R)xT)xP(-E)®P∆
Lbl 4¿
“GREEKS? Y=1,N=0”?®Q¿
If Q=1¿
Then Prog “GREEKS”:IfEnd:Lbl 5
OPSUM – 95
bytes
x
BINOMIAL –
554 bytes
“BINOMIAL MODEL…”¿
“S”?®S¿
“X”?®X¿
“PC U(+.01)”?®U¿
“PC D(-.01)”?®D¿
“R”?®R¿
“T”?®T¿
Lbl 0¿
“CONTINUOUS T? Y=1,N=0”?®Q¿
If Q=1¿
Then Prog “CONTINUE”:Goto 1:Else Goto 1¿
IfEnd¿
Lbl 1¿
“SU”:S(1+U)®V¿
“SD”:S(1+D)®W¿
Lbl 2¿
“CU=”:V>XÞV-X®E∆
V≤XÞ0®E∆
“CD=”:W>XÞW-X®F∆
W≤XÞ0®F∆
“PU=”:V≤XÞX-V®G∆
V>XÞ0®G∆
“PD=”:W≤XÞX-W®H∆
W>XÞ0®H∆
“P=”:(R-D)÷(U-D)®P∆
V≤XÞ0®E∆
Lbl 3¿
(PxE+(1-P)xF)÷(1+R)®I¿
(PxG+(1-P)xH)÷(1+R)®J¿
“CALL=K”:I∆
S-X>IÞS-X®K∆
S-X≤IÞI®K∆
“PUT=L”:J∆
X-S>JÞX-S®L∆
X-S≤JÞJ®L∆
Lbl 4¿
“NEW C,P? Y=1,N=0”?Q:If Q=1¿
Then Goto 5¿
Else Goto 6¿
IfEnd¿
Lbl 5¿
“NEXT CU OR PU”?®E:E®G ¿
“NEXT CD OR PD”?®F:F®H ¿
“OPTN=”:(PxE+(1-P)xF)÷(1+R)®I∆
Goto 4¿
Lbl 6
RISKNEUT –
321 bytes
“RISK-NEUTRAL PRICING…”¿
“PERCENT=1,MULTIPLR=2”?®Q:If Q=1¿
Then Goto 1:Else Goto 2:IfEnd¿
Lbl 1¿
“PC U(+.01)”?®U¿
“PC D(-.01)”?®D¿
Goto 3¿
Lbl 2¿
“PC U MULT(1.01)”?®U:U-1®U¿
“PC D MULT(.99)”?®D:D-1®D¿
Lbl 3¿
“R”?®R¿
“T”?®T¿
“CONTINUOUS T? Y=1,N=0”?®Q¿
If Q=1¿
Then e(RT)-1®R¿
Goto 4:Else Goto 4¿
IfEnd¿
Lbl 4¿
“P=”:(R-D)÷(U-D)®P∆
Lbl 5¿
“DU”?®E:“DD”?®F¿
“VALUE=”:(PE+(1-P)F)÷(1+R)
∆
Goto 5
REPLPORT –
414 bytes
Lbl 0¿
“REPLICATING PORTFOLIO “¿
“S”?®S¿
“SU”?®V¿
“PC U=”:(V¸S-1)®U∆
“SD”?®W¿
“PC D=”:(W¸S-1)®D∆
“R”?®R¿
Lbl 1¿
“CU”?®E¿
“CD”?®F¿
Lbl 2¿
“CONTINUOUS T? Y=1,N=0”?®Q¿
If Q=1¿
Then Prog “CONTINUE”:Goto 3:Else Goto 3¿
IfEnd¿
Lbl 3¿
“DELTA-HEDGE(#ASSETS)=”:(E-F)÷(V-W)®A∆
“PSI -=BORROW
#BONDS=”:((1+U)F-(1+D)E)÷((U-D)x(1+R))®B∆
“NUMERATOR÷(1+R)”:(E-(AxV))∆
“CALL V=LONG A+BORROW=”:AS+B®C∆
“BETA D(xBETA ASSET)=”AS÷C∆
“NEW ASSET=0,DERIV=1”?®Q:If Q=1¿
Then Goto 1:Else Goto 0
CONTINUE –
168 bytes
“CONTINUOUS RATE…”:”N”?®N¿
“T*=”:T¸N®T¿
“R*=”:e(RT)-1®R¿
“SDV”?®Z¿
“PC U*=”:e(ZÖT)-1®U¿
“U MULT=”:1+U∆
“PC D*=”:e(-ZÖT)-1®D:(U+1)-1-1®D¿
“D MULT=”:1+D∆
Return
RRR – 48
bytes
“EV”?®E¿
“COST”?®C¿
“RRR=”:E¸C-1∆
TERMUNDR –
215 bytes
“TERML PERIOD#”?®M¿
S∆
“S=”?®S:X∆
“X=”?®X:1+U∆
“U MULT=”?®G:1+D∆
“D MULT=”?®H:Lbl 1¿
“PERIOD#”:M∆
M®N:0®O¿
Lbl 2¿
Lbl 3¿
“S´(G^N´H^O)=”¿
Lbl 4¿
S(G^N´H^O)®V∆
N-1®N:O+1®O¿
If N³0¿
Then Goto 3:Else “END PERIOD”¿
If M>0¿
Then M-1:Goto 1:Else “END”¿
Return
GREEKS –
148 bytes (unfinished)
“GREEKS…”¿
“DELTA-C=”∆
“GAMMA-C=”∆
“RHO-C=”∆
“THETA-C=”∆
“VEGA-C=”∆
“DELTA-P=”∆
“GAMMA-P=”∆
“RHO-P=”∆
“THETA-P=”∆
“VEGA-P=”∆
Return
MULTIPLR –
19 bytes (unfinished)
Return
Graph Func Y =
Y1 = A=(U+((1-Z^X)¸(1-Z))*M*G)¸(-Z^X)
Y2 = B=e(-RT)(PE+(1-P)F+D)
Y3 = U=e(ÖT)-1
Y4 = D=e(-VÖT)-1
Y5 = A=e((M-LV)T)-1
Y6 = P=(R-D)¸(U-D)
Y7 = S=(PE+PF+D)¸(1+R)
Y8 = S=A¸(1+Y)^N
Y9 = V=ln(Y¸Z)¸2
Y10 = I=N*ln(1+R¸N)
Y11 = H=(E-F)¸(S*(U-D))
Y12 = B=((1+U)F-(1+D)E)¸((U-D)*(1+R))
Y13 = C=(PE+(1-P)F)¸(1+R)
Y14 = S=F*(e(V2*T)-1)^.5
Y15 = P=(1+(M¸V)*ÖT)¸2
Y16 = Q=(e(R*T)-1¸e(VÖT))¸(e(VÖT)-1¸e(VÖT))
Y17 = C=Ö(X2+Y2+2*R*X*Y)
Y18 = T=A*U^P*D^Q
Y19 = X=e(R*T)-1
Y20 = D=(1+U)^4*S
Note
Programs
on the Casio CFX-9850GB Plus may be uploaded/downloaded to/from a PC via
“Program-Link.”
What
is required are:
1)
the FA-123 Program Link Software which may be downloaded free from the
Casio Japan website (http://www.casio.co.jp/edu_e/resources/fa123/), and
2)
a data cable (Casio part number SB-87).
Cable may be purchased from: 1) Casio directly, or 2) a non-OEM
cable can be purchased from PC Cables (http://www.pccables.com/87020.htm).
If
you have these, you can download the programs here.
Good
Luck Programming!
|