Crypto Trading Bot: Architecture and Roadmap

Introduction
I decided to build a crypto trading bot, which will trade cryptocurrencies on some exchange, for example: Coinbase. Actually, the idea of building the trading bot has been in my mind since 2018. I tried to build it a couple of times, but continuously switched to something else. But this time my intention was serious, so I implemented the MVP for the crypto trading bot, and in this post, I will explain my vision of the crypto trading bot and the development roadmap for it.
Crypto Trading Bot Targets
My targets of the crypto trading bot:
- To achieve a daily capital gain of 1%.
- To be able to trade different cryptocurrency pairs.
- To operate efficiently without high trading speed as this is not a high-frequency trading project.
- To be cost-effective in maintenance — I have limited time for my pet projects after work.
- To be cost-effective in hosting — pet projects shouldn’t consume too much money.
Crypto Trading Bot Architecture
The core concept for the Crypto Trading Bot is shown in this high-level architecture diagram:
- AWS Lambda was used to achieve low hosting costs for the bot because I have Free Tier compute minutes for AWS Lambda.
- Amazon EventBridge generates an event every minute, triggering a lambda.
- Coinbase API was chosen as the exchange API because I already had an account on this platform, and the documentation seemed good to me. I may add support for other exchanges in the future.
- Grafana was selected as the visualization tool for metrics and logs because its Free Tier provides 50 GB of storage and 7 days retention, which is sufficient for my project. Additionally, Grafana is a powerful tool for metrics, making it an obvious choice when I saw it offered for free.
- Amazon DynamoDB was chosen as the database due to its free tier in AWS and low costs for handling low data volumes.
Additionally, I developed the AWS Lambda functions in TypeScript because I decided to switch from Python to Node.js for quick prototyping, leveraging JavaScript’s capabilities as a language for both backend and frontend. TypeScript simplifies project maintenance with its type system, aligning with my goal of low-cost maintenance.
Crypto Trading Bot Algorithm
The algorithm for the bot contains two main stages:
update context
 — updating trading context based on the updates from Coinbase..trade
 — execute trading strategy on the market data and place orders.
The complete algorithm is shown in the diagram below:
- Amazon EventBridge will send an event every minute to the AWS Lambda.
- AWS Lambda will retrieve all pending orders from DynamoDB to check if some of them are already filled, cancelled, etc.
- AWS Lambda will get updates for pending orders from the Coinbase API and compare them with pending orders received from the database.
- The lambda will save updated orders in the DynamoDB database and update the context by adding or removing money depending on the orders’ state.
- The lambda will retrieve the context from DynamoDB. Although the lambda already had context in the previous step, I decided to decouple theÂ
update context
 stage from theÂtrade
 stage. Maybe in the future, there will be two separate lambdas or updating context will occur from the WebSocket event. - The lambda will retrieve candles for the cryptocurrency pair for the last 10 minutes. The time range of 10 minutes was chosen randomly; it may change in the future.
- Execute the trading strategy based on the trading context and historical candles received from Coinbase.
- If the decision is made to sell or buy, the order will be placed.
- The lambda will save the placed order and updated trading context to the DynamoDB database.
- The lambda will publish metrics to Grafana for visualization.
Crypto Trading Bot Roadmap
Currently, I have implemented a locally running Crypto Trading Bot which has been running for 12 hours on the Coinbase sandbox from my laptop.
It started with 100 sandbox USD
 and traded with the BTC-USD pair. After working for 12 hours, it initially won 14 USD
, but in the end, it lost approximately 48 USD
, leaving the total amount of USD at 66 USD
. So, the trading strategy currently is not working, but the MVP target was achieved — the bot is simply working. My next steps will be as follows:
- Deploy the bot to AWS Lambda while continuing to work on the Coinbase sandbox.
- Add Grafana support — I need to see the current trading strategy outputs because it wins something but loses everything. For better analysis, I need to have metrics from the bot.
- Create backtests for the trading strategy — download historical data for cryptocurrency pairs and execute my trading strategy on it.
- Improve the trading strategy with ChatGPT to have continuous capital gains in the backtesting — receive proofs that the trading strategy works.
- After receiving proof that the trading strategy works on the historical data, leave the bot for at least 7 days with a new strategy at the Coinbase sandbox environment for additional testing.
- If backtesting and testing during the 7 days at the Coinbase sandbox environment are successful — try to launch the bot on the main Coinbase environment with the real 10 USD; otherwise, continue improving the strategy until it becomes profitable.
The curious reader may ask me a question:
Why am I developing operational things, like monitoring, deployments, and so on, instead of focusing on the trading strategy?
The answer is this: I need to run a crypto trading bot in “production,” instead of developing a trading strategy that will never be used. One of the principles of software development is iterative development: delivering software continuously in small pieces. I decided to first implement the framework for a crypto trading bot that will simply work continuously and then focus on the unknown area for me, the “trading strategy.”
Conclusions
In this article, I described my new pet project — Crypto Trading Bot, its architecture, and roadmap. I didn’t delve into the details of implementation to keep the article concise; I may explain them in the next articles. Also, algorithmic trading is a completely new area for me, and it is very interesting, actually. So, my architecture explained in the article may change over time.
Share this article
Related articles
Building ai-svc: A Reliable Foundation for AI Founder
Learn how to build robust LLM-powered apps using ai-svc—a Go backend service that adds retries, fallback models, and clean API orchestration to your AI workflows.
AI Founder: Next Generation Business Problem Validation Platform
Discover how AI Founder helps validate startup ideas using ChatGPT—analyzing problems, competitors, and business potential with a structured GPT workflow.
Got a Specific Challenge? 🤔
Describe your backend challenge below to get a preliminary fixed-fee package suggestion and estimated price.
Please note: The initial proposal is generated by AI. A final, detailed proposal will be provided after a discovery call.