Game currency rates

What this is

Each game on Arena54 can be its own small economy with its own currency. Your server reports a few figures, and Arena54 works out what one unit of your currency is worth in every other reporting game’s. The rates are public at arena54.com/rates. This is game money: no rate here is a price for real money. Rates have their own switch on Arena54’s side; while it is off these calls answer 503 module_off.

MethodPathPurpose
POST/v1/economy/reportReport your game’s economy: supply, minted, burned, four basket prices, output, active players. It moves your currency’s rates
GET/v1/economy/ratesEvery pair of listed currencies, both ways: the rate, where it came from and its change in a day
GET/v1/economy/currenciesEach listed currency’s figures: prices, output, supply, trade balance, policy rate

Reporting

Your server
await fetch("https://developers.arena54.com/api/v1/economy/report", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.ARENA54_SECRET_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    supply: 100000, minted: 500, burned: 200,
    basket: { meal: 50, ride: 20, wage: 400, rent: 3000 },
    output: 9000, active_players: 340,
    policy_rate: 5,        // optional: your own interest rate, in percent
    naira_per_unit: 0.5,   // optional: your own selling price for one unit
  }),
});
// → { stored: true, report, at, counted: true, held: null }
  • Amounts are whole numbers in your own currency.
  • The basket is what four things cost in your game: a meal, a ride, a day’s wage and a month’s rent. Use the nearest thing your game has, and keep using the same one, or your prices will seem to jump.
  • supply is all the currency that exists now. minted, burned and output (what players earned by playing) are since your last report.
  • Once an hour is plenty. A report sooner than the minimum gap answers 429 too_soon.
  • A report whose prices move too far since your last one is stored and held (counted: false, with the reason in held) until a person at Arena54 has looked at it. It moves no rate while held.
  • A test key checks the shape and stores nothing.
  • Each report writes an entry in your game’s audit log.

Reading rates

GET /v1/economy/rates returns every pair both ways. source is worked when the rate comes from the two economies’ figures, and market when enough swaps were made on the pair in a day for their price to be used. GET /v1/economy/currencies returns each currency’s figures. Either works with any key of a registered game.

How a rate is worked out

  1. Buying power: if the basket costs 200 in your game and 500 in another, one of yours is worth 2.5 of theirs.
  2. A pull from each economy: faster growth in output, and taking in more than you send out through the exchange, make a currency a little stronger. Each pull is capped.
  3. The market: when players make enough swaps on a pair in a day, the price of those swaps is the rate.

A point is added to a pair’s chart only when a report or swaps changed the rate. Nothing is invented between reports.

Limits and refusals

StatusCodeWhen
429too_soonAn economy report arrived sooner after the last one than is allowed. Retry-After says how long to wait.
503module_offArena54 has switched the module off for now.
403secret_key_requiredThe call needs the game’s secret key, from a server.