MQuant Developers v1
Open MQuant

XTS API reference

Every XTS-compatible endpoint, under https://app.mquant.in/api/v1/interactive. Paths, function names, fields and replies are those of the Symphony XTS Interactive API. Rules that apply to every endpoint are in the XTS-compatible API guide.

Method and path under /api/v1/interactiveWhatPython XTConnectNode xts-interactive-api
POST /user/sessionLog ininteractive_loginlogIn
DELETE /user/sessionLog outinteractive_logoutlogOut
GET /user/profileProfileget_profilegetProfile
GET /user/balanceBalance, all zeroget_balancegetBalance
GET /user/enumsEnumsNonegetEnums
POST /ordersPlace an orderplace_orderplaceOrder
PUT /ordersModify an ordermodify_ordermodifyOrder
DELETE /orders?appOrderID=Cancel an ordercancel_ordercancelOrder
POST /orders/cancelallCancel all in a segmentcancelall_orderNone
GET /ordersOrder bookget_order_bookgetOrderBook
GET /orders?appOrderID=Order historyget_order_historygetOrderHistory
GET /orders/tradesTrade book, emptyget_tradegetTradeBook
GET /portfolio/positions?dayOrNet=Positions, emptyget_position_daywise, get_position_netwisegetPositions
GET /portfolio/holdingsHoldings, emptyget_holdinggetHoldings

The examples assume you have logged in: in Python an XTSConnect named xt after xt.interactive_login(); in Node.js an XTSInteractive named xts after await xts.logIn(…), inside an async function; in the shell XTS_ROOT=https://app.mquant.in/api/v1 and TOKEN from the login call. Pick a language once and every page remembers it.

Dealer endpoints#

Dealer-style code that calls these gets the same reply as the investor endpoint. MQuant answers isInvestorClient: true, so the SDKs do not call them on their own.

Path under /api/v1/interactiveSame asPython XTConnect
GET /orders/dealerorderbookOrder bookget_dealer_orderbook
GET /orders/dealertradebookTrade bookget_dealer_tradebook
GET /portfolio/dealerpositions?dayOrNet=Positionsget_dealerposition_daywise, get_dealerposition_netwise

Any other path under /interactive/ returns 400 e-mquant-0001 "Not supported by MQuant". A supported path with the wrong method returns 405 e-request-0002 with an Allow header.

Log in#

POST/api/v1/interactive/user/session

Exchanges your MQuant key id and secret for a session token. Send the token in the authorization header on every other call.

  • SDK Python interactive_login() · Node logIn({ appKey, secretKey, source })
  • Auth appKey and secretKey
  • Rate class Login
  • Max body 4,096 bytes
Body fieldRule
appKeyRequired. Your MQuant key id, mq_live_pk_… or mq_test_pk_….
secretKeyRequired. Your MQuant secret.
sourceOptional, default WEBAPI. Any XTS source: WEBAPI, WEB, TWS, TWSAPI, MOBILEANDROID, MOBILEIOS, ENTERPRISEWEB, ENTERPRISEMOBILE, ENTERPRISETWS, or its number.
uniqueKey, accessToken, userIDAccepted and ignored.

The body may be JSON or form-encoded, with any Content-Type. The token lasts until midnight IST. MQuantTokenExpiry gives the time in IST, application_expiry_date the key's expiry date.

Responses

  • 200s-user-0001 "Valid User." with result.token and result.userID.
  • 400e-user-0001 wrong appKey or secretKey; e-user-0003 key revoked, expired or suspended, or trader inactive; e-user-0004 unreadable body or bad source.
  • 403e-user-0005: your IP is not on the key's allowlist.
  • 429e-user-0002 after repeated failed logins; e-rate-0001 login limit.
Python XTConnect
from Connect import XTSConnect

xt = XTSConnect("mq_test_pk_YOUR_KEY_ID", "mq_test_sk_YOUR_SECRET", "WEBAPI",
                root="https://app.mquant.in/api/v1")
login = xt.interactive_login()
print(login["type"], login["result"]["userID"], login["result"]["MQuantTokenExpiry"])
Response 200 (enums abridged)
{"type": "success", "code": "s-user-0001", "description": "Valid User.", "result": {
  "enums": {
    "socketEvent": [],
    "orderSide": ["BUY", "SELL"],
    "positionSqureOffMode": ["DayWise", "NetWise"],
    "positionSquareOffQuantityType": ["Percentage", "ExactQty"],
    "dayOrNet": ["DAY", "NET"],
    "instrumentType": ["Futures", "Options", "Equity"],
    "exchangeSegment": ["NSECM", "NSEFO", "BSECM", "BSEFO", "MCXFO"],
    "exchangeInfo": {"NSECM": {"productType": {"1": "MIS", "2": "NRML", "4": "CNC", "MIS": 1, "NRML": 2, "CNC": 4}, "orderType": ["StopLimit", "StopMarket", "Limit", "Market"], "timeInForce": ["DAY", "IOC"]}, "...": "..."}
  },
  "clientCodes": ["MQ12"],
  "exchangeSegmentArray": [{"key": "NSECM", "value": "NSECM"}, {"key": "NSEFO", "value": "NSEFO"}, {"key": "BSECM", "value": "BSECM"}, {"key": "BSEFO", "value": "BSEFO"}, {"key": "MCXFO", "value": "MCXFO"}],
  "token": "mq_xts_…",
  "userID": "MQ12",
  "isInvestorClient": true,
  "isOneTouchUser": false,
  "application_expiry_date": "02-03-2027",
  "MQuantTokenExpiry": "03-12-2026 00:00:00",
  "MQuantMode": "live",
  "MQuantNote": "MQuant stores every order as a signal for the desk. Nothing is sent to an exchange."
}}

Profile#

GET/api/v1/interactive/user/profile

Your client id, name and the segments MQuant can resolve instruments for. No email, phone, PAN, address or bank data is returned.

  • SDK Python get_profile() · Node getProfile()
  • Auth Session token
  • Scope Any
  • Rate class Read

Enabled in ClientExchangeDetailsList is true for a segment MQuant has an instrument master for.

Responses

  • 200s-user-0001 "User profile".
Python XTConnect
profile = xt.get_profile()
print(profile["result"]["ClientId"], profile["result"]["ClientName"])
Response 200
{"type": "success", "code": "s-user-0001", "description": "User profile", "result": {
  "ClientId": "MQ12", "ClientName": "Ravi Kumar", "EmailId": "", "MobileNo": "", "PAN": "",
  "IncludeInAutoSquareoff": false, "IncludeInAutoSquareoffBlocked": false,
  "IsProClient": false, "IsInvestorClient": true,
  "ResidentialAddress": "", "OfficeAddress": "", "ClientBankInfoList": [],
  "ClientExchangeDetailsList": {
    "NSECM": {"ClientId": "MQ12", "ExchangeSegNumber": 1, "Enabled": true, "ParticipantCode": ""},
    "NSEFO": {"ClientId": "MQ12", "ExchangeSegNumber": 2, "Enabled": true, "ParticipantCode": ""},
    "BSECM": {"ClientId": "MQ12", "ExchangeSegNumber": 11, "Enabled": true, "ParticipantCode": ""},
    "BSEFO": {"ClientId": "MQ12", "ExchangeSegNumber": 12, "Enabled": true, "ParticipantCode": ""},
    "MCXFO": {"ClientId": "MQ12", "ExchangeSegNumber": 51, "Enabled": false, "ParticipantCode": ""}
  },
  "MQuantKeyId": "mq_live_pk_7Lq2Wd9XcR4tVb1N0ZpKfE", "MQuantKeyLabel": "Algo box 1", "MQuantMode": "live",
  "MQuantNote": "MQuant stores every order as a signal for the desk. Nothing is sent to an exchange."
}}

Balance#

GET/api/v1/interactive/user/balance

The XTS balance shape with every amount zero. MQuant holds no money for you.

  • SDK Python get_balance() · Node getBalance()
  • Auth Session token
  • Scope Any
  • Rate class Read

Responses

  • 200s-user-0002 "OK". BalanceList is a list with one entry.
Python XTConnect
balance = xt.get_balance()
print(balance["result"]["BalanceList"][0]["limitObject"]["RMSSubLimits"]["netMarginAvailable"])
Response 200 (abridged)
{"type": "success", "code": "s-user-0002", "description": "OK", "result": {"BalanceList": [{
  "limitHeader": "ALL|ALL|ALL",
  "limitObject": {
    "RMSSubLimits": {"cashAvailable": "0", "collateral": 0, "marginUtilized": "0", "netMarginAvailable": "0", "MTM": "0", "UnrealizedMTM": "0", "RealizedMTM": "0"},
    "marginAvailable": {"CashMarginAvailable": 0, "...": 0},
    "marginUtilized": {"GrossExposureMarginPresent": 0, "...": 0},
    "limitsAssigned": {"CNCLimit": 0, "...": 0},
    "AccountID": "MQ12"
  }
}], "MQuantNote": "MQuant holds no funds. All balances are zero."}}

Enums#

GET/api/v1/interactive/user/enums

The same enums object the login reply carries: segments, product types, order types and validities MQuant accepts.

  • SDK Python None · Node getEnums({ userID })
  • Auth Session token
  • Scope Any
  • Rate class Read

The userID query parameter is accepted and ignored. XTConnect has no function for it; read enums from the login reply instead.

Responses

  • 200s-user-0001 "Enums".
Node xts-interactive-api
const enums = await xts.getEnums({ userID: xts.userID })
console.log(enums.result.enums.exchangeSegment)
Response 200 (abridged)
{"type": "success", "code": "s-user-0001", "description": "Enums", "result": {
  "enums": {"exchangeSegment": ["NSECM", "NSEFO", "BSECM", "BSEFO", "MCXFO"], "...": "..."},
  "clientCodes": ["MQ12"],
  "isInvestorClient": true
}}

Place an order#

POST/api/v1/interactive/orders

Validates the order, resolves the instrument and stores it as a signal with status received. Nothing is sent to an exchange.

  • SDK Python place_order(...) · Node placeOrder({...})
  • Auth Session token
  • Scope signals:write
  • Rate class Write, cost 1
  • Max body 8,192 bytes
Body fieldRule
exchangeSegmentNSECM, NSEFO, BSECM, BSEFO, MCXFO or 1, 2, 11, 12, 51
exchangeInstrumentIDThe exchange token, as at your broker
productTypeMIS, NRML or CNC
orderTypeMARKET, LIMIT, STOPMARKET or STOPLIMIT
orderSideBUY or SELL
timeInForceDAY or IOC
orderQuantityUnits; a multiple of the lot size on F&O
disclosedQuantityOptional, default 0
limitPrice, stopPrice0 means not set; required as the order type needs; tick-size multiples
orderUniqueIdentifierOptional, up to 20 characters; echoed back
apiOrderSource, clientIDOptional

Every rule is in Order fields. An identical order with the same orderUniqueIdentifier within 10 seconds returns the first order with Idempotent-Replayed: true. MQuantWarnings may hold outside_market_hours, notional_unchecked or expiry_today.

Responses

  • 200s-orders-0001 "Request sent" with AppOrderID.
  • 400e-orders-0001 Bad Request with result.errors; e-orders-0004 risk cap; e-instrument-0001 to 0004; e-request-0004 unreadable JSON.
  • 403e-user-0007 the key lacks signals:write.
  • 503e-mquant-0003: new orders are paused by the desk.
Python XTConnect
order = xt.place_order(
    exchangeSegment=xt.EXCHANGE_NSECM,
    exchangeInstrumentID=2885,
    productType=xt.PRODUCT_MIS,
    orderType=xt.ORDER_TYPE_LIMIT,
    orderSide=xt.TRANSACTION_TYPE_BUY,
    timeInForce=xt.VALIDITY_DAY,
    disclosedQuantity=0,
    orderQuantity=10,
    limitPrice=1250.5,
    stopPrice=0,
    orderUniqueIdentifier="reliance1",
    apiOrderSource="WEBAPI",
)
print(order["type"], order["result"]["AppOrderID"])
Response 200
{"type": "success", "code": "s-orders-0001", "description": "Request sent", "result": {
  "AppOrderID": 1000000017,
  "OrderUniqueIdentifier": "reliance1",
  "ClientID": "MQ12",
  "MQuantSignalID": "sig_9f2c4e1a7b3d5f60a1b2c3d4",
  "MQuantWarnings": []
}}

Order book#

GET/api/v1/interactive/orders

Today's orders (since midnight IST) placed through this interface by your trader, in the key's mode, oldest first.

  • SDK Python get_order_book() · Node getOrderBook()
  • Auth Session token
  • Scope signals:read
  • Rate class Read

One row per order in the XTS order book shape. OrderStatus follows the status mapping; MQuantStatus and MQuantSignalID give the signal behind it. Times are IST, DD-MM-YYYY HH:MM:SS. ExchangeTransactTime is the last status change at MQuant, as there is no exchange.

Responses

  • 200s-orders-0001 "Success order book"; result is a list.
  • 403e-user-0007 the key lacks signals:read.
Python XTConnect
book = xt.get_order_book()
for row in book["result"]:
    print(row["AppOrderID"], row["TradingSymbol"], row["OrderStatus"], row["MQuantStatus"])
Response 200
{"type": "success", "code": "s-orders-0001", "description": "Success order book", "result": [
  {
    "LoginID": "MQ12", "ClientID": "MQ12", "AppOrderID": 1000000017,
    "OrderReferenceID": "", "GeneratedBy": "TWSAPI", "ExchangeOrderID": "",
    "OrderCategoryType": "NORMAL", "ExchangeSegment": "NSECM", "ExchangeInstrumentID": 2885,
    "OrderSide": "BUY", "OrderType": "Limit", "ProductType": "MIS", "TimeInForce": "DAY",
    "OrderPrice": 1250.5, "OrderQuantity": 10, "OrderStopPrice": 0,
    "OrderStatus": "New", "OrderAverageTradedPrice": "0",
    "LeavesQuantity": 10, "CumulativeQuantity": 0, "OrderDisclosedQuantity": 0,
    "OrderGeneratedDateTime": "02-12-2026 10:15:02", "ExchangeTransactTime": "02-12-2026 10:15:02",
    "TradingSymbol": "RELIANCE", "LastUpdateDateTime": "02-12-2026 10:15:02",
    "OrderExpiryDate": "01-01-1980 00:00:00", "CancelRejectReason": "",
    "OrderUniqueIdentifier": "reliance1", "OrderLegStatus": "SingleOrderLeg", "BoLegDetails": 0,
    "IsSpread": false, "BoEntryOrderId": "", "ApiOrderSource": "WEBAPI",
    "MessageCode": 9004, "MessageVersion": 4, "TokenID": 0, "ApplicationType": 0,
    "SequenceNumber": 0, "IsAMO": false, "ApiVendorCode": "", "DashboardAppKey": "",
    "MQuantStatus": "received", "MQuantSignalID": "sig_9f2c4e1a7b3d5f60a1b2c3d4"
  }
]}

Order history#

GET/api/v1/interactive/orders?appOrderID={appOrderID}

Every state of one order, oldest first: New, a Replaced row per modification, then PendingCancel, Cancelled or Rejected.

  • SDK Python get_order_history(appOrderID) · Node getOrderHistory(appOrderID)
  • Auth Session token
  • Scope signals:read
  • Rate class Read
Query parameterRule
appOrderIDRequired. Any AppOrderID of your trader in the key's mode, from any day.

Each row shows the quantity and prices the order had at that point.

Responses

  • 200s-orders-0001 "Success order history".
  • 400e-orders-0002 unknown AppOrderID; e-orders-0001 it is not a number.
Python XTConnect
history = xt.get_order_history(appOrderID=1000000017)
print([row["OrderStatus"] for row in history["result"]])
Response 200 after one modify (first row abridged)
{"type": "success", "code": "s-orders-0001", "description": "Success order history", "result": [
  {"AppOrderID": 1000000017, "OrderStatus": "New", "OrderQuantity": 10, "OrderPrice": 1250.5, "MQuantStatus": "received", "...": "..."},
  {
    "LoginID": "MQ12", "ClientID": "MQ12", "AppOrderID": 1000000017,
    "OrderReferenceID": "", "GeneratedBy": "TWSAPI", "ExchangeOrderID": "",
    "OrderCategoryType": "NORMAL", "ExchangeSegment": "NSECM", "ExchangeInstrumentID": 2885,
    "OrderSide": "BUY", "OrderType": "Limit", "ProductType": "MIS", "TimeInForce": "DAY",
    "OrderPrice": 1249.5, "OrderQuantity": 20, "OrderStopPrice": 0,
    "OrderStatus": "Replaced", "OrderAverageTradedPrice": "0",
    "LeavesQuantity": 20, "CumulativeQuantity": 0, "OrderDisclosedQuantity": 0,
    "OrderGeneratedDateTime": "02-12-2026 10:15:02", "ExchangeTransactTime": "02-12-2026 10:16:40",
    "TradingSymbol": "RELIANCE", "LastUpdateDateTime": "02-12-2026 10:16:40",
    "OrderExpiryDate": "01-01-1980 00:00:00", "CancelRejectReason": "",
    "OrderUniqueIdentifier": "reliance1", "OrderLegStatus": "SingleOrderLeg", "BoLegDetails": 0,
    "IsSpread": false, "BoEntryOrderId": "", "ApiOrderSource": "WEBAPI",
    "MessageCode": 9004, "MessageVersion": 4, "TokenID": 0, "ApplicationType": 0,
    "SequenceNumber": 0, "IsAMO": false, "ApiVendorCode": "", "DashboardAppKey": "",
    "MQuantStatus": "received", "MQuantSignalID": "sig_9f2c4e1a7b3d5f60a1b2c3d4"
  }
]}

Modify an order#

PUT/api/v1/interactive/orders

Changes the product, order type, quantity, prices or validity of an order the desk has not acted on yet (signal status received).

  • SDK Python modify_order(...) · Node modifyOrder({...})
  • Auth Session token
  • Scope signals:write
  • Rate class Write, cost 1
  • Max body 8,192 bytes
Body fieldRule
appOrderIDRequired
modifiedProductType, modifiedOrderType, modifiedOrderQuantity, modifiedTimeInForceRequired, with the place rules
modifiedDisclosedQuantity, modifiedLimitPrice, modifiedStopPriceOptional, default 0
orderUniqueIdentifierOptional; echoed back. The stored tag does not change.
apiOrderSource, clientID, algoID, algoCategoryAccepted

The segment, instrument and side cannot change. A modify that changes nothing succeeds and stores nothing.

Responses

  • 200s-orders-0001 "Request sent".
  • 400e-orders-0001 invalid modified… fields; e-orders-0002 not found; e-orders-0003 the order is no longer received.
  • 503e-mquant-0003: new orders are paused by the desk.
Python XTConnect
reply = xt.modify_order(
    appOrderID=1000000017,
    modifiedProductType=xt.PRODUCT_MIS,
    modifiedOrderType=xt.ORDER_TYPE_LIMIT,
    modifiedOrderQuantity=20,
    modifiedDisclosedQuantity=0,
    modifiedLimitPrice=1249.5,
    modifiedStopPrice=0,
    modifiedTimeInForce=xt.VALIDITY_DAY,
    orderUniqueIdentifier="reliance1",
)
print(reply["type"], reply["result"])
Response 200
{"type": "success", "code": "s-orders-0001", "description": "Request sent", "result": {"AppOrderID": 1000000017, "OrderUniqueIdentifier": "reliance1", "ClientID": "MQ12"}}

Cancel an order#

DELETE/api/v1/interactive/orders?appOrderID={appOrderID}

Withdraws an order. Its signal becomes cancelled (or cancel_requested once mapped). Nothing is sent to an exchange.

  • SDK Python cancel_order(appOrderID, orderUniqueIdentifier) · Node cancelOrder({ appOrderID, orderUniqueIdentifier })
  • Auth Session token
  • Scope signals:write
  • Rate class Write, cost 1
Query parameterRule
appOrderIDRequired
orderUniqueIdentifier, clientIDOptional

Works while new orders are paused.

Responses

  • 200s-user-0001 "Request sent"; result is a one-item list.
  • 400e-orders-0002 not found; e-orders-0003 already cancelled or rejected.
Python XTConnect
cancel = xt.cancel_order(appOrderID=1000000017, orderUniqueIdentifier="reliance1")
print(cancel["type"], cancel["result"])
Response 200
{"type": "success", "code": "s-user-0001", "description": "Request sent", "result": [{"AppOrderID": 1000000017, "ClientID": "MQ12"}]}

Cancel all#

POST/api/v1/interactive/orders/cancelall

Cancels today's open orders placed through this interface in one segment, for one instrument or for all of them.

  • SDK Python cancelall_order(exchangeSegment, exchangeInstrumentID) · Node None
  • Auth Session token
  • Scope signals:write
  • Rate class Write, cost 1
  • Max body 4,096 bytes
Body fieldRule
exchangeSegmentRequired, as for place
exchangeInstrumentIDRequired. 0 means every instrument in the segment.
clientIDOptional

The header X-MQuant-Cancelled gives the number of orders changed. Works while new orders are paused. The Node SDK 3.0.3 has no function for it.

Responses

  • 200s-cancelAll-0001; result is an empty string.
  • 400e-orders-0001 bad segment or id.
Python XTConnect
reply = xt.cancelall_order(exchangeSegment=xt.EXCHANGE_NSECM, exchangeInstrumentID=0)
print(reply["type"], reply["description"])
Response 200
{"type": "success", "code": "s-cancelAll-0001", "description": "Cancel All Order Request Send Successfully", "result": ""}

Trade book#

GET/api/v1/interactive/orders/trades

Always an empty list: MQuant does not execute orders.

  • SDK Python get_trade() · Node getTradeBook()
  • Auth Session token
  • Scope Any
  • Rate class Read

Responses

  • 200s-tradeBook-0001 "Success trade book".
Python XTConnect
trades = xt.get_trade()
print(trades["result"])
Response 200
{"type": "success", "code": "s-tradeBook-0001", "description": "Success trade book", "result": []}

Positions#

GET/api/v1/interactive/portfolio/positions?dayOrNet={dayOrNet}

Always an empty position list.

  • SDK Python get_position_daywise(), get_position_netwise() · Node getPositions({ dayOrNet })
  • Auth Session token
  • Scope Any
  • Rate class Read
Query parameterRule
dayOrNetRequired. DayWise or NetWise (also DAY, NET, 1, 2), any case.

Responses

  • 200s-portfolio-0009 "Success get position".
  • 400e-portfolio-0001 dayOrNet missing or wrong.
Python XTConnect
positions = xt.get_position_netwise()
print(positions["result"]["positionList"])
Response 200
{"type": "success", "code": "s-portfolio-0009", "description": "Success get position", "result": {"positionList": []}}

Holdings#

GET/api/v1/interactive/portfolio/holdings

Always empty holdings.

  • SDK Python get_holding() · Node getHoldings()
  • Auth Session token
  • Scope Any
  • Rate class Read

Responses

  • 200s-portfolio-0012 "Success holding".
Python XTConnect
holdings = xt.get_holding()
print(holdings["result"]["RMSHoldings"])
Response 200
{"type": "success", "code": "s-portfolio-0012", "description": "Success holding", "result": {
  "ClientId": "MQ12", "IsCollateralLTPBased": false, "RMSHoldings": {"Holdings": {}}, "CollateralHoldings": {}
}}

Log out#

DELETE/api/v1/interactive/user/session

Ends this session. The token stops working at once; your other sessions on the key keep working.

  • SDK Python interactive_logout() · Node logOut()
  • Auth Session token
  • Scope Any
  • Rate class None

Responses

  • 200s-user-0001; result is an empty string.
  • 400e-session-0007 "Invalid Token": the session had already ended.
Python XTConnect
reply = xt.interactive_logout()
print(reply["type"], reply["description"])
Response 200
{"type": "success", "code": "s-user-0001", "description": "successfully logout from all API.", "result": ""}