# hahaStock **Repository Path**: snnu/hahaStock ## Basic Information - **Project Name**: hahaStock - **Description**: 基于Nodejs+VUE3的前后端分离股票量化交易系统 - **Primary Language**: JavaScript - **License**: BSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-19 - **Last Updated**: 2025-09-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Stock Quant Trading System ## Technology Stack - **Backend**: Node.js + Express - **Database**: LevelDB - **Data Sources**: Alpha Vantage, Sina, Tencent stock APIs - **Frontend**: Vue.js - **Deployment**: Docker, Docker Compose, deployment script support ## Project Structure - `server/`: Backend service code - `client/`: Frontend client code - `server/src/models/`: Data model definitions (stocks, trades, users, etc.) - `server/src/services/`: Core business logic and API services - `server/src/routes/`: API route definitions - `server/src/middleware/`: Request middleware (e.g., authentication) - `client/src/services/`: Frontend API calling services - `client/src/components/`: Vue component collection ## Installation and Running ### Method 1: Direct Deployment 1. Install Node.js 2. Configure the `.env` file 3. Install dependencies and start the service ```bash npm install npm start ``` ### Method 2: Using Deployment Script Run the `deploy.sh` script for deployment ### Method 3: Using Docker Build and run the Docker container: ```bash docker build -t stock-trading-system . docker run -p 3000:3000 stock-trading-system ``` ### Method 4: Using Docker Compose Run the following command to start the entire system: ```bash docker-compose up ``` ## API Endpoints ### Stock Related - `GET /stock`: Retrieve all stock data - `GET /stock/:symbol`: Retrieve specific stock information - `GET /stock/:symbol/history`: Retrieve historical stock data ### Trading Related - `POST /trade`: Create a trade order - `PUT /trade/:id/execute`: Execute a trade - `PUT /trade/:id/cancel`: Cancel a trade ### User Related - `POST /user`: User registration - `GET /user/:id`: Retrieve user information - `GET /user/:id/portfolio`: Retrieve user portfolio ### Authentication Related - `POST /auth/login`: User login - `POST /auth/register`: User registration ### Strategy Related - `POST /strategy`: Create a strategy - `GET /strategy`: Retrieve user strategies - `POST /strategy/moving-average`: Execute moving average strategy - `POST /strategy/rsi`: Execute RSI strategy - `POST /strategy/bollinger-bands`: Execute Bollinger Bands strategy - `POST /strategy/turtle`: Execute Turtle Trading strategy - `POST /strategy/multi-factor`: Execute multi-factor stock selection strategy ## Database Design - **Users Table**: UserID, Username, Email, Password Hash, Balance - **Stocks Table**: StockID, Symbol, Name, Current Price, Last Updated Time - **Trades Table**: TradeID, UserID, StockID, Type (buy/sell), Quantity, Price, Timestamp, Status - **Portfolio Table**: UserID, StockID, Quantity Held, Average Buy Price ## Quantitative Trading Strategies - **Moving Average Strategy**: Determine buy/sell points through short-term and long-term moving average crossovers - **RSI Strategy**: Use the Relative Strength Index to determine overbought/oversold conditions - **Bollinger Bands Strategy**: Use price relationships with Bollinger Bands upper and lower bounds to identify volatility opportunities - **Turtle Trading Strategy**: Momentum trading strategy based on channel breakout - **Multi-Factor Stock Selection Strategy**: Comprehensive stock scoring and screening using multiple factors (momentum, volatility, trading volume, etc.) ## Deployment Notes - **Access Application**: Default runs at `http://localhost:3000` - **Production Environment Configuration**: Edit the `.env.production` file ## Development Roadmap - Add more quantitative strategies (e.g., MACD, ATR, etc.) - Enhance frontend visualization capabilities (chart display) - Support more stock markets and data sources - Add backtesting module and performance evaluation functionality ## License This project uses the MIT License. Please refer to the LICENSE file for details.