TRADING API

We use the XTS API to let your app talk directly to the stock market. Think of it as a bridge: you can fetch live market data and place trades from your own software no manual clicking. Build your rules, and let your code do the work with REST for requests and WebSocket for real‑time feeds.

OVERVIEW

What is the XTS API?

XTS API is a developer toolkit that lets your application read market data and place trades programmatically. Instead of doing everything by hand, you can automate your workflow with clean REST endpoints and subscribe to live updates via WebSocket.

Use it to pull quotes and depth, manage orders (place/modify/cancel), and track positions, holdings, and margins all securely and with low latency. Build anything from simple rules to advanced strategies.

Algorithmic Trading Overview

Functionalities of XTS API

Core capabilities you can plug into your app right away.

Real‑Time Market Data

Stream quotes, depth (LTP, bid/ask), and snapshots via WebSocket; pull historical data via REST for analysis.

Order Management

Place, modify, and cancel orders with control over quantity, price, product type, and validity across segments.

Portfolio & Funds

Fetch positions, holdings, margins, and limits to monitor risk and build your own portfolio dashboards.

Authentication & Sessions

Secure token‑based auth for REST and WebSocket connections, so all calls and streams remain protected.

Understanding the API Flow

This interactive diagram illustrates the typical communication flow between your application and the PESB API. Each step shows how authentication, requests, and data flow work together for successful integration.

$ curl -X POST http://IP:Port/instancename/user/session
# Request Payload
{ "secretKey": "Doqg107#6V", "appKey": "5a75a8676cabe678", "source": "WebAPI" }
 
Response Code: 200
 
# Response samples...
[ { "type": "success", "code": "s-user-0001", "description": "Valid User", "result": {} } ]
> const ws = new WebSocket( 'http://IP:Port/instancename/user/session' )
 
> ws.send(JSON.stringify({
   "action" : "subscribe" ,
   "symbols" : [ "NIFTY" , "BANKNIFTY" ]
}))
 
// Receiving live updates...
✓ Connected | Streaming real-time data
1

Login Request

Your application sends a secure POST request with your API key and secret to the authentication endpoint. This establishes your identity with the system.

POST /user/session
{ "appKey": "your_key", "secretKey": "your_secret", "source": "your_source" }
2

Receive Token

Upon successful authentication, the API returns a temporary JWT token. This token is your access pass for all subsequent API calls.

{ "token": "eyJhbGciOiJIUzI1NiIsInR5...", "expires": 3600 }
3

Make API Calls

Include the token in the Authorization header to access protected endpoints. Place orders, check positions, or fetch market data securely.

Header: Content-Type: application/json authorization: Bearer YOUR_TOKEN
4

Connect WebSocket

Use the same token to establish a WebSocket connection for real-time data streaming. Subscribe to live market feeds and order updates instantly.

ws://IP:Port/instancename/stream?token=YOUR_TOKEN

Choose Your Plan

Find the perfect plan that fits your trading needs, whether you are an individual developer or an institutional firm.

Free Trial

₹0

/ 1 month

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Start Free Trial

Monthly

₹450

/ month

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Choose Plan

6 Month

₹2000

/ 6 months

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Choose Plan

12 Month

₹2700

/ year

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Choose Plan

Free Trial

₹0

/ 1 month

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Start Free Trial

Monthly

₹450

/ month

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Choose Plan

6 Month

₹2000

/ 6 months

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Choose Plan

12 Month

₹2700

/ year

  • NSE Cash, BSE Cash, MCX & F&O
  • Place, modify, and cancel orders with supported brokers
  • WebSocket depth, OHLC, and trades
Choose Plan

Get Started in 4 Simple Steps

Starting your development journey with the PESB API is straightforward. Follow these steps to get your credentials, explore the documentation, and begin building your application. This structured path ensures you have everything you need for a smooth and successful integration.

1
Register for API Access

Register for API Access

Contact the PESB team to get your API key and secret. This is your unique identifier for accessing the system.

2
Explore the Documentation

Explore the Documentation

Dive into our comprehensive API documentation to understand all the available endpoints, parameters, and data formats.

3
Build Your Application

Build Your Application

Start integrating the API into your application. Use your preferred programming language to make HTTP requests to our endpoints.

4
Test and Deploy

Test and Deploy

Thoroughly test your integration in a sandbox environment. Once you are confident, you can move to production and launch your platform.

DOCUMENTATION

Documentation of XTS API

XTS API is REST based Trading API. This will help you to develop trading and investment platform. Open the guides to see endpoints, parameters, and examples.

$ xts-api --version
v2.0.1
 
$ xts-api status
✓ Market Data API: Online
✓ Trading API: Online
✓ WebSocket: Connected