feat: post resting limit orders instead of only taking asks#31
Merged
Conversation
Changes the default price_action_bot behavior from taker-only to maker-first: - Bots now post resting limit orders at prices derived from their confidence signal - If a matching ask exists at/below the bot's price, it fills immediately (same as before) - If no matching ask, the order rests on the book for other bots to fill against - Orders expire after 10 min (most of a 15-min market's life) - Signal flip detection: cancels stale orders when direction changes - HOLD signal cancels resting orders (not confident enough to leave on book) - Skips re-posting if already has a resting order in the same direction This addresses the empty orderbook deadlock where all bots wait for asks that never appear. Now bots populate the book, enabling bot-vs-bot crossing which generates fee revenue without MM exposure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
All bots currently only take from the orderbook — they check for existing asks, and if there are none, they do nothing:
This creates a deadlock: every bot waits for someone else to post first. The only liquidity comes from the MM, so every trade has the MM as counterparty. No bot-vs-bot crossing happens.
Solution
Change the default
price_action_botto post resting limit orders based on its price signal:Impact
This is the structural fix for bot-vs-bot crossing. When multiple bots post resting orders with different views:
The MM becomes a backstop, not the primary counterparty for every trade.