EaseAPI For Business
Partners do not have direct access to the place, modify, or cancel order APIs. Instead, they can use EaseApi for Business to submit and display recommended baskets to Ventura clients. Clients can then review these recommendations and choose to either execute or cancel the orders.
Step 1: Submit Recommendation Basket¶
To store a recommendation basket, call the Submit Recommendation Basket API. Pass the x-app-key, x-client-id and authorization bearer tokens in the headers. All the orders must be sent with order_type
as MKT
and validity
as IOC
only.
After submitting the basket, you will get a basket_id.
Note
The submit_recommendation_basket
API has a limit of 20 orders per basket.
Sample code¶
curl --location 'https://easeapi.venturasecurities.com/partner/v1/submit_recommendation_basket' \
--header 'x-app-key: 8ab5rt7yp2lm9qw4s1ex' \
--header 'x-client-id: AA0605' \
--header 'Content-Type: application/json' \
--header 'Authorization': 'Bearer eyJraWQiOiJRMUd0YmNyZVwvZWo5U0JZUHBiVGxOc1U1...' \
--data '{
"title": "Swing Trade Opportunities Short Term Gulluck",
"description": "Weekly Review of Stocks to guide with stocks for slow accumulation and sell when uptrend Diversified",
"recommendation_type": "Weights Rebalance",
"additional_metadata": {},
"orders": {
"delivery": [
{
"instrument_id": 2885,
"exchange": "NSE",
"segment": "E",
"transaction_type": "B",
"order_type": "MKT",
"quantity": 1,
"price": 1224.0,
"trigger_price": 0.0,
"product": "C",
"validity": "IOC",
"disclosed_quantity": 0,
"off_mkt_flag": 0
}
]
}
}'
import requests
import json
url = "https://easeapi.venturasecurities.com/partner/v1/submit_recommendation_basket"
payload = json.dumps({
"title": "Swing Trade Opportunities Short Term Gulluck",
"description": "Weekly Review of Stocks to guide with stocks for slow accumulation and sell when uptrend Diversified",
"recommendation_type": "Weights Rebalance",
"additional_metadata": {},
"orders": {
"delivery": [
{
"instrument_id": 2885,
"exchange": "BSE",
"segment": "E",
"transaction_type": "B",
"order_type": "MKT",
"quantity": 1,
"price": 1224.0,
"trigger_price": 0.0,
"product": "C",
"validity": "IOC",
"disclosed_quantity": 0,
"off_mkt_flag": 0
}
]
}
})
headers = {
'x-app-key': '8ab5rt7yp2lm9qw4s1ex',
'x-client-id': 'AA0605',
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJraWQiOiJRMUd0YmNyZVwvZWo5U0JZUHBiVGxOc1U1...'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const axios = require('axios');
let data = JSON.stringify({
"title": "Swing Trade Opportunities Short Term Gulluck",
"description": "Weekly Review of Stocks to guide with stocks for slow accumulation and sell when uptrend Diversified",
"recommendation_type": "Weights Rebalance",
"additional_metadata": {},
"orders": {
"delivery": [
{
"instrument_id": 2885,
"exchange": "BSE",
"segment": "E",
"transaction_type": "B",
"order_type": "MKT",
"quantity": 1,
"price": 1224.0,
"trigger_price": 0.0,
"product": "C",
"validity": "IOC",
"disclosed_quantity": 0,
"off_mkt_flag": 0
}
]
}
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://easeapi.venturasecurities.com/partner/v1/submit_recommendation_basket',
headers: {
'x-app-key': '8ab5rt7yp2lm9qw4s1ex',
'x-client-id': 'AA0605',
'Content-Type': 'application/json',
'Authorization: Bearer eyJraWQiOiJRMUd0YmNyZVwvZWo5U0JZUHBiVGxOc1U1...'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response¶
{
"success": true,
"message": "Recommendation Basket submitted successfully.",
"data": {
"basket_id": "930b2db7-1602-4e71-a9db-45507f970bbb"
}
}
Request parameters¶
Parameter |
Description |
---|---|
title |
A title to the recommendation basket |
description |
A detailed description providing more context about the recommendation. (optional) |
recommendation_type |
The category or type of recommendation being provided, which helps classify the suggestion. (optional) |
additional_metadata |
Device metadata |
orders |
An object that acts as a container for three different categories of orders - allowed category is - delivery |
instrument_id |
Unique identifier for the trading instrument. |
exchange |
The stock exchange where the trade is placed. |
segment |
The segment of the market (e.g., Equity, Derivatives). |
transaction_type |
Indicates the type of transaction (e.g., B for Buy, S for Sell). |
order_type |
Type of order, this must be MKT (Market Order). |
quantity |
Number of units to trade. |
price |
Price of the trade. |
trigger_price |
Trigger price for conditional orders (e.g., Stop Loss). |
product |
Product type (e.g., C for Cash). |
validity |
Validity period for the order, has to be set to IOC (Immediate or Cancel). |
disclosed_quantity |
Quantity to disclose publicly. |
off_mkt_flag |
Indicates whether the trade is off-market. |
Response parameters¶
Parameter |
Description |
---|---|
success |
Indicates the status of the api was successful true or not false |
message |
A message providing a reason if the basket was not submitted for some reason |
basket_id |
The recommendation basket id |
Step 2: Get Order Confirmation page¶
To begin the order confirmation and execution process, send a request to the order confirmation URL, including the basket_id received in step 1. Clients will be able to see all the orders in the basket and be given options to execute the order by selecting the confirm button or cancel the basket.
https://easeapi.venturasecurities.com/order/order-ui/v1/order-confirmation?basket_id=xxxxx&client_id=xxxxx&app_key=xxxxx&auth_token=xxxxx'
Confirmation¶
On clicking the confirm button, the client will be taken to the order status page where they will be able to see the status of each of the orders in the basket.
Cancellation¶
When the client decides to cancel the order basket, they will be shown a pop-up to confirm their decision.
Once the basket is cancelled, the client will be see no orders in their basket.
Step 3: Get Basket Status¶
To store a recommendation basket, call the Submit Recommendation Basket API. Pass the x-app-key, x-client-id and authorisation bearer tokens in the headers. All the orders must be sent with 'order_type' as 'MKT' and 'validity' as 'IOC' only.
After submitting the basket, you will get a basket_id.
Sample code¶
curl --location 'https://easeapi.venturasecurities.com/partner/v1/get_recommendation_basket?basket_id=xxxxx' \
--header 'x-app-key: 8ab5rt7yp2lm9qw4s1ex' \
--header 'x-client-id: AA0605' \
--header 'Content-Type: application/json' \
--header 'Authorization': 'Bearer eyJraWQiOiJRMUd0YmNyZVwvZWo5U0JZUHBiVGxOc1U1...'
import requests
import json
url = "https://easeapi.venturasecurities.com/partner/v1/get_recommendation_basket?basket_id=xxxxx"
payload = {}
headers = {
'x-app-key': '8ab5rt7yp2lm9qw4s1ex',
'x-client-id': 'AA0605',
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJraWQiOiJRMUd0YmNyZVwvZWo5U0JZUHBiVGxOc1U1...'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://easeapi.venturasecurities.com/partner/v1/get_recommendation_basket?basket_id=xxxxx',
headers: {
'x-app-key': '8ab5rt7yp2lm9qw4s1ex',
'x-client-id': 'AA0605',
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJraWQiOiJRMUd0YmNyZVwvZWo5U0JZUHBiVGxOc1U1...'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response¶
{
"success": true,
"message": "Basket fetched successfully.",
"basket_status": "placed", // Basket Status - "created" when basket is submitted, "placed" when basket is sent for execution, "cancelled" when basket is cancelled.
"data": {
"delivery": [
{
"order_record_id": 2873,
"instrument_id": "2885",
"exchange": "NSE",
"segment": "E",
"transaction_type": "B",
"order_type": "MKT",
"quantity": 1,
"price": 1224.0,
"last_traded_price": 0.0,
"trigger_price": 0.0,
"product": "C",
"validity": "IOC",
"disclosed_quantity": 0,
"off_market_flag": 0,
"type": "Stock",
"symbol": "RELIANCE",
"expiry_date": "",
"expiry_type": "",
"option_type": "",
"strike_price": "",
"instrument_type": "",
"order_id": "1147250123216" //Order ID
}
]
}
}
Query parameters¶
Parameter |
Description |
---|---|
basket_id |
The recommendation basket id |
Response parameters¶
Parameter |
Description |
---|---|
success |
Indicates the status of the api was successful true or not false |
message |
A message providing a reason if the basket was not fetched for some reason |
basket_status |
The basket status; Created - when basket is submitted, Placed - when basket is sent for execution, Cancelled - when basket is cancelled. |
data |
An object that acts as a container for the different categories of orders |
instrument_id |
Unique identifier for the trading instrument. |
exchange |
The stock exchange where the trade is placed. |
segment |
The segment of the market (e.g., E for Equity, D for Derivatives). |
transaction_type |
Indicates the type of transaction (e.g., B for Buy, S for Sell). |
order_type |
Type of order, this must be MKT (Market Order). |
quantity |
Number of units to trade. |
price |
Price of the trade. |
ltp |
Last traded price |
trigger_price |
Trigger price for conditional orders (e.g., Stop Loss). |
product |
Product type (e.g., C for Cash). |
validity |
Validity period for the order, has to be set to IOC (Immediate or Cancel). |
disclosed_quantity |
Quantity to disclose publicly. |
off_mkt_flag |
Indicates whether the trade is off-market (0 or 1). |
type |
Indicates whether the type of order |
sym |
It is the name of the instrument |
type |
Indicates whether the type of order |
expiry_date |
It shows the expiry date of the instrument if the type is "NFO" (derivatives) |
expiry_type |
It is the expiry type of the derivative instrument |
op_type |
It shows the option type of the instrument (Eg: it's a derivative and an option) |
strike_price |
It shows the strike price of the option instrument |
inst_type |
It is the type of instrument (Eg: if it's a derivative (NFO)) |
order_id |
It is the order number |
Note
To check the status of each order, call the Order Book API and refer to the status parameter in the Order Book