I am trying to place order but not getting the order id and the order is not getting placed. I am using the following code: $kite = new KiteConnect($api_key); $order_id = $kite->placeOrder([ "api_key" => $api_key, "access_token" => $access_token, "tradingsymbol" => $tradingSymbol, "exchange" => $exchange, "quantity" => $quantity, "transaction_type" => $transactionType, "order_type" => $orderType, "price" => $price, "validity" => "DAY", "product" => "NRML" ], "regular"); echo " Order id is ".$order_id;
Hi Sujith, I am not getting any status message [order ID or status]. Infact, I can not see my order when I am logging in to my account. When I am placing a manual order from kite then I can see that order in the kite. But this is not happening when I am using API. Where am I going wrong???
if you have successfully gotten to $kite; print_r($kite);
you'll see key, token etc values are already present. not needed for placeOrder(). If you trace the placeOrder() function to _request() function you'll see;
You can check status message to know the rejection reason.
$order_id = $kite->placeOrder("regular", [
"api_key" => $api_key,
"access_token" => $access_token,
"tradingsymbol" => "INFY",
"exchange" => "NSE",
"quantity" => 1,
"transaction_type" => "BUY",
"order_type" => "MARKET",
"product" => "NRML"
])["order_id"];
echo "Order id is ".$order_id; //NOT GETTING ANYTHING
print_r($order_id); //NOT GETTING ANYTHING
print_r($kite);
you'll see key, token etc values are already present. not needed for
placeOrder()
.If you trace the
placeOrder()
function to_request()
function you'll see; also the added["order_id"]
is not required.run the example in kiteconnect.php, as is, and you should get a response order ID.
// Place order. I ran the example as is and got a response. status=> "REJECTED"
status_message=> "RMS:Blocked for EQUITY nse_cm NRML Remarks: Equity orders are not allowed in NRML product type block type: ALL"
I didn't know about the debugging. It is a class property, I found it at line 161 on my kiteconnect.php
public $debug = null;//set true to see debug messages
private function _request(...)
{
....
if($this->debug) {
print("Request: " . $method . " " . $url . "\n");
var_dump($params);
}
}
Possible products for equity are CNC and MIS.
NRML is for F&O instruments only.
To clarify, MIS is possible for F&O, yes?
Thanks!