Trade

Trade in M&T has two components. An all new market system where trade goods are exchanged between provinces and the regular trade system which distributes the profits from exchanges in the market system.

Sectors
Provinces are grouped in sectors, and each nation with provinces in a trade node has a sector in that trade node consisting of its provinces in that node. Sectors handle the task of: A bid is a sector saying to the world ‘I want to buy this type of good up to this quantity for at most this price’. An offer is a sector saying to the world ‘I want to sell this type of good up to this quantity for at least this price.’
 * Summing up supply and demand from its member provinces
 * Organizing summed supply and demand into bids and offers
 * Resolving its bids and offers through trade with other sectors
 * Creating, maintaining, and utilizing a stockpile of goods

Trading Conditions
For sectors to be able to trade with each other they must meet these conditions:
 * Their nations aren't at war
 * Their nations aren't embargoed in either direction
 * Their nations' relations aren't abysmal (above -50)
 * They are in trading range

Trading Range
Trade range is expanded by linking neighboring nodes. Each neighboring node that has an owned province in it is linked, expanding trade range, and this can be chained across the world. If a merchant is placed in a node with an owned province then adjacent nodes are added to trade range, and a merchant can also be placed in one of those adjacent nodes to make that node in tradeable. Note that this can only be done adjacent to nodes with owned provinces and also does not allow filling in gap nodes in chains for continuing trade range. Sectors can then trade with all same-nation sectors in trade range, and all other nations’ sectors in trade range that are in nodes in tradeable state, if the sectors meet the other conditions.

Trading range of each sector is determined by the following process. The sector itself is within its trading range. If the owner has no merchant, end trade range check. If not, proceed. If its owner has placed a merchant in the sector’s trade node, or if the sector is within the owner’s home node, every other sector within the trade node owned by non hostile countries are within its trading range. If the owner has another non-empty sector in a trade node that has a connection with this sector’s trade node, then that sector is within its trading range. These sectors will be referred as jump sectors. If a jump sector has a merchant placed by its owner in its trade node, then every other sectors within the trade node owned by non hostile countries are within its trading range. If the owner has another sector in a trade node that has a connection with jump sector’s trade node, then that sector is also within trading range and also becomes a jump sector. Repeat until no new sector can be added into the trade range.

Bids and Offers
Resolving of bids and offers is done by the following process. Every sector is assigned a score. The sector with the highest score is selected. Selected sector checks through every sector within its trading range to find the best bids and best offers. When that is found, it resolves its bid and offer with whatever was found. Repeat until no new bid or offer can be resolved. Select the sector with the next highest score, and do the same. Repeat until no new bid or offer can be resolved by any sector.

Stockpiles
Every sector has a stockpile for each type of good. Every stockpile has 4 variables, its desired size, current size, bid, and offer. For every iteration of economy, stockpile does the following. bid = (desired size - current size) / 2 offer = current size / 2 stockpile’s own bid and offer are added on top of sector’s bid and offer to be resolved together. desired size := desired size * 0.875 + how much of offer was sold If desired size > sector commerce production * 20 / price, then desired size is capped to that value. If desired size < sector demand * 4, then desired size is locked to that value. Each sectors hold their own price belief for each goods, which determines how much wealth they are willing to pay or is going to ask for when they buy or sell goods. For every iteration of economy, price := price * X, where X < 1 when desired size < 2 * current size, and X > 1 when desired size > 2 * current size. At the time of writing, 0.8 <= X <= 1.2 Prices are capped below at 0.1 and above at 100.0, at time of writing At the end of each iteration, each member province of the sector fetches the price variables from their respective sector and saves that in itself. Then, at the start of each iteration, each sector sum and average out the price variables from their respective member provinces. This accounts for when sectors change size or are created. When trade occurs, every margin is distributed to commerce producing industries as income. A portion of wealth owned by commerce producing industries gets turned into trade value, which is then collected by states via vanilla trade system.

Tariffs
1. Every country has a tariff rate on every 12 tradegoods

2. Every sectors owned by that country fetch tariff rate from their owner

3. There's smuggling rate, which is increased by high tariff rate and decreased by state reach * (100 - local autonomy)

4. Effective tariff rate is tariff rate * (1 - smuggling rate)

5. Tariff is raised during trade

Tariffs affect behavior by decreasing expected profit when deciding who sectors resolve bids/offers with

= Summary of Trade and Differences from Vanilla =

Trade system is a system that handles the movement of goods from one province to the other. It achieves that by creating a provincial market in each provinces, where each goods are assigned a price which varies depending on supply and demand. If the price is low, then the province will export its surplus to other provinces where the price is high. Every such transactions create a trade value in a province where the transaction is being made. That trade value can then be collected by the states based on their trade power share, just as how it's done in vanilla.

= Trade Nodes =

Trade nodes work in the same way as they do in vanilla. Provinces generate trade value, they get summed up in trade nodes, which the states then collect based on their trade power share.

= Provincial Trade Value (Largest section) =

Explanation of how the provincial trade value number is determined. This will reference the output of production, supply and demand, price, transportation cost, etc.

Trade Links
Description of what they are and explanation of what they enable. List of conditions to create or remove one.

= Trade Centers =

Description of what they are and explanation of what they enable. List of conditions to create or remove one.

= Trade Power =

Description of trade power.

Global Trade Power
Explanation of global trade power and list of ways to get it.

Domestic Trade Power
Explanation of domestic trade power and list of ways to get it.

Trade Power Abroad
Explanation of trade power abroad and list of ways to get it.

Trade Steering
Explanation of trade steering and list of ways to get it.

Inland Bonus
Explanation of inland bonus and list of ways to get it. Note, this replaces vanilla caravan power.

= Mercantilism =

Description of what it is/does.

= Merchants =

Description of what merchants do.

Gaining Merchants
List of ways to gain merchants.

Trade Range
Explanation of what trade range is and list of ways to increase it.

= Trade Policies =

Explanation of node trade policies, including the effects of and requirements for each.

= Embargo =

Description of what the embargo diplomatic option does.

= Promote Trade =

Description of what the promote trade diplomatic option does.

= Privateering =

Description of how privateering fleets impact trade.

Privateer Efficiency
Explanation of Privateer Efficiency and list of ways to get it.

= Relevant Files =

List