Help with these calculations

I am trying to calculate those balances that remain when opening or closing purchase and sale operations, the problem I have is the following in the image you can see that my balance in the ETHUSDT pair is $200 USDT when trying to open a purchase operation I see that I am I have exceeded my balance by $0.001672 as seen in the second image with the response of the purchase operation in the cummulativeQuoteQty field, my logic tells me that if I have $200 USDT balance in my account and if I exceeded $0.001672 USDT then binance I borrowed that amount, however, when reviewing the marginBuyBorrowAmount field, I see that the amount borrowed is $0.00168872, which exceeds $0.00001672 of the $0.001672 that was the original surplus, I review the result of the operation in the app and see that the pair remains a balance of $0.00001672 and that is where I no longer understand why that balance was in USDT, because binance decided not to use the total of the $200 that I have in balance, I don’t know what calculation it uses for To determine that you will only use a part of $200 and leave me that small balance, I need an explanation

The other problem that I am seeing is how it calculates the interest, before it had not taken importance, only towards the query and saved the data and at the time of closing the operation I only multiplied that interest by the hours to know how much I had to pay, now I check and I see that the interest does not match the formula proposed by Binance, according to Binance the interest is calculated with the following formula

The calculation formula: I (interest) = P (borrowed money) * R (daily interest 0.02%/24) * T (in hours)

Returning to the second image at the bottom is the response to the query to obtain the interest data of the operation that was opened there we see that the daily interest is 0.0002 in the interestRate field, if my borrowed amount is $0.00168872 then the calculation would be

0.00168872 * (0.0002 / 24)

Where the result would be 1.4e-8 but in field of interest it has 2e-8, what is happening then? how did binance get that result

I’d appreciate your help

Another example of the problem I have with the balances in the BTCUSDT pair, as seen in the first image at the beginning I had $101.50503108 USDT in balance in the pair, I made a purchase which was executed for $200.160048 which is seen in the second image in the cummulativeQuoteQty field, in theory I exceeded my initial balance by $98.65501692 but in the marginBuyBorrowAmount field $99.6500026 is reflected, having a difference of $0.99498568 with respect to the $98.65501692 and that difference appears as balance in my account after the purchase as seen in the third image, why does this happen? Is there a filter that should be applied to the loans? How did binance calculate that of the $101.50503108 it had as its initial balance, it was only going to use $100.5130724 and the rest was going to be borrowed? please help

  1. I see you placed a MARKET order.

MARKET orders using quoteOrderQty specifies the amount the user wants to spend (when buying) or receive (when selling) the quote asset; the correct quantity will be determined based on the market liquidity and quoteOrderQty

  1. For the interest, it’s up to 8 decimals, that’s why the digit is ceiled to 0.00000002

Thanks for the answer but it does not solve my question, I am going to rephrase the question without so much trouble, how can I calculate that balance that remains after doing an operation before executing it?