Fei Xiong1,2 ★ Xiang Zhang3 ★ Aosong Feng4 Siqi Sun5 Chenyu You1
1 Stony Brook University
2 Carnegie Mellon University
3 University of British Columbia
4 Yale University
5 Fudan University
★ Equal Contribution
A sophisticated multi-agent trading analysis system that combines technical indicators, pattern recognition, and trend analysis using LangChain and LangGraph. The system provides both a web interface and programmatic access for comprehensive market analysis.
🚀 Features | ⚡ Installation | 🎬 Usage | 🔧 Implementation Details | 🤝 Contributing | 📄 License
• Computes five technical indicators—including RSI to assess momentum extremes, MACD to quantify convergence–divergence dynamics, and the Stochastic Oscillator to measure closing prices against recent trading ranges—on each incoming K‑line, converting raw OHLC data into precise, signal-ready metrics.
• Upon a pattern query, the Pattern Agent first uses the agent draws the recent price chart, spots its main highs, lows, and general up‑or‑down moves, compares that shape to a set of familiar patterns, and returns a short, plain‑language description of the best match.
• Leverages tool-generated annotated K‑line charts overlaid with fitted trend channels—upper and lower boundary lines tracing recent highs and lows—to quantify market direction, channel slope, and consolidation zones, then delivers a concise, professional summary of the prevailing trend.
• Synthesizes outputs from the Indicator, Pattern, Trend, and Risk agents—including momentum metrics, detected chart formations, channel analysis, and risk–reward assessments—to formulate actionable trade directives, clearly specifying LONG or SHORT positions, recommended entry and exit points, stop‑loss thresholds, and concise rationale grounded in each agent’s findings.
Modern Flask-based web application with:
- Real-time market data from Yahoo Finance
- Interactive asset selection (stocks, crypto, commodities, indices)
- Multiple timeframe analysis (1m to 1d)
- Dynamic chart generation
- API key management
conda create -n quantagents python=3.10
conda activate quantagentspip install -r requirements.txtIf you encounter issues with TA-lib-python, try
conda install -c conda-forge ta-libOr visit the TA-Lib Python repository for detailed installation instructions.
You can set it in our Web InterFace Later,

Or set it as an environment variable:
export OPENAI_API_KEY="your_api_key_here"python web_interface.pyThe web application will be available at http://127.0.0.1:5000
- Asset Selection: Choose from available stocks, crypto, commodities, and indices
- Timeframe Selection: Analyze data from 1-minute to daily intervals
- Date Range: Select custom date ranges for analysis
- Real-time Analysis: Get comprehensive technical analysis with visualizations
- API Key Management: Update your OpenAI API key through the interface
Important Note: Our model requires an LLM that can take images as input, as our agents generate and analyze visual charts for pattern recognition and trend analysis.
To use QuantAgents inside your code, you can import the trading_graph module and initialize a TradingGraph() object. The .invoke() function will return a comprehensive analysis. You can run web_interface.py, here's also a quick example:
from trading_graph import TradingGraph
# Initialize the trading graph
trading_graph = TradingGraph()
# Create initial state with your data
initial_state = {
"kline_data": your_dataframe_dict,
"analysis_results": None,
"messages": [],
"time_frame": "4hour",
"stock_name": "BTC"
}
# Run the analysis
final_state = trading_graph.graph.invoke(initial_state)
# Access results
print(final_state.get("final_trade_decision"))
print(final_state.get("indicator_report"))
print(final_state.get("pattern_report"))
print(final_state.get("trend_report"))You can also adjust the default configuration to set your own choice of LLMs, analysis parameters, etc.
from trading_graph import TradingGraph
from default_config import DEFAULT_CONFIG
# Create a custom config
config = DEFAULT_CONFIG.copy()
config["agent_llm_model"] = "gpt-4o-mini" # Use a different model for agents
config["graph_llm_model"] = "gpt-4o" # Use a different model for graph logic
config["agent_llm_temperature"] = 0.2 # Adjust creativity level for agents
config["graph_llm_temperature"] = 0.1 # Adjust creativity level for graph logic
# Initialize with custom config
trading_graph = TradingGraph(config=config)
# Run analysis with custom configuration
final_state = trading_graph.graph.invoke(initial_state)For live data, we recommend using the web interface as it provides access to real-time market data through yfinance. The system automatically fetches the most recent 30 candlesticks for optimal LLM analysis accuracy.
The system supports the following configuration parameters:
agent_llm_model: Model for individual agents (default: "gpt-4o-mini")graph_llm_model: Model for graph logic and decision making (default: "gpt-4o")agent_llm_temperature: Temperature for agent responses (default: 0.1)graph_llm_temperature: Temperature for graph logic (default: 0.1)
Note: The system uses default token limits for comprehensive analysis. No artificial token restrictions are applied.
You can view the full list of configurations in default_config.py.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
@article{xiong2025quantagent,
title={QuantAgent: Price-Driven Multi-Agent LLMs for High-Frequency Trading},
author={Fei Xiong and Xiang Zhang and Aosong Feng and Siqi Sun and Chenyu You},
journal={arXiv preprint arXiv:2509.09995},
year={2025}
}
This repository was built off of LangGraph, OpenAI, yfinance, Flask, TechnicalAnalysisAutomation and tvdatafeed.
This software is for educational and research purposes only. It is not intended to provide financial advice. Always do your own research and consider consulting with a financial advisor before making investment decisions.
-
TA-Lib Installation: If you encounter TA-Lib installation issues, refer to the official repository for platform-specific instructions.
-
OpenAI API Key: Ensure your API key is properly set in the environment or through the web interface.
-
Data Fetching: The system uses Yahoo Finance for data. Some symbols might not be available or have limited historical data.
-
Memory Issues: For large datasets, consider reducing the analysis window or using a smaller timeframe.
If you encounter any issues, please:
- Check the troubleshooting section above
- Review the error messages in the console
- Ensure all dependencies are properly installed
- Verify your OpenAI API key is valid and has sufficient credits
For questions, feedback, or collaboration opportunities, please contact:
Email: [email protected], [email protected]





