
- Created Alembic migrations for SQLite database - Set up database initialization on app startup - Fixed linting issues with Ruff - Updated README with comprehensive documentation - Configured startup tasks and health checks
94 lines
2.6 KiB
Markdown
94 lines
2.6 KiB
Markdown
# Solana Arbitrage Trading System
|
|
|
|
A backend system for detecting and executing arbitrage opportunities on Solana DEXes.
|
|
|
|
## Overview
|
|
|
|
This FastAPI application provides a robust backend for:
|
|
|
|
1. Monitoring price differences between different Solana DEXes (currently Jupiter and Raydium)
|
|
2. Identifying profitable arbitrage opportunities based on configurable parameters
|
|
3. Optionally executing trades to capture these opportunities
|
|
4. Tracking performance metrics and historical trade data
|
|
|
|
## Features
|
|
|
|
- Real-time price monitoring across multiple DEXes
|
|
- Configurable profit thresholds and slippage tolerance
|
|
- Wallet integration for trade execution
|
|
- Historical opportunity and trade tracking
|
|
- Comprehensive API for monitoring and configuration
|
|
- SQLite database for persistent storage
|
|
|
|
## API Endpoints
|
|
|
|
### Base Endpoints
|
|
|
|
- `GET /` - Root endpoint with API information
|
|
- `GET /health` - Health check endpoint
|
|
- `GET /docs` - Swagger UI documentation
|
|
- `GET /redoc` - ReDoc documentation
|
|
|
|
### V1 API Endpoints
|
|
|
|
- `GET /api/v1/status` - System status and statistics
|
|
- `GET /api/v1/opportunities` - List arbitrage opportunities with filtering options
|
|
- `GET /api/v1/trades` - List historical trades with filtering options
|
|
|
|
## Environment Variables
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `SOLANA_RPC_URL` | Solana RPC endpoint URL | `https://api.mainnet-beta.solana.com` |
|
|
| `SOLANA_NETWORK` | Solana network to use (mainnet-beta, testnet, devnet) | `mainnet-beta` |
|
|
| `WALLET_KEYPAIR_PATH` | Path to wallet keypair JSON file | `None` |
|
|
| `PROFIT_THRESHOLD_PERCENT` | Minimum profit percentage to consider | `1.0` |
|
|
| `MAX_SLIPPAGE_PERCENT` | Maximum allowed slippage percentage | `0.5` |
|
|
| `EXECUTION_ENABLED` | Whether to execute trades or just monitor | `False` |
|
|
| `SCAN_INTERVAL_SECONDS` | How often to scan for opportunities (seconds) | `10` |
|
|
| `MONITORED_TOKENS` | Comma-separated list of token addresses to monitor | `[]` |
|
|
| `ENABLED_DEXES` | Comma-separated list of DEXes to monitor | `jupiter,raydium` |
|
|
|
|
## Installation
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.9+
|
|
- SQLite
|
|
|
|
### Setup
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Configure environment variables (see above)
|
|
4. Run the application:
|
|
```
|
|
uvicorn main:app --host 0.0.0.0 --port 8000
|
|
```
|
|
|
|
## Development
|
|
|
|
### Database Migrations
|
|
|
|
Database migrations are handled with Alembic:
|
|
|
|
```bash
|
|
# Create a new migration
|
|
alembic revision -m "description"
|
|
|
|
# Run migrations
|
|
alembic upgrade head
|
|
```
|
|
|
|
### Running Tests
|
|
|
|
```bash
|
|
pytest
|
|
```
|
|
|
|
## License
|
|
|
|
MIT |