An automated and intelligent trading bot, designed to be transparent, secure, and scalable. This open-source project allows traders of all levels to automate their trading strategies with modern and reliable technology.
This trading bot is a complete platform that allows you to:
- Automate your trading strategies on different financial markets
- Manage your risks with customizable parameters
- Track your performance in real-time with detailed dashboards
- Collaborate with a community of traders and developers
- β 100% Open Source: Transparent and auditable code
- β Enhanced Security: Robust authentication and data protection
- β Modern Architecture: Scalable and maintainable microservices
- β Ease of Use: Intuitive interface and complete documentation
- β Active Community: Continuous support and contributions
The project uses a modern microservices architecture:
- Business Services: Each feature is an independent service
- Database: PostgreSQL for data persistence
- Cache: Redis for performance
- API: FastAPI for fast and documented interfaces
- Containerization: Docker for simplified deployment
trading-bot-open-source/
βββ services/ # Business services (authentication, trading, etc.)
βββ infra/ # Infrastructure (database, migrations)
βββ libs/ # Shared libraries
βββ scripts/ # Automation scripts
βββ docs/ # Documentation
| Domain | Scope | Status | Activation Prerequisites |
|---|---|---|---|
| Strategies & research | Visual Strategy Designer, declarative imports, AI assistant, backtesting API | Delivered (designer & backtests), Beta opt-in (assistant) | make demo-up, pip install -r services/algo_engine/requirements.txt (assistant auto-enabled), OPENAI_API_KEY; set AI_ASSISTANT_ENABLED=0 to disable |
| Trading & execution | Sandbox order router, strategy bootstrap script, market connectors (Binance, IBKR, DTC stub) | Delivered (sandbox + Binance/IBKR), Experimental (DTC) | scripts/dev/bootstrap_demo.py, connector credentials when available |
| Real-time monitoring | Streaming gateway, InPlay WebSocket feed, OBS/overlay integrations | Delivered (dashboard + alerts), Beta (OBS automation) | Service tokens (reports, inplay, streaming), optional OAuth secrets |
| Reporting & analytics | Daily reports API, PDF exports, risk metrics | Delivered (reports), In progress (extended risk dashboards) | Ensure data/generated-reports/ is writable; enable Prometheus/Grafana stack |
| Notifications & alerts | Alert engine, multi-channel notification service (Slack, email, Telegram, SMS) | Delivered (core delivery), Beta (templates/throttling) | Configure channel-specific environment variables; keep NOTIFICATION_SERVICE_DRY_RUN for staging |
| Marketplace & onboarding | Listings API with Stripe Connect splits, copy-trading subscriptions, onboarding automation | Beta private launch | Stripe Connect account, entitlements via billing service |
Track detailed milestones and owners in docs/release-highlights/2025-12.md.
Prerequisites:
- Docker (default workflow), or native installations of
postgresql(providingpg_ctl,pg_isready,initdb) andredis(redis-server,redis-cli).
# 1. Clone the project
git clone https://github.com/decarvalhoe/trading-bot-open-source.git
cd trading-bot-open-source
# 2. Install development tools
make setup
# 3. Start the development environment (Docker)
make dev-up
# 4. Check that everything is working (auth-service health)
curl http://localhost:8011/health
# 5. Stop the environment
make dev-downThe default .env.dev assumes every dependency runs inside Docker. When you
prefer to run PostgreSQL/Redis/RabbitMQ directly on your machine, switch to the
native configuration helpers:
# Point the stack at localhost services
export $(cat .env.native | grep -v '^#' | xargs)
# Make sure ENVIRONMENT=native so shared helpers hand out localhost URLs
echo $ENVIRONMENT # native
# Apply the latest migrations against your host database
scripts/run_migrations.shBoth the configuration service and the shared helpers use the
ENVIRONMENT flag to pick the right .env.<env> file and config JSON. Setting
ENVIRONMENT=native automatically rewrites DSNs such as POSTGRES_DSN,
DATABASE_URL, REDIS_URL and RABBITMQ_URL to target localhost while the
Docker-based environments keep pointing at the internal container hostnames.
To explore the monitoring and alerting services together, start the full demo stack:
make demo-upThe command builds the additional FastAPI services, applies Alembic migrations and wires Redis/PostgreSQL before exposing the following ports. Enable the optional AI strategy assistant and connectors with:
pip install -r services/algo_engine/requirements.txt
# Assistant runs by default once the optional dependencies are installed.
# Export AI_ASSISTANT_ENABLED=0 to opt out if you prefer to keep it disabled.
export OPENAI_API_KEY="sk-your-key"βΉοΈ Installing
services/algo_engine/requirements.txtonly makes the assistant dependencies available; the runtime flagAI_ASSISTANT_ENABLED(read inservices/algo_engine/app/main.py) controls whether the feature starts. Leave it unset for the default enabled behaviour or exportAI_ASSISTANT_ENABLED=0to disable it even with the dependencies present.
Available Services:
8005βbilling-service(Stripe-style subscription orchestration and webhook replay tools)8013βorder-router(execution plans and simulated brokers)8014βalgo-engine(strategy catalogue, backtesting, optional AI assistant on/strategies/generate)8015βmarket_data(spot quotes, orderbooks and TradingView webhooks)8016βreports(risk reports and PDF generation)8017βalert_engine(rule evaluation with streaming ingestion)8018βnotification-service(alert delivery history)8019βstreaming(room ingest + WebSocket fan-out)8020βstreaming_gateway(overlay OAuth flows and TradingView bridge)8021βinplay(watchlist WebSocket updates)8022βweb-dashboard(HTML dashboard backed by reports + alerts APIs)
Generated artefacts are stored in data/generated-reports/ (PDF exports) and data/alert-events/ (shared SQLite database for alerts history). Default service tokens (reports-token, inplay-token, demo-alerts-token) and external API secrets can be overridden through environment variables before running the stack.
Stop every container with:
make demo-downOnce the stack is running you can exercise the full onboarding β trading journey with the helper script:
scripts/dev/bootstrap_demo.py BTCUSDT 0.25 --order-type marketThe command provisions a demo account, assigns entitlements, configures a strategy, routes an order, generates a PDF report, registers an alert, books a mock subscription in the billing API (available at http://localhost:8005) and publishes a streaming event. The emitted JSON summarises all created identifiers (user, strategy, order, alert, report location) together with the JWT tokens associated to the demo profile.
scripts/dev/run_mvp_flow.py now simply wraps this command for backward compatibility.
Use the Makefile helpers to manage Alembic migrations locally (the commands default to postgresql+psycopg2://trading:trading@localhost:5432/trading, override it with ALEMBIC_DATABASE_URL=<your-url> when needed):
# Generate a new revision
make migrate-generate message="add user preferences"
# Generate a trading revision directly with Alembic (autogenerates orders/executions models)
ALEMBIC_DATABASE_URL=postgresql+psycopg2://trading:trading@localhost:5432/trading \
alembic -c infra/migrations/alembic.ini revision --autogenerate -m "add trading orders and executions tables"
# Apply migrations (defaults to head)
make migrate-up
# Roll back the previous revision (override DOWN_REVISION to target another one)
make migrate-downDocker services now apply migrations automatically during startup through scripts/run_migrations.sh, ensuring the database schema is up to date before each application boots.
Objective: To set up the basic technical infrastructure
- β Project Setup: Repository, development tools, CI/CD
- β Configuration Service: Centralized parameter management
Result: The technical infrastructure is operational and ready for development.
Objective: To allow users to create accounts and log in securely
- β Authentication System: Registration, login, JWT security, MFA TOTP
- β Profile Management: Creation and modification of user profiles with entitlement-based masking
- β End-to-End Documentation: Consolidated OpenAPI specs and UX guides for a full onboarding path
Result: Users can create secure accounts, activate their profile and prepare for MFA enrolment.
Objective: To allow the creation and execution of trading strategies
- β Strategy Engine: Persistent catalogue, declarative import and backtesting API
- β Visual Strategy Designer: Drag-and-drop interface for strategy creation
- β AI Strategy Assistant: OpenAI-powered strategy generation from natural language
- β Market Connectors: Sandbox adapters for Binance/IBKR with shared limits
- β Order Management: Persistence and execution history implementation
Objective: To provide tools for performance analysis and tracking
- β Reports Service: Performance metrics calculations, API and unit tests
- β Notifications Service: Multi-channel dispatcher with Slack, email, Telegram, SMS support
- β Web Dashboard: React components, streaming integration and metrics display
- β Observability Infrastructure: Prometheus/Grafana configuration and FastAPI dashboard
Objective: To create a community-driven ecosystem for strategy sharing
- π Strategy Marketplace: Listings API with Stripe Connect integration
- π Copy Trading: Subscription-based strategy following
- π Community Features: Strategy ratings, reviews, and social features
- Lines of Code: 25,000+ (Python, JavaScript, TypeScript)
- Number of Services: 22 microservices
- Number of Commits: 200+
- Number of Tests: 150+ test files
- Contributors: 3+ active developers
A complete technical review of the repository was conducted in November 2025. The project has evolved significantly with the addition of visual strategy creation tools, AI assistance, and comprehensive monitoring capabilities.
- Key achievements: Visual Strategy Designer, AI-powered strategy generation, comprehensive dashboard, multi-channel notifications
- Current focus: Marketplace beta launch, advanced analytics, community features
- Next priorities: Mobile app, advanced risk management, institutional features
Find the detailed review, roadmap and backlog in:
docs/reports/2025-11-code-review.mddocs/project-evaluation.mddocs/tasks/2025-q4-backlog.mddocs/release-highlights/2025-12.md
-
Marketplace Launch
- Complete Stripe Connect integration
- Launch beta marketplace with selected strategy creators
- Implement copy trading subscriptions
-
Advanced Analytics
- Enhanced risk metrics and portfolio analytics
- Performance attribution analysis
- Advanced backtesting features
-
Mobile Experience
- Responsive web design improvements
- Progressive Web App (PWA) features
- Mobile-optimized trading interface
-
Institutional Features
- Multi-user accounts and permissions
- Advanced compliance and reporting
- Institutional-grade risk management
-
Advanced AI Features
- Strategy optimization recommendations
- Market regime detection
- Automated risk adjustment
-
Ecosystem Expansion
- Additional exchange integrations
- Third-party plugin system
- API marketplace for developers
We welcome all contributions! Whether you are:
- Experienced Trader: Share your strategies and expertise
- Developer: Improve the code and add new features
- Tester: Help us identify and fix bugs
- Designer: Improve the user experience
- Consult the open issues
- Read the contribution guide in
CONTRIBUTING.md - Create a branch for your contribution
- Submit a pull request with your improvements
- GitHub Issues: To report bugs or suggest features
- Discussions: To interact with the community
- Documentation: Complete guide in the
docs/folder
This project is licensed under the MIT License - see the LICENSE file for more details.
Developed with β€οΈ by decarvalhoe and the open-source community Last updated: December 2025