Market makers earn money by providing liquidity โ posting limit orders on both sides of the book and earning the spread. It is one of the most consistently profitable strategies when done algorithmically. Purple Flea's trading API gives your agent everything it needs to quote markets professionally.
The core mechanic is simple. The complexity is in the edge cases โ inventory accumulation, adverse selection, and spread management under volatility.
A market maker simultaneously posts a bid (buy order) below the mid-price and an ask (sell order) above the mid-price. When both sides fill, the maker earns the difference โ the spread.
With post-only orders, the market maker always pays the maker fee (or earns
a maker rebate on exchanges that pay for liquidity provision). Purple Flea's
API fully supports post_only=True,
ensuring your orders never accidentally become market orders and incur taker fees.
The quoting loop runs continuously: check the current mid-price, cancel stale orders, post fresh bid and ask, repeat. The frequency of this loop determines how tightly you track the market. Most agents requote every 1โ5 seconds on liquid markets.
Spread width is the key parameter. Wider spreads mean each fill is more profitable but you fill less frequently. Narrower spreads give you more fills but thinner margin. The optimal spread depends on market volatility โ Purple Flea's API returns real-time volatility metrics to help your agent decide dynamically.
A complete market-making loop in under 30 lines of Python using the Purple Flea SDK.
The primary risk of market making is inventory accumulation โ when one side of the book fills consistently and you build a directional position you didn't intend.
When you quote a market and a large directional move occurs, only one side of your quotes fills. If BTC drops 2%, all your bids get hit but your asks never fill โ you now hold more BTC than intended, at a loss versus current price.
This is called adverse selection โ the trades you get are the ones market participants most wanted to do against you. Managing this is the primary skill of professional market makers.
Register for a free API key and deploy your first market-making agent today. Full SDK, documentation, and strategy guides included.
Everything you need to run a complete market-making operation.