# Technical Analysis API

Open, no-auth technical analysis: daily and weekly indicator study of one ticker over two date ranges, computed from Yahoo Finance data and written up by an LLM.

## Quick start

One `POST`, no API key. Copy this, then change the ticker and the dates:

```
curl -X POST https://ta.tigzig.com/v1/technical-analysis -H 'Content-Type: application/json' -d '{"ticker": "AAPL", "daily_start_date": "2023-07-01", "daily_end_date": "2023-12-31", "weekly_start_date": "2022-01-01", "weekly_end_date": "2023-12-31"}'
```

## What you send

`POST /v1/technical-analysis` with a JSON body carrying `ticker`, `daily_start_date`, `daily_end_date`, `weekly_start_date` and `weekly_end_date`. The ticker follows the Yahoo Finance convention, so non-US listings carry an exchange suffix: RELIANCE.NS (India NSE), .BO (BSE), .L (London), .HK (Hong Kong), .T (Tokyo). Indices look like ^NSEI and FX like EURUSD=X. Broker, scheme or company names do not resolve. Dates are YYYY-MM-DD.

**Dates are strings, not numbers.** All four date fields must be written as `YYYY-MM-DD`. A bare number is rejected rather than guessed at: it could be a unix timestamp or a spreadsheet date serial, and guessing wrong would produce a confidently incorrect analysis while spending a paid model call on it.

## What you get back

`200` returns two URLs, `pdf_url` and `html_url`, pointing at the generated report. The analysis itself lives in those documents, not in the JSON.

## Public endpoints

`/v1/technical-analysis`. `GET /v1/` returns the discovery block, including your remaining daily budget, and is deliberately NOT rate-limited, so you can check your budget without spending any of it.

## Request limits

- This endpoint runs a **paid model on every call**, so the per-IP budget is a small **daily** allowance rather than a per-minute one.
- A run takes roughly **30 seconds**. Treat it as a slow call and set your client timeout accordingly.
- Check `X-RateLimit-Remaining` before starting a batch. On a 429, `Retry-After` gives the exact seconds until your window resets - use it rather than retrying blind.

## Errors

Every 4xx and 5xx returns `{error: {code, message}, help: {docs, openapi, catalog}}`.

Where the endpoint is known and the request shape is what failed, the body also carries an `example` - **a runnable curl** built from the request example in this spec. Copy it, run it, then adapt it.

More Tigzig tools: https://api.tigzig.com/.well-known/api-catalog

## Create Technical Analysis

`POST /v1/technical-analysis`

Generates comprehensive technical analysis reports for a specified stock ticker.

Part of Tigzig: free interactive tools, open-source repos, APIs and MCP servers for
analytics and live data across global and Indian markets, macro indicators and
filings. Catalog: https://api.tigzig.com/.well-known/api-catalog
Guide: https://www.tigzig.com/llms.txt

This endpoint performs detailed technical analysis including:
- Price trend analysis on daily and weekly timeframes
- Multiple technical indicators (EMAs, MACD, RSI, Bollinger Bands)
- Support and resistance levels
- Volume analysis
- Pattern recognition
- AI-powered market interpretation

The analysis is returned in two formats:
- PDF report with detailed analysis and charts
- Interactive HTML report for dynamic viewing

The analysis covers:
- Daily timeframe analysis (short-term trends)
- Weekly timeframe analysis (long-term trends)
- Technical indicator signals
- Volume profile analysis
- Market structure assessment
- Potential support/resistance zones

Example request:
{
    "ticker": "AAPL",
    "daily_start_date": "2023-07-01",
    "daily_end_date": "2023-12-31",
    "weekly_start_date": "2022-01-01",
    "weekly_end_date": "2023-12-31"
}

## Read Root

`GET /`

Serve the technical analysis frontend UI
