File: //opt/af/src/demo_forex_agents.py
"""
Demo script for forex trading agents.
This script demonstrates how to use the forex trading agents
individually and as a team.
"""
import logging
import os
from dotenv import load_dotenv
from src.ai.forex_agents import (
FXSeerLSTMAgent,
TrendSightTAAgent,
MomentumMoverAgent,
MeanReversionScoutAgent,
create_forex_team
)
# Load environment variables
load_dotenv()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def demo_individual_agents():
"""Demo each forex agent individually"""
print("\n=== INDIVIDUAL AGENT DEMO ===\n")
# Create individual agents
lstm_agent = FXSeerLSTMAgent()
ta_agent = TrendSightTAAgent()
momentum_agent = MomentumMoverAgent()
mean_reversion_agent = MeanReversionScoutAgent()
# Demo FXSeer LSTM Agent
print("\n--- FXSeer LSTM Agent Demo ---\n")
lstm_response = lstm_agent.chat("What's your prediction for EUR/USD for tomorrow?")
print(f"LSTM Agent Response:\n{lstm_response}")
# Demo TrendSight TA Agent
print("\n--- TrendSight TA Agent Demo ---\n")
ta_response = ta_agent.chat("Analyze GBP/JPY on the daily timeframe using RSI and Bollinger Bands.")
print(f"TA Agent Response:\n{ta_response}")
# Demo Momentum Mover Agent
print("\n--- Momentum Mover Agent Demo ---\n")
momentum_response = momentum_agent.chat("Show me the top momentum pairs from this list: EUR/USD, GBP/USD, USD/JPY, AUD/USD")
print(f"Momentum Agent Response:\n{momentum_response}")
# Demo Mean Reversion Scout Agent
print("\n--- Mean Reversion Scout Agent Demo ---\n")
reversion_response = mean_reversion_agent.chat("Find mean reversion opportunities for USD/CAD using Z-Score method.")
print(f"Mean Reversion Agent Response:\n{reversion_response}")
def demo_team_collaboration():
"""Demo the forex team collaboration"""
print("\n=== FOREX TEAM COLLABORATION DEMO ===\n")
# Create the forex team
forex_team = create_forex_team()
# Team analysis example
print("\n--- Comprehensive Forex Analysis ---\n")
team_response = forex_team.chat("""
I'm looking at EUR/USD and interested in trading it.
Can you provide a comprehensive analysis including:
1. Technical indicators
2. Price prediction
3. Momentum status
4. Mean reversion potential
""")
print(f"Team Response:\n{team_response}")
if __name__ == "__main__":
logger.info("Starting Forex Agents Demo")
try:
# Demo individual agents
demo_individual_agents()
# Demo team collaboration
demo_team_collaboration()
except Exception as e:
logger.error(f"Error in demo: {e}", exc_info=True)
logger.info("Forex Agents Demo completed")