Example code to place SL order

ansumanm
Can someone please paste an example code to place SL/SLM order in python?


If I am putting SL order (trigger price + limit price) the order is getting executed as a LIMIT order.

This is the payload that I am sending
{'api_key': 'xxx', 'access_token': 'xxx', 'tradingsymbol': 'CRUDEOILM17DECFUT', 'exchange': 'MCX', 'transaction_type': 'SELL', 'order_type': 'LIMIT', 'quantity': '1', 'product': 'NRML', 'price': '3650', 'trigger_price': '3650', 'validity': 'DAY'}

Also, should the price be string or integer? I am not finding any examples in documentation...

Thanks,
Ansuman
  • sujith
    Hi,
    We don't have python example as of now.
    You can check out example for placing order. It is an example for the limit order, you just need to send order type as SL and add trigger_price to place stop-loss order.
    You need to send price as a number.
  • ansumanm
    Ok..Just one more thing that is confusing me...in the request payload, limit price and trigger price and trigger price are strings or floats?
  • sujith
    Whatever you send finally it will be sent as a string. In order to be consistent, we recommend using numbers. Price, trigger price are float type. Quantity and disclosed quantity are integers.
  • venun
    @ansumanm
    Check the order type in your code.. or past your snippet here will check
Sign In or Register to comment.