Loading repository data…
Loading repository data…
The-Swarm-Corporation / repository
tickr-agent is an enterprise-ready, scalable Python library for building swarms of financial agents that conduct comprehensive stock analysis and produce insights.
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.
loguru, offering superior logging capabilities for debugging, auditing, and monitoring.To install tickr-agent, simply run:
$ pip3 install -U tickr-agent
In your .env file you need
WORKSPACE_DIR=""
OPENAI_API_KEY=""
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)
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.
Multithreading: Multiple stock tickers are processed concurrently using Python’s ThreadPoolExecutor, ensuring high performance and efficiency.
Data Validation: Each piece of stock data is validated using pydantic, ensuring the reliability of the data processed.
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.
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.
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}")
tickr-agent can be customized based on your enterprise needs, including:
tickr-agent as part of a larger financial data pipeline, feeding real-time stock analysis into dashboards, reporting systems, or decision-making tools.tickr-agent uses loguru for logging, providing robust, enterprise-grade logging capabilities:
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.
docker build -t tickr-agent-api .
docker run -d -p 8000:8000 tickr-agent-api
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.
This project is licensed under the MIT License. See the LICENSE file for details.
Join our discord for real-time support or email me at kye@swarms.world
MIT