Required cost to open a position formula

Hi. I’m trying to calculate required cost to open a position using formulas from the article How to Calculate Cost Required to Open a Position in Perpetual Futures Contracts | Binance Support
Formula is actually works if selected price is higher than current Price.

But if i set price lower than current price, formula does not work properly. Cost is correct for open order, but for the short one it is not. Answer has to be 9133.57, not 9220. It seems like open loss does not fit.

And i’ve noticed another issue. If i have an open position for current symbol (in my case it is 0.5 btc buy long) cost for open short is equal to zero. Where did it come from and how should i calculate it?

Hi @mnbeh, appreciate your report on this, however we don’t have association with the web design and its returned behaviours (this forum is focused on the API itself), so if possible, please redirect your findings with the Customer Support department. Thank you