System Monitor & Configuration

0
Total Agents
0 Active
5
Cycle Interval
Minutes
117
Total Cycles
All Time
IDLE
System Status
2025-12-03 19:59:18
Scheduler Configuration
Automatic Trading Cycle

Interval: Every 5 minutes

Status: Running

Next Run: 2025-12-03 20:04:18

Last Execution: 2025-12-03 19:59:18

Execution Mode: Sequential (one agent at a time)

Trigger: Time-based + Manual

Cycle Execution Flow
1. Fetch TA Data
Global watchlist
2. For Each Agent
Active agents only
3. Fetch Sentiment
Per ticker
4. Evaluate Signals
Decision logic
5. Execute Trades
If triggered
Agent Decision Tree Logic
Signal Evaluation Process
START: New ticker evaluation
CONDITION 1: Check if ticker already in open positions
✗ IF YES → Skip evaluation, manage existing position
✓ IF NO → Continue to signal evaluation
CONDITION 2: Check RSI availability
✗ IF RSI = NULL → Reject signal (missing data)
✓ IF RSI available → Continue
CONDITION 3: Sentiment Score >= min_sentiment
Param: min_sentiment (default: 2.0)
✓ IF sentiment_score >= min_sentiment → PASS
✗ IF sentiment_score < min_sentiment → FAIL
CONDITION 4: RSI < rsi_threshold (Oversold)
Param: rsi_threshold (default: 30)
✓ IF RSI < rsi_threshold → PASS (oversold)
✗ IF RSI >= rsi_threshold → FAIL (not oversold)
FINAL DECISION:
✓ IF all_checks_passed AND no_checks_failed → BUY SIGNAL
✗ IF any_check_failed → REJECT SIGNAL
EXECUTE: Submit Market Buy Order (1 share)
Position Exit Strategy
Stop Loss Mechanism

Trigger: Automatically placed after position is opened

Method: ATR-based (Average True Range)

Formula: stop_price = current_price - (ATR × sl_multiplier)

Default Multiplier: 1.5x

Exit Logic Flow
START: Position exists in portfolio
CHECK: Does position have open stop loss order?
✓ IF YES → Skip (already protected)
✗ IF NO → Need to add stop loss
CHECK: Is ATR (Average True Range) available?
✗ IF NO → Cannot place SL (missing data)
✓ IF YES → Calculate stop price
CALCULATE: stop_price = current_price - (ATR × sl_multiplier)
VALIDATE: stop_price < current_price?
✓ IF YES → Submit Stop Loss Order
✗ IF NO → Invalid (would trigger immediately)
RESULT: Position protected with automatic stop loss
Note: Stop losses are dynamic and recalculated on each cycle if conditions change. No take-profit is currently implemented (manual exit required).
Reinforcement Learning (RL) Process
Optimization Loop

The system uses a Hill Climbing algorithm to continuously improve agent performance.

  1. Collect: Every decision (Buy/Sell/Hold) is logged with its context (State).
  2. Track: The Outcome Tracker checks the price 24-72 hours later to calculate the "Reward" (Profit/Loss).
  3. Optimize: The Optimizer Service analyzes the rewards and perturbs parameters to find better values.
  4. Update: If "Auto-Optimization" is enabled, the agent updates itself. Otherwise, it suggests a recommendation.
Tunable Meta-Parameters
Learning Rate (Step Multiplier)

Controls the "aggressiveness" of parameter changes.

  • 1.0: Standard (e.g., +/- 5 for RSI)
  • 2.0: Fast Adaptation (Big jumps)
  • 0.5: Fine-tuning (Small adjustments)
Lookback Window

How much history to consider for optimization.

  • 72h: Standard (3 Days)
  • 24h: Reactive (1 Day)
  • 168h: Stable (1 Week)
Optimization Flow Diagram
1. Agent Act
Generates Signal
2. Wait
24-72 Hours
3. Calculate Reward
Price Change %
4. Hill Climb
Adjust Params
5. New Policy
Updated Agent
System Configuration
Scheduler Interval 5 minutes
TA API Endpoint https://ta-analysis.martinrodl.me/market/watchlist
Sentiment API Endpoint https://sentiment-news.martinrodl.me/api
Alpaca Paper URL https://paper-api.alpaca.markets
Alpaca Live URL https://api.alpaca.markets
Database SQLite (tradeswarm.db)
Concurrent Execution Sequential (to prevent race conditions)
Trading Lock Enabled (prevents overlapping cycles)
Default Agent Parameters
Minimum Sentiment 2.0 (range: -5 to 5)
RSI Threshold 30 (oversold indicator)
Stop Loss Multiplier 1.5x ATR
Max Articles 5 per ticker
Days Lookback 7 days
Analysis Model Gemini 2.0 Flash / GPT-4o
Position Size 1 share (fixed)
Order Type Market Order (Day)
Active Agents Configuration
No agents configured yet. Create one from the dashboard.
External API Integration Status
Technical Analysis API
Connected
https://ta-analysis.martinrodl.me/market/watchlist
News Sentiment API
Connected
https://sentiment-news.martinrodl.me/api
Alpaca Trading API
Connected
Paper + Live endpoints