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 main entry point for programmatic use. It initialises the
LLMs, builds the LangGraph workflow, and exposes a single .graph.invoke() call
that accepts your OHLCV data and returns a complete analysis state.
Installation check
Confirm the package is importable before writing integration code:ImportError, ensure you have activated the project’s conda
environment and installed all dependencies (pip install -r requirements.txt).
Initialising TradingGraph
TradingGraph falls back to DEFAULT_CONFIG from
default_config.py and reads the API key from the OPENAI_API_KEY environment
variable.
Building the initial state
The graph expects a dictionary with the following keys:| Key | Type | Description |
|---|---|---|
kline_data | dict | OHLCV data with keys Datetime, Open, High, Low, Close — each a list of scalar values. |
analysis_results | None | Set to None on first invocation; the graph populates this field. |
messages | list | Empty list []; used internally by the agent message passing layer. |
time_frame | str | Human-readable timeframe label, e.g. "4hour", "1min", "1 week". |
stock_name | str | Display name of the asset, e.g. "BTC" or "S&P 500". |
Preparing kline_data from a DataFrame
The web interface usespandas DataFrames fetched from Yahoo Finance. Convert
your own DataFrame to the required dict format like this:
The pipeline analyses the most recent 45 candles. Passing significantly
fewer candles may reduce indicator accuracy; passing more is unnecessary as
the web interface already slices to 45.
Running analysis and reading results
Result fields
| Field | Type | Contents |
|---|---|---|
final_trade_decision | str | JSON string with decision (LONG/SHORT), risk_reward_ratio, forecast_horizon, and justification. |
indicator_report | str | Free-text summary of RSI, MACD, Stochastic, and other indicator values. |
pattern_report | str | Plain-language description of the detected chart pattern. |
trend_report | str | Trend direction, channel slope, ADX reading, and consolidation assessment. |
Updating API keys at runtime
You can rotate or set an API key on an existingTradingGraph instance without
recreating it. This is equivalent to what the web interface does when you save a
key in the Settings panel:
update_api_key() writes the key to both the config dict and the corresponding
environment variable (OPENAI_API_KEY, ANTHROPIC_API_KEY, or
DASHSCOPE_API_KEY), then calls refresh_llms() to rebuild the LLM objects
and recompile the graph.