api limit order error

rastogi97
rastogi97 edited May 2021 in .Net API client
im getting this error sometimes when i place entry order with kite.PlaceOrder()

400 {"status":"error","message":"Limit price should be greater than zero.","data":null,"error_type":"InputException"}

all the parameters are correct

this error is supposed to pop only when limit entry price is zero or way far away from the LTP but now i will never knw why its popping up cause the entry price parameter is perfectly fine!! and its only happening in localhost mode!!

@sujith please help sir!
  • sujith
    You can run the Kite Connect client in debug mode and see all the params that are being sent. Can you post the complete stack trace here?
    Make sure to remove the app and client-specific credentials.
  • rastogi97
    rastogi97 edited May 2021
    thanks for replying @sujith

    I have already made placing limit orders work.
    now it just doesnt with a specific set up.
    it still works with a simpler set up, but i cant see a difference anywhere.
    the limit order has a price during debugging at the last step when i send the place order
    and the same code works in my production environment...


    then the error happens --->
    400 {"status":"error","message":"Limit price should be greater than zero.","data":null,"error_type":"InputException"}

    error stack trace --->
    " at KiteConnect.Kite.Request(String Route, String Method, Object Params, Boolean json)\r\n at KiteConnect.Kite.Post(String Route, Object Params, Boolean json)\r\n at KiteConnect.Kite.PlaceOrder(String Exchange, String TradingSymbol, String TransactionType, Int32 Quantity, Nullable`1 Price, String Product, String OrderType, String Validity, Nullable`1 DisclosedQuantity, Nullable`1 TriggerPrice, Nullable`1 SquareOffValue, Nullable`1 StoplossValue, Nullable`1 TrailingStoploss, String Variety, String Tag)\r\n at TradeMaster6000.Server.Helpers.TradeHelper.d__21.MoveNext() in C:\\Users\\
  • sujith
    Can you enable debug logs like this and paste the stacktrace?
  • rastogi97
    rastogi97 edited May 2021
    DEBUG: POST https://api.kite.trade/orders/amo
    exchange=NSE&tradingsymbol=ADANIPORTS&transaction_type=BUY&quantity=1&price=755%2c00&product=MIS&order_type=LIMIT&validity=DAY
    DEBUG: Content-Type: application/x-www-form-urlencoded
    DEBUG: Content-Length: 126
    DEBUG: User-Agent: KiteConnect.Net/3.0.7.0
    DEBUG: X-Kite-Version: 3
    DEBUG: Authorization: token {secret?}
    DEBUG: 400 {"status":"error","message":"Limit price should be greater than zero.","data":null,"error_type":"InputException"}

    this? @sujith
  • rastogi97
    oh i see something weird! the price has weird syntax after it... do you have any idea how that could happen?
  • sujith
    %2c is ,
  • sujith
    I think your intention is to send 755.00 and it is being changed to 755,00 somehow
  • rastogi97
    rastogi97 edited May 2021
    yes thank you!

    this error might happen for anyone trying from denmark.
    apparently my computer converts that value to another region format.

    solution was to change region and region format in windows 10 to india.

    it also makes sense my remote server could do it and not my home one, since it probably doesnt have stupid region formatting.

    thank you, bye!
This discussion has been closed.