Skip to main content

cryptoagent - Swarms

Project description

CryptoAgent: Real-Time Cryptocurrency Data Analysis Agent

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

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

$ pip3 install -U cryptoagent

Requirements

Create a .env file and place your keys inside

WORKSPACE_DIR=""
OPENAI_API_KEY=""
COINMARKETCAP_API_KEY=""
ETHERSCAN_KEY=""

Usage

import os

from swarm_models import OpenAIChat
from swarms import Agent

from cryptoagent.main import CryptoAgent
from cryptoagent.prompts import CRYPTO_AGENT_SYS_PROMPT

# Create an instance of the OpenAIChat class for LLM integration
api_key = os.getenv("OPENAI_API_KEY")
model = OpenAIChat(
    openai_api_key=api_key, model_name="gpt-4o-mini", temperature=0.1
)

# Create the input agent
input_agent = Agent(
    agent_name="Crypto-Analysis-Agent",
    system_prompt=CRYPTO_AGENT_SYS_PROMPT,
    llm=model,
    max_loops=1,
    autosave=True,
    dashboard=False,
    verbose=True,
    dynamic_temperature_enabled=True,
    saved_state_path="crypto_agent.json",
    user_name="swarms_corp",
    retry_attempts=1,
    context_length=10000,
)

# Create CryptoAgent instance and pass the input agent
crypto_analyzer = CryptoAgent(agent=input_agent, autosave=True)

# Example coin IDs to summarize multiple coins
coin_ids = ["bitcoin", "ethereum"]

# Fetch and summarize crypto data for multiple coins in parallel
summaries = crypto_analyzer.run(
    coin_ids,
    "Conduct a thorough analysis of the following coins:",
    # real_time=True,
)

# # Print the summaries
print(summaries)

System Architecture

CryptoAgent follows a modular architecture:

  • CryptoAgentAgent 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.

Enterprise-Grade Features

  • 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.

Getting Started

  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 section to set up and run CryptoAgent.

Sample Output

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.

Future Enhancements

  • 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

We welcome contributions from the community! Please follow our contribution guidelines and submit pull requests.

License

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

Contact

For enterprise inquiries, custom deployments, or support, please contact kye@swarms.world.

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

cryptoagent-0.0.9.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

cryptoagent-0.0.9-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file cryptoagent-0.0.9.tar.gz.

File metadata

  • Download URL: cryptoagent-0.0.9.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/23.3.0

File hashes

Hashes for cryptoagent-0.0.9.tar.gz
Algorithm Hash digest
SHA256 bf0b9555c72c763d1916df3014b8985084f85f7649d32bdc8dd52eb5d71e36ba
MD5 356a30be68710bc7fb552fe8b00abc70
BLAKE2b-256 bf756962964aec3c9063ca1eae3219393a436376dd3e5748594eab1333bb093f

See more details on using hashes here.

File details

Details for the file cryptoagent-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: cryptoagent-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/23.3.0

File hashes

Hashes for cryptoagent-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 046092390d1418aa17aa8561d2007345c77b0a504ce8417be1a051fd573d68e0
MD5 e5deb4aa9671a8e1bd1105fb131abd69
BLAKE2b-256 9dd7f203815fc8aa450c73fcc4228bee64a8d7d09b6b0f98852a0411daae6229

See more details on using hashes here.

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