2.2 Data Flow
This is how MollyBet interacts with your API.
2.2.1 The sequence
- MollyBet calls your /account endpoint to verify the account is active.
- MollyBet starts continuously calling your/events endpoint to get the current list of events and odds.
- MollyBet POSTs to your /bets endpoint when it wants to place a bet. Your response determines whether the bet is accepted.
- MollyBet calls your single-bet endpoint,
GET /bets/{bet_id}, to get the status of a single bet (this is used to track bets reported as "danger"). - MollyBet calls your /bets endpoint to get a list of bets filtered by date range and status.
- MollyBet periodically calls your /balance & /keep_alive endpoints to get the current balance of the account and check if your API is still alive.
- MollyBet calls your /price_and_stake endpoint to get the latest price & liquidity for a selection each time a betslip is opened.
The steps in this sequence are not necessarily in order. However, step 1 is always called first since it does a "login".
Step 5 has two distinct uses: retrieving recent placements in order to recover from network errors, and checking how you have settled bets.
2.2.2 Polling rates
The /events endpoint is polled separately for each value of the type parameter, and each type is polled
at a different rate:
| Type | Meaning | Relative polling rate |
|---|---|---|
live | Events currently in-play. | Fastest (every 5 seconds) |
today | Events happening today but not in-play. | Moderate (every 60 seconds) |
early | Events happening tomorrow onwards. | Slowest (every 5 minutes) |
If you implement the offers WebSocket, you can push events, price and liquidity changes as they happen.
2.2.3 Recovering from errors
If a POST /bets call fails at the network level, MollyBet does not know whether you received it. The
recovery path is the bets list: query /bets/ over the relevant date range and reconcile against the
bet_id values we sent.
This is why the bet_id we supply at placement must be stored and echoed back. It is our identifier, not
yours, and it is the only reliable way to match a bet across a failed request.