I have come across an artificial, simulated, stock-market type of situation, whose rules, I find, create a rather interesting problem. I want to know if there is a mathematically optimal solution for "trading" on this simplified market, and if not, what may be a good approximation of this optimal solution.
Here are the rules we are aware of for the market:
1. There are two commodities, gold coins and oil.
2. The price of a barrel of oil cannot exceed 6.4 coins.
3. The price of a barrel of oil cannot be less than 4.8 coins.
4. The price of a barrel of oil is evaluated every 5 minutes.
5. Trades placed within these 5 minutes are guaranteed at the current price.
It is observed that the price of oil changes as a large number of purchases or sells are made, and any individual "trader" cannot make a trade large enough to influence the price of oil.
A graph of a typical "day" of trading on this market is here.
Actual numbers of the given graph are available in the first comment below (until I have 10 reputation).
The first, very simple, solution that I came up with, was as follows:
1. If current oil price is greater than previous oil price, sell 10% of oil owned.
2. If current oil price is less than previous oil price, spend 10% of gold coins to buy oil.
3. If there is no change in oil price, do nothing.
However, I feel that this solution does not make good use of the conditions of the market.