Market making is one of the oldest jobs in finance: stand ready to buy and sell the same thing at the same time, and earn the gap between the two prices. It used to be done by people on exchange floors. Over the last thirty years it became software, and that software's ideas now run a large part of the Counter-Strike 2 skin market, where virtual items worth billions of dollars trade across dozens of independent marketplaces.
Here's which ideas carried over, which ones break, and what a CS2 market making bot looks like in code.
What a market maker does
A market maker quotes both sides: a bid (the price it buys at) and an ask (the price it sells at). The gap between them, the spread, is its profit each time both sides fill. Buy at 99, sell at 101, keep 2.
Two risks eat into that:
- Inventory risk. Fills don't come in pairs. Keep getting filled on the bid and you're holding a pile of something whose price may be falling.
- Adverse selection. The people trading against you often know more. If your bid fills right before the price drops, someone picked off your stale quote. Glosten and Milgrom formalized this in 1985: part of the spread is payment for trading against better-informed people.
How it became software
Two US changes pushed market making from people to programs. Decimalization in 2001 cut the minimum price step from 1/16 of a dollar to one cent, shrinking spreads until only fast, high-volume software could profit. Regulation NMS (2005–2007) spread trading over many venues and rewarded whoever could watch all of them at once.
The toolkit that came out of this, automated quoting, inventory models and routing across venues, is exactly what CS2 bots use today. Its textbook model is Avellaneda–Stoikov (2008), which we'll simplify below.
The CS2 market, seen as a market
Put a stock exchange's words next to a CS2 marketplace's and they line up:
- Bid: a buy order (DMarket targets, Steam buy orders, ...)
- Ask: a listing
- Tick size: 1 cent
- Many exchanges, one stock: many marketplaces, one market_hash_name
- Exchange fees: seller fees, sometimes buyer and withdrawal fees
- Settlement: a Steam trade, then trade protection
The strategy carries over directly: hold the best buy order on an item, and when it fills, list it just under the cheapest listing. If the gap is wider than the fee, there's a spread to capture. Two habits carry over unchanged too: penny jumping (best buy order + 1 cent, cheapest listing − 1 cent, which bots do to each other all day) and inventory skew (hold too much, quote lower on both sides).
What's different changes how the software is built:
- No consolidated feed. Stocks have a national best bid and offer. CS2 has none: each marketplace publishes its own prices, in its own format and currency, behind its own rate limits.
- Fees are wider than the spread. Seller fees run from a couple of percent to over ten, so the fee, not the tick size, sets the minimum profitable spread.
- Settlement takes a week. An item received in a Steam trade sits in a 7-day trade protection period, during which the trade can be reverted. That's a week of inventory risk on every fill.
- No short selling. Inventory is zero or more, so quotes only skew one way.
- Items aren't fully fungible. Float, pattern and stickers make two "identical" items worth different amounts.
- Rate limits, not microseconds. Your reaction time is set by how many requests a marketplace allows your key, not by colocation.
- Adverse selection has a calendar. When a new case or sticker capsule comes out, prices fall fast and every standing buy order fills too high.
Building a quoter
Avellaneda–Stoikov places quotes around a reservation price instead of the mid price:
r = s − q · γ · σ² · (T − t)
s is the mid price, q the inventory, γ risk aversion, σ² price variance, T − t the time left. The more you hold, the lower your quotes. For CS2, inventory is never negative and the time horizon is roughly the trade protection week, so a linear skew per item held works well enough:
type Book = { bestBid: number | null; bestAsk: number | null };
type Params = {
fee: number; // seller fee, 0.05 for 5%
minEdge: number; // profit wanted after fees, 0.02 for 2%
skewPerItem: number; // how much each held item lowers our quotes, 0.005 for 0.5%
maxInventory: number; // stop buying at this many
};
const TICK = 0.01;
const floorTick = (x: number) => Math.floor(x / TICK + 1e-9) * TICK;
const ceilTick = (x: number) => Math.ceil(x / TICK - 1e-9) * TICK;
export function quote(book: Book, inventory: number, p: Params) {
if (book.bestBid === null || book.bestAsk === null) return null;
// 1. penny jump: one tick better than the best price on each side
let bid = book.bestBid + TICK;
let ask = book.bestAsk - TICK;
// 2. inventory skew: the more we hold, the lower both quotes
const skew = 1 - inventory * p.skewPerItem;
bid = floorTick(bid * skew);
ask = Math.max(ceilTick(ask * skew), TICK);
// 3. never buy at a price our own listing can't sell at a profit
bid = Math.min(bid, floorTick((ask * (1 - p.fee)) / (1 + p.minEdge)));
// 4. a full inventory means no new buy order
return {
bid: inventory >= p.maxInventory || bid <= 0 ? null : Number(bid.toFixed(2)),
ask: inventory > 0 ? Number(ask.toFixed(2)) : null,
};
}Step 3 is where CS2 differs most: the fee decides the bid. When the gap is narrower than fee plus edge, the quoter drops below the best buy order and simply doesn't compete. One thing left to the caller: if the best buy order is already yours, don't jump it, or you'll outbid yourself a cent at a time.
Feeding it prices
The quoter needs each marketplace's best buy order and cheapest listing. Collecting those yourself means a client per marketplace, rate limiting, currencies and name matching. Here they come from our price API, which gathers every item's cheapest listing and highest buy order per marketplace into one API:
const API = "https://api.apiskins.com/v1";
const headers = { "X-API-KEY": process.env.APISKINS_API_KEY! };
const name = encodeURIComponent("AK-47 | Redline (Field-Tested)");
const [offers, orders] = await Promise.all([
fetch(`${API}/offers/${name}?providers=dmarket`, { headers }).then((r) => r.json()),
fetch(`${API}/orders/${name}?providers=dmarket`, { headers }).then((r) => r.json()),
]);
const book = {
bestBid: orders.orders?.[0]?.price ?? null,
bestAsk: offers.offers?.[0]?.price ?? null,
};
console.log(book, quote(book, 2, { fee: 0.05, minEdge: 0.02, skewPerItem: 0.005, maxInventory: 5 }));GET /v1/offers and GET /v1/orders without a name return every item at once.
The engineering nobody writes about
The math is the easy part. Most of a real bot is keeping its view of the world correct. These are the lessons from running our own market making robots:
- Your own order list lags. Marketplaces take a while to show a new order in your account. Trust the list and you'll place it twice. Keep your own record and treat the marketplace's errors ("not found", "already sold") as corrections.
- Requests fail halfway. An order can be created while the response never arrives. Periodically find orders you have no record of and remove them, or they'll fill without you knowing.
- Each order only checks the balance alone. $100 can hold many $80 buy orders, and the first to fill takes the money. Check the balance before every placement.
- Don't requote on every tick. Answering every one-cent undercut burns your request budget and drags the price down. A cooldown of several minutes after each change saves both.
- Rate limits are per key. One account's key should never carry another's requests; a bot running many accounts needs a scheduler that spreads work across keys.
Wrapping up
Market making in CS2 is the same game as on an exchange: quote both sides, capture the spread, control inventory, don't get picked off. What changes is everything around it: no shared price feed, fees bigger than the spread, a week of settlement risk, and rate limits instead of microseconds.
The API docs cover the offer and buy order APIs used above. If you'd rather not build the bot yourself, our trading robots do this: they keep your buy orders and listings at the best price, within the limits you set.