Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
Actual numbers of the given graph are available at – 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

One thing you may consider to be a problem with the algorithm is that will be forced towards 50% cash, 50% investments over time.


Say you start with 100 gold pieces, none invested, if a buy decision takes place then 10 gold will be invested. Then next time either 1 gold from investment to purse or 9 gold from purse into investment. You would need a very strange probability distribution for that to not approach 50/50 in the long run.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.