On this page
The complete enumerations used by the WebSocket feed. These are transcribed from the Infinn WebSocket annexure, which differs in places from the REST annexure - the differences are noted.
Status types
The values status can take, on both the stream and the REST order endpoints.
| status |
|---|
PENDING |
OPEN |
COMPLETE |
CANCELED |
REJECTED |
TRIGGER_PENDING |
INVALID_STATUS_TYPE |
These are the documented values. The published Order Book sample response contains "Open" and "REJECT" - different capitalisation, and a shorter form of REJECTED. Compare case-insensitively and accept both spellings. More
Report types - the WebSocket list
The values reporttype can take on an order update message. This list is substantially longer than the REST one.
| reporttype |
|---|
NewAck |
ModAck |
CanAck |
PendingNew |
PendingReplace |
PendingCancel |
New |
Replaced |
Canceled |
Fill |
Rejected |
ReplaceRejected |
CancelRejected |
Validation pending |
lapsed |
Modify lapsed |
Cancel lapsed |
Drop copy |
Triggered |
Trigger pending |
Price confirmation |
Frozen |
AMO received |
AMO replaced |
AMO canceled |
AMO replace rejection |
AMO cancel rejection |
Modify validation pending |
Auth pending |
Mass Canceled |
INVALID_REPORT_TYPE |
The REST annexure lists fourteen report types. The WebSocket annexure adds sixteen more, covering lifecycle events that only a live feed would observe - Triggered, lapsed, Frozen, Auth pending, Mass Canceled and the full set of after-market variants.
If you are writing an exhaustive switch, use this list, not the shorter one. And include a default branch: an unrecognised report type should be logged, not dropped.
The shorter REST list, for comparison
| rpt |
|---|
NewAck |
ModAck |
CanAck |
PendingNew |
PendingReplace |
PendingCancel |
New |
Replaced |
Canceled |
Fill |
Rejected |
ReplaceRejected |
CancelRejected |
INVALID_REPORT_TYPE |
Retention types, by exchange
Which ret values each exchange accepts. Offering a value the exchange does not take is a rejection.
| Exchange | Permitted ret values |
|---|---|
| NSE | DAY, IOC |
| BSE | EOS, DAY, IOC |
| NFO | DAY, IOC |
| CDS | DAY, IOC |
| NCX | DAY, IOC |
| BFO | EOS, DAY, IOC |
EOS appears only on BSE and BFO. The NSE family accepts DAY and IOC only. Build the validity dropdown from the selected exchange.
Internal status types
The st_intrn field, returned by Single Order Status, carries a finer-grained status than status does.
| st_intrn |
|---|
COMPLETE |
REJECTED |
CANCELED |
MODIFY PENDING |
CANCEL PENDING |
ORDER PENDING |
OPEN |
ORDER ACK |
MODIFY ACK |
CANCEL ACK |
TRIGGER_PENDING |
AMO OPEN |
AMO MODIFIED |
AMO CANCELED |
status is the coarse state a user understands. st_intrn distinguishes, for example, an order that is pending because it was just placed from one that is pending because a modification is in flight. Useful in logs; usually too much detail for a screen.
Message type reference
Every t value the WebSocket uses, in one table.
t | Direction | Message | Documented on |
|---|---|---|---|
a | Client → server | Connect task | Connect & authenticate |
ak | Server → client | Connect acknowledgement | Connect & authenticate |
h | Client → server | Heartbeat | Heartbeat |
hk | Server → client | Heartbeat acknowledgement | Heartbeat |
t | Client → server | Subscribe | Touchline feed |
tk | Server → client | Subscribe acknowledgement (full snapshot) | Touchline feed |
tf | Server → client | Touchline update (changed fields only) | Touchline feed |
u | Client → server | Unsubscribe | Touchline feed |
uk | Server → client | Unsubscribe acknowledgement | Touchline feed |
d | Client → server | Subscribe | Market depth feed |
dk | Server → client | Subscribe acknowledgement (full snapshot) | Market depth feed |
df | Server → client | Depth update (changed fields only) | Market depth feed |
ud | Client → server | Unsubscribe | Market depth feed |
udk | Server → client | Unsubscribe acknowledgement | Market depth feed |
l | Client → server | Subscribe | LTP feed |
lk | Server → client | Subscribe acknowledgement (full snapshot) | LTP feed |
lf | Server → client | LTP update | LTP feed |
ul | Client → server | Unsubscribe | LTP feed |
ulk | Server → client | Unsubscribe acknowledgement | LTP feed |
om | Server → client | Order update | Order updates |
uo | Client → server | Unsubscribe from order updates | Order updates |
uok | Server → client | Unsubscribe acknowledgement | Order updates |
p | Client → server | Subscribe | Position updates |
pk | Server → client | Subscribe acknowledgement | Position updates |
pm | Server → client | Position update | Position updates |
up | Client → server | Unsubscribe | Position updates |
upk | Server → client | Unsubscribe acknowledgement | Position updates |
am | Server → client | Alert update | Alert updates |
rm | Server → client | Admin message update | Admin messages |
ms | Server → client | Market status update | Market status updates |
Field name differences between the stream and REST
The same concepts carry different names depending on where you read them. If you merge stream and REST data into one model, normalise at the boundary.
| Concept | On the WebSocket | Over REST |
|---|---|---|
| Product | pcode | prd |
| Event / report type | reporttype | rpt |
| Message type | msgtype | msgtyp |
| Contract token | tk | token |
| Exchange | e | exch |
| Trading symbol | ts | tsym |
# The stream and the REST endpoints disagree on three field names. Mapping
# them once, where messages arrive, keeps the rest of the codebase from
# having to know which source a row came from.
STREAM_TO_REST = {
"pcode": "prd",
"reporttype": "rpt",
"msgtype": "msgtyp",
}
def normalise_stream(message):
"""Renames stream-only field names to their REST equivalents."""
out = {}
for key, value in message.items():
out[STREAM_TO_REST.get(key, key)] = value
return outExchange codes
| Code | Exchange |
|---|---|
NSE | National Stock Exchange - cash / equity |
NFO | NSE equity derivatives (futures & options) |
BSE | Bombay Stock Exchange - cash / equity |
BFO | BSE equity derivatives |
CDS | NSE currency derivatives |
MCX | Multi Commodity Exchange |
NCX | NSE commodity |