Tezos Trading Bot in C++: DEX Monitoring, Strategies and Telegram Control
A C++ rewrite of a bot that watches Quipuswap pools, applies the client's own rules and reports to Telegram
About the project
- Project: A trading bot for the Quipuswap exchange on Tezos
- Industry: Trading, blockchain
- Timeline: September 2021 – June 2022
- Technologies: C++, Tezos, Quipuswap, Coinbase API, Telegram
- Team: a C++ developer and a project manager
A trader wanted to profit from short price gaps in the liquidity pools of Quipuswap, a decentralized exchange on the Tezos blockchain. A large swap moves a pool away from the market price, and a fast bot can trade in the opposite direction and capture the difference.
The client already had a working prototype in Node.js and TypeScript, written by a freelancer. It was hard to maintain, used a single address for all trades and struggled when traffic grew. So he needed a faster, cleaner core that he could keep extending with his own trading rules. We worked on it from September 2021 until the final hand-over in June 2022.
What we delivered
THE CHALLENGE
- Hard-to-maintain Node.js code.
- A single address for all trades.
- No documentation for Quipuswap.
- Rules that the client wants to own.
THE SOLUTION
- A C++ core with its own Tezos library.
- A market feed from Coinbase.
- A rules framework for strategies.
- Telegram reports and control.
THE OUTCOME
- A bot built in C++.
- Rules the client records himself.
- Trade reports in Telegram.
- A launch on the client's machine.
A trading bot is only as good as its core: it must read the market, follow the client's rules and run on his machine without surprises.
From a prototype to a plan
First we read the prototype and the client's specification. The bot watches swaps in the pools, compares the pool price with the market price and trades back when the gap passes a threshold. The size of its trade is a share of the incoming one, and it retries or restarts after an error.
In the end, we recommended to rewrite the core in C++, because the code of the prototype was hard to follow and to extend. We agreed on sprints, with a daily written report and a weekly demo call.
The C++ core
Quipuswap has no formal API and no documentation, only its smart contracts and a TypeScript library. For this reason, our developer wrote a small Tezos library in C++ instead of wrapping the old code. It reads the pools, subscribes to completed transactions and sends the bot's own transactions.
By late September 2021 the bot was "listening to the market", and it made its first transaction soon after. In November we connected Coinbase as a second market and linked the trading logic to its price data.
Rules, strategies and Telegram
The client wanted to set the trading logic himself, so we built a framework of indicators, signals, rules and strategies. He records his own rules in it, and the team does not hard-code them. The bot reports every trade to Telegram with its size and gas, and the client controls it from the same chat.
Running it on the client's machine
In April 2022 we moved the bot to the client's Windows virtual machine. We compiled it from sources on the target machine, found a crash in the HTTP layer during the first runs and fixed it. We also set up remote desktop access, so the client's team could start the program from a desktop shortcut.
After the first runs, the client asked for data at any time interval per strategy, such as a 17-minute window, and we treated it as a change request. On 31 May 2022 we uploaded the production build, and after the client's feedback we updated it on 5 June. By 20 June 2022 the remaining points were agreed, and the bot was handed over and launched.
What turned out to be hard
- No documentation. Quipuswap offered only contracts and a TypeScript library, so we studied the contracts and wrote our own C++ library.
- Tezos data formats. Encoding and decoding the JSON and Michelson structures took more time than planned.
- Building on the target machine. A compiled bot needs its libraries built where it runs, including OpenSSL, so the first launch needed a day of debugging.
- Changing requirements. Flexible time intervals for strategies came late, so we estimated them as a separate change.
Result of the project
The client received a C++ trading bot for Tezos with his own rules framework and Telegram control, running on his virtual machine since June 2022.
Looking for a trading or data bot? See our blockchain development services or read how we built data collectors for a DApp ranking site. The bot trades on Quipuswap and reads market data from Coinbase.
Need a trading bot or a blockchain data tool? Tell us about your task.
SEE MORE OUR CASE STUDIES
Contact us
Please fill out the form, and we will get back to you once your request has been processed.
You can also send your request directly to our email: info@24gen.space
We will respond as soon as possible after receiving your message.



