Skip to content

Markets

There are two kinds of market, and they answer different questions.

A local market belongs to a star system and has an order book: people posting what they will buy or sell and at what price. A faction market offers goods on faction terms rather than through player orders.

const markets = await system.localMarkets.all();
const forOre = await system.localMarkets.forCargo(cargoId);

forCargo is the one you usually want: markets are per-resource, so asking “what is the market for this cargo in this system” is the natural question.

An order book is not a price. It is a set of orders, each with a quantity and a price — and the two sides are separate reads rather than one list you filter:

const buying = market.bids;
const selling = market.asks;

They are modelled apart because the data available on an order depends on its side: maker state differs between buying and selling. Flattening them would mean a single shape with half its fields undefined at any time.

The same resource can trade at different prices in different systems, and that is a feature of the game rather than stale data. Moving goods between systems where prices differ is a strategy, not an arbitrage bug.

So there is no such thing as the price of a resource. There is a price at a market, at a moment.

An empty order book is normal. A market with nobody trading in it exists and returns nothing. That is not a missing read.

Prices are raw integers. Like all amounts, they need the cargo definitions to render meaningfully, and they are bigint.

Faction markets are not order books. Do not expect the same shape. They offer goods rather than matching player orders.

  • markets — every export in this entry
  • world — markets belong to systems
  • cargo — what is being traded