Olympia PBEM

# Chapter 7: Markets

Characters issue `buy` and `sell` commands to indicate their desire to trade goods. Every trade must be between a buyer and a seller. Whenever a compatible `buy` and `sell` request are found, the trade will be executed.

Trades are only matched in cities, where merchants gather at the local bazaar to swap goods.

(Note that characters are always free to use the `give` command to exchange items, regardless of where they are. But `buy` and `sell` orders are only matched in cities.)

A buyer indicates what he wants to buy, how much of it he wants, and the most he is willing to pay. A seller indicates what item is being sold, how much of it is to be sold, and the per-item price.

A trade will match if the seller's price does not exceed the maximum price specified by the buyer; if the buyer has enough gold to buy at least one of the item; if the seller possesses at least one of the item; and if the buyer and seller are both in the same city.

If the buyer is willing to pay more than the seller is asking, the trade takes place at the seller's price.

Example: A noble who wants to buy five iron [79] at no more than 10 gold each issues:

```> buy 79 5 10
Try to buy five iron [79] for 10 gold each.
```

If someone who had iron issues a `sell` order which matches this buyer's request, the trade would be executed:

```> sell 79 5 10
Sold five iron [79] for 50 gold.
```

The buyer would see:

```Bought five iron [79] for 50 gold.
```

Either the `buy` or the `sell` order could have been issued first. If the order can't be matched with pending trades from other units in the city, it will become a standing order and remain in effect until executed or canceled.

```> buy 79 0
Cleared pending buy for iron [79].
```

Note that the buyer and seller can't specify what character they will deal with. They will trade with any unit that has a matching `buy` or `sell` order.

• Market report