The base price is defined in your module, which is I believe for the buying price if you and the merchant both have 0 trading.
Look at get_trade_penalty, where the player's relation to towns and their efects on prices are defined. The two triggers (buy/sell) both above and below it deals with the economic effect of the player's purchase.
If you're looking for item modifier prices, then those are hard-coded, look on
strategiwiki for the percentages.