Kotak-Neo / kotak-neo-api

112 stars 103 forks source link

Limit order above current price acting as market order #195

Open sandeepbhutani304 opened 3 months ago

sandeepbhutani304 commented 3 months ago

I have tried ordering some stocks using API. I wanted to buy above the current price so have set the price to 217 as shown below, the current price was 216.10 rs. But order executed at 216.10 rs itself.
I have tried setting following combinations, but all of these are buying at the current price which is lower than the limit price:
price=0, trigger_price=217
price=217, trigger_price=217
price=217, trigger_price=0

client.place_order(exchange_segment="nse_cm", product="MIS", price="217", order_type="Limit", quantity="1", validity="DAY", trading_symbol="CASTROLIND-EQ",
                       transaction_type="B", amo="NO", disclosed_quantity="0", market_protection="0", pf="N",
                       trigger_price="0", tag=None)

Please let me know what changes to be done above so that order is created for price above than current price.

shusinghal commented 3 months ago

You cannot buy something costly that is available at cheaper price. Not just API, it happens on apps too. Only way you can do this is by setting order_type as SL-M. That means you are telling the exchange that you want to put a stop loss order. A stop loss buy order is always above the CMP.

sandeepbhutani304 commented 2 months ago

From the web portal or from app, if I put a limit price above the current price, then order goes in pending state