Input:
PB_Order_id_1 = tsl.order_placement(tradingsymbol=Traded_Stock_Name ,exchange=‘NSE’, quantity=Half_Sell_Quantity_1, price=Target_Price_1, trigger_price=1, order_type=‘STOPMARKET’, transaction_type =‘SELL’, trade_type=‘MIS’)
Output:
'Got exception in place_order as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-906’, ‘error_type’: ‘Order_Error’, ‘error_message’: ‘Trigger Price should be greater than Price’}, ‘data’: ‘’}
if I place ‘STOPMARKET‘ order in Buy side or Sell side even price is greater than trigger price that time also this error shown and order has not place
Please Help me for this issue
Hi @HunterGP ,
As of now, STOPMARKET orders are currently not supported through API. As an alternative, you may use STOPLIMIT orders.
Refer the code -
from Dhan_Tradehull import Tradehull
client_code = ""
tsl = Tradehull(client_code, mode="pin_totp", pin="", totp_secret="")
order_id_buy = tsl.order_placement(tradingsymbol='YesBank', exchange='NSE', quantity=1, price=24.06, trigger_price=23.82, order_type='STOPLIMIT', transaction_type='BUY', trade_type='MIS')
print(order_id_buy)
order_id_sell = tsl.order_placement(tradingsymbol='YesBank', exchange='NSE', quantity=1, price=22.01, trigger_price=22.82, order_type='STOPLIMIT', transaction_type='SELL', trade_type='MIS')
print(order_id_sell)
Output -
Okk, Thanks for you help sir
1 Like