Skip to content

Position Conversion

POST /position/convertPosition

Convert an existing position of a margin product to a different margin product type. All or a subset of an existing position quantity can be converted to a different product type.The available margin product types are MARGIN_INTRADAY_SQUAREOFF(MIS), CASHNCARRY(CNC), NORMAL(NRML).

Parameters

NameTypeRequiredDescription
bodyobjectfalsenone
symbolNamestringtrueSymbol name of the scrip
exchangestringtrueName of the exchange. If the user does not provide an exchange name, by default considered as NSE
transactionTypestringtrueTransaction type can be either BUY or SELL
positionTypestringtrueDAY or NET
netQuantitystringtrueTotal quantity of the position
quantityToConvertstringtrueQuantity to be converted. Can be less than or equal to netQuantity
fromProductTypestringtrueThe existing product type of the position. It can be CNC (Cash and Carry), NRML (Normal), MIS (Intraday)
toProductTypestringtrueThe target product type user wants to convert to. It can be CNC (Cash and Carry), NRML (Normal), MIS (Intraday)

Sample Request Body

json
requestBody={
  "symbolName": "RELIANCE",
  "exchange": "BSE",
  "transactionType": "BUY",
  "positionType": "DAY",
  "netQuantity": "18",
  "quantityToConvert": "2",
  "fromProductType": "MIS",
  "toProductType": "CNC"
}

Live trading endpoint

This sample sends a real request against your trading account. Replace <SESSION_TOKEN> and review every field before running — Samco does not provide a sandbox, and any successful call affects live positions and balances.

Sample Code

bash
curl -X POST 'https://tradeapi.samco.in/position/convertPosition' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>' \
  -d '{"symbolName":"RELIANCE","exchange":"BSE","transactionType":"BUY","positionType":"DAY","netQuantity":"18","quantityToConvert":"2","fromProductType":"MIS","toProductType":"CNC"}'
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Sample {
  public static void main(String[] args) throws Exception {
    String requestBody = """
        {
          "symbolName": "RELIANCE",
          "exchange": "BSE",
          "transactionType": "BUY",
          "positionType": "DAY",
          "netQuantity": "18",
          "quantityToConvert": "2",
          "fromProductType": "MIS",
          "toProductType": "CNC"
        }
        """;

    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/position/convertPosition"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .POST(HttpRequest.BodyPublishers.ofString(requestBody))
        .build();

    HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.body());
  }
}
js
(async () => {
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'x-session-token': '<SESSION_TOKEN>',
  };

  const requestBody = {
    symbolName: "RELIANCE",
    exchange: "BSE",
    transactionType: "BUY",
    positionType: "DAY",
    netQuantity: "18",
    quantityToConvert: "2",
    fromProductType: "MIS",
    toProductType: "CNC"
  };

  const response = await fetch('https://tradeapi.samco.in/position/convertPosition', {
    method: 'POST',
    headers,
    body: JSON.stringify(requestBody),
  });

  const data = await response.json();
  console.log(data);
})();
py
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': '<SESSION_TOKEN>',
}

requestBody = {
  "symbolName": "RELIANCE",
  "exchange": "BSE",
  "transactionType": "BUY",
  "positionType": "DAY",
  "netQuantity": "18",
  "quantityToConvert": "2",
  "fromProductType": "MIS",
  "toProductType": "CNC"
}

r = requests.post('https://tradeapi.samco.in/position/convertPosition',
  data=json.dumps(requestBody),
  headers=headers)

print(r.json())

Sample Responses

json
{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMsg": "Position Conversion from MIS to CNC successful"
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringTime at Server.
msgIdstringThis is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
statusstringStatus of the position conversion request. Success / Failure
statusMsgstringStatus message of position conversion request