Expand description
Bot-pattern signals in a venue’s recent trades and order book, for the market summary’s health advisory.
Market making is legitimate, so a signal never fails a summary: it warns, with the evidence, where the tape or the book looks machine-made. The signals:
- Repeated sizes: one exact trade size makes up a large share of the tape, or a few sizes make up half of it.
- Metronome timing: trades come at an almost fixed interval.
- Cadence: most gaps between trades are one interval, even when a bot trades in bursts with pauses between them (so the gaps as a whole are not a metronome).
- Ping-pong: a buy and a sell of the same size at nearly the same price, seconds apart (the shape of wash trading).
- Ladder quotes: consecutive book levels at even price steps whose sizes are equal, or rise or fall level by level (a quoting curve).
The functions are pure: they read trades and levels and fetch nothing.
Structs§
- BotPatterns
- The bot-pattern result of one summary.
Enums§
- Finding
- One signal that was found, with its evidence.
- Ladder
Shape - How a ladder’s sizes run, from the best level out.
Constants§
- CADENCE_
MIN_ GAP_ MS - Shortest interval the cadence signal judges: some venues print whole seconds, which would put many short random gaps on one value.
- CADENCE_
SHARE - Gaps at one interval, as a share of all gaps, at or above this are a cadence. Random arrivals put at most about 1.5% of gaps in any ±2% band.
- CADENCE_
TOLERANCE - Gaps within this share of an interval count as that interval.
- FEW_
SIZES - How many sizes the few-sizes signal adds up.
- FEW_
SIZES_ MIN_ SHARE - A size counts toward the few-sizes signal only with at least this share of the trades on its own.
- FEW_
SIZES_ SHARE - The
FEW_SIZESmost common sizes in at least this share of the trades are a signal. - LADDER_
DEPTH - How many levels from the top of each side the ladder signal reads.
- LADDER_
MIN_ LEVELS - Fewest consecutive levels that make a ladder.
- LADDER_
SIZE_ TOLERANCE - Levels of a ladder differ in size by at most this share.
- LADDER_
STEP_ TOLERANCE - Price steps of a ladder differ by at most this share of the first step.
- METRONOME_
MAX_ CV - Gaps whose standard deviation is under this share of their mean are a metronome.
- MIN_
GAPS - Fewest gaps between trade events the timing signal needs.
- MIN_
PING_ PONG_ PAIRS - Fewest ping-pong pairs that count as a signal.
- MIN_
TRADES - Fewest trades the tape signals need. Below this they are not judged.
- PING_
PONG_ PRICE_ TOLERANCE_ PCT - A ping-pong pair’s prices differ by at most this, in percent.
- PING_
PONG_ SHARE - Trades in ping-pong pairs, as a share of all trades, at or above this are a signal.
- PING_
PONG_ WINDOW_ MS - A ping-pong pair is at most this far apart in time.
- REPEATED_
SIZE_ SHARE - One exact size in at least this share of the trades is a signal.
- TRADE_
SAMPLE - How many recent trades the summary asks the venue for.
Functions§
- cadence
- Cadence: the interval (of at least
CADENCE_MIN_GAP_MS) that the most gaps between trade events are at, withinCADENCE_TOLERANCE, when those gaps are at leastCADENCE_SHAREof all gaps. - detect
- Runs every signal.
tradesis the venue’s recent tape, or why there is none.bookis the bids and asks of a real exchange book, orNonefor a synthetic one (a DEX pool’s curve is an even ladder by design). - few_
sizes - Few sizes: the
FEW_SIZESmost common sizes (each with at leastFEW_SIZES_MIN_SHARE) coverFEW_SIZES_SHAREof the trades. A bot that rotates through a few sizes passes underrepeated_size. - ladders
- Ladder quotes on either side of a real exchange book.
- metronome
- Metronome timing: the whole tape, else the dominant size’s trades, at a near-fixed interval.
- ping_
pong - Ping-pong: buy/sell pairs of the same size within
PING_PONG_WINDOW_MSandPING_PONG_PRICE_TOLERANCE_PCT. Each trade is in one pair at most. Returns the finding and the paired trades. - repeated_
size - Repeated sizes: the dominant size and the trades it covers, when it
reaches
REPEATED_SIZE_SHARE.