Market makers provide liquidity by quoting both sides of a market. You profit from the bid-ask spread while taking on inventory risk. Blink’s time-windowed markets and automatic settlement make this straightforward.
Use post_only=True to ensure your orders always provide liquidity (never take). This prevents crossing the spread and guarantees you earn the spread on every fill.
OrderArgs( token_id=token_id, side=Side.BUY, price=bid, size=SIZE, post_only=True, # rejected if it would match immediately)
Instead of cancel-all + re-place (which causes orderbook flicker), compare desired orders against existing ones and only modify what changed:
This is a simplified example. A production market maker would handle additional concerns like token ID normalization and parallel execution.
def converge_orders(client, desired_orders, tolerance=0.005): """Only cancel/place orders that actually changed.""" existing = client.get_orders() to_cancel = [] to_place = list(desired_orders) for existing_order in existing: # Find a matching desired order (within tolerance) matched = False for i, desired in enumerate(to_place): if (desired.token_id == existing_order.token_id and desired.side == existing_order.side and abs(desired.price - float(existing_order.price)) < tolerance and abs(desired.size - int(existing_order.size_remaining)) < tolerance * 100): to_place.pop(i) # already exists, keep it matched = True break if not matched: to_cancel.append(existing_order.id) if to_cancel: client.cancel_orders(to_cancel) if to_place: client.create_and_post_orders(to_place)
When you’re long (positive inventory), the skew makes your ask cheaper to encourage sells. When short, it makes your bid more aggressive to encourage buys.