Skip to main content

Tickr Agent - Swarms -- TGCS

Project description

Multi-Modality

Tickr Agent

Join our Discord Subscribe on YouTube Connect on LinkedIn Follow on X.com

Python License

tickr-agent is an enterprise-ready, scalable Python library for building swarms of financial agents that conduct comprehensive stock analysis and produce insights. Powered by yfinance, loguru for logging, and pydantic for data validation, tickr-agent is designed for businesses that need robust financial data processing, multithreading, and seamless integration with AI-powered models (via OpenAI) to derive actionable insights.

With tickr-agent, you can automate the retrieval of stock market data, perform technical analysis (e.g., RSI, moving averages), and integrate insights into AI-driven workflows. This solution is built to handle real-time data processing, analysis, and reporting at an enterprise scale.

Key Features

  • Multithreaded Stock Data Fetching: Retrieve and analyze financial data for multiple stocks concurrently for faster performance.
  • Advanced Logging: Built with loguru, offering superior logging capabilities for debugging, auditing, and monitoring.
  • Enterprise-Ready: Production-grade, modular design, and scalable for high-performance environments.
  • AI-Integrated: Leverage OpenAI models to generate comprehensive financial analysis and predictions based on real-time stock data.
  • Pydantic Validation: Ensures reliable and validated stock data, minimizing errors in data processing.

Installation

To install tickr-agent, simply run:

$ pip3 install -U tickr-agent

Getting Started

Basic Example: Running Financial Analysis on a Single Stock

from tickr_agent.main import TickrAgent
from loguru import logger

# Example Usage
if __name__ == "__main__":
    try:
        # Define stock tickers
        stocks = ["NVDA"]

        # Initialize the agent and configure the settings
        agent = TickrAgent(
            stocks=stocks,
            max_loops=1,          # Maximum number of loops
            workers=10,           # Number of threads for concurrent execution
            retry_attempts=1,      # Retry attempts for failed requests
            context_length=16000,  # Maximum context length for AI models
        )

        # Run the financial analysis and obtain the result
        result = agent.run("Conduct an analysis of this summary")

        # Output the result
        print(result)

    except Exception as e:
        logger.critical(f"Critical error in financial agent execution: {e}")

How It Works

  1. Stock Data Fetching: The agent fetches real-time stock data from multiple financial APIs using the yfinance library. Technical indicators such as RSI, 50-day moving average, and 200-day moving average are calculated.

  2. Multithreading: Multiple stock tickers are processed concurrently using Python’s ThreadPoolExecutor, ensuring high performance and efficiency.

  3. Data Validation: Each piece of stock data is validated using pydantic, ensuring the reliability of the data processed.

  4. AI-Powered Analysis: After gathering and validating stock data, the agent passes the summary of stock performance to an OpenAI-powered model, which can provide deeper insights, forecasts, or personalized reports based on the stock performance.

Enterprise Use Case: Swarms of Financial Agents

For large enterprises, tickr-agent supports creating swarms of financial agents, each focusing on different sectors, regions, or investment strategies. These swarms can analyze hundreds or even thousands of stocks concurrently, generate reports, and trigger AI-driven insights for decision-making.

Example: Running a Swarm of Agents for Multiple Stocks

from tickr_agent.main import TickrAgent
from loguru import logger

# Example Usage
if __name__ == "__main__":
    try:
        # Define multiple stock tickers
        stocks = ["AAPL", "GOOGL", "MSFT", "TSLA", "AMZN"]

        # Initialize the agent for multi-stock analysis
        agent = TickrAgent(
            stocks=stocks,
            max_loops=2,          # Increased loops for more in-depth analysis
            workers=20,           # Number of threads for concurrent execution
            retry_attempts=2,      # Retry logic for reliability
            context_length=32000,  # Maximum context length for AI models
        )

        # Run the financial analysis
        result = agent.run("Provide a detailed financial health report for the selected stocks.")

        # Output the result
        print(result)

    except Exception as e:
        logger.critical(f"Critical error in financial agent execution: {e}")

Advanced Customization

tickr-agent can be customized based on your enterprise needs, including:

  • Custom AI Models: Integrate custom models or fine-tuned versions of GPT for industry-specific insights.
  • Data Pipelines: Use tickr-agent as part of a larger financial data pipeline, feeding real-time stock analysis into dashboards, reporting systems, or decision-making tools.
  • Scalable Architecture: Deploy swarms of agents in cloud environments, utilizing Kubernetes or Docker for containerized scaling.

Logging and Monitoring

tickr-agent uses loguru for logging, providing robust, enterprise-grade logging capabilities:

  • File Rotation: Log files are rotated automatically after reaching 1 MB in size.
  • Detailed Error Tracking: Comprehensive error logging, including stack traces and timestamps, ensures that failures are easily traceable.
  • Custom Log Levels: Adjust the verbosity of logs as needed (DEBUG, INFO, WARNING, ERROR, CRITICAL).

Logs are saved to financial_agent_log.log by default. Customize the logging configuration to integrate with your enterprise logging systems.

Contributing

Contributions are welcome! If you would like to contribute, please open an issue or submit a pull request to the GitHub repository. We follow standard Python development practices and require tests for all new features.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

Join our discord for real-time support or email me

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tickr_agent-0.0.3.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

tickr_agent-0.0.3-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page