Hey Guys ... after a lot of debugging ... i figured it out ... basically ... in the earlier version of the API ... your code have sent the prices / trigger price in string format with double quotes. And it still used to work just fine.
I guess with the new version of the code ... the integer / double check is enforced somewhere at the app layer. API remains the same.
Just remove the double quotes around prices or any trigger price and it would work like a charm ...
@cdesai1987, The backend has become robust now, it expects a proper type. We are sorry for the inconvenience. The only solution here is to send the typed params as in number as number and string as a string.
@sujith Bingo! Yup ... I can confirm that both stuff are working now - (1) MIS is no longer going as CNC and (2) NFO exchange orders are going through without issues.
Below is HTML Code,
Buy SBI stock
Getting Error message : -
{"status":"error","message":"Invalid connect session.","data":null,"error_type":"InputException"}
NOTE : I have updated API with Kite Connect Publisher API Key.
cstext1.Append("");
cstext1.Append("KiteConnect.ready(function() {");
cstext1.Append(" var kite = new KiteConnect(\"kitedemo\");");
cstext1.Append("kite.add({");
cstext1.Append("\"exchange\": \"NSE\",");
cstext1.Append("\"tradingsymbol\": \"" + item["StockName"].ToString() + "\",");
cstext1.Append("\"quantity\": \"" + Qty + "\",");
cstext1.Append("\"transaction_type\": \"" + item["Signal"].ToString() + "\",");
cstext1.Append("\"product\": \"MIS\",");
cstext1.Append("\"order_type\": \"MARKET\",");
cstext1.Append(" });");
cstext1.Append("kite.add({");
cstext1.Append("\"exchange\": \"NSE\",");
cstext1.Append("\"tradingsymbol\": \"" + item["StockName"].ToString() + "\",");
cstext1.Append("\"quantity\": \"" + QtySL + "\",");
cstext1.Append("\"transaction_type\": \"" + SLSignal + "\",");
cstext1.Append("\"product\": \"MIS\",");
cstext1.Append("\"trigger_price\": \"" + SLTrigger + "\",");
cstext1.Append("\"order_type\": \"SL-M\",");
cstext1.Append(" });");
cstext1.Append(" kite.renderButton(\"#default-button\");");
cstext1.Append("kite.link(\"#custom-button\");");
cstext1.Append(" });");
cstext1.Append("");
Though Somehow only your test page is working . Our Pages are not working.
https://kite.trade/publisher-demo
I guess with the new version of the code ... the integer / double check is enforced somewhere at the app layer. API remains the same.
Just remove the double quotes around prices or any trigger price and it would work like a charm ...
Fix now ... thank me later ;-)
The backend has become robust now, it expects a proper type. We are sorry for the inconvenience. The only solution here is to send the typed params as in number as number and string as a string.
// Add a stock to the basket
kite.add({
"exchange": "NFO",
"tradingsymbol": "DLF18MARFUT",
"quantity": 5000,
"transaction_type": "BUY",
"order_type": "MARKET"
});
This fails ... and is not added in the basket. Request you to please look into it @sujith
This should be fixed now. Can you check and update about the same?
Bingo! Yup ... I can confirm that both stuff are working now -
(1) MIS is no longer going as CNC
and
(2) NFO exchange orders are going through without issues.
Thnx a ton!