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).
- Jittered timer: the gaps are not one interval but stay in a band (30–60 s, say), never much shorter: a timer with random jitter. Real order flow has many near-zero gaps.
- 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).
- Round notionals: most of a side’s levels are whole quote amounts (560.00 USDT) though their sizes are not whole: a bot sizes its quotes by value; people size orders by quantity.
Across the runs of a repeating summary, one more: a depth cycle, a
side of the book refilled on a timer and drained between the refills
(depth_cycle). One run cannot see it.
The functions are pure: they read trades and levels and fetch nothing.
Structs§
- BotPatterns
- The bot-pattern result of one summary.
- Depth
Cycle - A side of the book refilled at a near-fixed period and drained between the refills: a bot quoting on a timer.
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.
- CYCLE_
FALLING_ SHARE - Between refills, at least this share of the run-to-run steps must be flat or down: the depth drains, it does not grow.
- CYCLE_
JUMP - A run-to-run rise of at least this share of the depth is a refill.
- CYCLE_
MAX_ CV - Periods between refills whose standard deviation is under this share of their mean are a timer.
- CYCLE_
MIN - Fewest whole cycles (refills after the first) that make a depth cycle.
- CYCLE_
MIN_ RUNS - Fewest runs between two refills: a depth that jumps every other run is noise, not a cycle.
- 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_
SHAPE_ SLACK - A level at most this much larger (or smaller) than the one before does not end a falling (or rising) ladder: one bump in a quoting curve.
- 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.
- ROUND_
LEVELS - The round-notional signal reads this many levels from the top of a side.
- ROUND_
MIN_ LEVELS - At least this many of those levels with a whole quote amount are a signal.
- TIMER_
BAND - The band around the median gap that a jittered timer stays in: ±50%.
- TIMER_
BAND_ SHARE - At least this share of the gaps within
TIMER_BANDof the median gap, with the floor below, is a jittered timer. Random arrivals put about 35% there. A share, not the gaps’ spread: a bot that pauses between bursts has a few long gaps that blow the spread up but leave the share. - TIMER_
MIN_ FLOOR - The 5th-percentile gap at or above this share of the median is a floor: a timer never fires early. Real order flow puts it near 0.
- 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. - depth_
cycle - Depth cycle: in
points(time in ms, depth), oldest first, a refill (a rise ofCYCLE_JUMP) at leastCYCLE_MIN+ 1 times, at leastCYCLE_MIN_RUNSruns apart, at a period withinCYCLE_MAX_CV, with the depth flat or falling forCYCLE_FALLING_SHAREof the steps between. - 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. - round_
notionals - Round notionals on either side of a real exchange book.
- timer
- Jittered timer: gaps between trade events with a median of at least
CADENCE_MIN_GAP_MS, at leastTIMER_BAND_SHAREof them withinTIMER_BANDof the median, and a 5th percentile at leastTIMER_MIN_FLOORof the median.