You are on page 1of 25

Trading APIs – Other than Python & .

Net
(Detailed understanding and Implementation guide)

Date of document: 30 Aug, 2021


Version: 2.0 – Draft

Prepared by: Technology department


Trading APIs – Other than Python & .Net

Contents
1. General Guidelines .................................................................................................................. 3

2. Data Type Used - Broadcast .................................................................................................... 5

3. Broadcast API ........................................................................................................................... 6

4. Interactive API ....................................................................................................................... 13

Private and Confidential Page 2 of 25


Trading APIs – Other than Python & .Net

1. GENERAL GUIDELINES

• Define the Structure, types of Broadcasts, and de compression of feed.


Exchange Identification: -
• To identify that a packet belongs to which exchange, every packet consists of 2 fields
• 1 Exchange
• 2 Scrip Code
• Following are the check conditions to check,
• NSE CASH – If Exchange is ‘N’ and Scrip Code is between 1 to 34999 or between 888801
to 888820
• NSE FO – If Exchange is ‘N’ and above conditions for Scrip Code are not met.
• NSE CD – If Exchange is ‘C’.
• BSE CASH – If Exchange is ‘B’
• NCDEX – if Exchange is ‘D’
• MCX COMDTY – if Exchange is ‘M’

Broadcast Data Components: -


• There are 2 parts of Broadcast data,
o Snapshot (One time): It consists of one-time latest snapshot of a scrip registered,
i.e. Latest Trade, Bid Offers, Open, High, Low, Close, Circuit Limits information.

o Live feed (Incremental): It is received continually as and when there is change in


scrip components i.e. New Trade, Changed Bid Offers, New High, and Low and
changed Circuit limits.

Connection Modes: -
There are 2 modes available to receive Broadcast,
o INTERNET - TCP Only
o Leased Lines\ VSAT- Mixed Multicast

TCP Only: We generally use this type of connection for INTERNET standalone terminals;
here feed is received via TCP connection once established with the server, with the
provided IP: PORT credentials, only for those scrips which are registered. Both feed data
components, i.e. snapshot and live feed is received on the same TCP connection.

Mixed Multicast: We use this type of connection for Leased Lines, Local network or
VSAT; here live feed is received via Multicast Group on provided GROUP IP: PORT
credentials, for ALL SCRIPS as well as for snapshot of a scrip, we also need to establish a
TCP connection with the server with provided IP: PORT credentials and register the same.

Private and Confidential Page 3 of 25


Trading APIs – Other than Python & .Net

NOTE –
• Login Packet is mandatory to be sent to the server on every successful establishment of
TCP connection or re connection.
• In TCP Only, to receive feed for scrip, registration request of that scrip is mandatory.
• The data received on Multicast socket is compressed, ref De Compression
• In case of VSAT, for NSE FO user may not receive ALL SCRIPS broadcast feed, but only for
registered scrips, or amongst superset of all scrips registered across all the users.

De Compression: - The data received on Multicast socket is compressed with the


“QuickLZ data compression library”, after receiving (Max 8129 bytes or Total Available
bytes on socket) use the same library to de compress the data first, in order to parse it.
Ref. http://www.quicklz.com/
Packet Parsing: - Response packet contains 10 bytes Header and 20 Bytes body and sum
up to 30 Bytes fixed record size. Body data may vary depending on “Type” in Header. In
case if any unknown “Type” is received, then entire 30 bytes of record needs to be
ignored, and skip to next record.

Header Body
Byte 1 10 30

Private and Confidential Page 4 of 25


Trading APIs – Other than Python & .Net

2. DATA TYPE USED - BROADCAST

Type Size (Bytes)


Ushort 2 – Unsigned
Int 4 – Signed
Byte 1
Byte(N) N Bytes
Char 1
Char(N) N Bytes
Int16 2- Signed
Single 4 – Signed
Double 8 – Signed

Note: - Double and Single are for decimal values.

Private and Confidential Page 5 of 25


Trading APIs – Other than Python & .Net

3. BROADCAST API

1. Response Header – Length 10 Bytes

This is a nested structure and always will be the first field of all structures client will receive from
server.
Name Type Description
Exchange Byte For Exchange Identification, ref Exchange
Identification
Scrip Code Int Scrip Code as per exchange.
Time Int Time at which message is generated in terms of
seconds from 01-01-1980 00:00:00 hours.
Type Byte Type of Record.

2. Heartbeat Request Packet – Length 30 Bytes

Type: - “1”
This is a heartbeat request send from server to client. Client need to respond to this
request by sending heart beat response packet.
Name Type Description
Response Header Response Header
Reserved Byte(20)

3. Trade Packet – Length 30 Bytes

Type: - “A”
This will be received by client whenever there is a trade.
Name Type Description
Response Header Response Header
Rate Single Trade price
Qty Int Trade Qty
Cumulative Qty Int Total volume
AvgTradePrice Single Weighted average price
Open Interest Int Open interest (Valid for FnO Only)

Private and Confidential Page 6 of 25


Trading APIs – Other than Python & .Net

4. BID/Offer Packet – Length 30 Bytes

Type: - “B” or “C” or “D” or “E” or “F”


This will be received by client whenever there is a change in bid/offer. Type “B” will have
1 Best Bid/Offer, Type “C” will have 2nd Best Bid/Offer and onwards respectively.
st

Name Type Description


Response Header Response Header
BidRate Single Best bid rate
BidQty Int Best bid Qty
BidOrder Ushort No of bid orders
OfferRate Single Best offer rate
OfferQty Int Best offer Qty
OfferOrder Ushort No of Offer orders

5. OHLC Packet – Length 30 Bytes

Type: - “G”
This will be received by client whenever there is a change in day high/low.
Name Type Description
Response Header Response Header
Open Single Open price
High Single High Price
Low Single Low Price
PrevDayClose Single Close price
Reserved Byte(4) Reserved field

6. Index Trade Packet – Length 30 Bytes

Type: - “H”
This will be received by client whenever there is a change in spot Price for Index.
Name Type Description
Response Header Response Header
Rate Single Trade price
Reserved Byte(16) Reserved Field

Private and Confidential Page 7 of 25


Trading APIs – Other than Python & .Net

7. DPR Packet – Length 30 Bytes

Type: - “W”
This will be received by client whenever there is a change in daily price range.
Name Type Description
Response Header Response Header
UpperCktLimit Single Upper range
LowerCktLimit Single Lower range
Reserved Byte(12) Reserved field

8. Open Interrest Change Packet – Length 30 Bytes


Type: - “m”
This will be received by client whenever there is a change in Open Interest for Contract.
Name Type Description
Response Header Response Header
Open Interest Int Current Open Interest Qty
Open Interest High Int High OI Qty for current trading day
Open Interest Low Int Low OI Qty for current trading day

9. History Packet – Length 30 Bytes

Type: - “s”
This will be received by client as a START packet for downloading historical trades.
Name Type Description
Response Header Response Header
History Rec Count Ushort Total No. of historical trades upcoming.
Reserved Byte(18) Reserved field

Type: - “t”
This will be received by client as a Continuation packet for downloading historical trades.
Name Type Description
Response Header Response Header Time field is used for Tick A.
RateA Single Trade Price for Tick A
Qty A Int Trade Qty for Tick A
RateB Single Trade Price for Tick B
Qty B Int Trade Qty for Tick B
Time B Int Time at which message is generated in terms
of seconds from 01-01-1980 00:00:00 hours.

Private and Confidential Page 8 of 25


Trading APIs – Other than Python & .Net

Type: - “u”
This will be received by client as an END packet for downloading historical trades.
Name Type Description
Response Header Response Header
History Over Ushort 1 as end of History receiving
Reserved Byte(18) Reserved field

10. OI History Packet – Length 30 Bytes

Type: - “S”
This will be received by client as a START packet for downloading historical OI.
Name Type Description
Response Header Response Header
History Rec Count Ushort Total No. of historical OI upcoming.
Reserved Byte(18) Reserved field

Type: - “T”
This will be received by client as a Continuation packet for downloading historical OI.
Name Type Description
Response Header Response Header Time field is used for Open Interest Tick A.
QtyA Int Open Interest Qty for Tick A
TimeB Int Open Interest Time for Tick B
QtyB Int Open Interest Qty for Tick B
TimeC Int Open Interest Time for Tick C
QtyC Int Open Interest Qty for Tick C

Type: - “U”
This will be received by client as an END packet for downloading historical OI.
Name Type Description
Response Header Response Header
History Over Ushort 1 as end of History receiving
Reserved Byte(18) Reserved field

Private and Confidential Page 9 of 25


Trading APIs – Other than Python & .Net

11. Request Header – Length 3 Bytes

This is a nested structure and always will be the first field of all structures client will send to
server.
Name Type Description
Msg Type Char Type of message
Msg Len Ushort Length of message excluding request header

Private and Confidential Page 10 of 25


Trading APIs – Other than Python & .Net

12. Heartbeat Response Packet – Length 3 Bytes

Msg Type: - “1”


This is a heartbeat response send from client to server in reply of heart beat request
packet.
Name Type Description
Request Header Request Header

13. Login Packet – Length 114 Bytes

Msg Type: - “Q” for first login and “q” for further reconnection if any.
This need to be send as a very first packet after socket connection.
Name Type Description
Request Header Request Header
FEUserIDLength Byte Actual length of Client Code.
FEUserID Char(15) Client Code
FEUserNameLength Byte Actual length of Client name.
FEUserName Char(30) Client name
RequiredNseEquity Byte “1” if Allowed and “0” if not allowed NSE CASH
RequiredNseDeriv Byte “1” if Allowed and “0” if not allowed NSE FO
RequiredBseEquity Byte “1” if Allowed and “0” if not allowed BSE CASH
VersionLength Byte Actual length of Version
Version Char(10) As per provided by MOSL IT – OPERATION
Team
GetAllBO Byte “30” Hardcoded
AllScripsNseCash Byte “0” If connecting with TCP Only Mode,
“1” if connecting with Mixed Multicast Mode.
AllScripsNseDeriv Byte “0” If connecting with TCP Only Mode,
“1” if connecting with Mixed Multicast Mode.
AllScripsBseCash Byte “0” If connecting with TCP Only Mode,
“1” if connecting with Mixed Multicast Mode.
AllowTotalBuySellQty Byte “1” If Total Buy and Sell Qty allowed
“0” in not allowed
Reserved Byte[45] Reserved Space padding

Private and Confidential Page 11 of 25


Trading APIs – Other than Python & .Net

14. Scrip Register/Deregister Packet – Length 10 Bytes

Msg Type: - “D”


This will be used for registering/deregistering scrip for Broadcast.
Name Type Description
Request Header Request Header
Exchange Char For Exchange Identification, ref Exchange
Identification
Exch Type Char “C” for CASH market and “D” for DERIVATIVES
market scrip.
Scrip Code Int Scrip Code as per exchange.
AddToList byte “0” to deregister
“1” to register.

15. BID Offer Request Packet – Length 8 Bytes

Msg Type: - “O”


This will be used for requesting scrip for Bid Offer.
Name Type Description
Request Header Request Header
Exchange Char For Exchange Identification, ref Exchange
Identification
Scrip Code Int Scrip Code as per exchange.

16. Trade History Request Packet – Length 12 Bytes

Msg Type: - “r”


This will be used for requesting trades history from Beginning of Market start time.
Name Type Description
Request Header Request Header
Exchange Char For Exchange Identification, ref Exchange
Identification
Scrip Code Int Scrip Code as per exchange.
Upto Time Int Time upto which, history is required in terms of
seconds from 01-01-1980 00:00:00 hours.

Private and Confidential Page 12 of 25


Trading APIs – Other than Python & .Net

17. OI History Request Packet – Length 12 Bytes

Msg Type: - “o”


This will be used for requesting OI history from Beginning of Market start time.
Name Type Description
Request Header Request Header
Exchange Char For Exchange Identification, ref Exchange
Identification
Scrip Code Int Scrip Code as per exchange.
Upto Time Int Time upto which, history is required in terms of
seconds from 01-01-1980 00:00:00 hours.

4. INTERACTIVE API

Non-FIX Connect Application Programming Interface

1. Data Type Used - Interactive

Type Size (Bytes)


UInt16 2 – Unsigned
Int 4 – Signed
Byte 1
Char 1
Char(N) N Bytes
Int16 2- Signed
Double 8

Private and Confidential Page 13 of 25


Trading APIs – Other than Python & .Net

2. Message Header – Length 45 bytes

This is a nested structure and always will be the first field of all structures used for
communication.

Name Type Description


MessageCode UInt16 Contains the message number for the
messages received or sent. A message is invalid
without this.
MessageLength Int Specifies the length of the entire message
including the length of the Message Header.
ChannelID Byte 1 (one)
ClientID Char(20) Logged in ID from which message is coming.
TimeStamp Int Time at which message is generated in terms of
seconds from 01-01-1980 00:00:00 hours.
ErrorCode Int Outbound field. Always set to 0(zero) in
request.
ErroMessageLength Int Outbound field. Always set to 0(zero) in
request. In response if any value is there in this
field then Message length will be increased by
this and error text will come at the end of
packet of this length.
NumberOfDecimals Byte Always set to 2 in request. In response usually
value will be 2 but some cases it may be
different.
Source Char Always set to ‘L’.
ClientDispatcherID Int 0(zero)

3. Login Request – Length 134 Bytes

Message Code – 1 (one). In response user will get message code 2 having different
structure.
Name Type Description
MessageHeader Message This is a nested structure.
Header
UserID Char(20) ID provided by MOSL.
Password Char(16) Password of the ID.
IPAddress Char(16) IPAddress of the system.
MacAddress Char(20) MacAddress of the system.
VersionNo Int Version number of application. Currently it is
34.
PANOrDOB Char(13) PAN number or DOB in dd/mm/yyyy format.

Private and Confidential Page 14 of 25


Trading APIs – Other than Python & .Net

4. Login Response – Length 95 Bytes

Message Code – 2 (Two). Response of message code 1.

Name Type Description


MessageHeader Message This is a nested structure.
Header
UserID Char(20) ID provided by MOSL.
UserType Int16 0 – Client
1 – Dealer
PwdValidityDays Int16 Days left for password to expire.
LastLogonDateTime Int Last logged in date time in terms of seconds
from 01-01-1980 00:00:00 hours.
FirstTimeLogin Char ‘Y’ if user is login for first time.
PwdExpired Char ‘Y’ if password is expired.
SessionNo Int Reserved field.
ExchangeRights Int Reserved field.
MaxScripCount Int Reserved field.
SleepBetweenOrders Int Reserved field.
AvailableVersion Int Reserved field.

5. Change Password Request – Length 97 bytes

Message Code – 4 (four). In response user will get message code 51 having different
structure.

Name Type Description


MessageHeader Message This is a nested structure.
Header
UserID Char(20) ID provided by MOSL.
Password Char(16) Old Password of the ID.
NewPassword Char(16) New Password of the ID.

6. Change Password Response – Length 47 bytes

Message Code – 51.

Name Type Description


MessageHeader Message This is a nested structure.
Header
PwdValidityDays Int16 New password is valid for this many days.

Private and Confidential Page 15 of 25


Trading APIs – Other than Python & .Net

7. Forgot Password Request/Response – Length 165 bytes


Message Code – 3 (three). In response user will get message code 50 having same structure.
Name Type Description
MessageHeader Message This is a nested structure.
Header
UserID Char(20) ID provided by MOSL.
EmailOrMobile Char(100) Old Password of the ID.

8. Order – Length 288 bytes

This is a nested structure for order.

Name Type Description


ExchangeCode Byte For MCX commodity, set to 6.
ScripCode Int Code of the instrument as per exchange.
OrderNo Char(26) Send blank in case of fresh order request and
send same value in case of
modification/cancellation.
ClientCode Char(20) ID of client for which order is being placed.
BuyOrSell Char ‘B’ – Buy
‘S’ – Sell
DisclosedQty Int It should be >= 0 and in Lots.
TotalQtyRemaining Int It contains total qty remaining for the order.
For fresh order request it should be same as
OrderQty.
OrderQty Int It should be > 0 and in Lots.
QtyTradedToday Int It contains qty traded today for the order.
Price Int It should be >= 0. For market order it should be
0.
TriggerPrice Int It is mandatory for stop loss order else it will be
0.
GoodTillDate Int Date up to which order should be retained in
terms of seconds from 01-01-1980 00:00:00
hours.
EntryDateTime Int Send 0 in case of fresh order request and send
same value in case of
modification/cancellation.
MinFillQty Int 0 (zero)
LastModifiedTime Int Send 0 in case of fresh order request and send
same value in case of
modification/cancellation.
OrderInitiatorID Char(20) Contains logged in ID from which order is

Private and Confidential Page 16 of 25


Trading APIs – Other than Python & .Net

generated. Set it at the time of fresh order


entry and send same value in case of
modification/cancellation.
Remarks Char(26) Reserved field.
OrderType Char ‘C’
BookType Char ‘P’ – Stop loss order
‘L’ – Limit Order
‘M’ – Market Order
OrderLife Char ‘D’ – Day order
‘I’ – IOC order
‘G’ – GTD order
‘C’ – GTC order
ExchangeDispatcherID UInt16 Send 0 in case of fresh order request and send
same value in case of
modification/cancellation.
ProductCode Int 1
ProductFlag Char ‘ ’ – One space
TerminalID Char(20) Logged in ID which is doing the current activity.
UniqueOrderID Char(19) Send blank in case of fresh order request and
send same value in case of
modification/cancellation.
ExpiryDate Int Expiry date of scrip in terms of seconds from
01-01-1980 00:00:00 hours.
Symbol Char(10) Symbol or short name of scrip.
Series Char(2) ‘XX’
InstrumentName Char(6) ‘FUTCOM’
StrikePrice Int -1
CALevel UInt16 0
BunchSeqNo UInt16 0
AMOOrder Char ‘N’
AMOOrderValidated Char ‘N’
MPlusBlockedAmount Double 0
ParticipantType Char ‘N’
UserRefText Char(20) Send blank in case of fresh order request and
send same value in case of
modification/cancellation.
OrderStatus Int Send 0 in case of fresh order request and send
same value in case of
modification/cancellation.
ParticipantCode Char(20) Send blank in case of fresh order request and
send same value in case of
modification/cancellation.
PanNumber Char(10) This field will get populated on server, by

Private and Confidential Page 17 of 25


Trading APIs – Other than Python & .Net

default send it blank.


AlgoId Int By default send it 0
AlgoCategory UInt16 By default send it 0

Private and Confidential Page 18 of 25


Trading APIs – Other than Python & .Net

9. Order Packet – Length 317 bytes

Message Code –
10 – New Order Request. In response user will get 13(Order Confirm),16(Order Error) or
19(Order Reject). Structure will remain same.
11 – Order Modification. In response user will get 14(Order Modify Confirm),16(Order Error) or
20(Order Modify Reject). Structure will remain same.
12 – Order Cancellation. In response user will get 15(Order Cancell Confirm),16(Order Error) or
21(Order Cancell Reject). Structure will remain same.

Name Type Description


MessageHeader Message Nested structure.
Header
Order Order Nested structure.

Private and Confidential Page 19 of 25


Trading APIs – Other than Python & .Net

10. Trade – Length 171 bytes

This is a nested structure for trade.

Name Type Description


ExchangeCode Byte For MCX commodity, it is 6.
OrderNo Char(26) Order number of corresponding order to which
this trade belongs.
TerminalID Char(20) Logged in ID which is doing the current activity.
OrderInitiatorID Char(20) Contains logged in ID from which order is
generated.
ScripCode Int Code of the instrument as per exchange.
ClientCode Char(20) ID of client for which order is being placed.
BuyOrSell Char ‘B’ – Buy
‘S’ - Sell
OrderQty Int It will be in Lots.
DisclosedQty Int It will be in Lots.
QtyRemaining Int It contains total qty remaining for the order
TradeNo Char(26) Trade number provided by exchange.
TradeQty Int Trade qty in Lots.
TradePrice Int Price at which trade is executed.
TradeDateTime Int Time at which it got traded in exchange.
OrderType Char ‘C’
BookType Char ‘P’ – Stop loss order
‘L’ – Limit Order
‘M’ – Market Order
OrderLife Char ‘D’ – Day order
‘I’ – IOC order
‘G’ – GTD order
‘C’ – GTC order
ProductCode Int 1
ProductFlag Char ‘ ’ – One space
UniqueOrderID Char(19) Unique Identification number generated by
system.
ExchangeDispatcherID UInt16 For internal use.

Private and Confidential Page 20 of 25


Trading APIs – Other than Python & .Net

11. Trade Packet – Length 216 bytes

Message Code – 34

Name Type Description


MessageHeader Message Nested structure.
Header
Trade Trade Nested structure.

12. Order/Trade download Request/Response Packet – Length 69 bytes

Message Code –
9 –Order download request. In response user will first get message code 45. Structure will
be same of Message Header. This is to inform user that download is going to start now. After
this user will get multiple packets of message code 32. Structure will be same as request and
at end multiple order packet will come in bunch. Number of order packets will be mention in
NumberOfRecords field of response packet. At the end message code 46 will come. Structure
will be same of Message Header. This is to inform end of order download.

5 –Trade download request. In response user will first get message code 47. Structure will
be same of Message Header. This is to inform user that download is going to start now. After
this user will get multiple packets of message code 33. Structure will be same as request and
at end multiple trade packet will come in bunch. Number of trade packets will be mention in
NumberOfRecords field of response packet. At the end message code 48 will come. Structure
will be same of Message Header. This is to inform end of trade download.

Name Type Description


MessageHeader Message Nested structure.
Header
DownloadType Char ‘C’
MemberCode Char(20) Logged in ID
NumberOfRecords UInt16 Number of records in buffer.
Flag Char Reserved field

13. Margin report request – Length 66 bytes

Message Code – 35. In response user will get message code 36.

Name Type Description


MessageHeader Message Nested structure.
Header
ClientCode Char(20) Code of the client whose report is required.
IsEquity Char ‘Y’ – For Equity report.
‘N’ – For commodity report.

Private and Confidential Page 21 of 25


Trading APIs – Other than Python & .Net

14. Margin report response – Length 352 bytes

Message Code – 36

Name Type Description


MessageHeader Message Nested structure.
Header
IsEquity Char ‘Y’ – For Equity report.
‘N’ – For commodity report.
ClientCode Char(20) Code of the client.
LedgerBalance Double Cash field
InstrumentCapital Double 0
InitialMarginPaid Double 0
StockCapital Double Non cash field
AdditionalCapital Double Non cash field
EquityMarginUsed Double 0
EquityM2MLoss Double 0
EquityBPL Double 0
DerivativeSpanMargin Double MCX Span margin blocked
DerivativeExposureMargin Double MCX Exposure margin blocked
DerivativeM2MLoss Double MCX M2M Loss.
DerivativeBPL Double MCX booked profit/loss.
OptionSegment Double 0
WithDrawnAmount Double Amount withdrawn today.
MaxWithDrawalAmt Double 0
FundTransferAmount Double Cash field.
MFIPOAmount Double 0
AvailableFundsForMFIPO Double 0
AvailableFundsforWithDraw Double 0
AvailableFundsforCash Double 0
AvailableFundsforFO Double Available fund for MCX
AvailableFundsforCurrency Double Available fund for NCDEX
AdditionalCapitalFO Double 0
AdditionalCapitalCurrency Double 0
StockCapitalFO Double Non cash field
StockCapitalCurrency Double 0
StockCapitalDelivery Double 0
CreditLimit Double 0
CurrencySpanMargin Double NCDEX Span margin blocked
CurrencyExposureMargin Double NCDEX Exposure margin blocked
CurrencyM2MLoss Double NCDEX M2M Loss.
CurrencyBPL Double NCDEX booked profit/loss.
UnRealisedAmount Double UnRealized cheque amount
Private and Confidential Page 22 of 25
Trading APIs – Other than Python & .Net

MaxUnrealisedAmount Double Max Realised cheque Amount


MFEquityAmount Double 0
MFEquityAmount Double 0

NetOptionPremiumFO Double 0
NetOptionPremiumCurrency Double 0
CreditOptionAmountFO Double 0

CreditOptionAmountCurrency Double 0
Derivative Special Margin Double 0
Derivative Additional Margin Double 0
Currency Special Margin Double 0
Currency Additional Margin Double 0
AvailableFundsforCommodity Double 0
StockCapitalCommodity Double 0
AdditionalCapitalCommodity Double 0
CommoditySpanMargin Double 0
CommodityExposureMargin Double 0
CommoditySpecialMargin Double 0
CommodityAdditionalMargin Double 0
CommodityM2MLoss Double 0
CommodityBPL Double 0
NetOptionPremiumCommodity Double 0
CreditOptionAmountCommodity Double 0
SLBMMarginUsed Double 0
SLBMBPL Double 0
SLBMM2MLoss Double 0
MtfMargin Double 0
MtfLoss Double 0
Brokerage Double 0
15. Holding report request – Length 66 bytes

Message Code – 41. In response user will get message code 42.

Name Type Description


MessageHeader Message Nested structure.
Header
ClientCode Char(20) Code of the client whose report is required.
ScripIsInNo Char(20)

Private and Confidential Page 23 of 25


Trading APIs – Other than Python & .Net

NumberOfRecords Int Send Default value as 10


Holding report response – Length 352 bytes

Message Code – 42

Name Type Description


ClientCode Char(20) Code of the client.
ScripIsInNo Char(20)
DPQty Int64
BlockedQty Int64
TradedQty Int64 0
ScripName Char(30) 0
HairCut Double
LTP Double
ValueAtLTP Double 0
BuyAvgPrice Double 0
POAQty Int64 0
CollateralQty Int64
OutStandingQty Int64
DebitStockQty Int64
NonPoaQty Int64
RmsSellingQty Int64
CommodtyQty Int64
ClosePrice Double
DPValueAHC Double
MTFDebitQty Int64 0
MTFOutStandingQty Int64 0
CFSReceived Double 0
BTSTQty Int64 0
BTSTTradedQty Int64
BTSTBlockedQty Int64
BuyBackQty Int64 0
TPinQty Int64 0
SlbmQty Int64
NbfcQty Int64 0

16.Multi Leg Order Packet – Length 861 bytes

Message Code –
99 – New Order Request. In response user will get 100(Confirm), 101(Cancell
Confirm),102(Error) or 103(Reject). Structure will remain same.

Private and Confidential Page 24 of 25


Trading APIs – Other than Python & .Net

For multi leg order you should send orders in order1 and order2. Order must be IOC order .
Order3 will be null but packet size will be 861 only. For filling order1 and order2, follow rules
of normal order.

Name Type Description


MessageHeader Message Nested structure.
Header
Order1 Order Nested structure.
Order2 Order Nested structure.
Order3 Order Nested structure.

17.HeartBeat – Length 45 bytes

Message Code – HeartBeatRequest-129 . In response user will get message code 130 same
structure.

Name Type Description


MessageHeader Message Nested structure.
Header

------------------------------------End of document--------------------------------

Private and Confidential Page 25 of 25

You might also like