I'm looking for an effective way to monitor stop loss. At this moment, what I'm doing is that I'm getting the positions every 0.3 seconds, and based on the last_price column or pnl column I'm tracking SL. It seems this way, not that effective as I see the difference in pnl in the web console and python console. If you see the console it's throwing negative pnl sometimes. And positive pnl with some discrepancy. If anyone has any better way to manage this situation please share. Let's discuss.
Note: I'm running a short straddle at this moment.
It is not recommended to poll positions to fetch updated P&L. You can calculate P&L at your end using the live market data provided by Websockets API or Quote API. You can check out the formula here.
You can check out the formula here.