TradingRadar API

Public endpoints for basic health/status and payments integration. Educational use only.

Base URL

https://tradingradar.in

Requests must be HTTPS.

Auth

No auth required for /api/health, /api/status, /api/anomalies/recent.

Payments flows are server-side to Razorpay; you call our endpoints as shown below.

GET /api/health GET

Basic liveness probe.

curl -s https://tradingradar.in/api/health
{"ok":true}

GET /api/status GET

Service identity/version.

curl -s https://tradingradar.in/api/status
{"ok":true,"service":"tradingradar-api","version":"1.0"}

GET /api/anomalies/recent GET

Recent anomaly items (sample/teaser). Returns an array; can be empty if no items yet.

curl -s https://tradingradar.in/api/anomalies/recent
{"items":[]}

POST /api/payments/create-order POST

Create a Razorpay order for one-time plans: BASIC499 or PRO999. (Test mode until Razorpay live is enabled.)

curl -s -X POST https://tradingradar.in/api/payments/create-order \
  -H "Content-Type: application/json" \
  -d '{"plan":"BASIC499","email":"you@example.com","phone":"9999999999"}'

Response (example):

{
  "key_id":"rzp_test_xxx",
  "order":{"id":"order_abc123","amount":49900,"currency":"INR","status":"created"}
}

POST /api/payments/verify POST

Verify Razorpay signature after successful checkout.

curl -s -X POST https://tradingradar.in/api/payments/verify \
  -H "Content-Type: application/json" \
  -d '{
    "razorpay_order_id":"order_abc123",
    "razorpay_payment_id":"pay_def456",
    "razorpay_signature":"generatedsig"
  }'

Response (example):

{"ok":true,"access_until":"2025-11-01T00:00:00Z"}

POST /api/payments/webhook webhook

Razorpay → TradingRadar events (payments/subscriptions). We validate X-Razorpay-Signature with your RAZORPAY_WEBHOOK_SECRET.

# (From Razorpay only)
POST https://tradingradar.in/api/payments/webhook
Headers: X-Razorpay-Signature: <hmac>

POST /api/payments/create-subscription POST

Planned recurring billing. Disabled for end-users until Razorpay live + plans configured.

curl -s -X POST https://tradingradar.in/api/payments/create-subscription \
  -H "Content-Type: application/json" \
  -d '{"plan":"BASIC499"}'

Compliance

Legal: TermsPrivacyRefundCancellationCookiesDisclaimerSupport

LIVE /api/anomalies/stream SSE

Real-time anomaly feed over Server-Sent Events (HTTP). Events: anomaly (payload with ts, symbol, facet, score) and ping (keep-alive).

Quick test (terminal)

curl -N https://tradingradar.in/api/anomalies/stream

JavaScript

const es = new EventSource("/api/anomalies/stream");

// anomaly events
es.addEventListener("anomaly", (ev) => {
  try {
    const obj = JSON.parse(ev.data);
    console.log("ANOMALY", obj);
    // TODO: render into your dashboard list/tape
  } catch(e) {}
});

// optional heartbeat
es.addEventListener("ping", () => {
  // keep-alive; no-op
});

// connection errors
es.onerror = (e) => {
  console.warn("SSE error, will auto-retry", e);
};

Event format

event: anomaly
data: {"ts": 1759420000, "symbol":"NIFTY","facet":"IV","score":3.4}

event: ping
data: {}

Notes: