tickr-agent


Nametickr-agent JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/The-Swarm-Corporation/TickrAgent
SummaryTickr Agent - Swarms -- TGCS
upload_time2024-09-21 18:01:21
maintainerNone
docs_urlNone
authorKye Gomez
requires_python<4.0,>=3.10
licenseMIT
keywords artificial intelligence deep learning optimizers prompt engineering
VCS
bugtrack_url
requirements swarms loguru pydantic yfinance
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Tickr Agent by TGSC


[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)


[![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green)](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:

```bash
$ pip3 install -U tickr-agent
```

## Envs
In your `.env` file you need 

```
WORKSPACE_DIR=""
OPENAI_API_KEY=""

```

## Getting Started

### Basic Example: Running Financial Analysis on a Single Stock

```python
from tickr_agent.main import TickrAgent
from loguru import logger

# Example Usage
# Define stock tickers
stocks = ["NVDA", "CEG"]

# Run the financial analysis and save to JSON
# result = run_financial_analysis(stocks, output_file)
agent = TickrAgent(
    stocks=stocks,
    max_loops=1,
    workers=10,
    retry_attempts=1,
    context_length=16000,
)

result = agent.run("Conduct an analysis on this stock and show me if it's a buy or not and why")

# Output the result
print(result)

```

### 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

```python
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](LICENSE) file for details.

## Contact

Join our discord for real-time support or email me at kye@swarms.world


# Todo

- [ ] Implement a better prompt with instructions and multi-shot examples
- [ ] Implement more stock data and or richer financial calculations
- [ ] Implement a multi-agent implementation to predict stock price will go up or down


# License
MIT
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/The-Swarm-Corporation/TickrAgent",
    "name": "tickr-agent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "artificial intelligence, deep learning, optimizers, Prompt Engineering",
    "author": "Kye Gomez",
    "author_email": "kye@apac.ai",
    "download_url": "https://files.pythonhosted.org/packages/92/e9/5d4638e9337c39dcbccbddcc3bb2241e8cae369fe6855e1345364d3a48f4/tickr_agent-0.1.0.tar.gz",
    "platform": null,
    "description": "# Tickr Agent by TGSC\n\n\n[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)\n\n\n[![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/)\n[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n\n\n`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.\n\nWith `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.\n\n## Key Features\n\n- **Multithreaded Stock Data Fetching**: Retrieve and analyze financial data for multiple stocks concurrently for faster performance.\n- **Advanced Logging**: Built with `loguru`, offering superior logging capabilities for debugging, auditing, and monitoring.\n- **Enterprise-Ready**: Production-grade, modular design, and scalable for high-performance environments.\n- **AI-Integrated**: Leverage OpenAI models to generate comprehensive financial analysis and predictions based on real-time stock data.\n- **Pydantic Validation**: Ensures reliable and validated stock data, minimizing errors in data processing.\n\n## Installation\n\nTo install `tickr-agent`, simply run:\n\n```bash\n$ pip3 install -U tickr-agent\n```\n\n## Envs\nIn your `.env` file you need \n\n```\nWORKSPACE_DIR=\"\"\nOPENAI_API_KEY=\"\"\n\n```\n\n## Getting Started\n\n### Basic Example: Running Financial Analysis on a Single Stock\n\n```python\nfrom tickr_agent.main import TickrAgent\nfrom loguru import logger\n\n# Example Usage\n# Define stock tickers\nstocks = [\"NVDA\", \"CEG\"]\n\n# Run the financial analysis and save to JSON\n# result = run_financial_analysis(stocks, output_file)\nagent = TickrAgent(\n    stocks=stocks,\n    max_loops=1,\n    workers=10,\n    retry_attempts=1,\n    context_length=16000,\n)\n\nresult = agent.run(\"Conduct an analysis on this stock and show me if it's a buy or not and why\")\n\n# Output the result\nprint(result)\n\n```\n\n### How It Works\n\n1. **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.\n  \n2. **Multithreading**: Multiple stock tickers are processed concurrently using Python\u2019s `ThreadPoolExecutor`, ensuring high performance and efficiency.\n  \n3. **Data Validation**: Each piece of stock data is validated using `pydantic`, ensuring the reliability of the data processed.\n\n4. **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.\n\n## Enterprise Use Case: Swarms of Financial Agents\n\nFor 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.\n\n### Example: Running a Swarm of Agents for Multiple Stocks\n\n```python\nfrom tickr_agent.main import TickrAgent\nfrom loguru import logger\n\n# Example Usage\nif __name__ == \"__main__\":\n    try:\n        # Define multiple stock tickers\n        stocks = [\"AAPL\", \"GOOGL\", \"MSFT\", \"TSLA\", \"AMZN\"]\n\n        # Initialize the agent for multi-stock analysis\n        agent = TickrAgent(\n            stocks=stocks,\n            max_loops=2,          # Increased loops for more in-depth analysis\n            workers=20,           # Number of threads for concurrent execution\n            retry_attempts=2,      # Retry logic for reliability\n            context_length=32000,  # Maximum context length for AI models\n        )\n\n        # Run the financial analysis\n        result = agent.run(\"Provide a detailed financial health report for the selected stocks.\")\n\n        # Output the result\n        print(result)\n\n    except Exception as e:\n        logger.critical(f\"Critical error in financial agent execution: {e}\")\n```\n\n### Advanced Customization\n\n`tickr-agent` can be customized based on your enterprise needs, including:\n\n- **Custom AI Models**: Integrate custom models or fine-tuned versions of GPT for industry-specific insights.\n- **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.\n- **Scalable Architecture**: Deploy swarms of agents in cloud environments, utilizing Kubernetes or Docker for containerized scaling.\n\n## Logging and Monitoring\n\n`tickr-agent` uses `loguru` for logging, providing robust, enterprise-grade logging capabilities:\n\n- **File Rotation**: Log files are rotated automatically after reaching 1 MB in size.\n- **Detailed Error Tracking**: Comprehensive error logging, including stack traces and timestamps, ensures that failures are easily traceable.\n- **Custom Log Levels**: Adjust the verbosity of logs as needed (`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`).\n\nLogs are saved to `financial_agent_log.log` by default. Customize the logging configuration to integrate with your enterprise logging systems.\n\n## Contributing\n\nContributions 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.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nJoin our discord for real-time support or email me at kye@swarms.world\n\n\n# Todo\n\n- [ ] Implement a better prompt with instructions and multi-shot examples\n- [ ] Implement more stock data and or richer financial calculations\n- [ ] Implement a multi-agent implementation to predict stock price will go up or down\n\n\n# License\nMIT",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Tickr Agent - Swarms -- TGCS",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/The-Swarm-Corporation/TickrAgent",
        "Homepage": "https://github.com/The-Swarm-Corporation/TickrAgent",
        "Repository": "https://github.com/The-Swarm-Corporation/TickrAgent"
    },
    "split_keywords": [
        "artificial intelligence",
        " deep learning",
        " optimizers",
        " prompt engineering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6901e05e4a8d5140d67cb8c8c38b74afa120c4377a4f1c9aa1156493ae66edbd",
                "md5": "ad2f78d1e0c2ed05635d84b5c1a19c45",
                "sha256": "f66dd9c6cadd48f949001ba99f97575e36423558be5e69c37a0f40b37bba1aac"
            },
            "downloads": -1,
            "filename": "tickr_agent-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ad2f78d1e0c2ed05635d84b5c1a19c45",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 13764,
            "upload_time": "2024-09-21T18:01:19",
            "upload_time_iso_8601": "2024-09-21T18:01:19.346615Z",
            "url": "https://files.pythonhosted.org/packages/69/01/e05e4a8d5140d67cb8c8c38b74afa120c4377a4f1c9aa1156493ae66edbd/tickr_agent-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92e95d4638e9337c39dcbccbddcc3bb2241e8cae369fe6855e1345364d3a48f4",
                "md5": "bd5764d7af8fa88dc81d32a3c28e2024",
                "sha256": "5a2e2c2a6a115e7494c3f059273cfbb450957c8177e9a03e305469c5944e9a39"
            },
            "downloads": -1,
            "filename": "tickr_agent-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bd5764d7af8fa88dc81d32a3c28e2024",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 14738,
            "upload_time": "2024-09-21T18:01:21",
            "upload_time_iso_8601": "2024-09-21T18:01:21.011908Z",
            "url": "https://files.pythonhosted.org/packages/92/e9/5d4638e9337c39dcbccbddcc3bb2241e8cae369fe6855e1345364d3a48f4/tickr_agent-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-21 18:01:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "The-Swarm-Corporation",
    "github_project": "TickrAgent",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "swarms",
            "specs": []
        },
        {
            "name": "loguru",
            "specs": []
        },
        {
            "name": "pydantic",
            "specs": []
        },
        {
            "name": "yfinance",
            "specs": []
        }
    ],
    "lcname": "tickr-agent"
}
        
Elapsed time: 0.35083s