A simple implementation of the Martingale betting strategy that automates bet placement using Stake's GraphQL API.
Disclaimer This project is intended for educational purposes only. It demonstrates how the Martingale strategy can be automated. Gambling involves significant financial risk, and this repository does not guarantee profit or encourage irresponsible gambling.
The Martingale strategy is a betting system where the stake is doubled after every loss, with the goal of recovering all previous losses plus making a profit equal to the original bet once a win occurs.
Example:
| Round | Bet | Result |
|---|---|---|
| 1 | 0.10 | Lose |
| 2 | 0.20 | Lose |
| 3 | 0.40 | Lose |
| 4 | 0.80 | Win |
After the win, the betting amount resets back to the default stake.
- Automated Dice betting
- Automatic bet doubling after each loss
- Resets to the default amount after every win
- Configurable base bet
- Stops after reaching the maximum consecutive loss threshold
- Uses Stake's GraphQL API
.
├── src/
├── index.ts
├── package.json
├── tsconfig.json
└── README.md
git clone https://github.com/yourusername/martingale-automation.git
cd martingale-automation
npm installInside index.ts, configure your authentication values.
const cookie = ``;You will also need valid request headers such as:
- Cookie
- x-access-token
- x-lockdown-token
These are obtained from your own authenticated browser session.
Compile TypeScript
npx tscRun
node index.jsOr using ts-node
npx ts-node index.tsStart with Default Bet
│
▼
Place Bet
│
▼
Win? ───────── Yes ─────────► Reset to Default Amount
│
No
│
▼
Double Bet
│
▼
Continue
The bot stops automatically after a predefined number of consecutive losses to prevent unlimited bankroll growth.
const DEFAULT_AMOUNT = 0.1;Maximum consecutive losses before stopping:
if (lossesInRow >= 13) process.exit(0);The Martingale strategy does not eliminate risk.
A long losing streak can rapidly increase bet size and may exceed your available bankroll or platform betting limits.
Use at your own risk.
- TypeScript
- Node.js
- Axios
- GraphQL
MIT