Let's say that the blacksmith buys horseshoes during the day and sells them at night from one character. Meanwhile, some novice is pounding away making horseshoes as much as possible. The blacksmith can make money both times as long as the market is nearly perfectly liquid. In such a market the broker is earning the difference between bid and ask prices. Now at all times during the day the blacksmith is likely to sell and buy horseshoes at the different bid (how much he'll pay) and ask (how much he charges) prices.
I think the details will be world-specific. The economic system in a medieval village will be quite different from that in an interstellar empire.
The blacksmith shouldn't always make money. Sometimes he'll lose money, and he may even go out of business.
He will probably buy at a higher price from people he knows and considers reliable sources. If PC's just show up and start selling horseshoes, the blacksmith may be reluctant to deal with them. He'll wonder if they're trustworthy and if their products are any good (unless he knows they bought the horseshoes from him this morning, or recognizes them as the work of the blacksmith in the next village). Also, the market probably isn't very liquid, and he'll be reluctant to take on too much inventory. He won't be worried about running out; that happens all the time, and when it does, he just makes more (and customers just have to wait). He will only buy a lot of horseshoes if he has a large order, or knows he will have one shortly.
You're probably focused on more advanced markets than the medieval village. In Byzantium, or in an interstellar empire, there would be more liquidity, and exploits would be more practical. Of course, the broker would also have better knowledge of the market, and banks and governments would be more sophisticated.
Let's assume he has an inventory with unlimited capacity. At any capacity, he wants to make money off each horseshoe. If he buys 5@10g and sells them, he needs to sell them for more than 10g. We'll assume he prices them at 12g. He does need to be aware of his different buy rates and sell rates. The more he is buying and selling in quantity, the more he is earning spread. If his inventory is constantly growing, he needs to be careful that he is not heavily invested in horseshoes above a certain price. If 60% of his business is selling horseshoes at 12g, he probably shouldn't hold more than 60% of his inventory buying at 10g to sell at 12.
So lets say some people figure this out. Here is the exploit: buy horseshoes until the price goes up. Sell as many horseshoes at the higher price as you can. Wait and do it again in a few hours. Why does this work? because you've let everyone else absorb volume up to the price points and now you earn the higher rate.
In a large trading center, I assume they're buying from several merchants and selling to several others. Of course, prices will vary from merchant to merchant, so they'll need to buy from merchants with slightly lower prices and sell to those with slightly higher prices. They'll need to have contracts, because the merchants won't want to do large deals without them. (Hence they won't be anonymous.) They'll also need a warehouse (or several warehouses) to store all the horseshoes they'll have to buy to move the market. They'll need to hire wagons and wagoneers, hire guards, and pay taxes. (If they set up in business as brokers, they may just deal in contracts and avoid inventory, but this has its own set of problems.)
They may very well be able to buy enough horseshoes to move the market, and then sell them at a profit. They may even be able to corner the market and make a killing. I don't see this as a problem, as long as it's done realistically. It won't be easy; it will involve a lot of work. And it shouldn't be common, simply because there shouldn't be many people who can afford all those horseshoes.
If it isn't a lot of work, or if there is too much cash in the economy, then the world builder hasn't built a very good world.
PC's who can't actually move the market may try to buy and sell to take advantage of market fluctuations (day trading in horseshoes, essentially). I wouldn't object to this, but there should be a good chance of losing money. Timing the market should be as difficult as it is in the real world.
I'm probably missing some things here; I don't have much experience with virtual economies. And I don't know how much is practical for the AI. Still, I don't think we should prevent people from buying goods to drive prices up and then selling them at the higher price. This is realistic; people have gotten rich doing it. PC's should be able to get rich doing it, too -- if they can manage it realistically. We just want to make sure it isn't too easy.
Maybe the blacksmith should pay under the least he can sell for, and sell for more than the most he paid for?
Well, he should try to, at least. Sometimes he may guess wrong and lose money, so he'll probably be pretty conservative. He has to have income, so he has to sell product, which means he can't set his own prices.
I think this would cause the same sort of inflation to the masses I mentioned before - while someone else walks off with a disproportionate amount of cash each time they have some goods to sell. Find a low price and just empty them out, then eek them back into the market. I suppose that would be allowed as long as price is based on inventory costs, and not pure demand.
I think it would be a combination. Merchants have to sell; they need income, and have limited shelf space, and some inventory will spoil. But they will try hard to avoid selling at a loss. In most cases they will prefer too little inventory over too much.
I'm not sure, it is too late to think straight.

The likely answer is that the algorithms should be available to economists so they can make their own answers and see how well they perform. Any dynamic pricing structure for NPC will probably work better than a biased static pricing structure. Inflation should go both ways...
Sounds reasonable. We'll probably need to experiment. Which is a good argument for periodic resets.