Dear Friends,
I hope you’re doing well. I need help with a Python script that will automatically exit my position when the profit reaches ₹3000. If anyone has a solution or can guide me, I’d really appreciate your support.
Thank you in advance!
Dear Friends,
I hope you’re doing well. I need help with a Python script that will automatically exit my position when the profit reaches ₹3000. If anyone has a solution or can guide me, I’d really appreciate your support.
Thank you in advance!
You need to use both the data apis and trading apis from Orders - DhanHQ Ver 2.0 / API Document. From the data apis, get the current price based on your preferred duration and then calculate the PnL on the position based on the data.
As an alternative, when you take the position, you can precalculate the INR 3000 profit and add a Forever order on the position or use the Super order feature.
You can checkout https://dhanhq.co/home, Readmade algos with in-built SL and Profit booking