#!/usr/bin/env python3
"""
Trading Analytics Service - Main entry point
"""

import uvicorn
import logging
import os
from dotenv import load_dotenv

# 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 main():
    """Start the analytics service"""
    host = os.getenv('ANALYTICS_HOST', '0.0.0.0')
    port = int(os.getenv('ANALYTICS_PORT', '3003'))
    
    logger.info(f"Starting Trading Analytics Service on {host}:{port}")
    
    uvicorn.run(
        "src.api.app:app",
        host=host,
        port=port,
        reload=os.getenv('ENV') == 'development',
        log_level="info"
    )

if __name__ == "__main__":
    main()