From e9baa818a427c137a92148b9f8fe1e123a5b7f6f Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 30 Oct 2025 18:33:40 -0400 Subject: [PATCH] Add entrypoint script for container startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sequential execution: data fetch → MCP services → trading agent Handles graceful shutdown of background services Supports custom config file as argument --- entrypoint.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..7019671 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e # Exit on any error + +echo "🚀 Starting AI-Trader..." + +# Step 1: Data preparation +echo "📊 Fetching and merging price data..." +cd /app/data +python get_daily_price.py +python merge_jsonl.py +cd /app + +# Step 2: Start MCP services in background +echo "🔧 Starting MCP services..." +cd /app/agent_tools +python start_mcp_services.py & +MCP_PID=$! +cd /app + +# Step 3: Wait for services to initialize +echo "⏳ Waiting for MCP services to start..." +sleep 3 + +# Step 4: Run trading agent with config file +echo "🤖 Starting trading agent..." +CONFIG_FILE="${1:-configs/default_config.json}" +python main.py "$CONFIG_FILE" + +# Cleanup on exit +trap "echo '🛑 Stopping MCP services...'; kill $MCP_PID 2>/dev/null; exit 0" EXIT SIGTERM SIGINT