{"id":29803383,"url":"https://github.com/amirphl/cipher-trader","last_synced_at":"2025-09-12T03:41:39.678Z","repository":{"id":283735196,"uuid":"939415549","full_name":"amirphl/cipher-trader","owner":"amirphl","description":"Trading bot","archived":false,"fork":false,"pushed_at":"2025-06-29T21:33:29.000Z","size":1067,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T11:41:20.373Z","etag":null,"topics":["algorithmic-trading","algorithmic-trading-engine","crypto-bot","crypto-trading","cryptocurrency","finance","forex","forex-trading","trade-bot","trading","trading-algorithms","trading-platform","trading-software","trading-strategies","trading-strategy","trading-systems","tradingbot"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amirphl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-26T14:03:38.000Z","updated_at":"2025-07-15T16:02:11.000Z","dependencies_parsed_at":"2025-04-05T08:22:35.452Z","dependency_job_id":"4b729635-3e84-4e9a-8591-8cbf671168a4","html_url":"https://github.com/amirphl/cipher-trader","commit_stats":null,"previous_names":["amirphl/ciphertrader","amirphl/cipher-trader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amirphl/cipher-trader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirphl%2Fcipher-trader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirphl%2Fcipher-trader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirphl%2Fcipher-trader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirphl%2Fcipher-trader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amirphl","download_url":"https://codeload.github.com/amirphl/cipher-trader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirphl%2Fcipher-trader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274748791,"owners_count":25342005,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithmic-trading","algorithmic-trading-engine","crypto-bot","crypto-trading","cryptocurrency","finance","forex","forex-trading","trade-bot","trading","trading-algorithms","trading-platform","trading-software","trading-strategies","trading-strategy","trading-systems","tradingbot"],"created_at":"2025-07-28T11:07:22.496Z","updated_at":"2025-09-12T03:41:39.642Z","avatar_url":"https://github.com/amirphl.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 CipherTrader\n\n**A High-Performance C++ Trading Framework for Cryptocurrency Markets**\n\n[![C++17](https://img.shields.io/badge/C++-17-blue.svg)](https://isocpp.org/std/the-standard)\n[![CMake](https://img.shields.io/badge/CMake-3.20+-green.svg)](https://cmake.org/)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![Build Status](https://img.shields.io/badge/Build-Passing-brightgreen.svg)]()\n\n---\n\n## 🎯 Overview\n\nCipherTrader is a sophisticated, high-performance trading framework built in modern C++ that provides institutional-grade tools for cryptocurrency trading. Designed for speed, reliability, and scalability, it offers comprehensive state management, real-time data processing, and advanced trading capabilities.\n\n### ✨ Key Features\n\n- **🚀 High-Performance Engine**: Built with modern C++17 for maximum speed and efficiency\n- **📊 Comprehensive State Management**: Advanced state tracking for orders, positions, trades, and orderbooks\n- **🗄️ Robust Database Layer**: PostgreSQL integration with SQLPP11 for type-safe database operations\n- **💾 Intelligent Caching**: Multi-level caching system with Cereal serialization for optimal performance\n- **🔐 Secure Authentication**: Built-in authentication system with token-based security\n- **📈 Real-Time Data Processing**: WebSocket support for live market data streaming\n- **🔄 Arbitrage Capabilities**: Triangular arbitrage detection and execution\n- **🧪 Sandbox Environment**: Complete testing and simulation environment\n- **📋 Advanced Order Management**: Support for market, limit, and stop orders with partial fills\n- **⚡ Multi-Exchange Support**: Unified interface for multiple cryptocurrency exchanges\n\n\u003e ⚠️ Development Status: This project is currently under active development and is NOT STABLE for production use. APIs may change without notice, and features may be incomplete or experimental. Use at your own risk.\n\n---\n\n## ��️ Architecture\n\n### Core Components\n\n```\nCipherTrader/\n├── �� State Management\n│   ├── OrdersState      # Order lifecycle management\n│   ├── PositionsState   # Position tracking and calculations\n│   ├── TradesState      # Trade aggregation and analysis\n│   ├── OrderbooksState  # Real-time orderbook processing\n│   └── ClosedTradesState # Historical trade analysis\n├── 🗄️ Database Layer\n│   ├── PostgreSQL Integration\n│   ├── Type-safe SQLPP11 queries\n│   └── Advanced filtering and caching\n├── �� Trading Engine\n│   ├── Broker implementation\n│   ├── Exchange adapters\n│   └── Arbitrage detection\n└── 🛠️ Infrastructure\n    ├── Authentication system\n    ├── Configuration management\n    └── Logging and monitoring\n```\n\n---\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- **C++17** compatible compiler (Clang recommended)\n- **CMake 3.20+**\n- **PostgreSQL 12+**\n- **Boost Libraries**\n- **Blaze Math Library**\n\n### Installation\n\n#### 1. Clone the Repository\n```bash\ngit clone https://github.com/your-username/cipherTrader.git\ncd cipherTrader\n```\n\n#### 2. Install Dependencies\n\n**Ubuntu/Debian:**\n```bash\nsudo apt update\nsudo apt install build-essential cmake libboost-all-dev \\\n    libpq-dev libssl-dev libz-dev libgtest-dev \\\n    libspdlog-dev libyaml-cpp-dev libhiredis-dev \\\n    libblaze-dev nlohmann-json3-dev\n```\n\n**macOS:**\n```bash\nbrew install cmake boost postgresql openssl zlib \\\n    googletest spdlog yaml-cpp hiredis nlohmann-json\n```\n\n#### 3. Build the Project\n```bash\nmkdir build \u0026\u0026 cd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\nmake -j$(nproc)\n```\n\n#### 4. Run Tests\n```bash\nmake test\n```\n\n---\n\n## 📖 Usage Examples\n\n### Basic Trading Strategy\n\n```cpp\n#include \"CipherTrader.hpp\"\n\nclass MyStrategy : public ct::helper::Strategy {\npublic:\n    void execute() override {\n        // Get current market data\n        auto orderbook = ct::orderbook::OrderbooksState::getInstance()\n            .getOrderbook(ct::enums::ExchangeName::BINANCE_SPOT, \"BTC/USDT\");\n        \n        // Place a limit order\n        auto order = std::make_shared\u003cct::db::Order\u003e();\n        order-\u003esetSymbol(\"BTC/USDT\");\n        order-\u003esetOrderSide(ct::enums::OrderSide::BUY);\n        order-\u003esetOrderType(ct::enums::OrderType::LIMIT);\n        order-\u003esetQty(0.001);\n        order-\u003esetPrice(50000.0);\n        \n        // Submit order\n        ct::order::OrdersState::getInstance().addOrder(order);\n    }\n};\n```\n\n### Arbitrage Detection\n\n```cpp\n#include \"ArbitrageBot.hpp\"\n\n// Configure arbitrage bot\nBotConfig config;\nconfig.useTestNet = true;\nconfig.accessToken = \"your_token\";\nconfig.symbolB = \"USDT\";\nconfig.symbolC = \"ETH\";\nconfig.tradeAmountA = 0.001;\n\n// Create and run bot\nArbitrageBot bot(config);\nbot.start();\n\n// Monitor for arbitrage opportunities\nwhile (bot.isRunning()) {\n    auto profit = bot.calculateArbitrageProfit();\n    if (profit \u003e 0.001) { // 0.1% minimum profit\n        bot.executeArbitrage();\n    }\n    std::this_thread::sleep_for(std::chrono::milliseconds(100));\n}\n```\n\n### Database Operations\n\n```cpp\n#include \"DB.hpp\"\n\n// Create a new order\nauto order = std::make_shared\u003cct::db::Order\u003e();\norder-\u003esetSymbol(\"BTC/USDT\");\norder-\u003esetExchangeName(ct::enums::ExchangeName::BINANCE_SPOT);\norder-\u003esetOrderSide(ct::enums::OrderSide::BUY);\norder-\u003esetQty(0.001);\norder-\u003esetPrice(50000.0);\n\n// Save to database\norder-\u003esave();\n\n// Query orders with filters\nauto filter = ct::db::Order::Filter()\n    .withSymbol(\"BTC/USDT\")\n    .withExchangeName(ct::enums::ExchangeName::BINANCE_SPOT);\n\nauto orders = ct::db::Order::findByFilter(nullptr, filter);\n```\n\n---\n\n## �� Configuration\n\n### Environment Variables\n\n```bash\n# Database Configuration\nDB_HOST=localhost\nDB_PORT=5432\nDB_NAME=ciphertrader\nDB_USER=trader\nDB_PASSWORD=secure_password\n\n# Exchange API Keys\nBINANCE_API_KEY=your_binance_key\nBINANCE_SECRET_KEY=your_binance_secret\n\n# Trading Configuration\nTRADING_MODE=live  # or 'sandbox'\nMAX_LEVERAGE=10\nRISK_PERCENTAGE=2.0\n```\n\n### Configuration File\n\n```yaml\n# config.yaml\napp:\n  trading_symbols: [\"BTC/USDT\", \"ETH/USDT\"]\n  trading_timeframes: [\"1m\", \"5m\", \"1h\"]\n  \nenv:\n  exchanges:\n    binance:\n      fee: 0.001\n      type: \"spot\"\n      balance: 10000.0\n      \n  data:\n    warmup_candles_num: 240\n    generate_candles_from_1m: false\n    persistency: true\n```\n\n---\n\n## 🧪 Testing\n\n### Run All Tests\n```bash\ncd build\nmake test\n```\n\n### Run Specific Test Suites\n```bash\n# Database tests\n./tests/DB_Test\n\n# Trading engine tests\n./tests/Trading_Test\n\n# Performance tests\n./tests/Performance_Test\n```\n\n### Sandbox Environment\n```bash\n# Start sandbox mode\n./cipherTrader --mode=sandbox --config=config.yaml\n\n# Run with specific strategy\n./cipherTrader --strategy=MyStrategy --backtest --start-date=2024-01-01\n```\n\n---\n\n## 📊 Performance\n\n### Benchmarks\n\n- **Order Processing**: 10,000+ orders/second\n- **Market Data**: 100,000+ ticks/second\n- **Database Operations**: 50,000+ queries/second\n- **Memory Usage**: \u003c 100MB for typical trading operations\n\n### Optimization Features\n\n- **Precompiled Headers**: Faster compilation times\n- **Link-Time Optimization**: Smaller, faster binaries\n- **SIMD Operations**: Vectorized mathematical operations\n- **Lock-Free Data Structures**: Minimal contention in high-frequency scenarios\n\n---\n\n## 🔒 Security\n\n### Authentication\n- Token-based authentication system\n- Secure API key management\n- Encrypted configuration storage\n\n### Risk Management\n- Position size limits\n- Maximum drawdown protection\n- Real-time risk monitoring\n- Automatic stop-loss mechanisms\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n### Development Setup\n```bash\n# Install development dependencies\nsudo apt install clang-format clang-tidy cppcheck\n\n# Format code\nmake format\n\n# Run static analysis\nmake analyze\n\n# Run all checks\nmake check\n```\n\n---\n\n## �� Documentation\n\n- [API Reference](docs/API.md)\n- [Trading Strategies](docs/Strategies.md)\n- [Database Schema](docs/Database.md)\n- [Performance Guide](docs/Performance.md)\n- [Deployment Guide](docs/Deployment.md)\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## ⚠️ Disclaimer\n\n**Trading cryptocurrencies involves substantial risk of loss and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade cryptocurrencies, you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose.**\n\n---\n\n## 🆘 Support\n\n- **Documentation**: [docs.ciphertrader.com](https://docs.ciphertrader.com)\n- **Issues**: [GitHub Issues](https://github.com/your-username/cipherTrader/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/your-username/cipherTrader/discussions)\n- **Email**: support@ciphertrader.com\n\n---\n\n**Built with ❤️ by the CipherTrader Team**\n\n*Empowering traders with institutional-grade tools for the digital asset revolution.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirphl%2Fcipher-trader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famirphl%2Fcipher-trader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirphl%2Fcipher-trader/lists"}