### Docker Deployment - Quick Start Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Commands to clone the repository, navigate to the directory, and copy the example environment file for customization. ```bash git clone https://github.com/ZhuLinsen/daily_stock_analysis.git cd daily_stock_analysis cp .env.example .env vim .env ``` -------------------------------- ### Setup Development Environment Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/CONTRIBUTING.md Commands to clone the repository, initialize a Python virtual environment, install dependencies, and configure environment variables. ```bash git clone https://github.com/ZhuLinsen/daily_stock_analysis.git cd daily_stock_analysis python -m venv venv source venv/bin/activate pip install -r requirements.txt cp .env.example .env ``` -------------------------------- ### Frontend Development Setup (Bash) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/README.md Navigates to the frontend application directory, installs Node.js dependencies, and runs linting and build processes. This is specific to modifications within the 'apps/dsa-web' directory. ```bash cd apps/dsa-web npm ci npm run lint npm run build ``` -------------------------------- ### Docker Compose: Start Services Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Commands to start the Docker services for the stock analysis project. Options include starting the web server, the analyzer, or both. The web server mode is recommended for API and WebUI access. ```bash docker-compose -f ./docker/docker-compose.yml up -d server docker-compose -f ./docker/docker-compose.yml up -d analyzer docker-compose -f ./docker/docker-compose.yml up -d ``` -------------------------------- ### Install Dependencies and Run CI Gate (Bash) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/README.md Installs project dependencies using pip, installs development tools like flake8 and pytest, and then executes the CI gate script. This is a prerequisite for running the project locally. ```bash pip install -r requirements.txt pip install flake8 pytest ./scripts/ci_gate.sh ``` -------------------------------- ### Install and Run Daily Stock Analysis Service Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Instructions for cloning the repository, installing dependencies, configuring environment variables, and running the stock analysis service in different modes (normal, debug, web UI, scheduled). ```bash git clone https://github.com/ZhuLinsen/daily_stock_analysis.git cd daily_stock_analysis pip install -r requirements.txt cp .env.example .env # Edit .env file with API Keys and stock list python main.py python main.py --debug python main.py --stocks 600519,000001,AAPL python main.py --webui python main.py --webui-only python main.py --schedule python main.py --market-review python main.py --backtest --backtest-code 600519 python main.py --no-notify ``` -------------------------------- ### Start FastAPI Service and Analysis Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Launch the FastAPI service which includes triggering a full stock analysis. This command starts the API server and immediately initiates the analysis process. ```bash python main.py --serve ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Commands to install project dependencies using pip or conda. It highlights the automatic installation of 'pypinyin' and 'openpyxl' which are required for smart import features. ```bash # Python 3.10+ 推荐 pip install -r requirements.txt # 或使用 conda conda create -n stock python=3.10 conda activate stock pip install -r requirements.txt ``` -------------------------------- ### Start FastAPI Service Only Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Initiate the FastAPI service without automatically running a full stock analysis. This allows for manual triggering of analysis tasks via API calls. ```bash python main.py --serve-only ``` -------------------------------- ### Crontab for Scheduling Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Example of how to use the system's Crontab to schedule the execution of the Python script. This provides an alternative to the built-in scheduler or GitHub Actions. ```bash crontab -e ``` -------------------------------- ### Python Script Command-Line Arguments Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Examples of command-line arguments for running the main Python script. These arguments control various aspects of the analysis, such as mode, specific stocks, dry runs, and debugging. ```bash python main.py # 完整分析(个股 + 大盘复盘) python main.py --market-review # 仅大盘复盘 python main.py --no-market-review # 仅个股分析 python main.py --stocks 600519,300750 # 指定股票 python main.py --dry-run # 仅获取数据,不 AI 分析 python main.py --no-notify # 不发送推送 python main.py --schedule # 定时任务模式 python main.py --force-run # 非交易日也强制执行(Issue #373) python main.py --debug # 调试模式(详细日志) python main.py --workers 5 # 指定并发数 ``` -------------------------------- ### GET /api/v1/analysis/tasks/stream - Task Status SSE Stream Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Provides a Server-Sent Events (SSE) stream to receive real-time updates on task status changes. This allows clients to react instantly to events like task creation, start, completion, or failure. ```APIDOC ## GET /api/v1/analysis/tasks/stream ### Description Provides a Server-Sent Events (SSE) stream to receive real-time updates on task status changes. This allows clients to react instantly to events like task creation, start, completion, or failure. ### Method GET ### Endpoint /api/v1/analysis/tasks/stream ### Parameters None ### Response #### Success Response (200) - The response is a stream of Server-Sent Events. Each event has a type (e.g., `connected`, `task_created`, `task_completed`) and data. #### Event Stream Example Output: ``` event: connected data: {"message": "Connected to task stream"} event: task_created data: {"task_id": "task_001", "stock_code": "600519", "status": "pending"} event: task_started data: {"task_id": "task_001", "stock_code": "600519", "status": "processing"} event: task_completed data: {"task_id": "task_001", "stock_code": "600519", "status": "completed", "result": {...}} event: heartbeat data: {"timestamp": "2026-03-17T18:00:30"} ``` #### JavaScript Frontend Listening Example: ```javascript const eventSource = new EventSource('/api/v1/analysis/tasks/stream'); eventSource.addEventListener('task_completed', (event) => { const data = JSON.parse(event.data); console.log(`Analysis completed: ${data.stock_code}`, data.result); }); eventSource.addEventListener('task_failed', (event) => { const data = JSON.parse(event.data); console.error(`Analysis failed: ${data.stock_code}`, data.error); }); ``` ``` -------------------------------- ### Manual Docker Image Build and Run Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Instructions for manually building the Docker image and running the container. This is an alternative to using Docker Compose for deployment. ```bash docker build -f docker/Dockerfile -t stock-analysis . docker run -d --env-file .env -p 8000:8000 -v ./data:/app/data stock-analysis python main.py --serve-only --host 0.0.0.0 --port 8000 ``` -------------------------------- ### GET /api/v1/analysis/tasks - Get Task List Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Retrieves a list of analysis tasks. Supports filtering by status and pagination. ```APIDOC ## GET /api/v1/analysis/tasks ### Description Retrieves a list of analysis tasks. Supports filtering by status and pagination. ### Method GET ### Endpoint /api/v1/analysis/tasks ### Parameters #### Query Parameters - **status** (string) - Optional - Comma-separated list of statuses to filter by (e.g., `pending,processing`). - **limit** (integer) - Optional - The maximum number of tasks to return per page. Defaults to 20. - **page** (integer) - Optional - The page number for pagination. Defaults to 1. ### Response #### Success Response (200) - **total** (integer) - The total number of tasks matching the filter. - **pending** (integer) - The count of pending tasks. - **processing** (integer) - The count of tasks currently being processed. - **tasks** (array of objects) - A list of task summaries. - **task_id** (string) - The unique identifier of the task. - **stock_code** (string) - The stock code associated with the task. - **status** (string) - The current status of the task. - **progress** (integer) - The completion progress of the task. #### Response Example ```json { "total": 5, "pending": 2, "processing": 1, "tasks": [ {"task_id": "task_001", "stock_code": "600519", "status": "processing", "progress": 60}, {"task_id": "task_002", "stock_code": "000858", "status": "pending", "progress": 0} ] } ``` ``` -------------------------------- ### 配置直接部署环境变量 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 复制 .env.example 文件为 .env,并编辑 .env 文件填入必要的配置信息。 ```bash cp .env.example .env vim .env ``` -------------------------------- ### GET /api/v1/history - Get Historical Analysis List Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Retrieves a paginated list of historical stock analysis records. Supports filtering by stock code and date range. ```APIDOC ## GET /api/v1/history ### Description Retrieves a paginated list of historical stock analysis records. Supports filtering by stock code and date range. ### Method GET ### Endpoint /api/v1/history ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **limit** (integer) - Optional - The number of records to return per page. Defaults to 20. - **stock_code** (string) - Optional - Filter results by a specific stock code. - **start_date** (string) - Optional - Filter results from a specific start date (YYYY-MM-DD). - **end_date** (string) - Optional - Filter results up to a specific end date (YYYY-MM-DD). ### Response #### Success Response (200) - The response contains a list of historical analysis summaries. The exact structure of each summary item would depend on the implementation but typically includes stock code, date, and a summary of the analysis. #### Response Example (Default Pagination) ```bash curl "http://localhost:8000/api/v1/history?page=1&limit=20" ``` #### Response Example (Filter by Stock Code) ```bash curl "http://localhost:8000/api/v1/history?stock_code=600519" ``` #### Response Example (Filter by Date Range) ```bash curl "http://localhost:8000/api/v1/history?start_date=2023-01-01&end_date=2023-12-31" ``` ``` -------------------------------- ### Replay Snapshot for All Active Accounts (Python) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md This snippet demonstrates generating a read-time snapshot for all active accounts in the portfolio system. This provides a comprehensive view of the entire portfolio. ```python # Example: Replaying snapshot for all active accounts # all_snapshots = snapshot_service.replay_snapshot_for_all_accounts(cost_method='avg') ``` -------------------------------- ### 进入 Docker 容器调试 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 通过 bash 进入正在运行的 stock-analyzer Docker 容器,用于调试和检查。 ```bash docker-compose -f ./docker/docker-compose.yml exec stock-analyzer bash ``` -------------------------------- ### Replay Snapshot for Portfolio Account (Python) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md This snippet shows how to generate a read-time snapshot of a portfolio for a specific account. This is useful for analyzing the current state of holdings. ```python # Example: Replaying snapshot for a single account # snapshot = snapshot_service.replay_snapshot_for_account(account_id='acc123', cost_method='fifo') ``` -------------------------------- ### GET /api/v1/analysis/status/{task_id} Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/README_CHT.md Retrieves the current status of a specific analysis task. ```APIDOC ## GET /api/v1/analysis/status/{task_id} ### Description Checks the progress or completion status of an asynchronous analysis task. ### Method GET ### Endpoint /api/v1/analysis/status/{task_id} ### Parameters #### Path Parameters - **task_id** (string) - Required - The unique identifier of the task ### Response #### Success Response (200) - **status** (string) - Current status (e.g., pending, completed, failed) - **result** (object) - Analysis results if completed ### Response Example { "task_id": "task_12345", "status": "completed", "result": { ... } } ``` -------------------------------- ### Get Overall Backtest Performance Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Retrieves the overall performance metrics for all backtested stocks. ```APIDOC ## GET /api/v1/backtest/performance ### Description Retrieves the overall performance metrics for all backtested stocks. ### Method GET ### Endpoint /api/v1/backtest/performance ### Parameters None ### Response #### Success Response (200) - **overall_performance** (object) - Object containing aggregated performance metrics. #### Response Example ```json { "overall_performance": { "direction_accuracy_pct": 70.2, "win_rate_pct": 55.5, "avg_stock_return_pct": 1.0, "avg_simulated_return_pct": 0.7, "stop_loss_trigger_rate": 15.0, "take_profit_trigger_rate": 25.0 } } ``` ``` -------------------------------- ### Docker 构建失败处理 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 当 Docker 构建失败时,使用 --no-cache 选项清理缓存并重新构建 Docker 镜像。 ```bash docker-compose -f ./docker/docker-compose.yml build --no-cache ``` -------------------------------- ### Manage System Configuration Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Endpoints to retrieve, update, and validate system configurations. Supports dynamic updates and schema metadata retrieval. ```bash curl "http://localhost:8000/api/v1/system/config" curl -X PUT "http://localhost:8000/api/v1/system/config" -H "Content-Type: application/json" -d '{"config_version": "2026-03-17T18:00:00Z:sha256:4f9a...", "items": [{"key": "STOCK_LIST", "value": "600519,000858,AAPL"}, {"key": "GEMINI_API_KEY", "value": "******"}]}' curl -X POST "http://localhost:8000/api/v1/system/config/validate" -H "Content-Type: application/json" -d '{"items": [{"key": "STOCK_LIST", "value": "600519,invalid_code"}]}' curl "http://localhost:8000/api/v1/system/config/schema" ``` -------------------------------- ### Get Single Stock Backtest Performance Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Retrieves the backtest performance metrics for a specific stock. ```APIDOC ## GET /api/v1/backtest/performance/{code} ### Description Retrieves the backtest performance metrics for a specific stock. ### Method GET ### Endpoint /api/v1/backtest/performance/{code} ### Parameters #### Path Parameters - **code** (string) - Required - The stock code to retrieve performance for. #### Query Parameters None ### Response #### Success Response (200) - **performance** (object) - Object containing performance metrics for the specified stock. #### Response Example ```json { "performance": { "code": "600519", "direction_accuracy_pct": 75.5, "win_rate_pct": 60.0, "avg_stock_return_pct": 1.2, "avg_simulated_return_pct": 0.8, "stop_loss_trigger_rate": 10.0, "take_profit_trigger_rate": 20.0 } } ``` ``` -------------------------------- ### Stock List and LLM Model Configuration Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Environment variables for defining stock lists (including Hong Kong stocks) and configuring primary/fallback LLM models. ```bash # Stock list with HK support STOCK_LIST=600519,hk00700,hk01810 # Gemini primary model GEMINI_API_KEY=xxx GEMINI_MODEL=gemini-3-flash-preview # OpenAI compatible fallback OPENAI_API_KEY=xxx OPENAI_BASE_URL=https://api.deepseek.com/v1 OPENAI_MODEL=deepseek-chat ``` -------------------------------- ### GET /api/health Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Health check endpoint for monitoring service availability. ```APIDOC ## GET /api/health ### Description Returns the current operational status of the API service. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - **status** (string) - Service status (e.g., 'ok') - **timestamp** (string) - Current server time ### Response Example { "status": "ok", "timestamp": "2026-03-17T18:00:00Z" } ``` -------------------------------- ### GET /api/v1/backtest/performance Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Retrieves the overall backtesting performance metrics or performance for a specific stock symbol. ```APIDOC ## GET /api/v1/backtest/performance ### Description Fetches overall backtesting performance statistics including accuracy and profit/loss metrics. ### Method GET ### Endpoint /api/v1/backtest/performance ### Response #### Success Response (200) - **total_samples** (integer) - Total number of samples - **direction_accuracy** (float) - Accuracy of price direction prediction - **avg_max_profit_pct** (float) - Average maximum profit percentage ### Response Example { "total_samples": 500, "direction_accuracy": 0.68, "avg_max_profit_pct": 3.5 } ``` -------------------------------- ### Environment Variable Configuration Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Core configuration settings for the system, including stock lists, AI model API keys, and search engine integration. ```bash STOCK_LIST=600519,000858,hk00700,AAPL,TSLA GEMINI_API_KEY=your_gemini_key TAVILY_API_KEYS=your_tavily_key ``` -------------------------------- ### Run Server with Custom Configuration (Bash) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md This command allows you to run the main Python script with custom server configurations. You can specify the host address and port number, and enable serving only mode. ```bash python main.py --serve-only --host 0.0.0.0 --port 8888 ``` -------------------------------- ### GET /api/v1/history Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt Retrieve a list of historical stock analysis reports filtered by date range. ```APIDOC ## GET /api/v1/history ### Description Retrieve historical stock analysis records within a specified date range. ### Method GET ### Endpoint /api/v1/history ### Parameters #### Query Parameters - **start_date** (string) - Required - Start date in YYYY-MM-DD format - **end_date** (string) - Required - End date in YYYY-MM-DD format ### Request Example curl "http://localhost:8000/api/v1/history?start_date=2026-03-01&end_date=2026-03-17" ### Response #### Success Response (200) - **total** (integer) - Total records found - **items** (array) - List of analysis records #### Response Example { "total": 156, "page": 1, "limit": 20, "items": [ { "id": 1, "stock_code": "600519", "stock_name": "贵州茅台", "sentiment_score": 72 } ] } ``` -------------------------------- ### GET /api/health Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/openclaw-skill-integration.md Performs a health check on the daily_stock_analysis API service. This endpoint can be used to verify if the service is running and responsive. ```APIDOC ## GET /api/health ### Description Performs a health check on the daily_stock_analysis API service. This endpoint can be used to verify if the service is running and responsive. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - Typically returns a simple status message like "OK" or a JSON object indicating the service is healthy. #### Response Example ```json { "status": "OK" } ``` ``` -------------------------------- ### Run Local CI Verification Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/CONTRIBUTING.md Commands to execute backend and frontend gate checks locally to ensure code quality before submitting a Pull Request. ```bash # Backend gate pip install -r requirements.txt pip install flake8 pytest ./scripts/ci_gate.sh # Frontend gate cd apps/dsa-web npm ci npm run lint npm run build ``` -------------------------------- ### 重启 Docker Compose 服务 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 重启 Docker Compose 管理的所有服务。 ```bash docker-compose -f ./docker/docker-compose.yml restart ``` -------------------------------- ### Health Check API Endpoint Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Perform a health check on the running FastAPI service. This simple GET request verifies if the API server is operational and responsive. ```bash curl http://127.0.0.1:8000/api/health ``` -------------------------------- ### Trigger Backtest Run API Request (Specific Stock) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Start a backtest for a specific stock code. This allows focused evaluation of the backtesting engine on individual assets. ```bash curl -X POST http://127.0.0.1:8000/api/v1/backtest/run \ -H 'Content-Type: application/json' \ -d '{"code": "600519", "force": false}' ``` -------------------------------- ### GET /api/v1/analysis/status/{task_id} Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/openclaw-skill-integration.md Checks the status of an asynchronous stock analysis task. This endpoint is used when `async_mode` is set to `true` in the analyze request. ```APIDOC ## GET /api/v1/analysis/status/{task_id} ### Description Checks the status of an asynchronous stock analysis task. This endpoint is used when `async_mode` is set to `true` in the analyze request. ### Method GET ### Endpoint /api/v1/analysis/status/{task_id} ### Parameters #### Path Parameters - **task_id** (string) - Required - The ID of the asynchronous task obtained from the `/api/v1/analysis/analyze` endpoint. ### Response #### Success Response (200) - **task_id** (string) - The ID of the task. - **status** (string) - The current status of the task. Possible values: `pending`, `processing`, `completed`, `failed`. - **result** (object) - The analysis result, available only when `status` is `completed`. Structure is the same as the synchronous response. #### Response Example ```json { "task_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "status": "completed", "result": { "query_id": "abc123def456", "stock_code": "600519", "stock_name": "贵州茅台", "report": { "summary": { "analysis_summary": "...", "operation_advice": "持有", "trend_prediction": "看多", "sentiment_score": 75 }, "strategy": { "ideal_buy": "1850", "stop_loss": "1780", "take_profit": "1950" } }, "created_at": "2026-03-13T10:00:00" } } ``` ``` -------------------------------- ### Systemd 服务管理命令 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 用于重载 systemd 配置、启动、启用(开机自启)、查看状态和日志的服务管理命令。 ```bash sudo systemctl daemon-reload sudo systemctl start stock-analyzer sudo systemctl enable stock-analyzer sudo systemctl status stock-analyzer journalctl -u stock-analyzer -f ``` -------------------------------- ### Docker Compose 服务日志查看 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 实时跟踪 Docker Compose 管理的服务的日志输出。 ```bash docker-compose -f ./docker/docker-compose.yml logs -f ``` -------------------------------- ### Agent Tool for Portfolio Snapshot (Python) Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md This snippet defines an agent tool that provides account-aware LLM suggestions by fetching portfolio snapshots. It supports various optional parameters for customization. ```python # Example: Using the get_portfolio_snapshot tool # from agent_tools import get_portfolio_snapshot # snapshot_summary = get_portfolio_snapshot(account_id='acc123', include_risk=True, as_of='2023-10-27') ``` -------------------------------- ### Query Analysis Task Status API Request Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Retrieve the status of a specific analysis task using its task ID. This GET request allows monitoring the progress of ongoing or completed analyses. ```bash curl http://127.0.0.1:8000/api/v1/analysis/status/ ``` -------------------------------- ### Other Configuration Settings Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Miscellaneous configuration options including stock lists, web authentication, concurrency, market review settings, scheduling, and logging. ```environment STOCK_LIST="AAPL,MSFT,GOOG" ADMIN_AUTH_ENABLED=false TRUST_X_FORWARDED_FOR=false MAX_WORKERS=3 MARKET_REVIEW_ENABLED=true MARKET_REVIEW_REGION="cn" TRADING_DAY_CHECK_ENABLED=true SCHEDULE_ENABLED=false SCHEDULE_TIME="18:00" LOG_DIR="./logs" ``` -------------------------------- ### 准备 Docker Compose 配置文件 Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/DEPLOY.md 克隆项目代码,复制并编辑 .env 示例文件以填入真实配置信息,为 Docker Compose 部署做准备。 ```bash git clone /opt/stock-analyzer cd /opt/stock-analyzer cp .env.example .env vim .env ``` -------------------------------- ### Enable Debug Mode for Logging Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Activate debug mode to generate detailed logs for troubleshooting. This command starts the main application with enhanced logging capabilities, directing output to specific log files. ```bash python main.py --debug ``` -------------------------------- ### Get Historical Analysis List API Source: https://context7.com/chong-aaa1114/daily_stock_analysis/llms.txt API endpoint to retrieve a paginated list of historical stock analysis records. Supports filtering by stock code and date range. ```bash # Get historical list (default pagination) curl "http://localhost:8000/api/v1/history?page=1&limit=20" # Filter by stock code curl "http://localhost:8000/api/v1/history?stock_code=600519" ``` -------------------------------- ### Configure API Keys and Fallback Models Source: https://github.com/chong-aaa1114/daily_stock_analysis/blob/main/docs/full-guide.md Set up necessary API keys for LLM providers and define fallback models for robust operation. LITELLM_FALLBACK_MODELS specifies a comma-separated list of models to try if the primary model fails, ensuring service continuity. ```bash # Required API Keys: # ANTHROPIC_API_KEY # OPENAI_API_KEY LITELLM_FALLBACK_MODELS=anthropic/claude-3-5-sonnet-20241022,openai/gpt-4o-mini ```