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.
$ pip3 install -U cryptoagent
Create a .env file and place your keys inside
WORKSPACE_DIR=""
OPENAI_API_KEY=""
COINMARKETCAP_API_KEY=""
ETHERSCAN_KEY=""
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)
CryptoAgent follows a modular architecture:
swarms, ensures flexibility, scalability, and reliability for enterprise deployments..env and best practices for API management.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.
We welcome contributions from the community! Please follow our contribution guidelines and submit pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
For enterprise inquiries, custom deployments, or support, please contact kye@swarms.world.
$ claude mcp add CryptoAgent \
-- python -m otcore.mcp_server <graph>