Indicators›Momentum›Stochastic
GET/indicator/stoch

Stochastic Oscillator

Category: Momentum · Updated November 2026


The TAAPI.IO Stochastic API returns k, d values for the Stochastic indicator as JSON, for crypto pairs and US stocks. Send an exchange, symbol and timeframe to get real-time or historical data, with no candles to download and no calculations to maintain.

SpecValue
EndpointGET https://v2.taapi.io/indicator/stoch
OutputsvalueK, valueD
MarketsBinance, Binance Futures, Bybit, Gate.io, Kraken and US stocks
Timeframes1m to 1w
DeliveryREST, bulk and WebSocket

Get Stochastic with one API call

This request returns Stochastic for BTCUSDT on 1-hour Binance candles. Add your API key to run it here.

curl -G https://v2.taapi.io/indicator/stoch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h"

Stochastic API response

This response came from the live API on 9 November 2026. Long lists are shortened here.

200 OK
{
  "valueK": [50.175444100724434],
  "valueD": [39.460480439559056],
  "timestamp": [1794218400]
}
FieldTypeDescription
valueKnumber[]K
valueDnumber[]D
timestampinteger[]Unix time of each candle, in seconds

Stochastic API parameters

NameTypeRequiredDefaultDescription
exchangestringYes—binance, binancefutures, bybit, gateio, kraken or stocks
symbolstringYes—Pair or ticker, e.g. BTCUSDT or AAPL
timeframestringYes—1m 5m 15m 1h 4h 1d 1w
kPeriodintegerNo5K period
dPeriodintegerNo3D period
kSmoothintegerNo3K smooth
resultsintegerNo1Number of values to return, or max
backtrackintegerNo0Candles to skip from the most recent

What is Stochastic?

The Stochastic Oscillator, popularised by George Lane, shows where the close sits within the recent high-low range on a scale of 0 to 100. The idea is that closes cluster near the highs in uptrends and near the lows in downtrends.

Stochastic formula

OutputCalculation
Raw %K(close − lowest low) ÷ (highest high − lowest low) × 100
%KRaw %K smoothed by kSmooth
%DMoving average of %K over dPeriod

How to read Stochastic in your code

SignalMeaningCondition
OverboughtClose near top of rangevalueK above 80
OversoldClose near bottom of rangevalueK below 20
Bullish crossMomentum turning upvalueK crosses above valueD
Bearish crossMomentum turning downvalueK crosses below valueD

Limitations: It stays pinned near the extremes during strong trends. Note the defaults: this endpoint uses a 5-period %K, while stochtv follows TradingView's 14. Nothing on this page is financial advice.

Fast, slow and full stochastic

The names describe how much smoothing is applied. The fast stochastic uses raw %K, the slow version smooths %K once, and a full stochastic lets you set every length. On this endpoint, kSmooth controls that smoothing, which makes it a full stochastic.

Three related endpoints are available. stochf returns the unsmoothed fast form, stochtv defaults to 14, 3, 3, and stochrsi applies the same maths to RSI rather than price.

Using the Stochastic in trends

In a rally the close keeps landing near the top of the range, so %K can remain above 80 for a long time. That is the indicator working as designed, and not a reason to sell. Crossovers are generally more useful when taken in the direction of the larger trend: buying oversold crossovers in an uptrend, for instance.

The API default for kPeriod is 5, which is much faster than the 14 most charts use. Set it explicitly if you're comparing values with a chart.

Detect a Stochastic crossover in oversold with Python

This looks for %K crossing above %D while %K is below 20, using the common 14, 3, 3 settings on the last two closed candles.

curl -G https://v2.taapi.io/indicator/stoch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "kPeriod=14" \
  --data-urlencode "dPeriod=3" \
  --data-urlencode "kSmooth=3" \
  --data-urlencode "results=2" \
  --data-urlencode "backtrack=1"

Get historical Stochastic values

Add results to return a series for backtesting or charting. The last element is the most recent candle.

curl -G https://v2.taapi.io/indicator/stoch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "results=100"

Get Stochastic for multiple symbols

Combine Stochastic with other indicators in one request. Each exchange, symbol and timeframe combination is one construct: Basic allows 1 per request, Pro 3 and Expert 10.

POST/bulk
curl -X POST https://v2.taapi.io/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "constructs": [
    {
      "id": "btc_1h",
      "exchange": "binance",
      "symbol": "BTCUSDT",
      "timeframe": "1h",
      "indicators": [
        {
          "id": "stoch",
          "indicator": "stoch"
        },
        {
          "id": "rsi",
          "indicator": "rsi"
        }
      ]
    }
  ]
}'

Stream Stochastic in real time

Subscribe over WebSocket to receive new values every 5 seconds while the candle is forming. Streaming supports 1m, 5m, 15m and 1h, and uses interval where REST uses timeframe.

WSSwss://v2.taapi.io/streaming
{
  "type": "subscribe",
  "id": "stoch",
  "exchange": "binance",
  "symbol": "BTCUSDT",
  "interval": "1m",
  "indicator": "stoch"
}

Why Stochastic values can differ between platforms

  • Default length: This endpoint defaults to a kPeriod of 5, while most charts default to 14.
  • Smoothing: Check kSmooth and dPeriod against your chart settings.
  • Exchange data: Highs and lows vary between exchanges, and the stochastic depends directly on them.
  • Open candle: Compare closed candles with backtrack=1.

Stochastic API FAQ

What does the Stochastic API return?

It returns valueK, valueD, plus a timestamp for the request. Results are JSON.

Is the latest Stochastic value final?

No. The newest value belongs to the candle still forming and can change until it closes. Add backtrack=1 to read the last closed candle.

Which Stochastic settings can I change?

You can set kPeriod, dPeriod, kSmooth. See the parameters table above for defaults.

Can I get Stochastic for US stocks?

Yes. Use exchange=stocks with a ticker such as AAPL. US stocks are included on the Pro plan and above.

Why does the Stochastic API not match my chart?

The most likely reason is the default kPeriod of 5. Request kPeriod=14, or use the stochtv endpoint.

See the full list of indicators, or start for free.