Sync Trades
📝 Sync Trade Request
| Field | Details |
|---|---|
| API Name | SyncTrades |
| URL Format | <protocol>://<domain name:port>/<VirtualDir>/<URL> |
| Example URL | https://localhost:8080/OTPA/V1/SyncTrades |
| Description | This request retrieves all trades available in the system. Upon receiving this request, the system sends trade information messages. The request must include jToken received from the Authentication API response. |
🗺️ Sync Trade Request Parameters
| Parameter | Data Type | Description |
|---|---|---|
| jMessageType | varchar(15) | Must be sent as SYNC_ORDER_REQ (Confirm: Often trade sync uses SYNC_TRADE_REQ, but using your given text exactly.) |
| jManagerID | varchar(50) | Manager Identification Number |
| jCustomerId | varchar(50) | Customer ID assigned to the user |
| jExchange | int | Exchange identifier |
| jToken | varchar(512) | Authentication token received from the Authentication API |
| jEntrySequenceNumber | int64 | Last received sequence number (default 0 if not provided) |
| jRequestID | varchar(255) | Echo‑back field |
Example Sync Trade Request
{
"jMessageType": "SYNC_ORDER_REQ",
"jManagerID": "<MANAGER_ID>",
"jCustomerId": "<CUSTOMER_ID>",
"jExchange": 1,
"jToken": "<Token received in Authentication Response>",
"jEntrySequenceNumber": 0,
"jRequestID": "<Echo back field>"
}
💻 Sync Trade Response
The response contains the following parameters:
| Parameter | Data Type | Description |
|---|---|---|
| jManagerId | varchar(50) | User ID assigned to the user |
| jCustomerId | varchar(50) | Customer ID assigned to the user |
| jLastSyncedPacket | int | Indicates if this is the last packet: 1 = Last packet |
| jNoOfRecords | int | Number of trade records included |
| jTradeMessage | Trade Detail Structure (array) | Array of trade detail records, with size equal to jNoOfRecords |
| jRequestID | varchar(255) | Echo‑back field |
| jResponseID | varchar(255) | System‑generated alphanumeric ID |
🧩 Trade Detail Structure
Each entry inside jTradeMessage contains the following fields:
| Parameter (Key) | Data Type | Description |
|---|---|---|
| Trade Number | int | Trade number |
| Order Number | int | Unique order number |
| Cli Order Number | int | Gateway/Client order number (system-generated) |
| Exchange | varchar(10) | Exchange |
| Scrip Token | int | Scrip token |
| Symbol | float | Exchange-provided security scrip name |
| Series | varchar(3) | Exchange-provided security series |
| InstrumentName | varchar(20) | Instrument name. Valid values: • Equity = blank • Future Index = FUTIDX • Interest Rate Future = FUTINT • Future Stock = FUTSTK • Option Index = OPTIDX • Option Stock = OPTSTK • MCX/NCDEX Futures = FUTCOM • MCX Spot = COM • NCDEX Spot = COMDTY • NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR • NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT |
| Expiry Date | varchar(10) | Expiry date (ddMMMyyyy, e.g., 24JUN2004). Applicable for F&O only; otherwise blank. |
| Strike Price | float | Exchange-provided strike price (in rupees). Applicable for options only; otherwise -1. |
| Option Type | varchar(2) | Option type. Applicable for options only; otherwise blank. |
| Buy Sell | int | Buy/Sell flag: • 1 → Buy• 2 → Sell |
| TradedQty | int | Traded quantity |
| TradedPrice | float | Traded price (in rupees) |
| Order Type | varchar(10) | Type of the order |
| Pro/Cli | int | Participant flag: • 2 → PRO• 1 → CLI |
| User ID | varchar(10) | Client code (blank for PRO users) |
| DealerCode | varchar(5) | Unique user identification code |
| Part Code | varchar(12) | Participant code; otherwise blank |
| TradeTime | varchar(10) | Trade timestamp (e.g., 15Jun2018 15.25.15) |
| Modify Time | varchar(10) | Modification timestamp (e.g., 15Jun2018 15.25.15) |
| Alias | varchar(5) | Alias ID; otherwise blank |
| Product | varchar(5) | Product type |
| Initiated By | varchar(25) | Application that initiated the trade (e.g., ADMIN, NET) |
| Modified By | varchar(25) | Application that modified the trade |
| Initiated By User Id | varchar(10) | User ID that initiated the trade |
| Modified By User Id | varchar(10) | User ID that modified the trade |
| Leg Indicator | int | Spread leg indicator |
| LocationID | varchar(5) | Location ID (PIN + NSECTCLBRANCH ID + NSECTCLID + ALGO FLAG + VENDOR CODE). Can be blank. |
| User Remarks | varchar(10) | User-provided remarks |
| Misc | varchar(50) | Miscellaneous values: • SPO-LMT• SPO-MKT• PO-MKT• PO-LMT |
| SpreadFlag | int | Spread flag: • 1 → Spread• 0 → Normal |
| Spread Price | float | Spread price (in rupees) |
| SequenceNo | int64 | Unique sequence number |
| Order Price | float | Order price (fresh or modified) in rupees |
| UniqueCode | varchar(12) | Alphanumeric value with special characters |