home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
new
/
amigalibdisks
/
d990
/
stocks
/
calccommission.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-04-04
|
2KB
|
80 lines
/*
** Calculate Stock Commission for StockCross Brokerage Firm
*/
PARSE ARG type stockOrOption name quantity price
/*
** type = BUY or SELL
**
** stockOrOption = STOCK or OPTION
**
** quanitity = number of shares traded
**
** price = price of stock or option
*/
/*
** StockCross does not treat BUY or SELL any differently
** so nothing is done with type.
*/
select;
when stockOrOption = "STOCK"
then do
commission = 25 + 0.085 * quantity
end
when stockOrOption = "OPTION"
then do
select;
when (price < 2.000)
then do
if quantity < 1100
then commission = quantity * 0.030
else
if (quantity < 3100)
then commission = quantity * 0.020
else commission = quantity * 0.015
end
when (price < 4.000)
then do
if (quantity < 1100)
then commission = quantity * 0.045
else
if (quantity < 3100)
then commission = quantity * 0.025
else commission = quantity * 0.020
end
when (price < 8.000)
then do
if (quantity < 1100)
then commission = quantity * 0.065
else
if (quantity < 3100)
then commission = quantity * 0.035
else commission = quantity * 0.030
end
otherwise
if (quantity < 1100)
then commission = quantity * 0.080
else
if (quantity < 3100)
then commission = quantity * 0.060
else commission = quantity * 0.050
end
if (commission < 20.000)
then commission = 20.000
end
otherwise
say "Unknown stockOrOption Type"
commission = 0
end
exit trunc( commission + 0.0005, 3 )