Chapter 2: General Guidelines (Baby-Friendly Explanation)
What This Chapter Talks About
Chapter 2 lays the ground rules for developers like you. It teaches how your terminal will send and receive messages to/from NSE’s system. Think of it as the "language" your terminal needs to speak to communicate properly.
Key Concepts for Your Terminal
- Message Structure Basics
- Every message you send to NSE or receive from NSE has two parts:
- Message Header: Like the envelope of a letter, it contains information about the message type and where it’s going.
- Message Data: Like the letter itself, it contains the actual information (e.g., order details, market updates).
- Transaction Codes
- Every action (like placing an order, logging in) has a unique number called a transaction code.
- Example: A "Logon Request" has a transaction code like
2300
.
- Data Types
- Data in messages uses specific types:
- CHAR: For text (e.g., symbols like "RELIANCE").
- LONG: For numbers (e.g., prices).
- DOUBLE: For very large or precise numbers (e.g., timestamps).
- Each type has a specific size (e.g., CHAR = 1 byte, LONG = 4 bytes).
- Endian-ness (Twiddling)
- Computers have two ways of storing numbers: big-endian (used by NSE) and little-endian (used by some systems).
- If your system uses little-endian, you need to "twiddle" (reverse) the bytes before sending numbers to NSE.
Guidelines for Designers
When designing your terminal:
- Logon Message Order:
- NSE expects messages in a strict order during login (explained in Chapter 3). If you mess up the order, your terminal can’t connect.
- Price and Quantity Scaling:
- NSE handles prices in paisa, not rupees.
- Multiply price by
100
before sending it (e.g., ₹250.75
becomes 25075
).
- Divide by
100
when receiving price data from NSE.
- Quantities are scaled by
(100,000 x 100)
. Handle them carefully.
- No Host-End Inquiries:
- Your terminal cannot ask the NSE system for additional information beyond what’s described in the protocol.
Guidelines for Programmers
When coding:
- Set Reserved Fields to Zero:
- Some fields are marked as "reserved" in the protocol. Always set these fields to
0
or null
when sending messages.