# What is the optimal investing solution for the given simulated market?

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.

-
Actual numbers of the given graph are available at pastebin.com/WARLKE5M – Cory Klein Jan 18 '11 at 20:43
What determines the price? Since there are limits on the price of oil, I guess it's not just the actions of selling and buying. But, I think the optimal strategy would be to sell more oil as you get closer to the top price, since you know it is probably unlikely to raise much more, and on the other hand buy more oil the closer the price is to the bottom price. – Raskolnikov Jan 18 '11 at 21:37
You can also try to simulate a market where everybody has certain strategies, if at least you know more precisely what the price-forming mechanism is. – Raskolnikov Jan 18 '11 at 21:44
I don't have access to the algorithm that determines the price, but from observation, it increases as "traders" purchase oil, up to the 6.40 maximum, at which point it holds steady until "traders" sell it, at which point it will continue to drop until there is more purchasing than selling of oil, or it hits the 4.8 minimum. – Cory Klein Jan 18 '11 at 21:51
I guess the best one could do in that case, if we don't have the details of the transactions and price mechanism, is to model the price as a random variable and try to fix the parameters of our random variable model from the data on the webpage you linked to. – Raskolnikov Jan 18 '11 at 22:05