This is infrastructure, not a trading bot.
MYCELIUM is a minimal, deterministic execution engine stripped down from Freqtrade. It provides the core infrastructure for order execution, position tracking, and PnL attribution, but contains no trading logic or signal generation.
- β A trading bot
- β A strategy framework
- β An indicator library (TA-Lib removed)
- β A machine learning system (FreqAI removed)
- β A retail trading platform (UI/API removed)
- β A hyperparameter optimizer (Hyperopt removed)
- β Order execution engine
- β Position tracking system
- β PnL attribution
- β Exchange abstraction layer (ccxt-based)
- β Backtesting/simulation framework (price replay)
- β Risk management primitives
- β Capital and state isolation
Pushbutton startup - get the platform running in seconds:
# Linux/Mac
./start.sh
# Windows
./start.ps1This single command will:
- β Check dependencies and install if needed
- β Start the demo UI server
- β Open the platform at http://127.0.0.1:5000
π Complete Local Development Guide - Full setup instructions, troubleshooting, and development workflow
Interactive demo with TWO modes:
# Quick start - just run this script
./start_demo.sh # Linux/Mac
./start_demo.ps1 # Windows
# Then open your browser to:
# http://127.0.0.1:5000Shows the complete money-making cycle step-by-step:
- Open Position β Deploy capital into a trade
- Market Movement β Price moves in your favor
- Close Position β Realize profit and get capital back with gains
π‘ Try the "Profitable Trade Cycle" scenario:
- Opens a 15% position (deploys $1,500)
- Closes with 8% profit (returns $1,500 + $120 profit)
- Your capital grows from $10,000 β $10,120
See the bot operate autonomously with realistic market simulation:
- β Continuous operation - Bot runs automatically without manual intervention
- β Realistic market data - Simulated price ticks mimicking real markets
- β Live decision-making - Watch the strategy analyze and execute in real-time
- β Multiple market conditions - Test in trending, volatile, ranging markets
- β Real performance metrics - See actual wins, losses, and P&L
Switch to Automated Mode in the UI and click "Start Auto" to see the platform do what it will do in live markets!
π Automated Demo Guide | π Full Demo UI Documentation | π Quick Start Guide
Easy integration with backtesting tools:
from freqtrade.ui.backtest_adapter import run_quick_backtest
# Run realistic automated simulation
results = run_quick_backtest(
market_condition="mixed",
num_ticks=1000,
initial_capital=10000.0
)
print(f"Final Capital: ${results['final_capital']:,.2f}")
print(f"Total Return: {results['total_return_pct']:+.2f}%")
print(f"Win Rate: {results['win_rate']:.2f}%")See examples/automated_backtest_example.py for complete examples.
NEW: Production-ready Streamlit dashboards for configuration and monitoring
Secure interface to manage config.prod.json with:
- π― Dynamic ExploitModule discovery - Auto-detect and select modules
- π Full CCXT exchange support - All CEX and DEX venues (Binance, Hyperliquid, etc.)
- π‘οΈ Risk limits configuration - Position sizes, exposure, stop losses
- π° Capital management - Set initial capital and stake currency
- π API credentials - Secure input for exchange keys
- π Password protection - Environment-based authentication
Run:
# Set password (optional but recommended)
export STREAMLIT_PASSWORD=your_secure_password
# Start configuration dashboard
streamlit run freqtrade/ui/prod_config.py
# Access at: http://localhost:8501Install dependencies:
pip install streamlit plotly pandasReal-time production monitoring with:
- π° Capital state overview - Available, deployed, total with PnL metrics
- π Open positions table - Live position tracking from database
- π Recent orders - Order history and status
- π Cumulative PnL chart - Visual profit/loss over time
- π Live logs - Tail of production log file
- π Auto-refresh - Updates every 10 seconds
Run:
# Start monitoring dashboard
streamlit run freqtrade/ui/prod_monitor.py
# Access at: http://localhost:8502Features:
- β No dependencies on running engine - Reads directly from SQLite DB
- β Production-safe - Read-only access to database and logs
- β CCXT agnostic - Works with any exchange
- β Module agnostic - Shows results regardless of ExploitModules used
Security Notes:
- π Set
STREAMLIT_PASSWORDenvironment variable for config dashboard - π« Do not expose dashboards to public internet without additional authentication
- π Use firewall rules to restrict access to localhost or trusted IPs
- π API credentials in config are masked in the UI
This system follows a strict Intent β Execution separation:
External System β ExploitModule β Action β Risk Check β Execution β Result
The engine NEVER decides when to trade β only HOW.
All trading decisions (WHEN to trade) come from external ExploitModules. The engine only executes explicit Actions and enforces risk limits.
risk.py- Risk management with hard boundsstate.py- Capital and state isolation
exploit_module.py- Base interfaceexample_exploit.py- Stub implementation
External systems (DSPy, MYCELIUM, etc.) implement ExploitModule to provide trading intent.
- Exchange abstraction (ccxt-based)
- Order placement and tracking
- Balance management
- Trade and Order models
- Database migrations
- Key-value store
- Deterministic price replay
- Result reporting
Over 40,000 lines of code deleted, including:
- β FreqAI - All ML/AI features
- β RPC/API/Telegram - All communication systems
- β Plotting - All visualization
- β Hyperopt - All optimization
- β Strategy Templates - All example strategies
- β TA-Lib - All technical indicators
- β Analysis Tools - Lookahead/recursive analysis
- β Web UI - All UI components
- β Documentation - 140+ markdown files
See FILES_DELETED.md for complete list.
Minimal dependencies only:
Core:
ccxt- Exchange connectivitySQLAlchemy- Persistencepandas/numpy- Data handlingrequests/aiohttp- Networking
Removed:
- TA-Lib, ft-pandas-ta, technical (indicators)
- python-telegram-bot (notifications)
- FastAPI, uvicorn, websockets (API/WebSocket)
- scipy, scikit-learn, optuna (ML/optimization)
- LightGBM, XGBoost, torch (ML models)
- plotly (plotting)
from freqtrade.exploits.exploit_module import (
ExploitModule,
ExecutionState,
Action,
ActionType,
)
class MyExploit(ExploitModule):
def evaluate(self, state: ExecutionState) -> list[Action]:
# Your logic here - connect to DSPy, MYCELIUM, etc.
if should_open_long(state):
return [Action(
type=ActionType.OPEN_LONG,
symbol=state.symbol,
size=0.1, # 10% of capital
reason="my_signal",
)]
return []
def on_execution_result(self, action: Action, result: ExecutionResult) -> None:
# Handle result - feed back to your system
pass{
"exploit_module": "my_module.MyExploit",
"max_open_trades": 3,
"max_position_size": 0.1,
"max_total_exposure": 0.95,
"exchange": {
"name": "binance",
"key": "...",
"secret": "..."
}
}freqtrade trade --config config.jsonThe engine will:
- Call your
evaluate()method with current state - Check Actions against risk limits
- Execute approved Actions
- Return results to your
on_execution_result()
- ARCHITECTURE.md - System architecture
- DEPENDENCIES.md - Dependency graph
- FILES_DELETED.md - What was removed
- REMAINING_WORK.md - What still needs work
- docs/dspy.md - DSPy LM-based insights for external analysis
Generate manual insights and parameter adjustment suggestions using a local LLM:
# Install dependencies
pip install dspy-ai ollama
# Run Ollama
ollama run llama3.2
# Generate insights from metrics
python analysis/dspy_insights.pyKey features:
- Uses local LLM (Ollama) for privacy and zero cost
- Analyzes deployed capital, PnL, Sharpe ratio, win rate
- Outputs manual adjustment suggestions
- External only - NO automatic application to engine
- Manual review required - suggestions are logged only
π Complete DSPy Setup Guide
The system can run with zero exploits loaded (NullExploitModule). It should do nothing - this proves execution is decoupled from decision-making.
# Engine with no exploits = no trades
engine = ExecutionEngine(NullExploitModule())
engine.run() # Does nothing# 1. ExploitModule proposes action
action = Action(
type=ActionType.OPEN_LONG,
symbol="BTC/USDT",
size=0.1,
reason="external_signal"
)
# 2. Engine checks risk
allowed, reason = risk_manager.check_action(action, state)
# 3. If allowed, execute
if allowed:
result = engine.execute(action)
# 4. Result returned to exploit
exploit.on_execution_result(action, result)DSPy β ExploitModule.evaluate() β Actions β Engine β Results β DSPy
Each micro-exploit implements ExploitModule independently. Capital is explicitly managed, no hidden coupling.
Risk limits are enforced before execution:
RiskLimits(
max_position_size=0.10, # Max 10% per position
max_total_exposure=0.95, # Max 95% deployed
max_open_positions=3, # Max 3 simultaneous
max_daily_loss=0.20, # Max 20% daily loss
position_cooldown=0, # Cooldown in seconds
)All risk is config-driven, not code-driven.
All capital is explicitly tracked:
CapitalState(
total_capital=10000.0,
available_capital=9000.0, # Available for new positions
deployed_capital=1000.0, # Currently in positions
reserved_capital=0.0, # Reserved for fees/margin
pnl_realized=0.0,
pnl_unrealized=0.0,
)No global mutable state - everything is explicit.
This was derived from Freqtrade.
Original purpose: Retail crypto trading bot with strategies, indicators, optimization.
New purpose: Infrastructure for building custom execution systems.
GPLv3 (inherited from Freqtrade)
This software is for educational purposes only. Do not risk money you cannot afford to lose. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.
Please make sure to read the exchange specific notes, as well as the trading with leverage documentation before diving in.
Exchanges confirmed working by the community:
Single-container setup with demo UI, configuration dashboard, and monitoring dashboard.
# Clone repository
git clone https://github.com/rkendel1/freq.git
cd freq
# Start everything with Docker Compose
docker compose -f docker-compose.dev.yml up
# Or build and start in one command
docker compose -f docker-compose.dev.yml up --buildThat's it! After a few moments, you'll have:
- Demo UI: http://localhost:5000 - Interactive execution engine demo
- Configuration Dashboard: http://localhost:8501 - Manage configs, ExploitModules, exchanges
- Monitoring Dashboard: http://localhost:8502 - Real-time position tracking, PnL, logs
β
Auto-initialization - Directories, config, and database created automatically
β
No manual setup - Everything configured out-of-the-box
β
Persistent data - Volume-mounted user_data/ directory
β
Multi-process - All services running via supervisor
β
QuestDB-ready - Prepared for time-series metrics (optional)
Set these in docker/.env or pass via -e:
# Security (RECOMMENDED)
STREAMLIT_PASSWORD=your_secure_password
# Configuration
DRY_RUN=true # Safe mode (default)
INITIAL_CAPITAL=10000.0 # Starting capital
EXCHANGE_NAME=binance # Any CCXT exchange
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERRORMount your custom modules:
# In docker-compose.dev.yml, add volume:
volumes:
- ./user_data:/freqtrade/user_data
- ./my_exploits:/freqtrade/custom_exploits:roOr copy them to user_data/exploits/ - they'll be auto-discovered by the config dashboard.
# Start services
docker compose -f docker-compose.dev.yml up
# Start in background
docker compose -f docker-compose.dev.yml up -d
# View logs
docker compose -f docker-compose.dev.yml logs -f
# Stop services
docker compose -f docker-compose.dev.yml down
# Rebuild after code changes
docker compose -f docker-compose.dev.yml up --build
# Access shell in container
docker compose -f docker-compose.dev.yml exec freqtrade-dev /bin/bashAll data is stored in ./user_data/:
config.prod.json- Configurationtradesv3.sqlite- Trade databaselogs/- Application logsexploits/- Custom ExploitModulesstrategies/- Custom strategies (if using)
The directory is created automatically on first run with sensible defaults.
Q: Port already in use?
Change ports in docker-compose.dev.yml under the ports: section.
Q: How to enable QuestDB?
Uncomment the questdb service in docker-compose.dev.yml.
Q: Services not starting?
Check logs: docker compose -f docker-compose.dev.yml logs
Q: Need to run a single service?
See supervisor logs inside container: docker compose -f docker-compose.dev.yml exec freqtrade-dev tail -f /var/log/supervisor/*.log
For active development, mount source code:
volumes:
- ./user_data:/freqtrade/user_data
- ./freqtrade:/freqtrade/freqtrade:ro # Read-only source mountThen use docker compose restart to pick up changes.
π More details: See docker/README.md for advanced Docker usage.
Deploy the entire Docker environment to the cloud with persistent storage and automatic scaling.
If deployment fails with "No open ports detected" error, your service is misconfigured as Python instead of Docker.
Quick Fix: See RENDER_FIX.md for step-by-step instructions to fix this immediately.
Or deploy manually:
-
Fork this repository to your GitHub account
-
Create Blueprint on Render:
- Go to Render Dashboard
- Click "New" β "Blueprint"
- Connect your GitHub repo
- Render auto-detects
render.yaml β οΈ CRITICAL: This creates the service as Docker (not Python)
-
Configure & Deploy:
- Set
STREAMLIT_PASSWORDfor security - Review other environment variables
- Click "Apply" to deploy
- Set
-
Access Your App:
- Find your URL:
https://your-app.onrender.com - All dashboards accessible through this URL
- Find your URL:
Note: If you create the service manually instead of using Blueprint, you MUST select "Docker" as the environment type, not "Python".
β
Auto-deployed Docker container - Same environment as local
β
Persistent disk - 1GB storage for database, configs, logs
β
Automatic SSL/HTTPS - Secure by default
β
Health monitoring - Auto-restart on failures
β
Zero-downtime deploys - Updates without interruption
β
Free tier available - Start for $0, scale as needed
- Free Tier: $0/month (512MB RAM, sleeps after 15min inactivity)
- Starter: $7/month (2GB RAM, always on, recommended)
- Standard: $25/month (4GB RAM, production-ready)
- Disk: $0.25/GB/month (1GB recommended)
Recommended: Starter + 1GB disk = $7.25/month total
Set these in Render dashboard under "Environment":
# Security (REQUIRED)
STREAMLIT_PASSWORD=your_secure_password_here
# Core Settings
DRY_RUN=true # Keep true for testing
INITIAL_CAPITAL=10000.0 # Starting capital
EXCHANGE_NAME=binance # Any CCXT exchange
LOG_LEVEL=INFO # Logging levelFor live trading (be careful!):
DRY_RUN=false
EXCHANGE_API_KEY=your_key
EXCHANGE_API_SECRET=your_secret- Auto-deploy on Git push - Changes go live automatically
- Persistent data - Trades, configs, logs survive restarts
- Health checks -
/healthendpoint monitored - Live logs - Stream logs in Render dashboard
- Shell access - Debug via Render shell
- Custom domains - Use your own domain
π Complete Render Deployment Guide - Detailed setup, troubleshooting, and best practices
# Trading
freqtrade trade --config config.prod.json # Run trading engine
# Configuration
freqtrade create-userdir --userdir user_data # Create user directory structure
freqtrade new-config --config config.json # Interactive config generator
freqtrade show-config --config config.json # Display resolved configuration
# Data Management
freqtrade download-data --exchange binance --pairs BTC/USDT ETH/USDT
freqtrade list-data --datadir user_data/data
freqtrade convert-data --format-from json --format-to feather
# Exchange Information
freqtrade list-exchanges # Show supported exchanges
freqtrade list-markets --exchange binance # Show available markets
freqtrade list-pairs --exchange binance # Show tradable pairs
freqtrade list-timeframes --exchange binance # Show available timeframes
# Database
freqtrade show-trades --db-url sqlite:///tradesv3.sqlite
freqtrade convert-db --from-url sqlite:///old.db --to-url sqlite:///new.db
# Backtesting (Price Replay Only)
freqtrade backtesting --config config.json --strategy-path exploits/
freqtrade backtesting-show # Show backtest results
freqtrade backtesting-analysis # Analyze backtest resultsThese commands still appear in help but are removed and will fail:
- β
hyperopt/hyperopt-list/hyperopt-show- Optimization removed - β
list-hyperoptloss- Hyperopt removed - β
list-freqaimodels- FreqAI removed - β
install-ui- FreqUI removed (use Streamlit dashboards instead) - β
plot-dataframe/plot-profit- Plotting removed - β
webserver- API server removed - β
test-pairlist- Pairlist testing removed - β
lookahead-analysis/recursive-analysis- Analysis tools removed - β
edge- Edge module removed
Local Development:
./start.sh # Demo UI at http://localhost:5000Production Dashboards:
streamlit run freqtrade/ui/prod_config.py # Port 8501
streamlit run freqtrade/ui/prod_monitor.py # Port 8502Docker (All-in-One):
docker compose -f docker-compose.dev.yml up # All servicesThe project is currently setup in two main branches:
develop- This branch has often new features, but might also contain breaking changes. We try hard to keep this branch as stable as possible.stable- This branch contains the latest stable release. This branch is generally well tested.feat/*- These are feature branches, which are being worked on heavily. Please don't use these unless you want to test a specific feature.
For any questions not covered by the documentation or for further information about the bot, or to simply engage with like-minded individuals, we encourage you to join the Freqtrade discord server.
If you discover a bug in the bot, please search the issue tracker first. If it hasn't been reported, please create a new issue and ensure you follow the template guide so that the team can assist you as quickly as possible.
For every issue created, kindly follow up and mark satisfaction or reminder to close issue when equilibrium ground is reached.
--Maintain github's community policy--
Have you a great idea to improve the bot you want to share? Please, first search if this feature was not already discussed. If it hasn't been requested, please create a new request and ensure you follow the template guide so that it does not get lost in the bug reports.
Feel like the bot is missing a feature? We welcome your pull requests!
Please read the Contributing document to understand the requirements before sending your pull-requests.
Coding is not a necessity to contribute - maybe start with improving the documentation? Issues labeled good first issue can be good first contributions, and will help get you familiar with the codebase.
Note before starting any major new feature work, please open an issue describing what you are planning to do or talk to us on discord (please use the #dev channel for this). This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
Important: Always create your PR against the develop branch, not stable.
The clock must be accurate, synchronized to a NTP server very frequently to avoid problems with communication to the exchanges.
To run this bot we recommend you a cloud instance with a minimum of:
- Minimal (advised) system requirements: 2GB RAM, 1GB disk space, 2vCPU
- Python >= 3.11 (Python 3.13 supported)
- pip
- git
- TA-Lib
- virtualenv (Recommended)
- Docker (Recommended)


