Skip to main content

Order & Report

Limits

A limit order is an order to buy or sell a stock with a restriction on the maximum price to be paid or the minimum price to be received (the "limit price"). If the order is filled, it will only be at the specified limit price or better.

The limits provide comprehensive information regarding the available cash, utilized margin, collateral margin, daily pay-in, and other relevant details.

Method: POST

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

Request details

API Parameters
Parameter Description Example
userId
string
Identifier for the user upon login, unique
to each user in the system.
AA0013
jKey
string
A unique key obtained upon successful login,
used for session identification and security.
d9b4e1b1c790424

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

limits = thefirstock.firstock_Limits(userId="PV0013")
curl --location --request POST 'https://connect.thefirstock.com/api/V4/limit' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jKey": "{{jKey}}",
    "userId": "{{userID}}"
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();

firstock.limits(userId: {{userId}},(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.limits();
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the outcome of the API
request. 'Success' denotes a
successful operation.
success
data.requestTime
String
The timestamp at which the
response was received, indicating the
exact time of the API response.
15:50:24 15-02-2023
data.cash
String
Current cash balance available
in the user's trading account.
-142.37
data.payin
String
Total amount transferred into
the trading account today via Payins.
0.00
data.marginused
String
Total margin or funds utilized
for trading activities on the current day.
0.00
data.brkcollamt
String
Amount of collateral pre-valued
and recognized by the broker for trading.
0.00
data.peak_mar
String
The highest margin that has
been utilized by the client during
the trading period.
0.00
data.span
String
Total span margin, which is
the minimum required margin to
hold a futures or options position
as per exchange guidelines.
0.00
data.expo
String
The exposure margin, which
is an additional amount over the
span margin, required for holding
futures and options positions.
0.00
data.premium
String
The total premium amount
used in options trading.
0.00
data.collateral
String
The value of the collateral
calculated based on the holdings
uploaded by the user, which can
be used for trading purposes.
0.00
{
  "status": "success",
  "data": {
      "requestTime": "15:50:24 15-02-2023",
      "cash": "-142.37",
      "payin": "0.00",
      "marginused": "0.00",
      "brkcollamt": "0.00",
      "peak_mar": "0.00",
      "span": "0.00",
      "expo": "0.00",
      "premium": "0.00",
      "collateral": "0.00"
  }
}

Failure response details

API Error Parameters
Parameter Description Example
status
String
Indicates the result status of
the API operation, such as success
or failure.
failed
code
String
HTTP status code associated with
the error, indicating the type of
issue encountered.
401
name
String
Specifies the type or category
of the error encountered in
textual format.
INVALID_JKEY
error.field
String
Identifies the specific field in
the request that triggered the error.
jKey
error.message
String
Provides a detailed message describing
the error for better understanding
and troubleshooting.
jKey parameter is invalid
{
  "status": "failed",
  "code": "401",
  "name": "INVALID_JKEY",
  "error": {
      "field": "jKey",
      "message": "jKey parameter is invalid"
  }
}