Inconsistent API Behavior, sometimes orders are rejected as if it's an InputException

teknas
Minimum reproducible sample
const KiteConnect = require("kiteconnect").KiteConnect;

const kite = new KiteConnect({
api_key: "xxx",
access_token: "xxx"
})

const order = {
"variety": "regular",
"exchange": "NSE",
"tradingsymbol": "ORIENTELEC",
"transaction_type": "BUY",
"quantity": 20,
"product": "MIS",
"order_type": "LIMIT",
"price": 383.5,
"validity": "DAY",
"disclosed_quantity": null,
"trigger_price": null,
"squareoff": null,
"stoploss": null,
"trailing_stoploss": null,
"tag": "FC_LONGENTRY",
"order_id": null
};

(async ()=>{
try {
const resp = await kite.placeOrder(order.variety, order)
console.log(resp)
}
catch(err) {
console.log(err)
}
})();

Results of running

> node streamer/test-entry.js
{ order_id: '211230201808289' }
> node streamer/test-entry.js
{ order_id: '211230201808783' }
> node streamer/test-entry.js
{ order_id: '211230201810937' }
> node streamer/test-entry.js
{
status: 'error',
message: 'Limit price should be greater than zero.',
data: null,
error_type: 'InputException'
}
> node streamer/test-entry.js
{
status: 'error',
message: 'Limit price should be greater than zero.',
data: null,
error_type: 'InputException'
}
> node streamer/test-entry.js
{
status: 'error',
message: 'Limit price should be greater than zero.',
data: null,
error_type: 'InputException'
}
> node streamer/test-entry.js
{
status: 'error',
message: 'Limit price should be greater than zero.',
data: null,
error_type: 'InputException'
}

As you see, sometimes orders go through, and sometimes they don't.
The order payload is definitely the same.

something very fishy happening inside Zerodha servers.
  • rakeshr
    try {
    const order = await kc.placeOrder('regular', {
    exchange:'NSE',
    tradingsymbol:'ORIENTELEC',
    quantity:20,
    product:'MIS',
    order_type:'LIMIT',
    price: 383.5,
    validity:'DAY',
    transaction_type:'BUY',
    tag: "FC_LONGENTRY",
    disclosed_quantity: null,
    trigger_price: null,
    squareoff: null,
    stoploss: null,
    trailing_stoploss: null,
    order_id: null
    });
    console.log(order); }
    catch(err) {
    console.log(err)
    }
    I just tried the same order param at my end for the node client. It's working perfectly fine.
  • teknas
    @rakeshr it's failing "Sometimes"
    Try running it in a loop 10 times.
Sign In or Register to comment.