Not able to Modify order in php

jitendra
jitendra edited October 2018 in PHP client
I am using the following code to modify an existing order:
$url = "https://api.kite.trade/orders/regular/".$orderId."?";


$fields = array(
api_key => $api_key,
access_token => $access_token,
tradingsymbol => $tradingSymbol,
exchange => $exchange,
quantity => $quantity,
transaction_type => $transactionType,
order_type => $orderType,
price => $price1,
validity => "DAY",
product => "MIS"
);



$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($fields));

$response = curl_exec($ch);
curl_close($ch);
$responsedata = json_decode($response, true);
echo "<br/>Response after Modify Order: <br/>";
print_r($responsedata);
I am getting the following response:
Array ( [status] => success [data] => Array (, [order_id] => 181016002539023 ) )

Still my order is not getting modified with the new price.

  • sujith
    You can check status_message field in an order response to know the reason for modification request rejection.
  • sujith
    A success response for an order modify request means placing modification request is successful and not order modification itself.
  • jitendra
    How to get this status_message. The complete response I am getting is the following array:
    Array ( [status] => success [data] => Array (, [order_id] => 181016002539023 ) )
  • jitendra
    Is the following url correct for order modification?

    $url = "https://api.kite.trade/orders/regular/".$orderId."?";
  • sujith
    Yes, you are right. When you place a modification request it goes through RMS validation and other series of processes before it is being modified. If it fails in between then order entry will have the status message which explains the reason of failure.
    You need to fetch orderbook and check the status_message field of that order.
Sign In or Register to comment.