Instructions for using the interactive exercise
The interactive exercise shows the prices of three stocks at eight consecutive
periods of time.
What you should do:
- Choose different stocks (ticker-symbols) and run the algorithm again.
(Be aware to press the ''Run Algorithm'' button to perform the calculations
after your changes.) Try to understand, how the algorithm works. In particular
answer the following questions:
- What is done in the forward part of the dynamic programming algorithm?
(Use the green arrows and the popup-windows, which appear, when you click onto
these arrows, to find this out.)
- What is done in the backward part of the algorithm? In particular: Where
does the backtracking start? Why is this always possible?
- Change some of the price-entries in the table to see, how this
influences the best transaction sequence. (E.g. with AVP, BHI and CB change
the BHI-value at time 3 from 38.56 to 36.56.)
- To check, whether your understanding is correct, formulate some
conditions which make it the best strategy to
- Keep the money and buy no stock.
- Keep a stock you already have.
- Sell a stock you have.
- Based on your findings in 3. enter new prices leading to the following
transaction sequence:
- Keep money until time 2.
- Buy shares 1 at time 2
- Sell shares 1 at time 3
- Buy shares 3 at time 4
- Keep shares 3 until time 6
- Sell shares 3 at time 6
- Buy shares 2 at time 7
- Keep shares 2 until end.
- Choose stocks EINS, ZWEI and DREI, and inspect the best transaction
sequence. Which possibilities can you find, to change only two prices in the
table and obtain a transaction sequence consisting exclusively of transactions
between one kind of stock and money?
- Under which conditions is it the best strategy to keep the money on day
1? Write down your findings!
- If you want to see the most spectacular effect of a small change in the
prices on the best transaction sequence, do the following:
- Choose shares AVP, BHI and CB.
- Change the prices of AVP at period 7 and 8 to 43.68.
- Change the price of CB at period 4 to 94.00.
- Change the price of BHI at period 5 first to 42.63, then to 42.64, then
back to 42.63.
You should do this last step with ''Show optimal path'' enabled. The optical
effect is really stunning, but be aware of the final amounts of money
- Write down the dynamic programming algorithm for finding the best
transactions sequence using either Java or Maple.
Gaston Gonnet, Institute for Scientific Computing, ETH Zürich, Switzerland
2002-02-24
With assistance from SkillsOnline and Web Pearls