Disable MAStock strategy; harden restart_bot kill logic
This commit is contained in:
parent
e50d3a160b
commit
d633439ae2
@ -35,7 +35,7 @@ class IBConfig:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class StockStrategyConfig:
|
class StockStrategyConfig:
|
||||||
enabled: bool = True
|
enabled: bool = False # MAStock disabled 2026-08-11: +101.66(ShortTerm)/-19.98(MeanRev)/-65.47(MAStock) since 08-03
|
||||||
symbols: list[str] = field(default_factory=lambda: ["AMZN", "AAPL", "NVDA", "NOK"])
|
symbols: list[str] = field(default_factory=lambda: ["AMZN", "AAPL", "NVDA", "NOK"])
|
||||||
currency: str = "USD"
|
currency: str = "USD"
|
||||||
exchange: str = "SMART"
|
exchange: str = "SMART"
|
||||||
|
|||||||
@ -7,8 +7,21 @@ LOG_FILE="$BOT_DIR/trading_bot.log"
|
|||||||
echo "=== IB Trading Bot Starter ==="
|
echo "=== IB Trading Bot Starter ==="
|
||||||
echo "BOT_DIR: $BOT_DIR"
|
echo "BOT_DIR: $BOT_DIR"
|
||||||
|
|
||||||
# Step 1: Kill any existing bot process
|
# Step 1: Kill any existing bot process (TERM first, escalate to KILL if stuck)
|
||||||
pkill -f "main.py" 2>/dev/null || true
|
PIDS=$(pgrep -f "main.py" || true)
|
||||||
|
if [ -n "$PIDS" ]; then
|
||||||
|
echo "Old bot PID(s): $PIDS, sending SIGTERM..."
|
||||||
|
pkill -f "main.py" 2>/dev/null || true
|
||||||
|
for _ in $(seq 1 10); do
|
||||||
|
if ! pgrep -f "main.py" >/dev/null 2>&1; then break; fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if pgrep -f "main.py" >/dev/null 2>&1; then
|
||||||
|
echo "Still alive after 10s, sending SIGKILL..."
|
||||||
|
pkill -9 -f "main.py" 2>/dev/null || true
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo "[1/2] Stopped old bot process (if any)"
|
echo "[1/2] Stopped old bot process (if any)"
|
||||||
|
|
||||||
# Step 2: Start the trading bot (setsid so it survives this shell exiting)
|
# Step 2: Start the trading bot (setsid so it survives this shell exiting)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user