Skip to main content

Order & Report

Product Conversion

Position conversion is defined as an act of converting trades from their original product type and intent. For instance, if intraday trades are converted to positional carry forward trades, this shall be an act of position conversion and so on.

The conversion of positions involves transforming an Intraday position into an overnight position, and vice versa.

Method: POST

https://connect.thefirstock.com/api/V4/productConversion

Request details

API Parameters
Parameter Description Example
userId
String
Identifier for the user upon login, unique
to each user in the system.
AA0013
exchange
String
Exchange on which the order is placed
(e.g., NSE, BSE, NFO, BFO)
NFO
quantity
String
Number of shares or contracts to be traded 250
product
String
Product code indicating the type of trade
C -> Cash and Carry,
M -> F&O Normal,
I -> Intraday
I
previousProduct
String
Specifies the original product type of the
position before conversion.
C -> Cash and Carry,
M -> F&O Normal,
I -> Intraday
M
transactionType
String
Transaction type, either Buy (B) or Sell (S) B
positionType
String
Indicates whether the position is
a Day position (for intraday trading)
or CF (Carry Forward) for positions
held beyond the trading day.
CF
tradingSymbol
String
Encoded trading symbol of the security NIFTY
jKey
String
Authentication token obtained from
the login API
d9b4e1b1c79042

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

convertProduct = thefirstock.firstock_ConvertProduct(
    userId="{{userId}}",
    transactionType="B",
    tradingSymbol="ITC-EQ",
    quantity="1",
    product="C",
    previousProduct="I",
    positionType="DAY",
    exchange="NSE"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/productConversion' \
--header 'Content-Type: application/json' \
--data-raw '{
    "userId": "{{userID}}",
    "exchange": "",
    "tradingSymbol": "",
    "quantity": "",
    "product": "",
    "transactionType": "",
    "previousProduct": "",
    "positionType": "",
    "jKey": "{{jKey}}"
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();

firstock.productConversion(
  {
    userId: {{userId}},
    exchange: "NSE",
    tradingSymbol: "ITC-EQ",
    quantity: "1",
    product: "C",
    previousProduct: "I",
    transactionType: "B",
    positionType: "DAY",
  },
  (err, result) => {
    console.log("Error, ", err);
    console.log("Result: ", result);
  }
);
using thefirstock;

class Program
{
    public static void Main()
    {
        Firstock firstock = new Firstock(userId: {{userId}});
        var result = firstock.productConversion(
           exchange: "NFO",
           tradingSymbol: "ITC-EQ",
           quantity: "1",
           product: "C",
           previousProduct: "I",
           transactionType: "B",
           positionType: "DAY"
            );
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the overall success status
of the API call
success
data.status
String
Specific status of the response,
typically used for more granular feedback
ok
data.requestTime
String
The time at which the response was
received, indicating the timestamp
of the operation
17:38:34 17-02-2023
{
  "status": "success",
  "data": {
    "requestTime": " "17:38:34 17-02-2023"",
    "status": "ok"
  }
}

Failure response details

API Error Parameters
Parameter Description Example
status
String
Indicates the result status of
the API operation, such as failure or success.
failed
code
String
HTTP status code indicating the
nature of the error.
404
name
String
Specifies the type or category
of the error encountered, such as
an invalid request or server error.
ORDERS_NOT_FOUND
error.field
String
Identifies the specific field in
the request that triggered the error.
orderDetails
error.message
String
Detailed explanation of the error
message, providing more context on
why the error occurred.
No data on the orders was found
{
  "status": "failed",
  "code": "404",
  "name": "ORDERS_NOT_FOUND",
  "error": {
      "field": "orderDetails",
      "message": "No data on the orders was found"
  }
}