Modify Order V3
Modify a delivery order
- Curl
- Python
- Node.js
- Java
- PHP
curl --location --request PUT 'https://api-hft.upstox.com/v3/order/modify' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 2,
"validity": "DAY",
"price": 16.8,
"order_id": "240108010918222",
"order_type": "LIMIT",
"disclosed_quantity": 0,
"trigger_price": 16.9
}'
import requests
url = 'https://api-hft.upstox.com/v3/order/modify'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
data = {
'quantity': 3,
'validity': 'DAY',
'price': 16.8,
'order_id': '240108010918222',
'order_type': 'LIMIT',
'disclosed_quantity': 0,
'trigger_price': 16.9
}
response = requests.put(url, headers=headers, json=data)
print(response.text)
const axios = require('axios');
const url = 'https://api-hft.upstox.com/v3/order/modify';
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
const data = {
'quantity': 2,
'validity': 'DAY',
'price': 16.8,
'order_id': '240108010918222',
'order_type': 'LIMIT',
'disclosed_quantity': 0,
'trigger_price': 16.9
};
axios.put(url, data, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error.response.data));
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
URL url = new URL("https://api-hft.upstox.com/v3/order/modify");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("PUT");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer {your_access_token}");
connection.setDoOutput(true);
String data = "{\"quantity\": 2, \"validity\": \"DAY\", \"price\": 16.8, \"order_id\": \"240108010918222\", \"order_type\": \"LIMIT\", \"disclosed_quantity\": 0, \"trigger_price\": 16.9}";
try (OutputStream os = connection.getOutputStream()) {
byte[] input = data.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = connection.getResponseCode();
System.out.println("Response Code: " + responseCode);
} catch (Exception e) {
e.printStackTrace();
}
}
}
<?php
$url = 'https://api-hft.upstox.com/v3/order/modify';
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
'Authorization: Bearer {your_access_token}'
);
$data = array(
'quantity' => 2,
'validity' => 'DAY',
'price' => 16.8,
'order_id' => '240108010918222',
'order_type' => 'LIMIT',
'disclosed_quantity' => 0,
'trigger_price' => 16.9
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
echo $result;
?>