The Museum of HP Calculators

HP Forum Archive 14

[ Return to Index | Top of Index ]

HP 17BII+ Black-Scholes using SOLVE
Message #1 Posted by Bob Wang on 16 Mar 2004, 8:44 p.m.

Tony Hutchins has posted some very compact versions of the Black-Scholes formula. This version is just a modification of Tony's previous work and ideas. The HP 17BII+ does not have L() and G() functions, and Tony has posted a version which cleverly uses intermediate variables. I liked his work so much that I decided to modify it a little. This version uses just one intermediate variable named "SOLVE", the user will presented with SOLVE, CALLV, and PUTV on the second page of variables. Hitting SOLVE would seem intuitive, and the user just has to remember to explicitly solve for CALLV before solving PUTV.

Thanks, Tony!

Bob Wang

BLK.SCHLS.TONY: 0×(PS+PE+RF%+T+S) +IF(S(SOLVE):SOLVE-(LN(PS÷PE)+(RF%÷100+S^2÷2)×T)÷S÷SQRT(T): IF(S(CALLV):CALLV-PS×ABS( IF(SOLVE<0:0:-1)+EXP(-(SOLVE^2)÷2) ×((187÷(1+ABS(SOLVE)÷3.006)-24) ÷(1+ABS(SOLVE)÷3.006)+87) ÷(1+ABS(SOLVE)÷3.006)÷500) +PE×EXP(-RF%×T÷100)×ABS( IF(SOLVE-S×SQRT(T)<0:0:-1)+EXP(-((SOLVE-S×SQRT(T))^2)÷2) ×((187÷(1+ABS(SOLVE-S×SQRT(T))÷3.006)-24) ÷(1+ABS(SOLVE-S×SQRT(T))÷3.006)+87) ÷(1+ABS(SOLVE-S×SQRT(T))÷3.006)÷500): PUTV-CALLV+PS-PE×EXP(-RF%×T÷100))

      
Re: HP 17BII+ Black-Scholes using SOLVE
Message #2 Posted by tony on 16 Mar 2004, 10:52 p.m.,
in response to message #1 by Bob Wang

Bob,

My pleasure. Glad you liked it!

Ah yes I forgot the 17bii+ is like the old 17b. Shame that L/G "escaped" from the 17bii+! I did the one below for the 17b - requires solving for D1,F1,D2,F2,CALLV and PUTV in order. I see your SOLVE does the D1. I tried to minimise the typing required to enter the eqn. Interesting to see your approach! Timothy Crack has a nice 17B Black-Scholes in his book "Heard on the Street" - page 278 - he implements the full AMS55 26.2.17, and requires solving for D1,N1,D2,N2, CALL.

{17bbs|0*(PS+PE+RF%+T+S)+
IF(S(D1):D1-(LN(PS/PE)+(RF%/100+S^2/2)*T)/S/SQRT(T):
IF(S(F1):F1-1/(1+ABS(D1)/3.006):
IF(S(D2):D2-D1+S*SQRT(T):
IF(S(F2):F2-1/(1+ABS(D2)/3.006):
IF(S(CALLV):CALLV
-PS*ABS(IF(D1<0;0;-1)+
EXP(-D1^2/2)*F1*((187*F1-24)*F1+87)/500)
+PE*EXP(-RF%*T/100)*ABS(IF(D2<0:0:-1)+
EXP(-D2^2/2)*F2*((187*F2-24)*F2+87)/500):
PUTV-CALLV+PS-PE*EXP(-RF%*T/100))
))))}

Somewhere I have a less accurate 17b one about 60 chars smaller than the above (300 v 360, approx) which still gives the correct 14.22 for the Call in that HP17BII example. It requires solving for D1,D2,CALLV, PUTV. No harm in solving for D1 & D2 - always good to see for the B-S student<G>. I admit the F1 and F2 above are not very interesting, but I am not fast at entering equations in the pioneers. In fact for something like the above it is almost easier to have separate equations for the components - then they are really short and load quickly. The old 18C didn't have the IF(S(.. so there we had to have separate eqns.

Cheers, Tony


[ Return to Index | Top of Index ]

Go back to the main exhibit hall