EXCH:Difference between limit price and trigger price is beyond permissible range

Hi @Dhan @Hardik ,

Please find code for BO =>

# connect to option_globals.dhan api gateway
dhan = dhanhq(client_id,access_token)

tag_buy_0000 = "test"
transaction_type_buy = dhan.BUY
transaction_type_sell = dhan.SELL
exchange_segment = dhan.FNO
product_type = dhan.BO
security_id = "62473"
quantity = 40

place_order_tag_buy_0000 = dhan.place_order(
tag=tag_buy_0000,
transaction_type=transaction_type_buy,
exchange_segment = exchange_segment,
product_type = product_type,
order_type = dhan.LIMIT,
validity = ‘DAY’,
security_id = security_id,
quantity = quantity,
disclosed_quantity = 0,
price = 86,
trigger_price = 84,
after_market_order = False,
amo_time = ‘OPEN’,
bo_profit_value = 21,
bo_stop_loss_Value = 21,
drv_expiry_date = None,
drv_options_type = None,
drv_strike_price = None
)

place_order_tag_buy_0000 = dhan.place_order(
    tag=tag_buy_0000,
    transaction_type=transaction_type_buy,
    exchange_segment = exchange_segment,
    product_type = product_type,
    order_type = dhan.SL,
    validity = 'DAY',
    security_id = security_id,
    quantity = quantity,
    disclosed_quantity = 0,
    price = 90,
    trigger_price = 84,
    after_market_order = False,
    amo_time = 'OPEN',
    bo_profit_value = 21,
    bo_stop_loss_Value = 21,
    drv_expiry_date = None,
    drv_options_type = None,
    drv_strike_price = None
    )

This order gives error =>

EXCH:Difference between limit price and trigger price is beyond permissible range

The order shows in the image =>

  1. It shows trigger price of 69.00 for order 62240304577002 of order price of 90. But trigger price as per code should be 84

  2. It shows trigger price of 65.00 for order 12240304592102 of order price of 86. But trigger price as per code should be 84.

Please check and let me know why the BO is failing with error and trigger price is changing.

Thanks,
Mukesh

Hello @MukeshM

Looks like you are trying to place BO order as SL order. This is not a right combination. It is taking BO Stop Loss Value into consideration. BO order can only be limit as of now.

Hi @Hardik , i have put the First order for the “price = 86,” with order_type = dhan.LIMIT, Still it throws the same error

Hello @MukeshM

Can you share the entire JSON payload and error message, if you are getting any.

Hi @Hardik

I am calling the api like below

# connect to option_globals.dhan api gateway
dhan = dhanhq(client_id,access_token)

tag_buy_0000 = "test"
transaction_type_buy = dhan.BUY
transaction_type_sell = dhan.SELL
exchange_segment = dhan.FNO
product_type = dhan.BO
security_id = "62473"
quantity = 40

place_order_tag_buy_0000 = dhan.place_order(
tag=tag_buy_0000,
transaction_type=transaction_type_buy,
exchange_segment = exchange_segment,
product_type = product_type,
order_type = dhan.LIMIT,
validity = ‘DAY’,
security_id = security_id,
quantity = quantity,
disclosed_quantity = 0,
price = 86,
trigger_price = 84,
after_market_order = False,
amo_time = ‘OPEN’,
bo_profit_value = 21,
bo_stop_loss_Value = 21,
drv_expiry_date = None,
drv_options_type = None,
drv_strike_price = None
)

The order is error out with the message

EXCH:Difference between limit price and trigger price is beyond permissible range

Hello @MukeshM

You can remove trigger price here, as BO order doesn’t require Trigger Price to execute. You can keep order_type as dhan.LIMIT itself.