---
title: "Generate one no-trade market/signal chart PNG"
method: POST
path: "/api/agents/market-chart"
tags: ["Agent API"]
---

# Generate one no-trade market/signal chart PNG

`POST /api/agents/market-chart`

## Request

- Base URL: `https://klinepic.com`
- URL: `https://klinepic.com/api/agents/market-chart`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-KLine-Agent-Key`

Renders a single market chart with technical indicators (including the vegas profile) and optional signal annotations, without requiring paired trade records. source=auto or source=binance resolve the symbol against the local Binance instrument allowlist and fetch candles server-side; source=csv is fully deterministic using caller-supplied klineCsv candles. Costs 1 chart against the monthly quota.

## Headers

- `X-Agent-Request-Id` string

## Request body

- AgentMarketChartRequest
  - `requestId` string
  - `responseFormat` 'json' | 'png' | 'jpeg' | 'webp'
  - `includeDataUri` boolean
  - `includeSvgOverlay` boolean
  - `chart` AgentMarketChartPayload, required
    - `symbol` string, required: The instrument symbol to render. No trade records are required; this is resolved against the local Binance instrument allowlist for source=auto/binance.
    - `name` string: Optional display name shown instead of the raw symbol.
    - `market` 'crypto', required: Only crypto is currently supported for market-chart.
    - `period` '1m' | '5m' | '15m' | '30m' | '60m' | '1h' | '4h' | '1d'
    - `source` 'auto' | 'binance' | 'csv': auto and binance resolve the symbol against the local instrument allowlist and fetch candles server-side. csv is fully deterministic and requires klineCsv.
    - `klineCsv` string: Required when source=csv. CSV columns: symbol,time,open,high,low,close,volume.
    - `displayBars` integer: Number of bars to display, excluding indicator warmup.
    - `endTime` string, date-time: Optional ISO timestamp anchoring the chart window. Defaults to now. Must be 2017-01-01T00:00:00Z or later and no more than 24 hours in the future.
    - `indicatorProfile` 'standard' | 'trend' | 'momentum' | 'risk' | 'minimal' | 'vegas': Reusable named indicator combination. It fills indicatorConfig and default sub-panels unless the caller supplies raw indicatorConfig or showSubPanels.
    - `indicatorConfig` AgentIndicatorConfig
      - `ma` object[], required
        - `period` integer, required
        - `visible` boolean, required
      - `ema` object[], required
        - `period` integer, required
        - `visible` boolean, required
      - `volumeMa` object[], required
        - `period` integer, required
        - `visible` boolean, required
      - `macd` object, required
        - `fast` integer, required
        - `slow` integer, required
        - `signal` integer, required
        - `visible` boolean, required
      - `kdj` object, required
        - `n` integer, required
        - `m1` integer, required
        - `m2` integer, required
        - `visible` boolean, required
      - `rsi` object, required
        - `period` integer, required
        - `visible` boolean, required
      - `boll` object, required
        - `period` integer, required
        - `stdMult` number, required
        - `visible` boolean, required
      - `atr` object, required
        - `period` integer, required
        - `visible` boolean, required
      - `vwap` object, required
        - `anchor` 'daily' | 'holding' | 'custom', required
        - `customStart` string, date-time
        - `visible` boolean, required
    - `showSubPanels` string[]: Sub-panels to render below the main chart. Defaults from indicatorProfile.
    - `imageTheme` 'darkUs' | 'darkCn' | 'lightUs' | 'lightCn': Output image style. This controls the generated chart only, not the website light/dark mode.
    - `theme` 'darkUs' | 'darkCn' | 'lightUs' | 'lightCn': Deprecated alias for imageTheme. It is still accepted for old callers.
    - `signals` object[]: Optional annotation markers, for example strategy buy/sell/watch signals, rendered on the chart at the given time.
      - `time` string, date-time, required: ISO timestamp of the signal.
      - `price` number: Optional price to anchor the marker; defaults to the candle close at time.
      - `label` string
      - `kind` 'bullish' | 'bearish' | 'neutral'
    - `layoutPreset` 'standard' | 'compact' | 'wide' | 'square' | 'portrait' | 'mobile': standard=1280x800@2x, compact=960x600@1x, wide=1280x720@2x, square=1200x1200@1x, portrait=1200x1600@1x, mobile=1080x1920@1x. Explicit width, height, or scale wins over the preset.
    - `width` integer
    - `height` integer
    - `scale` number: PNG pixel ratio. 1280x800 with scale=2 returns a 2560x1600 PNG.
    - `locale` 'zh-CN' | 'zh-TW' | 'en-US' | 'ja-JP' | 'ko-KR': Language used for rendered chart labels and built-in watermark text.
    - `timezone` string: Optional IANA timezone used for displayed timestamps. It does not change trade math or data matching.
    - `showInfoPanel` boolean: Set false to remove the right-side summary panel and give the K-line more horizontal room.
    - `infoPanelFields` string[]: Optional allow-list for right-side summary panel metrics. Omit it to render the full panel.
    - `infoPanelMode` 'reserved' | 'overlay': reserved keeps chart space clear for the summary panel. overlay places the panel over the chart and is mainly useful for compact previews.
    - `annotationDensity` 'smart' | 'full' | 'balanced' | 'minimal' | 'none': Controls chart annotation detail. smart clusters crowded buy/sell markers, full keeps all labels, balanced keeps trade labels with less range detail, minimal keeps only markers/range, none hides SVG annotations.
    - `markerLabelTemplate` string: Optional template for buy/sell marker labels. Supported tokens: {label}, {action}, {side}, {price}, {quantity}, {tradeId}, {symbol}, {name}, {fee}, {note}. Omit it to keep the built-in localized labels.
    - `themeOverrides` AgentThemeOverrides: Hex-only color overrides. Use #RRGGBB values; arbitrary CSS strings are not accepted.
      - `background` string
      - `grid` string
      - `axis` string
      - `candleUp` string
      - `candleDown` string
      - `candleLimitUp` string
      - `candleLimitDown` string
      - `ma` string[]
      - `ema` string[]
      - `boll` object
        - `middle` string
        - `upper` string
        - `lower` string
      - `vwap` string
      - `macd` object
        - `dif` string
        - `dea` string
        - `histogramUp` string
        - `histogramDown` string
      - `kdj` object
        - `k` string
        - `d` string
        - `j` string
      - `rsi` string
      - `atr` string
      - `volume` object
        - `up` string
        - `down` string
        - `ma` string[]
      - `annotations` object
        - `buyMarker` string
        - `sellMarker` string
        - `buyPriceLine` string
        - `sellPriceLine` string
        - `holdingBg` string
        - `maxProfit` string
        - `drawdown` string
        - `dividend` string
      - `infoPanel` object
        - `bg` string
        - `border` string
        - `text` string
        - `label` string
        - `valuePositive` string
        - `valueNegative` string
        - `accentCyan` string
        - `accentRed` string
        - `accentPurple` string
      - `watermark` string
    - `styleOverrides` AgentStyleOverrides: Safe numeric size controls for SVG decorations. Omit to keep the template default sizes.
      - `annotation` object: Controls trade labels, marker triangles/circles, and annotation line widths.
        - `textScale` number: Scales annotation label text.
        - `markerScale` number: Scales trade marker triangles and point circles.
        - `lineWidthScale` number: Scales SVG annotation strokes such as price lines and connectors.
      - `watermark` object
        - `textScale` number: Scales the built-in rendered watermark text.
    - `showWatermark` boolean
    - `watermark` union: Custom watermark text, or false to hide the default watermark.
      - string
      - boolean
    - `title` string
    - `subtitle` string
    - `footer` string
    - `logoText` string: Short text logo badge, for example a strategy or team name.
    - `output` AgentChartOutput
      - `layoutPreset` 'standard' | 'compact' | 'wide' | 'square' | 'portrait' | 'mobile': standard=1280x800@2x, compact=960x600@1x, wide=1280x720@2x, square=1200x1200@1x, portrait=1200x1600@1x, mobile=1080x1920@1x. Explicit width, height, or scale wins over the preset.
      - `width` integer
      - `height` integer
      - `scale` number: PNG pixel ratio. 1280x800 with scale=2 returns a 2560x1600 PNG.
      - `locale` 'zh-CN' | 'zh-TW' | 'en-US' | 'ja-JP' | 'ko-KR': Language used for rendered chart labels and built-in watermark text.
      - `timezone` string: Optional IANA timezone used for displayed timestamps. It does not change trade math or data matching.
      - `showInfoPanel` boolean: Set false to remove the right-side summary panel and give the K-line more horizontal room.
      - `infoPanelFields` string[]: Optional allow-list for right-side summary panel metrics. Omit it to render the full panel.
      - `infoPanelMode` 'reserved' | 'overlay': reserved keeps chart space clear for the summary panel. overlay places the panel over the chart and is mainly useful for compact previews.
      - `annotationDensity` 'smart' | 'full' | 'balanced' | 'minimal' | 'none': Controls chart annotation detail. smart clusters crowded buy/sell markers, full keeps all labels, balanced keeps trade labels with less range detail, minimal keeps only markers/range, none hides SVG annotations.
      - `markerLabelTemplate` string: Optional template for buy/sell marker labels. Supported tokens: {label}, {action}, {side}, {price}, {quantity}, {tradeId}, {symbol}, {name}, {fee}, {note}. Omit it to keep the built-in localized labels.
      - `themeOverrides` AgentThemeOverrides: Hex-only color overrides. Use #RRGGBB values; arbitrary CSS strings are not accepted.
        - `background` string
        - `grid` string
        - `axis` string
        - `candleUp` string
        - `candleDown` string
        - `candleLimitUp` string
        - `candleLimitDown` string
        - `ma` string[]
        - `ema` string[]
        - `boll` object
          - `middle` string
          - `upper` string
          - `lower` string
        - `vwap` string
        - `macd` object
          - `dif` string
          - `dea` string
          - `histogramUp` string
          - `histogramDown` string
        - `kdj` object
          - `k` string
          - `d` string
          - `j` string
        - `rsi` string
        - `atr` string
        - `volume` object
          - `up` string
          - `down` string
          - `ma` string[]
        - `annotations` object
          - `buyMarker` string
          - `sellMarker` string
          - `buyPriceLine` string
          - `sellPriceLine` string
          - `holdingBg` string
          - `maxProfit` string
          - `drawdown` string
          - `dividend` string
        - `infoPanel` object
          - `bg` string
          - `border` string
          - `text` string
          - `label` string
          - `valuePositive` string
          - `valueNegative` string
          - `accentCyan` string
          - `accentRed` string
          - `accentPurple` string
        - `watermark` string
      - `styleOverrides` AgentStyleOverrides: Safe numeric size controls for SVG decorations. Omit to keep the template default sizes.
        - `annotation` object: Controls trade labels, marker triangles/circles, and annotation line widths.
          - `textScale` number: Scales annotation label text.
          - `markerScale` number: Scales trade marker triangles and point circles.
          - `lineWidthScale` number: Scales SVG annotation strokes such as price lines and connectors.
        - `watermark` object
          - `textScale` number: Scales the built-in rendered watermark text.
      - `showWatermark` boolean
      - `watermark` union: Custom watermark text, or false to hide the default watermark.
        - string
        - boolean
      - `title` string
      - `subtitle` string
      - `footer` string
      - `logoText` string: Short text logo badge, for example a strategy or team name.

## Response `200`

JSON chart payload or raw image bytes when responseFormat is png, jpeg, or webp.

- object

## Other responses

- `400`: Structured error
- `401`: Authentication or policy failure
- `402`: Authentication or policy failure
- `403`: Authentication or policy failure
- `409`: Structured error
- `422`: MARKET_DATA_RANGE_EMPTY — no candles exist for the requested range (check endTime vs listing date), or MARKET_CHART_BUILD_FAILED — the model could not be built from the supplied data
- `502`: Upstream market data unavailable (code MARKET_DATA_UNAVAILABLE).

---

[API](https://skmtc.dev/klinepic/apis/klinepic-agent-api.md) · [All operations](https://skmtc.dev/klinepic/apis/klinepic-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/klinepic/apis/klinepic-agent-api/revisions/1c0680282e2c?raw)
