Trade: Difference between revisions
(first part) |
(→Terms) |
||
| (10 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
==Terms== |
==Terms== |
||
* [[EC]]: |
* [[EC]]: universally transferrable cryptocurrency that is used on a market. Currently issued by [[Void Church]]. |
||
* ''' |
* '''Goods''': Some commodity which can be bought for EC. |
||
* '''Economy agent''': An entity possessing some goods and/or EC which wants to participate in the market. The agent has a specific location and a store of EC and goods. |
* '''Economy agent''': An entity possessing some goods and/or EC which wants to participate in the market. The agent has a specific location and a store of EC and goods. Example: A planet's local government. |
||
* '''Demand''': information about a good being desired |
* '''Demand''': information about a good being desired by some agent. A demand has: |
||
** '''Budget''': how much EC it is willing to spend during the cycle. |
** '''Budget''': how much EC it is willing to spend during the cycle. |
||
** '''Maximum quantity''': how much goods total it is willing to buy. |
** '''Maximum quantity''': how much goods total it is willing to buy. |
||
** '''Maximum price''': how much it is ready to spend per item. |
** '''Maximum price''': how much it is ready to spend per item. |
||
* '''Supply''': information about a good being provided |
* '''Supply''': information about a good being provided by some agent. |
||
** ''Maximum quantity''': how much goods total it is willing to sell. |
** ''Maximum quantity''': how much goods total it is willing to sell. |
||
** '''Minimum price''': how cheap it is willing to sell the items. |
** '''Minimum price''': how cheap it is willing to sell the items. |
||
** Some of properties on Supply/Demand might be absent or infinite, there is also special information like demand |
** Some of properties on Supply/Demand might be absent or infinite, there is also special information like demand's agent being an issuer of energy credits, not willing to bargain, or not considering shipping a part of price. |
||
** '''Shipping''': goods being transferred from supply to demand cost EC to transport. The price depends on number of [[breach]]es between agents as well as other minor factors like gravity of agent's base. EC paid for shipping are destroyed along with matching amount of fuel in |
** '''Shipping''': goods being transferred from supply to demand cost EC to transport. The price depends on number of [[breach]]es between agents as well as other minor factors like gravity of agent's base. EC paid for shipping are destroyed along with matching amount of fuel in Void Church storage, and are considered to be spent on transport. |
||
==Trading process== |
==Trading process== |
||
| Line 20: | Line 20: | ||
Trading is done separately for every good. |
Trading is done separately for every good. |
||
First, all economy agents (planets, |
First, all economy agents (planets, Void Church branch offices, fleets) are queried for the list of their Demands and Supplies. |
||
'''Trading tables''' are created. These are maps ordered by price that are created for every supply or demand, and look like this: |
|||
| ⚫ | Every combination of Demand and Supply is queried for its viability. If a deal is theoretically possible (the max and min prices are compatible, shipping is considered, etc), a maximum price for demander and minimum price for the supplier that is possible as part of the deal is calculated and deal is added to the |
||
{|class=wikitable |
|||
|+ Demands for Fuel from Planet 10 |
|||
|- |
|||
! Maximum price |
|||
! Agent |
|||
! Quantity |
|||
! ... |
|||
|- |
|||
|rowspan="2"| 0.556 |
|||
| Planet 1 |
|||
| 400 |
|||
| |
|||
|- |
|||
| Planet 2 |
|||
| 300 |
|||
| |
|||
|- |
|||
| 0.345 |
|||
| Fleet 1 |
|||
| 1000 |
|||
| |
|||
|} |
|||
| ⚫ | Every combination of Demand and Supply is queried for its viability. If a deal is theoretically possible (the max and min prices are compatible, shipping is considered, etc), a maximum price for demander and minimum price for the supplier that is possible as part of the deal is calculated and deal is added to the proper tables. |
||
During this step, a 'sink price' is also determined, a best price for a 'sink' demander that issues credits and will buy unlimited goods. Currently, this is the case only for Void Church. All supplies are adjusted to sell only at this price or above, because it does not make sense to try to chase other suppliers from unlimited sinks. |
|||
Now, the main iterations begin. For every demand, best supplies is found, which are ready to pay the most. For these supplies, similarly, best demands are found. If a supply and a demand are best for each other, they make a deal. The price is determined to be either the effective price to buy from the next best supplier, so that it's barely feasible to choose the current supplier, or the demander's maximum if there is no competition. |
|||
As agents run out of EC and stock, they are removed from the trading tables. If at least one modification to the tables has been made, the cycle starts again, so that all the best deals are found. When no more deals are possible, the trading cycle ends. |
|||
Latest revision as of 11:59, 9 September 2025
Intergalactic trade is the heart of the economy of Librae. The game implements an iterative market simulation algorithm which matches demand and supply in an optimal way.
Terms
- EC: universally transferrable cryptocurrency that is used on a market. Currently issued by Void Church.
- Goods: Some commodity which can be bought for EC.
- Economy agent: An entity possessing some goods and/or EC which wants to participate in the market. The agent has a specific location and a store of EC and goods. Example: A planet's local government.
- Demand: information about a good being desired by some agent. A demand has:
- Budget: how much EC it is willing to spend during the cycle.
- Maximum quantity: how much goods total it is willing to buy.
- Maximum price: how much it is ready to spend per item.
- Supply: information about a good being provided by some agent.
- Maximum quantity': how much goods total it is willing to sell.
- Minimum price: how cheap it is willing to sell the items.
- Some of properties on Supply/Demand might be absent or infinite, there is also special information like demand's agent being an issuer of energy credits, not willing to bargain, or not considering shipping a part of price.
- Shipping: goods being transferred from supply to demand cost EC to transport. The price depends on number of breaches between agents as well as other minor factors like gravity of agent's base. EC paid for shipping are destroyed along with matching amount of fuel in Void Church storage, and are considered to be spent on transport.
Trading process
Trading is done separately for every good.
First, all economy agents (planets, Void Church branch offices, fleets) are queried for the list of their Demands and Supplies.
Trading tables are created. These are maps ordered by price that are created for every supply or demand, and look like this:
| Maximum price | Agent | Quantity | ... |
|---|---|---|---|
| 0.556 | Planet 1 | 400 | |
| Planet 2 | 300 | ||
| 0.345 | Fleet 1 | 1000 |
Every combination of Demand and Supply is queried for its viability. If a deal is theoretically possible (the max and min prices are compatible, shipping is considered, etc), a maximum price for demander and minimum price for the supplier that is possible as part of the deal is calculated and deal is added to the proper tables.
During this step, a 'sink price' is also determined, a best price for a 'sink' demander that issues credits and will buy unlimited goods. Currently, this is the case only for Void Church. All supplies are adjusted to sell only at this price or above, because it does not make sense to try to chase other suppliers from unlimited sinks.
Now, the main iterations begin. For every demand, best supplies is found, which are ready to pay the most. For these supplies, similarly, best demands are found. If a supply and a demand are best for each other, they make a deal. The price is determined to be either the effective price to buy from the next best supplier, so that it's barely feasible to choose the current supplier, or the demander's maximum if there is no competition.
As agents run out of EC and stock, they are removed from the trading tables. If at least one modification to the tables has been made, the cycle starts again, so that all the best deals are found. When no more deals are possible, the trading cycle ends.