Hi, If one MIS Buy order is placed of some price. Now, I want to place another MIS order Buy or Sell depend on the calculated price at the Post Back Page. Please share some sample code or idea.
<?php /*See whether the request is POST or not if the request is not POST then exit you may echo any custom message or throw exception to debug or you can just exit the code*/
/*we will read the POST body and store it in a variable*/ $postdata = file_get_contents("php://input"); /*next we will decode the json message body*/ $json_o = json_decode($postdata); /*retrieve the order number and save the json response with orderid as name for future use*/ $orderid = $json_o->order_id; $log_file = $orderid . '.json'; file_put_contents($log_file, $postdata); /*retrieve other properties from the json*/ /*Trade Symbol*/ $trdsym = $json_o->tradingsymbol; /*status*/ $status = $json_o->status; /*filled price*/ $filledprice = $json_o->average_price; /*filled qty*/ $filledqty = $json_o->filled_quantity; /*and so on*/ /*now you got the order details.manipulate whatever you want*/ /*final step.echo success*/ echo "Success"; /*Sample Pay load from kite server { "order_id": "16032300017157", "exchange_order_id": "511220371736111", "placed_by": "AB0012", "status": "COMPLETE", "status_message": "",
You can just use the above sample payload at https://www.hurl.it to check or debug or test your code. Remember you need to post the payload as body. You can create a subdomain like https://kite.yourdoamin.in and save this php file as index.php */ ?>
@botany02 I was using given provided code, But I can not properly use it. I can not see any response back on this page. Even without any condition, I am trying to put BO, but order is also not successfully placed.
You may try the below
I can not see any response back on this page. Even without any condition, I am trying to put BO, but order is also not successfully placed.