Close your eyes and let AutoSomnia trade for you.
An AI-powered Web3 trading bot that manages your cryptocurrency portfolio while you sleep.
AutoSomnia is a comprehensive Web3 trading automation platform that combines AI-powered market analysis with seamless account management. Built for the Somnia blockchain ecosystem, it provides users with intelligent trading suggestions and automated portfolio management through an intuitive Telegram bot interface.
https://gamma.app/docs/AutoSomnia-x3lbsffz3yuwgkn
- ๐ค AI-Powered Trading Suggestions: Leverages Google Gemini AI for intelligent market analysis
- ๐ผ Web3 Account Management: Create, import, and manage EVM-compatible wallets
- ๐ธ Automated Transactions: Send SOMI and ERC-20 tokens with MAX amount support
- ๐ Real-time Market Data: Integration with CoinGecko API for live price feeds
- ๐ Secure Storage: MongoDB-based account management with encrypted private keys
- ๐ฑ Telegram Interface: User-friendly bot commands for all operations
- ๐ Web Interface: Web panel for more advanced portfolio management
- ๐ Translation Ready: Multi-language support with translation files ready
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Telegram Bot โโโโโโ FastAPI App โโโโโโ Blockchain โ
โ โ โ โ โ โ
โ โข User Commands โ โ โข REST API โ โ โข Somnia โ
โ โข AI Responses โ โ โข Account Mgmt โ โ โข EVM Chains โ
โ โข Notifications โ โ โข Transactions โ โ โข Smart Contractsโ
โโโโโโโโโโโโโโโโโโโ โ โข Gateway โ โโโโโโโโโโโโโโโโโโโโ
โ โข AI Settings โ โ
โโโโโโโโโโโโโโโโโโโ โ โข Data Export โ โ
โ Web UI โโโโโโ โข Tasks โ โ
โ โ โโโโโโโโโโโโโโโโโโโ โ
โ โข Dashboard โ โ โ
โ โข Portfolio โ โโโโโโโโโโโโโโโโโโโ โ
โ โข Trading โ โ Database โ โ
โโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโ
โ โข MongoDB โ
โโโโโโโโโโโโโโโโโโโ โ โข User Accounts โ
โ Plugins โโโโโโ โข Transaction โ
โ โ โ History โ
โ โข Magento โ โโโโโโโโโโโโโโโโโโโ
โ โข WooCommerce โ
โ โข E-commerce โ
โโโโโโโโโโโโโโโโโโโ
Backend:
- FastAPI - High-performance async web framework
- Web3.py - Ethereum blockchain interaction
- MongoDB - Document database for account storage
- Pydantic - Data validation and serialization
AI & External APIs:
- Amazon Bedrock AI - Advanced language models for trading analysis
- CoinGecko API - Real-time cryptocurrency market data
- Telegram Bot API - User interface and notifications
Blockchain:
- Somnia Network - Primary blockchain integration
- EVM Compatibility - Support for Ethereum-based chains
- Web3 Standards - ERC-20 tokens, standard transactions
/new_account - Create a new Web3 wallet
/account_info - View your account details and balances
/withdraw_funds <to> - Send all SOMI to specified address
/withdraw_funds <to> <token> - Send all tokens to address
/suggest_exchange - Get AI-powered trading recommendations
/buy_usd <amount> - Manually buy USDT
/sell_usd <amount> - Manually sell USDT
/auto_exchange_on - Enable automated trading
/auto_exchange_off - Disable automated trading
/start - Welcome message and bot introduction
/help - Show available commands
- Python 3.9+
- MongoDB instance
- Telegram Bot Token
- AWS Access Key and Secret for Amazon Bedrock
- CoinGecko API Key
git clone https://github.com/nickyharpor/AutoSomnia.git
cd AutoSomniapip install -r requirements.txtCopy .env.example to .env in the root directory and fill in the values.
Start the FastAPI Backend:
python app/main.pyStart the Telegram Bot:
cd bot
python bot.py- Find your bot on Telegram
- Send
/startto begin - Use
/new_accountto create your first wallet - Try
/suggest_exchangefor AI trading advice
The FastAPI backend provides comprehensive REST endpoints:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Account Management:
POST /account/create- Create new Web3 accountGET /account/balance/{address}- Get ETH balanceGET /account/portfolio/{address}- Get complete portfolioPOST /account/send-eth- Send ETH transactionsPOST /account/send-token- Send ERC-20 tokensDELETE /account/remove/{address}- Remove single accountDELETE /account/remove-user/{user_id}- Remove user and all their accounts
Exchange Operations:
GET /exchange/weth-address- Get WETH token addressGET /exchange/factory-address- Get factory contract addressPOST /exchange/quote- Get quote for token pairsPOST /exchange/amounts-out- Calculate swap outputsPOST /exchange/swap-exact-tokens-for-tokens- Execute token swaps
Exchange Operations:
GET /exchange/amounts-out- Calculate swap outputsGET /exhange/quote- Get quote for token pairsPOST /exchange/swap-exact-tokens-for-tokens- Execute token swapsPOST /exchange/swap-exact-eth-for-tokens- Execute SOMA to token swapsPOST /exchange/swap-exact-tokens-for-eth- Execute token to SOMA swaps
Health & Monitoring:
GET /health- Application health checkGET /account/health- Account service status monitoringGET /exchange/health- Exchange service status monitoring
AutoSomnia's AI system analyzes multiple market factors:
- Real-time Prices - Live cryptocurrency prices from CoinGecko
- Market Trends - 24-hour price changes and volume data
- Technical Indicators - Price momentum and volatility analysis
- Market Sentiment - Evaluates current market conditions
- Risk Assessment - Considers volatility and market risks
- Timing Recommendations - Suggests optimal entry/exit points
- Portfolio Balance - Advises on asset allocation strategies
The AI provides actionable recommendations:
- Buy Signals - When to acquire specific assets
- Sell Signals - When to take profits or cut losses
- Hold Advice - When to maintain current positions
- Risk Warnings - Alerts about high-risk market conditions
- Encrypted Storage - Private keys stored securely in MongoDB
- Mnemonic Generation - BIP-39 compliant seed phrases
- Address Validation - Comprehensive input validation
- Transaction Verification - Multi-layer transaction checks
- Request Validation - Pydantic models for all inputs
- Error Handling - Secure error responses without data leakage
- Rate Limiting - Protection against API abuse
- CORS Configuration - Controlled cross-origin access
- Never store private keys in logs
- Validate all blockchain addresses
- Implement proper error handling
- Use secure random number generation
- AI-Driven Trading - First Web3 bot with integrated AI market analysis
- Seamless UX - Complex blockchain operations simplified to chat commands
- Multi-Chain Ready - Built for Somnia with broader EVM compatibility
- Production Ready - Comprehensive error handling and security measures
- Modern Architecture - Async FastAPI with proper separation of concerns
- Robust Database - MongoDB with optimized queries and indexing
- Comprehensive API - Full REST API with interactive documentation
- Quality Code - Type hints, validation, and extensive error handling
- Accessibility - Makes DeFi accessible to non-technical users
- Automation - Reduces manual trading effort and human error
- Education - Teaches users about market dynamics through AI insights
- Community - Telegram-based interface encourages user engagement
- Advanced portfolio analytics
- Copy trading
- Custom trading strategies
- Enhanced security features
- Multi-chain support (Polygon, BSC, Arbitrum)
- DeFi protocol integrations
- Social trading features
- Team account management
- Advanced analytics dashboard
- API for third-party integrations
- White-label solutions
We welcome contributions from the community! Here's how you can help:
- Use GitHub Issues to report bugs
- Include detailed reproduction steps
- Provide environment information
- Suggest new features via GitHub Issues
- Explain the use case and benefits
- Consider implementation complexity
# Fork the repository
git clone https://github.com/nickyharpor/AutoSomnia.git
# Create a feature branch
git checkout -b feature/amazing-feature
# Make sure all tests pass
pytest -s -v
# Make your changes and commit
git commit -m "Add amazing feature"
# Push to your fork and create a Pull Request
git push origin feature/amazing-feature- Issues: Bug Reports & Feature Requests
