diff --git a/README.md b/README.md index 2dd86af..fac7ac4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,52 @@ ## 第一部分:产品功能说明 +### 📸 界面预览 + +#### 🖥️ 桌面端 +
+ + + + + + + + + +
+ + + +
+ + + +
+
+ +#### 📱 移动端 +
+ + + + + + + + + +
+ + + + + +
+ +
+
+ ### ✨ 核心功能 #### 🔐 账户管理 diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 0000000..cd6931a --- /dev/null +++ b/README_EN.md @@ -0,0 +1,425 @@ +# PolyHermes + +[![GitHub](https://img.shields.io/badge/GitHub-WrBug%2FPolyHermes-blue?logo=github)](https://github.com/WrBug/PolyHermes) +[![Twitter](https://img.shields.io/badge/Twitter-@quant__tr-blue?logo=twitter)](https://x.com/quant_tr) + +A powerful copy trading system for Polymarket prediction markets, supporting automated copy trading, multi-account management, real-time order push, and statistical analysis. + +--- + +## 📋 Table of Contents + +- [Part 1: Product Features](#part-1-product-features) +- [Part 2: How to Deploy](#part-2-how-to-deploy) +- [Part 3: Development Documentation](#part-3-development-documentation) + +--- + +## Part 1: Product Features + +### 📸 Interface Preview + +#### 🖥️ Desktop +
+ + + + + + + + + +
+ + + +
+ + + +
+
+ +#### 📱 Mobile +
+ + + + + + + + + +
+ + + +
+ + + +
+
+ +### ✨ Core Features + +#### 🔐 Account Management +- **Multi-Account Support**: Import multiple wallet accounts via private keys for unified management +- **Secure Storage**: Private keys and API credentials are encrypted and stored securely +- **Account Information**: View detailed account information including balance, positions, and transaction history +- **Account Editing**: Support for modifying account names, setting default accounts, etc. + +#### 👥 Leader Management +- **Add Leaders**: Add wallet addresses of traders to copy (Leaders) +- **Category Filtering**: Support filtering by category (sports/crypto) +- **Leader Information**: View trading history and statistics of Leaders +- **Note Management**: Add notes to Leaders for easy identification and management + +#### 📊 Copy Trading Templates +- **Flexible Configuration**: Create copy trading templates and configure copy trading parameters +- **Copy Trading Modes**: Support proportional copy trading and fixed amount copy trading +- **Risk Control**: Configure daily loss limits, order count limits, price tolerance, etc. +- **Template Reuse**: One template can be used for multiple copy trading relationships + +#### 🔄 Copy Trading Configuration +- **Relationship Management**: Associate accounts, templates, and Leaders to create copy trading relationships +- **Enable/Disable**: Flexibly control the enabled state of copy trading relationships +- **Automatic Copy Trading**: Real-time monitoring of Leader trades, automatically copying orders (supports buy and sell) +- **Order Tracking**: Complete order lifecycle tracking, including buy, sell, and match records + +#### 📈 Order Management +- **Buy Orders**: View detailed information of all buy orders +- **Sell Orders**: View detailed information of all sell orders +- **Matched Orders**: View matched order records +- **Order Filtering**: Support filtering by account, Leader, time range, and other conditions + +#### 💼 Position Management +- **Real-Time Positions**: View and manage positions of all accounts in real-time +- **Position Push**: Real-time position changes via WebSocket +- **Sell Positions**: Support market and limit price selling of positions +- **Redeem Positions**: Support batch redemption of settled positions + +#### 📊 Statistical Analysis +- **Global Statistics**: View aggregated statistics of all copy trading relationships +- **Leader Statistics**: View statistics of specific Leaders +- **Category Statistics**: View statistics by category (sports/crypto) +- **Copy Trading Relationship Statistics**: View detailed statistics of individual copy trading relationships +- **Time Filtering**: Support filtering statistics by time range + +#### ⚙️ System Management +- **Proxy Configuration**: Configure HTTP proxy through Web UI without modifying environment variables +- **API Health Check**: Real-time monitoring of Polymarket API health status +- **User Management**: Manage system users, support adding, editing, and deleting users +- **Announcement Management**: View system announcements and update information + +### 🚀 Technical Features + +- **WebSocket Real-Time Push**: Real-time push of order and position data without manual refresh +- **Secure Storage**: Private keys and API credentials stored using AES encryption +- **Responsive Design**: Perfect support for mobile and desktop, providing a consistent user experience +- **High Performance**: Asynchronous processing, concurrency optimization, support for large-scale order processing +- **Risk Control**: Multiple risk control mechanisms including daily loss limits, order count limits, price tolerance, etc. +- **Multi-Language Support**: Support for Chinese (Simplified/Traditional) and English +- **Version Management**: Automatic version number display and management, support for GitHub Releases auto-build + +### 🏗️ Tech Stack + +#### Backend +- **Framework**: Spring Boot 3.2.0 +- **Language**: Kotlin 1.9.20 +- **Database**: MySQL 8.2.0 +- **ORM**: Spring Data JPA +- **Database Migration**: Flyway +- **HTTP Client**: Retrofit 2.9.0 + OkHttp 4.12.0 +- **WebSocket**: Spring WebSocket + +#### Frontend +- **Framework**: React 18 + TypeScript +- **Build Tool**: Vite +- **UI Library**: Ant Design 5.12.0 +- **HTTP Client**: axios +- **State Management**: Zustand +- **Routing**: React Router 6 +- **Ethereum Library**: ethers.js 6.9.0 +- **Internationalization**: react-i18next + +--- + +## Part 2: How to Deploy + +### 🚀 Quick Deployment + +#### All-in-One Deployment (Recommended) + +Deploy both frontend and backend together in a single Docker container, using Nginx to serve frontend static files and proxy backend API. + +**Prerequisites**: +- Docker 20.10+ +- Docker Compose 2.0+ + +**Deployment Steps**: + +1. **Using Docker Hub Images (Recommended, Production First Choice)** + +**Method 1: Standalone Deployment (No code clone required, Recommended)** + +Suitable for production environments, no need to download project code, only two files needed for deployment: + +```bash +# 1. Create deployment directory +mkdir polyhermes && cd polyhermes + +# 2. Download production environment configuration files +# Download docker-compose.prod.yml and docker-compose.prod.env.example from GitHub +curl -O https://raw.githubusercontent.com/WrBug/PolyHermes/main/docker-compose.prod.yml +curl -O https://raw.githubusercontent.com/WrBug/PolyHermes/main/docker-compose.prod.env.example + +# 3. Create configuration file +cp docker-compose.prod.env.example .env + +# 4. Edit .env file, modify the following required configurations: +# - DB_PASSWORD: Database password +# - JWT_SECRET: Generate using openssl rand -hex 64 +# - ADMIN_RESET_PASSWORD_KEY: Generate using openssl rand -hex 32 + +# 5. Start services +docker-compose -f docker-compose.prod.yml up -d + +# 6. View logs +docker-compose -f docker-compose.prod.yml logs -f + +# 7. Stop services +docker-compose -f docker-compose.prod.yml down +``` + +**Method 2: Using Deployment Script (Requires code clone)** + +```bash +# If you have already cloned the code +./deploy.sh --use-docker-hub +``` + +**Method 3: Modify Existing docker-compose.yml** + +```bash +# 1. Modify docker-compose.yml, uncomment: +# image: wrbug/polyhermes:latest +# and comment out the build section +# 2. Create .env file (see below) +# 3. Start services +docker-compose up -d +``` + +**Advantages**: +- ✅ No local build required, fast deployment +- ✅ No code clone required, only configuration files needed for deployment +- ✅ Uses officially built images with correct version numbers +- ✅ Supports multiple architectures (amd64, arm64), automatically selects matching architecture +- ✅ Recommended for production environments + +**Pull Specific Version**: + +```bash +# Modify the image tag in docker-compose.prod.yml +# image: wrbug/polyhermes:v1.0.0 +``` + +2. **Local Build Deployment (Development Environment)** + +```bash +# Use deployment script +./deploy.sh +``` + +The script will automatically: +- Check Docker environment +- Create `.env` configuration file (if it doesn't exist) +- Build Docker image (including frontend and backend) +- Start services (application + MySQL) + +3. **Manual Deployment** + +```bash +# Create .env file +cat > .env <