lab

small things you can poke.

Seven toys that run in your browser. They are the arithmetic and the rules from our posts, made clickable, so you can break them instead of taking our word for it.

Nothing you type leaves the page: no requests, no cookies, no accounts. Everything is illustrative, with made-up numbers and simulated exchanges.

the trading toys

The trading toys are arithmetic on numbers you type. They are not investment advice, they do not know any market, and crypto trading carries a risk of loss. Simulated and hypothetical results do not predict real ones. We build software. We do not manage money, hold funds, sell signals or trade for anyone else.

01

the best of a hundred coin flips

Every line is a made-up strategy that flips a fair coin for 250 steps and wins or loses one unit each time. None of them has any edge. Try enough of them and one will look like a genius: cyan is the best at the end, amber the worst. The post: the best of a hundred coin flips, and the older one on why every strategy has to beat a coin toss.

One unit is one unit of risk per step. The numbers are simulated with a seeded random generator, so they describe coins and not any strategy of ours.

02

wall or hiccup

A scraper meets a response it did not expect. Is it a wall, a reason to stop, or a hiccup, a reason to wait and retry, or neither? Eight responses, your call. Background: robots.txt first, Retry-After is a sentence and the proxy ladder.

These are our house rules for the scrapers we build. Other teams draw the lines elsewhere, and a few of these cases are judgement calls.

03

two readers, one robots.txt

Python's built-in robots.txt reader takes the first matching rule and does not know the wildcard characters. The standard, RFC 9309, says the longest matching rule wins and that * and $ work. Paste a file, pick an agent and a URL, and see both answers. More in robots.txt readers disagree.

try one of these

The standard column was checked against Protego 0.7.0 and the Python column against the real urllib.robotparser of Python 3.10.12, on 12,000 random file and URL pairs, with no differences. Random files are not real sites, and newer Python versions may behave differently.

04

the price is a string

Shops print the same number in a dozen ways. A careful parser reads what is clear and leaves the rest empty, because a plausible guess is a wrong number nobody can see. Edit the list and watch. The post: the price is a string.

This is a little stricter than the snippet in how a scraper job goes: a dot followed by exactly three digits could be a decimal point or a European thousands separator, so it is left empty.

05

did my order fill?

The connection drops right after the order goes out. The order may have filled, or never arrived, and your bot cannot tell which. Pick what to do. The world is decided at random each run, so luck can make a bad choice look good: run it a few times. The post: did my order fill?

press "send the order" to begin

A simulation. No exchange is involved and no real orders exist. The lesson is about the states, not about any particular venue.

06

the fee line eats the grid

A grid bot earns a small step on each round trip and pays for it twice in fees, once in spread and sometimes in funding. Type your own numbers and see what is left. The defaults are the made-up numbers from the post. The post: the fee line eats the grid.

Hypothetical numbers and plain arithmetic: one buy, one sell, nothing else. Not investment advice, and crypto trading carries a risk of loss.

07

stop first, then size

The stop decides how much you can hold, not the other way round. Give it an account, a risk budget, an entry and a stop, and it works out the size so that a stop-out costs the budget and not a cent more. Then it shows what a size picked by feel would cost. The post: start from the task, not the strategy.

The same formula as the illustrative snippet in the post, with hypothetical numbers. It works for longs and shorts. Not investment advice, and crypto trading carries a risk of loss.