📊 MTM Template
MTM Template
- MTM Template is used to set the MTM parameters through multiple widgets available in the template. User can add/delete groups and can create multiple groups under a single template name. All the group data will be saved on created template name.
🎯 Template Structure
There are five widgets available under every group:
- Position to Consider
- Position to Square Off
- MTM Limit
- MTM Utilization
- Square Off Rules
📦 Widget Overview
| Widget | Purpose | Options | Description |
|---|---|---|---|
| Position to Consider | all positions that need to be considered for MTM computation | Segment / Instrument / Product / Position type | select market segment e.g., all F&O, all EQ, etc. Instrument and Product are dynamic based on segment selection. Position type: Long, Short or All positions. |
| Position to Square Off | all positions to be squared off based on trigger of MTM conditions | Segment / Instrument / Product / Position type | select market segment e.g., all F&O, all EQ, etc. Instrument and Product are dynamic based on segment selection. |
| MTM Limit | set the MTM Limit with the use of Multiplier against each Holding | Displays list of Dynamic Deposits available in Deposit Master + Collateral and CFS Deposits | Example: Available Cash Deposit = 10000, Multiplier = 1.50 → Available MTM Limit in Cash Deposit = 15000 |
| MTM Utilization | select what all values to consider for MTM computation | MTM Profit, MTM Loss, Booked Profit, Booked Loss, MTM Profit - Option, MTM Loss - Option, Booked Profit - Option, Booked Loss - Option, Brokerage and Charges (order/trade based), Option CFS limit | Used to compute total MTM utilized value |
| Square Off Rules | Pre and Post trigger percentages and events | Pre MTM Square off %, MTM Square off %, Pre Trigger Event, Post Trigger Event, Revert MTM Trigger Restriction Percentage, Reserve Amount Percentage, Max MTM Trigger Attempts | Configure alert and square-off triggers based on MTM utilization percentages |
⚙️ Template Creation
Template Controls
Template
- Control Type: Entry Field + Drop-Down
- Allow alphanumeric and allowable special characters
- Template name length per API
- Duplicate MTM template name creation should not be allowed
- Display list of template names on search
- Display list of groups created under the selected template
- Multiple MTM templates allowed
Save
- Control Type: Button
- On click of SAVE button, system should validate:
- Minimum one group should be available in an MTM Template
- Minimum one record should be available on each widget under the group
- Popup message when saving without template name: "Template Name should not be blank"
Save As
- Control Type: Button
- Create copy of existing template with a new template name (with or without modifications)
- Enabled after selecting a template
- On click, popup child window to enter new template name with OK and CANCEL
- OK saves new MTM template with all parameters; CANCEL closes without saving
- Validate new template name against existing templates; if duplicate, show "Template Name Already Exists"
👥 Group Creation
Group Controls
Group
- Allow alphanumeric and allowable special characters
- Group name length per API
- Display on keyword search
- Show groups under selected template in dropdown
- Multiple groups allowed per template
- Duplicate group name should not be allowed
Add
- On click Add — system should create the group
- If Group Name blank, popup: "GROUP-NAME should not be blank"
Rename
- Control Type: Button
- Allows rename; validate duplicates; if duplicate show "Group Name Already Exist"
Delete
- On click Delete — popup confirmation "Do you want to Delete the Group" (Yes/No)
- Yes: Delete selected group
- No: No changes
📊 Widget 1 & 2: Position to Consider / Position to Square Off
Both widgets share the same columns and behavior.
Configuration Fields
| Field | Business Logic |
|---|---|
| Market Segment | Display list of Market Segment (Base Segment + Combined Segment). 'OTHERS' (value -1) option available. |
| Instrument | Display list of applicable instruments per selected segment. For FO segments show FUTURE and OPTION. |
| Product | Display list of applicable product per selected segment. |
| Position Type | Displays Long Position / Short Position. Applicable for segments other than "Others" and not for certain holding types. |
| Add | Adds selected combination to widget grid; prevent duplicate combination. |
| Edit | Edit option available per record; allow modifying position type. |
| Delete | Delete option per record with confirmation (Yes/No). |
Frontend Validations
- Front-end validation to prevent same combination of Market Segment + Product Type across multiple groups.
- Example: Group 1 - All FNO + Future + Carryforward + All Position; Group 2 - All FNO + Option + Carryforward + All Position → system should restrict on save.
- "Position to Square-off" must contain records that are present in "Position to Consider" (Segment + Instrument + Product must match; Position Type may differ).
- Restrict MTM Square-off Percentage to be greater than Pre MTM Square-off Percentage; show popup on save if invalid.
💰 Widget 3: MTM Limit
Deposit head grid with following fields:
| Field | Business Logic |
|---|---|
| Deposit Head | List of deposit heads as received from API |
| Multiplier | Allowed range 0.0001 to 999.9999; only non-zero multipliers should be sent to API |
Validation:
- Members may modify multiplier values.
- While sending records to API, system should send only records with multiplier other than zero.
📊 Widget 4: MTM Utilization
List of items available in MTM Utilization widget:
| Item | Control Type |
|---|---|
| MTM Profit | Toggle |
| MTM Loss | Toggle |
| Booked Profit | Toggle |
| Booked Loss | Toggle |
| Option MTM Profit | Toggle |
| Option MTM Loss | Toggle |
| Option Booked Profit | Toggle |
| Option Booked Loss | Toggle |
| Brokerage | Drop-down: Order Based / Trade Based (default) / None |
| Option CFS Limit | Toggle |
Option CFS Limit logic:
- If Option CFS Limit toggle is ON, respective segment Option CFS amount shall be taken into consideration in MTM limit for the SIPs available in "Position to Consider".
- If OFF, Option CFS amount shall not be considered.
- Option CFS amount is derived based on Market Segment (irrespective of Instrument/Product).
🎯 Widget 5: Square-off Rules
Fields and business logic:
| Field | Business Logic |
|---|---|
| Variables | Pre-Trigger %, Post-Trigger %, Pre-Trigger Events, Post-Trigger Events, Revert MTM Trigger Restriction Percentage, Reserve Amount Percentage, Max MTM Trigger Attempts |
| Value | Allow to define the value against each variable |
Variable Field validation:
- Pre-Trigger % and Post-Trigger %: allowed range 0.0000 to 100.0000
- Pre-Trigger Event and Post-Trigger Event: Multi-select dropdown (refer to API for list)
- Revert MTM Trigger Restriction Percentage: 0.0000 to 100.0000
- Reserve Amount Percentage: 0.0000 to 100.0000
- Max MTM Attempts: range 1 to 99. Default: 1
🔗 Template Mapping
MTM Template created here will be allowed to map to entities like Client, Dealer, Branch and Member as well as for users through the "Template Mapping" window.
⚙️ Master Configuration Validation
MTM Profit/Loss shall be computed based on master configuration variables for respective product types, including:
- Enable MTM Calculation - Cash
- Enable MTM Calculation - Future
- Enable MTM Calculation on Long Position
- Enable MTM Calculation on Short Position
- Price to Consider for Uploaded Long/Short Position for Option, Future, CASH - MTM
Based on the enable/disable and price configuration (LCP, Uploaded Price, or Zero), the system shall compute MTM P/L.
📋 Validation and Rejection Logic
- Based on Pre-Trigger % and Post-Trigger % defined in Widget 5, system shall validate MTM P/L Utilization with respect to MTM Limit.
- Once MTM utilization hits Pre-Trigger %, system shall trigger events selected in Pre-Trigger Event list (e.g., Restrict Fresh Order, Cancel Pending Order, Square-off Open Position, Restrict Position Conversion).
- Once MTM utilization hits Post-Trigger %, system shall trigger events selected in Post-Trigger Event list.
💡 Example
Consider the Scenarios for MTM Computation as per the MTM Template Configuration
3 groups are created under an MTM Template - MTMTemp1
| Group | Configuration Type | Parameters |
|---|---|---|
| Group 1 | Position to Consider | All Equity - Margin - All Position |
| Group 1 | Position to Squareoff | All Equity - Margin - All Position |
| Group 1 | MTM Limit | Cash -2, Adhoc -1 |
| Group 1 | Limit Set | Cash - 10000, Adhoc - 20000 |
| Group 1 | MTM Utilization | MTM Profit - Tick, MTM Loss - Tick, Booked Profit - Tick, Booked Loss -Tick |
| Group 1 | Trigger% | Pre-trigger % -70, Post Trigger% -80 |
| Group 1 | Trigger Event | Pre Trigger - Restrict Fresh Order - Tick, Post Trigger - Restrict fresh Order -Tick |
| Group 2 | Position to Consider | All Equity - Delivery - Long Position |
| Group 2 | Position to Squareoff | All Equity - Delivery - Long Position |
| Group 2 | MTM Limit | Cash -0.5, Adhoc -1 |
| Group 2 | Limit Set | Cash - 10000, Adhoc - 20000 |
| Group 2 | MTM Utilization | MTM Profit - Un-Tick, MTM Loss - Tick, Booked Profit - Un-Tick, Booked Loss -Tick |
| Group 2 | Trigger% | Pre-trigger % -75, Post Trigger% -85 |
| Group 2 | Trigger Event | Pre Trigger - Restrict Fresh Order - Un-Tick, Post Trigger - Restrict fresh Order -Tick |
| Group 2 | Position to Consider | All FNO - Future - Carryforward - Short Position |
| Group 2 | Position to Squareoff | All FNO - Future - Carryforward - Short Position |
| Group 2 | MTM Limit | Cash - 1, Adhoc -1 |
| Group 2 | Limit Set | Cash - 10000, Adhoc - 20000 |
| Group 2 | MTM Utilization | MTM Profit - Tick, MTM Loss - Tick, Booked Profit - Tick, Booked Loss -Tick |
| Group 2 | Trigger% | Pre-trigger % -60, Post Trigger% -65 |
| Group 2 | Trigger Event | Pre Trigger - Restrict Fresh Order - Un-Tick, Post Trigger - Restrict fresh Order+Cancel Pending Order+Square off Open Position -Tick |
Case 1:
- Trade Buy Order in NSEEQ-ACC-Margin-Qty: 400, Price: 100
- Trade Buy Order in NSEEQ-TCS-Margin-Qty: 100, Price: 100
- Consider LTP of ACC is: 40, LTP of TCS is 60
- In this case, MTM P/L should be ( 400 * (40-100) ) = 400 * -60 = -24000 ( i.e. MTM Loss) for ACC and MTM P/L should be ( 100 * (60-100) ) = 100 * -40 = -4000 ( i.e. MTM Loss)
- Cumulative MTM P/L should be (-24000 - 4000) = -28000
- MTM Set Limit = (10000 * 2 + 20000 * 1 = 40000)
- As per Pre- Trigger % (i.e. 70 %), system reaches 70% Loss of 40000 (i.e. -28000). Accordingly Pre-Trigger Should get Hit and system should not allow to place further Fresh Order in any of the scrip.
Case 2:
- Trade Buy Order in NSEEQ-ACC-Margin-Qty: 400, Price: 100
- Trade Buy Order in NSEEQ-TCS-Margin-Qty: 100, Price: 100
- Consider LTP of ACC is: 40, LTP of TCS is 20
- In this case, MTM P/L should be ( 400 * (40-100) ) = 400 * -60 = -24000 ( i.e. MTM Loss) for ACC and MTM P/L should be ( 100 * (20-100) ) = 100 * - 80 = -8000 ( i.e. MTM Loss)
- Cumulative MTM P/L should be (-24000 - 8000) = -32000
- MTM Set Limit = (10000 * 2 + 20000 * 1 = 40000)
- As per Post- Trigger % (i.e. 80 %), system reaches 80% Loss of 40000 (i.e. -32000). Accordingly Post-Trigger Should get Hit and system should not allow to place further Fresh Order in any of the scrip.
Case 3:
- Trade Buy Order in NSEEQ-ACC-Delivery-Qty: 400, Price: 100
- Consider LTP of ACC is: 53
- In this case, MTM P/L should be ( 400 * (53-100) ) = 400 * -47 = -18800 ( i.e. MTM Loss)
- MTM P/L should be =-18800
- MTM Set Limit = (10000 * 0.5 + 20000 * 1 = 25000)
- As per Pre- Trigger % (i.e. 75 %), system reaches 75% Loss of 25000 (i.e. -18800). Accordingly Pre-Trigger Should get Hit and but in this case, system should allow to place further Fresh Order in any of the scrip where Restrict Fresh Order is Un-Tick for Delivery Product Type in Group 2.
- Consider LTP of ACC is: 45, accordingly MTM P/L should be ( 400 * (45 - 100 ) = 400 * -55 = - 22000 which is above 85% Utilization of MTM Set Limit and Post trigger got hit. In this case, system should not allow to place fresh order in any of the scrip where Restrict Fresh Order is Ticked in Post Trigger Event for Delivery Product type in Group 2.
Case 4:
- Trade Sell Order in NSEFNO-ACC-Carry forward-Qty: 400, Price: 100
- Consider LTP of ACC is: 147
- In this case, MTM P/L should be ( 400 * (100 -147) ) = 400 * -47 = -18800 ( i.e. MTM Loss)
- MTM P/L should be =-18800
- MTM Set Limit = (10000 * 1 + 20000 * 1 = 30000)
- As per Pre- Trigger % (i.e. 60 %), system reaches above 60% Loss of 30000 (i.e. -18800).
- Consider LTP of ACC is: 160, accordingly MTM P/L should be ( 400 * (160 - 100 ) = 400 * 60 = -24000 which is above 80% Utilization of MTM Set Limit and Post trigger got hit. In this case, system should not allow to place fresh order in any of the scrip where Restrict Fresh Order is Ticked in Post Trigger Event for Delivery Product type in Group 2 and Square off the Open position trade Sell Order in NSEFNO-ACC-Carry forward.