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
The documented casing is not always the casing you receive

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 stream documents more events than REST does

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.

ExchangePermitted ret values
NSEDAY, IOC
BSEEOS, DAY, IOC
NFODAY, IOC
CDSDAY, IOC
NCXDAY, IOC
BFOEOS, DAY, IOC
EOS is BSE-family only

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
Use status for display, st_intrn for diagnosis

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.

tDirectionMessageDocumented on
aClient → serverConnect taskConnect & authenticate
akServer → clientConnect acknowledgementConnect & authenticate
hClient → serverHeartbeatHeartbeat
hkServer → clientHeartbeat acknowledgementHeartbeat
tClient → serverSubscribeTouchline feed
tkServer → clientSubscribe acknowledgement (full snapshot)Touchline feed
tfServer → clientTouchline update (changed fields only)Touchline feed
uClient → serverUnsubscribeTouchline feed
ukServer → clientUnsubscribe acknowledgementTouchline feed
dClient → serverSubscribeMarket depth feed
dkServer → clientSubscribe acknowledgement (full snapshot)Market depth feed
dfServer → clientDepth update (changed fields only)Market depth feed
udClient → serverUnsubscribeMarket depth feed
udkServer → clientUnsubscribe acknowledgementMarket depth feed
lClient → serverSubscribeLTP feed
lkServer → clientSubscribe acknowledgement (full snapshot)LTP feed
lfServer → clientLTP updateLTP feed
ulClient → serverUnsubscribeLTP feed
ulkServer → clientUnsubscribe acknowledgementLTP feed
omServer → clientOrder updateOrder updates
uoClient → serverUnsubscribe from order updatesOrder updates
uokServer → clientUnsubscribe acknowledgementOrder updates
pClient → serverSubscribePosition updates
pkServer → clientSubscribe acknowledgementPosition updates
pmServer → clientPosition updatePosition updates
upClient → serverUnsubscribePosition updates
upkServer → clientUnsubscribe acknowledgementPosition updates
amServer → clientAlert updateAlert updates
rmServer → clientAdmin message updateAdmin messages
msServer → clientMarket status updateMarket 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.

ConceptOn the WebSocketOver REST
Productpcodeprd
Event / report typereporttyperpt
Message typemsgtypemsgtyp
Contract tokentktoken
Exchangeeexch
Trading symboltstsym
Normalising stream messages to the REST names
# 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 out

Exchange codes

CodeExchange
NSENational Stock Exchange - cash / equity
NFONSE equity derivatives (futures & options)
BSEBombay Stock Exchange - cash / equity
BFOBSE equity derivatives
CDSNSE currency derivatives
MCXMulti Commodity Exchange
NCXNSE commodity

Next

Esc
↑↓ navigate↵ openEsc close/ to search