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 =>
-
It shows trigger price of 69.00 for order 62240304577002 of order price of 90. But trigger price as per code should be 84
-
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