Skip to content

Commit

Permalink
[README]
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 16, 2024
1 parent 1569359 commit 917b448
Show file tree
Hide file tree
Showing 76 changed files with 545 additions and 5,590 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
.vscode

# Distribution / packaging
agent_workspace
.Python
build/
develop-eggs/
Expand Down
13 changes: 0 additions & 13 deletions .readthedocs.yml

This file was deleted.

25 changes: 0 additions & 25 deletions Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions Makefile

This file was deleted.

140 changes: 108 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,143 @@
[![Multi-Modality](agorabanner.png)](https://discord.com/servers/agora-999382051935506503)

# Python Package Template
# Tickr Agent


[![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)

A easy, reliable, fluid template for python packages complete with docs, testing suites, readme's, github workflows, linting and much much more

[![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

You can install the package using pip
To install `tickr-agent`, simply run:

```bash
pip install -e .
$ pip3 install -U tickr-agent
```

# Usage
```python
print("hello world")
## Getting Started

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

```python
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.

### Code Quality 🧹
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.

- `make style` to format the code
- `make check_code_quality` to check code quality (PEP8 basically)
- `black .`
- `ruff . --fix`
## Enterprise Use Case: Swarms of Financial Agents

### Tests 🧪
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.

[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests.
### Example: Running a Swarm of Agents for Multiple Stocks

### Publish on PyPi 🚀
```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}")
```

**Important**: Before publishing, edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version.
### Advanced Customization

```
poetry build
poetry publish
```
`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:

### CI/CD 🤖
- **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`).

We use [GitHub actions](https://github.com/features/actions) to automatically run tests and check code quality when a new PR is done on `main`.
Logs are saved to `financial_agent_log.log` by default. Customize the logging configuration to integrate with your enterprise logging systems.

On any pull request, we will check the code quality and tests.
## Contributing

When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier.
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.

The **correct steps** to create a new realease are the following:
- edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version.
- create a new [`tag`](https://git-scm.com/docs/git-tag) with the release name, e.g. `git tag v0.0.1 && git push origin v0.0.1` or from the GitHub UI.
- create a new release from GitHub UI
## License

The CI will run when you create the new release.
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

# Docs
We use MK docs. This repo comes with the zeta docs. All the docs configurations are already here along with the readthedocs configs.
## Contact

Join our discord for real-time support or email me


# License
MIT
MIT
Binary file removed agorabanner.png
Binary file not shown.
Binary file removed docs/.DS_Store
Binary file not shown.
42 changes: 0 additions & 42 deletions docs/applications/customer_support.md

This file was deleted.

Empty file removed docs/applications/enterprise.md
Empty file.
64 changes: 0 additions & 64 deletions docs/applications/marketing_agencies.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/architecture.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/assets/css/extra.css

This file was deleted.

Binary file removed docs/assets/img/SwarmsLogoIcon.png
Binary file not shown.
Binary file removed docs/assets/img/swarmsbanner.png
Binary file not shown.
Binary file removed docs/assets/img/tools/output.png
Binary file not shown.
Binary file removed docs/assets/img/tools/poetry_setup.png
Binary file not shown.
Binary file removed docs/assets/img/tools/toml.png
Binary file not shown.
Binary file removed docs/assets/img/zetascale.png
Binary file not shown.
Loading

0 comments on commit 917b448

Please sign in to comment.