PHP Fatal error: Uncaught KiteConnect\Exception\InputException (400) 'Invalid `order_id`.'

AjayJoseph
Please find my code below:-
<?php

//Kiteconnect lib registration
require_once './../vendor/autoload.php';
use KiteConnect\KiteConnect;

$Access_Token = array();
$SQLQuery = "SELECT * FROM `db`.`table`";
$Access_Token = MysqlSelect($SQLQuery, $conn);


$kite = new KiteConnect("API Key");

$kite->setAccessToken($Access_Token["access_token"]);

$order = $kite->placeOrder("BO", [
"exchange" => "NSE",
"tradingsymbol" => "ICICIBANK",
"transaction_type" => "BUY",
"product" => "MIS",
"order_type" => "SL-M",
"quantity" => 100,
"trigger_price" => 720.15,
"squareoff" => 725.15,
"stoploss" => 718.15,
"trailing_stoploss" => 718.15,
"validity" => "DAY"
]);

print_r($order);

?>

For the above code, I am receving the following error when variety is BO. With Regual as variety, I am able to get the order placed and recieve back an order ID.

The error recevied is as below :-
PHP Fatal error: Uncaught KiteConnect\Exception\InputException (400) 'Invalid `order_id`.'

thrown in /var/www/html/dummytest/vendor/zerodha/phpkiteconnect/src/KiteConnect.php on line 1644
  • rakeshr
    For the above code, I am receving the following error when variety is BO.
    BO orders are no more allowed. You can use GTT orders for the same.
  • AjayJoseph
    AjayJoseph edited September 2021
    My bad.

    Thanks for the update.

    But just to know more, is there a way - I can have trailing stoploss using the leverage provided by Zerodha? I dont see any updates about trailing stoploss anywhere.

    My plans are to trade in Intraday using Leverages, as BOs are no more allowed, GTT can clear the issues with Stoploss and Target prices but I am still stuck with trailing stop loss. Please advice.
  • rakeshr
    Trailing stop loss is no more provided in an individual order product. You might have to logically build this at your end. Something like: when price moves in your direction you will have to modify the stoploss order up/down based on if you are long or short automatically.
  • AjayJoseph
    Thank you for the support.
This discussion has been closed.