> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chicago.global/llms.txt
> Use this file to discover all available pages before exploring further.

# Technical Analysis

> Get AI-powered technical analysis including trend analysis, momentum indicators (RSI, MACD), support/resistance levels, volume analysis, and volatility assessment. This endpoint uses async job processing - submit your request, receive a job ID, then poll for results.

## How It Works

This endpoint uses **async job processing** for AI-powered technical analysis:

1. **Submit Request**: POST with stock symbol as query parameter
2. **Receive Job ID**: Get a job ID and polling URL immediately
3. **Poll for Status**: Check `/v1/jobs/{job_id}` until status is `completed`
4. **Get Analysis**: The completed job contains comprehensive technical analysis

<Note>
  Analysis typically takes 15-30 seconds. Results are cached daily - subsequent requests return cached analysis instantly.
</Note>

## Query Parameters

| Parameter | Type    | Required | Default | Description                                       |
| --------- | ------- | -------- | ------- | ------------------------------------------------- |
| `symbol`  | string  | Yes      | -       | Stock symbol (e.g., AAPL.O for Apple Inc)         |
| `force`   | boolean | No       | `false` | Force regeneration even if cached analysis exists |

<Warning>
  If `force` is `false` and analysis was generated today, the cached result will be returned.
</Warning>

## Response (202 Accepted)

```json theme={null}
{
  "job_id": "tech-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "status": "pending",
  "symbol": "AAPL.O",
  "force": false,
  "check_url": "/v1/jobs/tech-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "estimated_duration_seconds": 30,
  "message": "Technical analysis started for AAPL.O."
}
```

## Completed Response

When the job completes, `GET /v1/jobs/{job_id}` returns:

```json theme={null}
{
  "job_id": "tech-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "job_type": "technical_analysis",
  "status": "completed",
  "result": {
    "symbol": "AAPL.O",
    "executive_summary": "AAPL trading at $178.52, down 1.2% from 5-day high. RSI at 52 (neutral), MACD showing bearish crossover. Short-term consolidation within broader uptrend.",

    "technical_analysis": {
      "trend_analysis": "Price 2.3% above SMA50 ($174.52) and 8.1% above SMA200 ($165.12). 30-day trend bullish with higher lows.",

      "momentum_indicators": "RSI at 52.3 (neutral zone). MACD histogram negative at -0.42, signal line crossover occurred 2 days ago indicating short-term weakness.",

      "price_action": "Trading between support at $175.20 (1.9% below) and resistance at $182.50 (2.2% above). Key breakout level at $183.",

      "volume_analysis": "Volume at 0.85x 30-day average. Declining volume on recent pullback suggests lack of selling conviction.",

      "volatility_assessment": "ATR at 2.1% of price. Trading in middle of Bollinger Bands, indicating normal volatility conditions."
    },

    "risk_assessment": {
      "volatility_level": "Moderate volatility with 2.1% daily ATR, typical for large-cap tech.",
      "risk_factors": "Key stop level at $174.50 (SMA50). Watch for breakdown below $172 which would signal trend reversal."
    }
  }
}
```

## Response Fields

| Field                                      | Description                                                            |
| ------------------------------------------ | ---------------------------------------------------------------------- |
| `executive_summary`                        | 2-3 sentence overview with price, key indicators, and directional bias |
| `technical_analysis.trend_analysis`        | Price vs moving averages, trend direction                              |
| `technical_analysis.momentum_indicators`   | RSI, MACD readings and interpretation                                  |
| `technical_analysis.price_action`          | Support/resistance levels, key price zones                             |
| `technical_analysis.volume_analysis`       | Volume patterns and implications                                       |
| `technical_analysis.volatility_assessment` | ATR, Bollinger Bands, volatility level                                 |
| `risk_assessment.volatility_level`         | Volatility classification                                              |
| `risk_assessment.risk_factors`             | Key risk levels and stop-loss guidance                                 |

## Example: Polling for Results

```javascript theme={null}
const response = await fetch(
  'https://api.chicago.global/v1/technical-analysis?symbol=AAPL.O',
  {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  }
);

const { job_id } = await response.json();

// Poll every 5 seconds
const interval = setInterval(async () => {
  const status = await fetch(
    `https://api.chicago.global/v1/jobs/${job_id}`,
    { headers: { 'Authorization': `Bearer ${API_KEY}` } }
  ).then(r => r.json());

  if (status.status === 'completed') {
    clearInterval(interval);
    console.log('Summary:', status.result.executive_summary);
    console.log('Trend:', status.result.technical_analysis.trend_analysis);
  } else if (status.status === 'failed') {
    clearInterval(interval);
    console.error('Failed:', status.error);
  }
}, 5000);
```

## Error Responses

| Status | Description                |
| ------ | -------------------------- |
| 401    | Invalid or missing API key |
| 500    | Failed to create job       |


## OpenAPI

````yaml POST /v1/technical-analysis
openapi: 3.1.0
info:
  title: Parallax API
  description: >-
    Financial data and portfolio analytics API. Analyze portfolios with
    multi-currency support, rebalancing, and comprehensive metrics.
  version: 1.0.0
servers:
  - url: https://api.chicago.global
security:
  - bearerAuth: []
paths:
  /v1/technical-analysis:
    post:
      tags:
        - Analysis
      summary: Technical Analysis
      description: >-
        Get AI-powered technical analysis including trend analysis, momentum
        indicators (RSI, MACD), support/resistance levels, volume analysis, and
        volatility assessment. This endpoint uses async job processing - submit
        your request, receive a job ID, then poll for results.
      operationId: technicalAnalysis
      parameters:
        - name: symbol
          in: query
          required: true
          description: Stock symbol (e.g., AAPL.O for Apple Inc)
          schema:
            type: string
          example: AAPL.O
        - name: force
          in: query
          required: false
          description: Force regeneration even if cached analysis exists
          schema:
            type: boolean
            default: false
      responses:
        '202':
          description: Job created successfully. Poll the check_url for results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TechnicalAnalysisJobResponse'
              example:
                job_id: tech-a3522a92-87ed-4be0-a912-ad56ed6a8806
                status: pending
                symbol: AAPL.O
                force: false
                check_url: /v1/jobs/tech-a3522a92-87ed-4be0-a912-ad56ed6a8806
                estimated_duration_seconds: 30
                message: Technical analysis started for AAPL.O.
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TechnicalAnalysisJobResponse:
      type: object
      properties:
        job_id:
          type: string
          description: Unique job identifier
        status:
          type: string
          enum:
            - pending
          description: Initial job status
        symbol:
          type: string
          description: Stock symbol being analyzed
        force:
          type: boolean
          description: Whether force regeneration was requested
        check_url:
          type: string
          description: URL to poll for job status
        estimated_duration_seconds:
          type: integer
          description: Estimated processing time in seconds
        message:
          type: string
          description: Human-readable status message
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Error message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key passed as Bearer token

````