Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Y-Research-SBU/QuantAgent/llms.txt
Use this file to discover all available pages before exploring further.
TradingGraph is the top-level entry point for running QuantAgent analysis. It initializes the language models, the TechnicalTools toolkit, and the compiled LangGraph StateGraph that wires together the Indicator, Pattern, Trend, and Decision agents.
Constructor
Optional configuration dictionary. When
None, DEFAULT_CONFIG is used. Accepts the following keys:| Key | Type | Default | Description |
|---|---|---|---|
agent_llm_provider | str | "openai" | Provider for per-agent LLMs ("openai", "anthropic", or "qwen"). |
agent_llm_model | str | "gpt-4o-mini" | Model name for the agent LLM. |
agent_llm_temperature | float | 0.1 | Sampling temperature for the agent LLM. |
graph_llm_provider | str | "openai" | Provider for the vision/graph LLM. |
graph_llm_model | str | "gpt-4o" | Model name for the graph LLM. Must be vision-capable. |
graph_llm_temperature | float | 0.1 | Sampling temperature for the graph LLM. |
api_key | str | — | OpenAI API key. Falls back to OPENAI_API_KEY env var. |
anthropic_api_key | str | — | Anthropic API key. Falls back to ANTHROPIC_API_KEY env var. |
qwen_api_key | str | — | Qwen (DashScope) API key. Falls back to DASHSCOPE_API_KEY env var. |
graph_llm_model must be a vision-capable model. The Pattern and Trend agents pass base64-encoded chart images to this LLM for visual analysis.Attributes
| Attribute | Type | Description |
|---|---|---|
config | dict | Active configuration dictionary. |
agent_llm | BaseChatModel | LLM instance used by the Pattern and Trend agents for the tool-dispatch step (chart generation). |
graph_llm | BaseChatModel | Primary LLM instance used by the Indicator agent (tool calling and report), the Pattern and Trend agents (vision analysis), and the Decision agent (trade synthesis). Must be vision-capable. |
toolkit | TechnicalTools | Toolkit providing all indicator and charting tools. |
graph | CompiledStateGraph | The compiled LangGraph graph. Call .invoke() on this to run a full analysis. |
graph.invoke(initial_state)
Runs all four agents in sequence (Indicator → Pattern → Trend → Decision) and returns the completed state dictionary.
Parameters
The starting state passed into the graph. Required keys:
Return value
Returns the finalIndicatorAgentState dictionary. Key output fields:
JSON string containing the trade decision. Fields:
forecast_horizon, decision (LONG or SHORT), justification, and risk_reward_ratio.Narrative report from the Indicator agent summarizing RSI, MACD, Stochastic, ROC, and Williams %R values.
Narrative report from the Pattern agent identifying classical candlestick formations.
Narrative report from the Trend agent describing support/resistance lines and directional bias.
update_api_key(api_key, provider='openai')
Updates the API key in both self.config and the corresponding environment variable, then calls refresh_llms() to rebuild all LLM objects.
The new API key value.
The provider whose key to update. One of
"openai", "anthropic", or "qwen".refresh_llms()
Recreates agent_llm, graph_llm, the SetGraph instance, and the compiled graph from the current self.config. Call this after manually modifying self.config to apply the changes.