It looks like you're new here. If you want to get involved, click one of these buttons!
$formattedSymbol = 'BANKNIFTY2421445700CE';
$quote = $kite->getQuote(['NFO:' . $formattedSymbol]);
$quote = $quote['NFO:' . $formattedSymbol];
$last_traded_price = $quote->last_price;
// Calculate stop-loss and target prices based on percentages
$stop_loss_percentage = 50; // 50 %
$target_percentage = 100; // 100%
$stop_loss_price = $last_traded_price * (1 - ($stop_loss_percentage / 100));
$target_price = $last_traded_price * (1 + ($target_percentage / 100));
// Place GTT order with market order type
$place_GTT = $kite->placeGTT([
"trigger_type" => $kite::GTT_TYPE_SINGLE,
"tradingsymbol" => $formattedSymbol,
"exchange" => "NFO",
"trigger_values" => [$stop_loss_price, $target_price], // Stop-loss and target prices
"orders" => [
[
"transaction_type" => $kite::TRANSACTION_TYPE_BUY,
"quantity" => 1,
"product" => $kite::PRODUCT_CNC,
"order_type" => $kite::ORDER_TYPE_MARKET // Market order type
]
]
]);
You can refer to the place GTT API documentation here. For OCO GTT, you can check out the example input params here.