4.2.3 Interactive exercise ``Optimal Transaction Sequence''

Instructions for using the interactive exercise

The interactive exercise shows the prices of three stocks at eight consecutive periods of time.

Sorry, your browser is completely ignoring html's applet-tag.

What you should do:

  1. 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:

    1. 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.)

    2. What is done in the backward part of the algorithm? In particular: Where does the backtracking start? Why is this always possible?

  2. 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.)

  3. To check, whether your understanding is correct, formulate some conditions which make it the best strategy to

    1. Keep the money and buy no stock.

    2. Keep a stock you already have.

    3. Sell a stock you have.

  4. Based on your findings in 3. enter new prices leading to the following transaction sequence:

    1. Keep money until time 2.

    2. Buy shares 1 at time 2

    3. Sell shares 1 at time 3

    4. Buy shares 3 at time 4

    5. Keep shares 3 until time 6

    6. Sell shares 3 at time 6

    7. Buy shares 2 at time 7

    8. Keep shares 2 until end.

  5. 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?

  6. Under which conditions is it the best strategy to keep the money on day 1? Write down your findings!

  7. If you want to see the most spectacular effect of a small change in the prices on the best transaction sequence, do the following:

    1. Choose shares AVP, BHI and CB.

    2. Change the prices of AVP at period 7 and 8 to 43.68.

    3. Change the price of CB at period 4 to 94.00.

    4. 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

  8. 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