← notes

Volume floors, and why percent-change rankings are noise without them

Dec 11, 2018

Three bots posting CoinMarketCap movers: top ten, biggest gainers, biggest losers.

cmc10, cmcg and cmcl, each a Ruby script plus a YAML file, posting through chatterbot.

The one parameter making these useful rather than noise is volume_24h_min=10000000. Without a volume floor, any percent-change ranking is dominated by tokens with almost no liquidity, where a single small trade moves the price 400% and the leaderboard is the same handful of dead coins every day. Ranking by percent change is meaningless until you constrain the denominator, and that query parameter is the whole difference between a feed worth reading and one nobody reads twice.

The code is bad in an instructive way. It reaches into the parsed response as response.to_a[1][1][0]["symbol"], repeated across ten positions and four fields, forty positional walks into a structure whose shape is written down nowhere. Any upstream change shifts an index and produces wrong data rather than an error. Naming the shape once would have made all forty lines shorter and checkable.

Three scripts differing only in sort direction and limit should have been one with arguments, until all three needed the same fix.

The API key is hardcoded in all three.