When placing an order, I wonder how the actual purchase amount is calculated.

hello.
When I place an order at 100%, I want to calculate how much quantity I actually have.

In the picture
(test-net)
I have 968.10 USDT
The market price is 0.5586 USDT.
Since I’m going to place a market order, the taker fee is 0.04%.

The buy order is 1602.3 XRP
The shell order is 1738.6 XRP
Why is this different?
Is there anything else to calculate besides fees?

How do I actually make it count like Binance?
do you have a link?

Thank you in advance.

As you’re attempting to place a market order, the difference in your buy and sell price is due to the orderbook spread. If you take a look at the orderbook (refer to my attached screenshot), you’ll see there’s a difference in price between the closest Sell price and the closest Buy price.