Get RSI, MACD, SMA & EMA for Indian Stocks via API (No Local Calculation)
Instead of computing indicators from price history yourself, ask for them. GET /v1/stocks/{ticker}/technical-indicators returns one row per trading day with sma, ema, rsi, macd, macd_signal and macd_histogram.
import httpx
API = "https://bharatstockapi.com"
HEADERS = {"X-API-Key": "bsk_live_..."} # your key from the dashboard
r = httpx.get(f"{API}/v1/stocks/RELIANCE/technical-indicators", headers=HEADERS,
params={"sma_period": 50, "ema_period": 20, "rsi_period": 14,
"from": "2026-01-01"})
r.raise_for_status()
for row in r.json()["data"][:5]:
print(row["trade_date"], row["close"], row["rsi"], row["macd"])Parameters and defaults
sma_periodandema_perioddefault to 20.rsi_perioddefaults to 14 and uses Wilder's smoothing.from/tobound the returned window.- Values are
nullwherever there is not enough history yet, so skip nulls before you threshold on RSI.