Commerce – Money, Shops and a Stock Exchange for Fabric

A Fabric mod for Minecraft 26.3 that gives your world an economy:

The stock terminal: quotes, a price chart, the order book and order entry

The stock terminal: quotes, a price chart, the order book and order entry

Installing with Prism Launcher

  1. Create an instance with Minecraft 26.3 and the Fabric loader (0.19.5 or newer).
  2. Add Fabric API (Edit → Mods → Download mods).
  3. Add commerce-1.0.0.jar (Edit → Mods → Add file).
  4. On a server, put the jar and Fabric API into mods/. Every player needs the mod too.

The download site also offers an auto-updating Prism instance that brings all our mods, including this one.

The currency

Money comes in two forms:

The currency's name, plural and symbol are set in config/commerce.json (default Eurodollar / Eurodollars / €$). Clients get them from the server, so everyone sees the server's currency.

Earning money in survival: - hostile mobs sometimes drop a few coins - the commodity market buys wheat, wood, ores, diamonds and more - shop counters let you sell to other players - dividends and trading on the stock exchange

Coins and a bank card; while you hold one, your money shows above the hotbar

Coins and a bank card; while you hold one, your money shows above the hotbar

Bank terminal

The bank terminal (ATM) is your branch:

On the right is your statement, the last 40 bookings. Positive balances earn 0.05 % interest each Minecraft day.

The bank terminal with balance, actions and statement

The bank terminal with balance, actions and statement

Shop counters

Place a shop counter and it is yours. As the owner:

As a customer, pick an offer and the number of lots, then Pay cash or Pay by card. Cash is paid in whole coins and you get change back. Card payments need your own bank card in your inventory.

Other mods can run shops for accounts that aren't players: Civitas' bakeries and taverns are shop counters.

A customer at a bakery counter The owner's view: offers, stock and till

The stock terminal

The stock terminal opens the exchange. It has four tabs.

Stocks

Every trade costs a 0.1 % broker fee. A buy limit order holds its money until it is filled or cancelled, so you can't spend it twice. Sell orders reserve the shares.

How prices move

Every company has an underlying value that wanders randomly. Each company has its own volatility, 2–6 % a day.

So prices follow the news, wobble from trade to trade, and recover from sell-offs. Your resting orders get filled by the simulated traders as prices move.

Dividends

At dawn every company pays its dividend, a percentage of the share price per share, into the accounts of all holders.

Commodities

The market buys (we pay) and sells (we ask) raw goods for real items: wheat, bread, potatoes, carrots, beef, pork, leather, wool, logs, cobblestone, coal, iron, copper, gold, redstone, lapis, emeralds, diamonds and gunpowder.

The commodity market

The commodity market

Portfolio and news

The portfolio shows your shares with average price, value and unrealised profit, and your open orders. Click ✕ to cancel an order. The news tab lists the latest headlines. When news concerns a company you hold, you also get it in chat.

Portfolio Market news

Stock ticker

A wall-mounted LED band scrolls the latest prices and headlines. Place several side by side and they form one long display.

A trading floor with a row of ticker boards and stock terminals The ticker band up close

Listed companies

The exchange opens with nine companies from around Funkstadt:

Ticker Company Sector Starting price
FUNK Funkstadt Rundfunk AG Media 42.50
GRID Gridworks Energie Utilities 118.00
FISS Fission Kernkraft AG Energy 76.20
RBTN RedButton Defense Systems Defense 254.00
RADX Radex Dekontamination Services 18.75
MONT Montan Bergbau AG Mining 33.40
HOFA Funkenhof Agrar Food 27.10
ATLS Atlas Kartographie Technology 64.90
BANK Eurodollar Bank Finance 91.30

You can add, change or remove companies in the config. Other mods can list companies through the API: Civitas towns can go public.

Commands

Command
/money your balance, loan and the value of your shares
/money pay <player> <amount> send money
/money top the richest players (money plus shares)
/money give\|take\|set <players> <amount> operators
/exchange all quotes
/exchange quote <ticker> details, best bid and ask
/exchange buy\|sell <ticker> <qty> [limit] trade without a terminal (can be switched off)
/exchange portfolio, /exchange orders, /exchange cancel <id> your holdings and orders
/exchange news the latest headlines
/exchange event <ticker> <percent> operators: make news

Configuration

config/commerce.json:

Setting Default
currencyName / currencyPlural / currencySymbol Eurodollar / Eurodollars / €$ the currency
startingBalance 250 welcome money for new players
savingsInterestPercentPerDay 0.05 interest on positive balances
loanInterestPercentPerDay 0.5 interest on loans
maxLoan 5000 credit limit at the bank terminal
bankCardPrice 5
mobCoinDrops, mobCoinDropChance true, 0.25 coins from hostile mobs
commandTrading true allow /exchange buy/sell
exchange.stepTicks 20 how often the market moves
exchange.feePercent 0.1 broker fee
exchange.defaultVolatilityPercent 3 daily volatility
exchange.newsPerCompanyPerDay 0.4 how often news breaks
exchange.dividends true
exchange.commodityImpactPercent 1.0 price move per lot sold or bought
exchange.commoditySpreadPercent 6 gap between bid and ask
exchange.commodityReversionPerDay 0.5 how fast prices return to base
companies nine companies ticker, name, sector, price, shares, dividend, volatility
commodities 19 goods item id, base price, lot size

For mod authors

net.antwire.commerce.api.CommerceApi gives other mods: - accounts, transfers, minting and burning - commodity prices, and selling to or buying from the market - listing companies, reporting earnings, publishing news and setting dividends

ShopBlockEntity can belong to any account and sell to accounts without a player (sellToAccount). All amounts are in cents. Civitas is built on this API.

Building from source

./gradlew build                 # build/libs/commerce-1.0.0.jar
./gradlew runClientGameTest     # bank, exchange, market and shop checks plus screenshots

Textures and models come from tools/gen_assets.py.

License

MIT