Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kyegomez authored Sep 26, 2024
1 parent dd8a8a1 commit 65da69e
Showing 1 changed file with 93 additions and 34 deletions.
127 changes: 93 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,126 @@
[![Multi-Modality](agorabanner.png)](https://discord.com/servers/agora-999382051935506503)

# Python Package Template
# CryptoAgent: Real-Time Cryptocurrency Data Analysis 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

CryptoAgent is a professional, enterprise-grade solution designed to fetch, analyze, and summarize real-time cryptocurrency data. It integrates with CoinGecko's API to retrieve the latest crypto metrics and leverages OpenAI's advanced language model to generate insightful, concise reports tailored for crypto investors and financial analysts.

## Key Features

- **Real-Time Data Fetching**: Retrieves live cryptocurrency data, including current price, market capitalization, trading volume, supply details, and recent price changes.
- **Advanced Analysis**: Summarizes complex crypto data into clear, actionable insights, allowing users to stay informed on key market trends.
- **Enterprise-Grade Reliability**: Built with robust error handling, retries, and logging to ensure uninterrupted data retrieval and analysis.
- **Customizable Reports**: Designed to provide tailored insights based on user requirements, making it suitable for investors, traders, and analysts.

## Use Cases

- **Market Monitoring**: Track real-time prices and key metrics for any cryptocurrency.
- **Investment Research**: Generate comprehensive reports on specific coins, including trends, market sentiment, and price changes.
- **Financial Analysis**: Use CryptoAgent to analyze large volumes of crypto data, summarize trends, and provide strategic insights.

## Installation

You can install the package using pip
```

```bash
pip install -e .
```
## Components Overview

### 1. **CryptoTool**
`CryptoTool` integrates with CoinGecko's API to fetch real-time cryptocurrency data. It provides detailed information such as:

- Current price
- Market capitalization
- 24-hour trading volume
- Circulating and total supply
- Price changes over 24 hours

Example of fetching data for a cryptocurrency:

# Usage
```python
print("hello world")
crypto_tool = CryptoTool()
crypto_data = crypto_tool.get_crypto_data("bitcoin")
```

### 2. **CryptoAnalysisAgent**
`CryptoAnalysisAgent` is the core component that combines data fetching with advanced analysis. It generates custom prompts for OpenAI's GPT-4 model, enabling deeper insights into the fetched data.

Example of running the agent:

```python
agent = CryptoAnalysisAgent(
agent_name="Crypto-Analysis-Agent",
system_prompt=CRYPTO_AGENT_SYS_PROMPT,
llm=model
)

# Fetch and analyze Bitcoin data
response = agent.run("Analyze the recent price changes and trends of Bitcoin.", "bitcoin")
print(response)
```

### 3. **Loguru for Logging**
The `loguru` library is integrated for real-time logging, making it easy to trace operations, handle errors, and ensure transparency in the data pipeline.

Example of error handling:

### Code Quality 🧹
```python
try:
response = requests.get(self.api_url, params=params)
response.raise_for_status()
except requests.RequestException as e:
logger.error(f"Error fetching crypto data: {e}")
```

- `make style` to format the code
- `make check_code_quality` to check code quality (PEP8 basically)
- `black .`
- `ruff . --fix`
## System Architecture

### Tests 🧪
CryptoAgent follows a modular architecture:

[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests.
- **CryptoTool** handles all interactions with the CoinGecko API.
- **CryptoAnalysisAgent** performs the crypto analysis by combining data fetched from the API with OpenAI's powerful language models.
- **Agent Framework**: The agent architecture, powered by `swarms`, ensures flexibility, scalability, and reliability for enterprise deployments.

### Publish on PyPi 🚀
## Enterprise-Grade Features

**Important**: Before publishing, edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version.
- **Scalability**: Easily integrates into larger infrastructures for monitoring hundreds of cryptocurrencies simultaneously.
- **Error Handling and Retries**: Built-in mechanisms for handling API failures and retrying failed requests ensure uninterrupted service.
- **Customization**: Modify the system prompt to tailor the analysis to specific use cases, whether it’s for a hedge fund, a financial institution, or individual investors.
- **Security**: Sensitive API keys and environment variables are securely managed via `.env` and best practices for API management.

```
poetry build
poetry publish
```
## Getting Started

### CI/CD 🤖
1. **Prerequisites**: Ensure you have Python 3.8+ installed.
2. **API Access**: You’ll need an OpenAI API key to interact with the model.
3. **Run the Agent**: Follow the instructions in the [Installation](#installation) section to set up and run CryptoAgent.

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`.
## Sample Output

On any pull request, we will check the code quality and tests.
```text
Coin: Bitcoin (BTC)
Current Price: $45,320.12
Market Cap: $853,000,000,000
24h Trading Volume: $32,000,000,000
Circulating Supply: 18,700,000 BTC
Total Supply: N/A
Price Change (24h): +4.2%
Analysis: Bitcoin has seen a significant price increase of 4.2% over the past 24 hours, driven by increased trading volume. The market cap remains strong, reflecting continued investor confidence.
```

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.
## Future Enhancements

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
- **Multi-Coin Analysis**: Enable simultaneous analysis of multiple cryptocurrencies for portfolio managers.
- **Sentiment Analysis**: Incorporate social media and news sentiment analysis into the crypto reports.
- **Predictive Analytics**: Add a layer of predictive insights using historical data to forecast market trends.

## Contributing

The CI will run when you create the new release.
We welcome contributions from the community! Please follow our [contribution guidelines](CONTRIBUTING.md) and submit pull requests.

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

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contact

# License
MIT
For enterprise inquiries, custom deployments, or support, please contact [support@cryptoagent.io](mailto:support@cryptoagent.io).

0 comments on commit 65da69e

Please sign in to comment.