If you trade on the exchange, then you may have difficulty in closing the order. This problem arises for the reason that Binance charges a commission from amount which you are buying .
You bought 50BAT but found 49.95BAT in your margin wallet is because you paid 0.05BAT as a trading fee. Now, you have 49.95BAT in your wallet, if you try to sell 50BAT, you will get the 'insufficient balance' error.
You don't need to buy extra 1 BAT to sell BAT back to BTC, you can just sell 49BAT and transfer leftover 0.95BAT to your spot account, after that you can convert dust asset to BNB. (Please refer this link to get more details). How to get around this problem. You just need to add small balance to each altcoin which you want to trade.
How to trade Altcoins on Binance (Latency Crypto Arbitrage)
If you trade BAT you can add 1 BAT to BAT wallet and when bought 50BAT but found 49.95BAT +1 BAT which you deposit before.. Now, you have 50.95BAT in your wallet, and you can sell 50 BAT.
If you decided do not trade this altcoin anymore and you still have leftover. You transfer leftover 0.95BAT to your spot account, after that you can convert dust asset to BNB.
This situation can be easier to solve when Binance margin trading will be available for trading via API.
Binance Margin Trading
Margin trading is in the spot market, which means you need to have sufficient balance before trading. In our case, you want to buy and sell BATBTC, you need to have BAT or BTC in your margin account. You can trade BATBTC without sufficient balance in your margin account is because you may using borrow feature when you trade.
At this stage, API doesn't have this feature yet, but it is under development, once it is in public view version, you can find it in the change log.