He purchases first from A and then from B. Next, Noble C makes a purchase. There are no other bidders, so he buys a horse at the seller's asking price. Noble E is not involved, since his asking price exceeds all the buyer's prices. Noble D buys 2 horses at 89 gold each from Noble A. Noble D buys 1 horse at 89 gold from Noble B. Noble C buys 1 horse at 80 gold from Noble B. Note that order in the market makes no difference. The first sale will go to the noble willing to pay the most.
Trades only happen at the end of the day.
If a buy or a sell 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. They will trade with any unit that has a matching buy or sell order.