i wont cancel order but limit order means i wont cancel order but limit code in nodejs
i wont to code both nodejs SDK and API also
this code is sdk
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
let apiInstance = new UpstoxClient.OrderApi();
let orderId = "240111010403654";
let apiVersion = "2.0";
apiInstance.cancelOrder(orderId, apiVersion, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
this api code
const axios = require('axios');
const url = 'https://api.upstox.com/v2/order/cancel?order_id=240108010445130';
const headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}', // Replace {your_access_token} with the actual access token
};
axios.delete(url, { headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response ? error.response.data : error.message);
});