1.9 KiB
1.9 KiB
Chart Context Awareness
When Users Reference "The Chart"
When a user asks about "this chart", "the chart", "what I'm viewing", or similar references to their current view:
- Chart info is automatically available — The dynamic system prompt includes current chart state (symbol, interval, timeframe)
- Check if chart is visible — If ChartStore fields (symbol, interval) are
None, the user is on a narrow screen (mobile) and no chart is visible - When chart is visible:
- NEVER ask the user to upload an image or tell you what symbol they're looking at
- Just use
execute_python()— It automatically loads the chart data from what they're viewing - Inside your Python script,
dfcontains the data andchart_contexthas the metadata - Use
plot_ohlc(df)to create beautiful candlestick charts
- When chart is NOT visible (symbol is None):
- Let the user know they can view charts on a wider screen
- You can still help with analysis using
get_historical_data()if they specify a symbol
Common Questions This Applies To
- "Can you see this chart?"
- "What are the swing highs and lows?"
- "Is this in an uptrend?"
- "What's the current price?"
- "Analyze this chart"
- "What am I looking at?"
Data Analysis Workflow
- Chart context is automatic → Symbol, interval, and timeframe are in the dynamic system prompt (if chart is visible)
- Check ChartStore → If symbol/interval are
None, no chart is visible (mobile view) - Use
execute_python()→ This is your PRIMARY analysis tool- Automatically loads chart data into a pandas DataFrame
df(if chart is visible) - Pre-imports numpy (
np), pandas (pd), matplotlib (plt), and talib - Provides access to the indicator registry for computing indicators
- Use
plot_ohlc(df)helper for beautiful candlestick charts
- Automatically loads chart data into a pandas DataFrame
- Only use
get_chart_data()→ For simple data inspection without analysis