A sophisticated, enterprise-grade cryptocurrency trading bot platform built with C# and .NET 8. CryptoBot provides automated trading capabilities across multiple exchanges with advanced technical indicators, risk management, and real-time market analysis.
- Multi-Exchange Support: Coinbase Pro (formerly GDAX), Bittrex, and extensible architecture for additional exchanges
- Advanced Technical Indicators: MACD, RSI, and custom indicator implementations
- Automated Trading Strategies: Configurable bot strategies with buy/sell rules
- Risk Management: Built-in safety engine with stop-loss and position sizing controls
- Real-time Market Data: WebSocket connections for live price feeds
- Backtesting Framework: Historical strategy testing and performance analysis
- REST API: Full-featured API for bot management and trading operations
- Web Dashboard: Angular-based real-time trading interface
- Database Integration: Entity Framework Core with SQL Server support
- Messaging Integration: Telegram and other messaging app notifications
- Scheduling System: Configurable time-based trading operations
- Comprehensive Logging: Structured logging with NLog
CryptoBot follows a clean, modular architecture with clear separation of concerns:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CryptoBot.UI β
β (Angular Web Dashboard) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
β CryptoBot.Api β
β (ASP.NET Core REST API) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
β CryptoBot.Core β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Trading β β Ordering β β Scheduling β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Bots β βIntegrations β β Messaging β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββ¬ββββββββΌββββββββ¬ββββββββββββββββββ¬ββββββββββ
β ExchangeEngine β Model β Database β IndicatorEngine β SafetyEngine β
β (API Layer) β(Domain)β (EF Core) β (Technical) β (Risk Mgmt) β
βββββββββββββββββββ΄ββββββββ΄ββββββββ΄ββββββββββββββββββ΄ββββββββββ
- CryptoBot.Core: Business logic, trading strategies, and bot orchestration
- CryptoBot.Api: REST API endpoints and controllers
- CryptoBot.UI: Angular web application for dashboard and management
- CryptoBot.Model: Domain models and shared entities
- CryptoBot.Database: Entity Framework Core data layer and migrations
- CryptoBot.ExchangeEngine: Exchange connectivity and API abstraction
- CryptoBot.IndicatorEngine: Technical analysis indicators (MACD, RSI, etc.)
- CryptoBot.SafetyEngine: Risk management and safety controls
- CryptoBot.BackTester: Strategy backtesting and performance analysis
- CryptoBot.Console: Console application for bot execution
- CryptoBot.Tests: Comprehensive unit and integration test suite
- .NET 8: Modern, high-performance runtime
- Entity Framework Core 8: Object-relational mapping and database operations
- ASP.NET Core 8: Web API framework
- Angular 4.3.1: Frontend web application
- SQL Server: Primary database storage
- WebSockets: Real-time market data streaming
- NLog: Structured application logging
- AutoMapper: Object-to-object mapping
- Moq: Unit testing framework for mocking
- MSTest: Microsoft testing framework
- .NET 8 SDK
- SQL Server (LocalDB or full instance)
- Node.js and npm (for UI development)
- Git
-
Clone the repository:
git clone https://github.com/TonyCasey/cryptobot.git cd cryptobot -
Restore dependencies:
dotnet restore CryptoBot.sln
-
Build the solution:
dotnet build CryptoBot.sln -c Release
-
Setup the database:
# Update connection string in appsettings.json dotnet ef database update --project CryptoBot.Database -
Install UI dependencies:
cd CryptoBot.UI npm install npm run build
API Server:
dotnet run --project CryptoBot.ApiWeb Dashboard:
cd CryptoBot.UI
npm run start
# Access at http://localhost:3003Console Application:
dotnet run --project CryptoBot.ConsoleCryptoBot maintains a comprehensive test suite with 100% passing rate (19/19 tests):
# Run all tests
dotnet test CryptoBot.Tests\CryptoBot.Tests.csproj
# Run with detailed output
dotnet test CryptoBot.Tests\CryptoBot.Tests.csproj --logger:"console;verbosity=detailed"- Unit tests for all core components
- Integration tests for exchange connectivity
- Mocked external dependencies for reliable testing
- Performance and load testing for critical paths
| Exchange | Status | Features |
|---|---|---|
| Coinbase Pro | β Active | REST API, WebSocket, Live Trading |
| Bittrex | β Active | REST API, Live Trading |
| Custom Exchange | π§ Extensible | Implement IExchangeApi interface |
- MACD Crossover: Moving Average Convergence Divergence signals
- RSI Oscillator: Relative Strength Index overbought/oversold
- Custom Indicators: Extensible framework for additional indicators
{
"name": "MACD Strategy",
"indicators": [
{
"type": "MACD",
"buyRules": [
{"type": "IsMacdAboveSignal"},
{"type": "IsHistogramAboveMinimumHeight", "value": 30}
],
"sellRules": [
{"type": "IsCrossingDown"}
]
}
],
"safety": {
"stopLoss": true,
"maxPositionSize": 1000
}
}{
"exchanges": {
"coinbasePro": {
"apiUrl": "https://api.exchange.coinbase.com",
"websocketUrl": "wss://ws-feed.exchange.coinbase.com",
"apiKey": "your-api-key",
"secret": "your-secret",
"passphrase": "your-passphrase",
"sandbox": false
}
}
}{
"connectionStrings": {
"defaultConnection": "Server=(localdb)\\mssqllocaldb;Database=CryptoBot;Trusted_Connection=true;MultipleActiveResultSets=true"
}
}- Real-time Processing: Sub-millisecond order execution
- Scalable Architecture: Supports multiple concurrent trading bots
- Memory Efficient: Optimized for long-running operations
- High Availability: Robust error handling and recovery
- API Key Management: Secure credential storage
- Rate Limiting: Exchange API rate limit compliance
- Audit Logging: Complete trade and operation history
- Sandbox Support: Safe testing environment
CryptoBot includes full Docker containerization support:
# Build and run with Docker Compose
docker-compose up -d
# Development environment
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up- API Documentation: Swagger/OpenAPI available at
/swagger - Architecture Guide: See
CLAUDE.mdfor detailed technical information - Strategy Development: Custom indicator and strategy creation guides
- Deployment Guide: Production deployment best practices
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow C# coding conventions
- Maintain test coverage above 90%
- Update documentation for new features
- Run
dotnet testbefore submitting PRs
- β Complete .NET 8 Migration: Upgraded from .NET Framework
- β Test Suite Excellence: Achieved 100% test pass rate (19/19)
- β API Modernization: Updated deprecated GDAX to Coinbase Pro APIs
- β Zero Build Warnings: Clean compilation across all projects
- β Enhanced Docker Support: Full containerization with multi-stage builds
- β Modern EF Core: Upgraded from Entity Framework 6 to EF Core 8
This software is for educational and research purposes only. Cryptocurrency trading involves substantial risk of loss. The authors and contributors are not responsible for any financial losses incurred through the use of this software. Always conduct thorough testing in sandbox environments before risking real capital.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with β€οΈ using .NET 8 and modern C# practices
- Technical analysis powered by custom indicator implementations
- Exchange connectivity via official APIs
- Community contributions and feedback
β Star this repository if you find it useful!
For questions, issues, or feature requests, please open an issue.