This gerbil trades stocks with a Raspberry Pi
Turns out stock trading is so easy a gerbil can do it. That, or maker Roni Bandini owns a harrowingly competent pet. Either way, we’re into it.
Roni saw a news story about the untimely passing of Mr Goxx the crypto-trading hamster and says he decided it was high time his own hamster, Milstein, started pulling their financial weight.
[Editor’s note: have you ever seen a hamster with a tail that long? I think not. We have been arguing about this for fifteen minutes now and conclude that Milstein, as Roni Bandini almost concedes in his Medium article, is a white gerbil. But life is short, so we’ll just roll with it.]
How does it work?
Milstein sets off running on a hamster wheel with a rotary coder sitting inside the axis. This is how the stocks are selected, a bit like the big Wheel of Fortune prize wheel. When the hamster wheel stops, a Python script “lands” on a stock selection.

If Milstein likes the look of their selection, they wander over to the Buy/Sell hamster house. When a PIR sensor installed there notices movement inside the house, the buy or sell signal is triggered, and the script dutifully executes Milstein’s trade.

The Raspberry Pi here is running the Alpaca Trading API and a local observer can watch everything on the OLED screen.
Milstein resides in Argentina so they only invest in Argentinian stocks trading in US markets, but the project code will work with any stock or ETF index. Patriotism is all well and good, but to date Milstein has lost $350. Perhaps broadening their portfolio might put them back in the black?

Hardware


- Rotary encoder
- OLED screen
- PIR sensor
- An obliging rodent with a calm temperament under pressure (Roni recommends you select your animal collaborator for their intelligence and propensity to be awake during daily trading hours)

Thingiverse holds the secrets to 3D-printing the hamster wheel, the buy/sell trading desk, and the means to support the OLED screen.
Having spent quarter of an hour arguing about rodent identification, we are now busy arguing about whether day-trading is, in fact, mere gambling and whether it is possible for a human to be materially better at it than a gerbil/hamster/etc. We await your input in the comments with quivering excitement.
6 comments
Lab Rat
They! Their! Not even the animals are safe from the woke brigade.
Raspberry Pi Staff Liz Upton
Hardly woke – we just have no idea what the genitals of this particular gerbil look like.
Raspberry Pi Staff Simon Long
I’m sure you could find pictures online if you looked hard enough… ;)
Batuhan
GerbilFx, MetaGerbil. :)
AndrewS
Would a gecko (named Gordon, obviously) be even better at this than a gerbil? ;-)
Raspberry Pi Staff Liz Upton
Honestly, Andrew, I am sure you will agree that the fewer things named Gordon we’re exposed to, the better.