25 - BOERSE - Broker Game

Post Reply
Peet
Posts: 91
Joined: Tue Sep 29, 2020 12:01 am
Location: Germany

25 - BOERSE - Broker Game

Post by Peet »

A Happy New Year.
After finishing the Advent calendar, there are 6 more programs from my HP41CV collection as New Years special.

Code: Select all

LBL "BOERSE"	; Stock Exchange 
FIX 0
BEEP
"+++BOERSE+++"
AVIEW
PSE
"TRADE DAYS?" 	
PROMPT
STO 01
1000
STO 02
CLX
STO 03
STO 04
LBL 01
RCL 02
XEQ 08		; show cash
XEQ 04		; new stock price
2
"B=1 S=2?"	; buy / sell
PROMPT
"NUMBER?"	
X=Y?
GTO 02
PROMPT 
STO 05
STO 06
XEQ 00
GTO 03
LBL 02
PROMPT 
STO 05
CHS
STO 06 
XEQ 00
GTO 03
LBL 00
RCL 06
RCL 03
+
STO 03
RCL 06
RCL 07
*
STO 06
RCL 02
RCL 06
-
STO 02
RTN
LBL 03
RCL 05
X<0?
GTO 06
RCL 03
X<0?
GTO 06
RCL 02
X<0?
GTO 06
RCL 07
X<=0?
GTO 06
RCL 03
"SHARES="	; AKTIEN 
ARCL X
AVIEW
PSE
PSE
RCL 04
1
+
STO 04
RCL 01
X>Y?
GTO 01
"-END-"
AVIEW
PSE
BEEP
XEQ 04		; final stock value
RCL 03
*
STO 06
RCL 02
+
STO 02
XEQ 08		; final asset, cash & stock
PSE
GTO 05
LBL 04
XEQ "ZZ"	; XEQ "ZZ" (Basics), XROM 26,36 (TRNG - DM41X), XROM 01,49 (RAN - DM42)
SQRT		; ZZ Wert vergrößern
99
*
1
+		; zz zwischen 1 und 99
INT
STO 07
"PRICE="	
ARCL X
AVIEW
PSE
PSE
RTN
LBL 08
"CASH="		
ARCL X
AVIEW
PSE
RTN
LBL 06
TONE 1
"-ILLEGAL-"
AVIEW
TONE 0
PSE
GTO 07
LBL 05
TONE 7
TONE 8
TONE 9
LBL 07
"++GOOD BYE++"
AVIEW
BEEP
FIX 4
END
Trading a share on a virtual exchange. The rate fluctuates between $1 and 99.
Under no circumstances may more be spent (money) or sold (shares) than is owned.

The original idea came from a program in a computer magazine in the early 80s.

Usage:

TRADE DAYS? <Number of trading days> R/S
CASH= account balance (start: $1000)
PRICE= value of a share ($1-99)
B=1 S=2 - <1> for buying, <2> for selling
NUMBER? <number> of shares to buy/sell
SHARES= number of shares owned
Loop until "number of trading days" is reached
At the end CASH= "the final asset (cash & stock)" is displayed
Attachments
25_BOERSE.raw
(260 Bytes) Downloaded 2 times
My programmable calculators - former: CBM PR100, HP41CV, HP28S, HP11C - current: HP48G(+), HP35S, DM41X, DM42
Post Reply