A Python script that places single and combo bets on bc.fun through the site's own web API instead of its interface, built for an interview task.
Problem
bc.fun has no documented API, so placing a bet means clicking through its website.
Solution
- Discovery
- Placed a minimum-stake bet and watched the requests in the Chrome DevTools Network tab
- Request
- Rebuilt the bet request the way the site does: event, market, specifier and outcome joined with colons, and chained for combos
- Auth
- A bearer token, pasted in by hand
- Interface
- One function,
place_bet(), for single bets and for combo and system bets
Limits
- It does not log in. The token is pasted in by hand.
- The bet details are entered by hand, so it automates placing a bet, not choosing one.
- It has no automated tests.
Result
Met the requirements of the interview task. It placed real bets from a single function call, and the code is public on GitHub.