Market Quote and Instrument
Market Quote and Instrument APIs
method | path | description |
---|---|---|
GET | https://api.mstock.trade/openapi/typea/instruments/quote/ohlc | View OHLC and LTP market data |
GET | https://api.mstock.trade/openapi/typea/instruments/quote/ltp | View OHLC and LTP market data |
GET | https://api.mstock.trade/openapi/typea/instruments/scriptmaster | Provides the consolidated,csv formatted list of instruments |
Market OHLC Data
This endpoint returns the OHLC market data identified by the exchange:tradingsymbol combination that are passed as values to the query parameter.
Request Headers -
-
X-Mirae-Version: Specifies the version of the API being used. In this case, it is set to 1.
-
Authorization: A token-based authentication header. The format is token api_key:access_token.
curl --location 'https://api.mstock.trade/openapi/typea/instruments/quote/ohlc?i=NSE%3AACC&i=BSE%3AACC' \
--header 'X-Mirae-Version: 1' \
--header 'Authorization: token access_token'
import axios from 'axios';
const params = new URLSearchParams();
params.append('i', 'NSE:ACC');
params.append('i', 'BSE:ACC');
const response = await axios.get('https://api.mstock.trade/openapi/typea/instruments/quote/ohlc', {
params: params,
headers: {
'X-Mirae-Version': '1',
'Authorization': 'token access_token'
}
});
import requests
headers = {
'X-Mirae-Version': '1',
'Authorization': 'token access_token',
}
params = {
'i': [
'NSE:ACC',
'BSE:ACC',
],
}
response = requests.get('https://api.mstock.trade/openapi/typea/instruments/quote/ohlc', params=params, headers=headers)
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NORMAL)
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.mstock.trade/openapi/typea/instruments/quote/ohlc?i=NSE%3AACC&i=BSE%3AACC"))
.GET()
.setHeader("X-Mirae-Version", "1")
.setHeader("Authorization", "token access_token")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Query Parameter -
Field | Description |
---|---|
i | NSE:ACC |
i | BSE:ACC |
Request Body - This endpoint does not require a request body or additional parameters in the query string for the retrieval of orders.
Request Response -
The response of the request will be based on authentication outcome.
- Success (HTTP Status 200): On successful order update, the server returns a JSON object containing the order ID and status.
{
"status": "success",
"data": {
"NSE:ACC": {
"instrument_token": 500410,
"last_price": 195700,
"ohlc": {
"open": 201190,
"high": 201190,
"low": 195005,
"close": 200745
}
},
"BSE:ACC": {
"instrument_token": 500410,
"last_price": 195700,
"ohlc": {
"open": 201190,
"high": 201190,
"low": 195005,
"close": 200745
}
}
}
}
{
"status": "error",
"message": "Invalid request. Please try again.",
"error_type": "TokenException",
"data": null
}
- Failure (HTTP Status 400): If the API Key is Invalid or expired.
{
"status": "error",
"message": "API is suspended/expired for use. Please check your API subscription and try again.",
"error_type": "APIKeyException",
"data": null
}
Market LTP Data
This endpoint returns the LTP market data identified by the exchange:tradingsymbol combination that are passed as values to the query parameter.
Request Headers -
-
X-Mirae-Version: Specifies the version of the API being used. In this case, it is set to 1.
-
Authorization: A token-based authentication header. The format is token api_key:access_token.
curl --location 'https://api.mstock.trade/openapi/typea/instruments/quote/ltp?i=NSE%3AACC&i=BSE%3AACC&i=NFO%3ACDSL25JAN2220CE' \
--header 'X-Mirae-Version: 1' \
--header 'Authorization: token access_token'
import axios from 'axios';
const params = new URLSearchParams();
params.append('i', 'NSE:ACC');
params.append('i', 'BSE:ACC');
params.append('i', 'NFO:CDSL25JAN2220CE');
const response = await axios.get('https://api.mstock.trade/openapi/typea/instruments/quote/ltp', {
params: params,
headers: {
'X-Mirae-Version': '1',
'Authorization': 'token access_token'
}
});
import requests
headers = {
'X-Mirae-Version': '1',
'Authorization': 'token access_token',
}
params = {
'i': [
'NSE:ACC',
'BSE:ACC',
'NFO:CDSL25JAN2220CE',
],
}
response = requests.get('https://api.mstock.trade/openapi/typea/instruments/quote/ltp', params=params, headers=headers)
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NORMAL)
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.mstock.trade/openapi/typea/instruments/quote/ltp?i=NSE%3AACC&i=BSE%3AACC&i=NFO%3ACDSL25JAN2220CE"))
.GET()
.setHeader("X-Mirae-Version", "1")
.setHeader("Authorization", "token access_token")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Query Parameter -
Field | Description |
---|---|
i | NSE:ACC |
i | BSE:ACC |
i | NFO:CDSL25JAN2220CE |
Request Body - This endpoint does not require a request body or additional parameters in the query string for the retrieval of orders.
Request Response -
The response of the request will be based on authentication outcome.
- Success (HTTP Status 200): On successful order update, the server returns a JSON object containing the order ID and status.
{
"status": "success",
"data": {
"NSE:ACC": {
"instrument_token": 500410,
"last_price": 195700
},
"BSE:ACC": {
"instrument_token": 500410,
"last_price": 195700
},
"NFO:CDSL25JAN2220CE": null
}
}
- Failure (HTTP Status 401): If the order fails due to invalid parameters, authentication issues, or other errors, the server will return an error message with below json format.
{
"status": "error",
"message": "Invalid request. Please try again.",
"error_type": "TokenException",
"data": null
}
- Failure (HTTP Status 200): If orderid does not exist then server will return below json reponse.
{
"status": "error",
"message": "Order Does not Exsist.Need to refresh orderbook / relogin in application ",
"error_type": "InputException",
"data": null
}
- Failure (HTTP Status 400): If the API Key is Invalid or expired.
{
"status": "error",
"message": "API is suspended/expired for use. Please check your API subscription and try again.",
"error_type": "APIKeyException",
"data": null
}
Instrument Script Master
This endpoint provides the consolidated, csv formatted list of instruments available for trading
Request Headers -
-
X-Mirae-Version: Specifies the version of the API being used. In this case, it is set to 1.
-
Authorization: A token-based authentication header. The format is token api_key:access_token.
-
Content-Type: Indicated the media type of the resource. For this request, it is set to application/x-www-form-urlencoded, which is used for submiting form data.
curl --location --request GET 'https://api.mstock.trade/openapi/typea/instruments/scriptmaster' \
--header 'X-Mirae-Version: 1' \
--header 'Authorization: token api_key:access_token' \
import axios from 'axios';
const response = await axios.get(
'https://api.mstock.trade/openapi/typea/instruments/scriptmaster',
'',
{
headers: {
'X-Mirae-Version': '1',
'Authorization': 'token api_key:access_token'
}
}
);
import requests
headers = {
'X-Mirae-Version': '1',
'Authorization': 'token api_key:access_token',
}
response = requests.get('https://api.mstock.trade/openapi/typea/instruments/scriptmaster', headers=headers)
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NORMAL)
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.mstock.trade/openapi/typea/instruments/scriptmaster"))
.GET(HttpRequest.BodyPublishers.noBody())
.setHeader("X-Mirae-Version", "1")
.setHeader("Authorization", "token api_key:access_token")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Request Body - This endpoint does not require a request body or additional parameters in the query string for the retrieval of orders.
Request Response -
The response of the request will be based on authentication outcome.
- Success (HTTP Status 200): On successful order update, the server returns a JSON object containing the order ID and status.
{
"status": "success",
"data": {
"NSE:ACC": null,
"BSE:ACC": null,
"NFO:CDSL25JAN2220CE": null
}
}
- Failure (HTTP Status 401): If the order fails due to invalid parameters, authentication issues, or other errors, the server will return an error message with below json format.
{
"status": "error",
"message": "Invalid request. Please try again.",
"error_type": "TokenException",
"data": null
}
- Failure (HTTP Status 400): If the API Key is Invalid or expired.
{
"status": "error",
"message": "API is suspended/expired for use. Please check your API subscription and try again.",
"error_type": "APIKeyException",
"data": null
}