Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% trading in the market using the .marketBuy function #886

Open
Mae6e opened this issue May 5, 2023 · 2 comments
Open

100% trading in the market using the .marketBuy function #886

Mae6e opened this issue May 5, 2023 · 2 comments

Comments

@Mae6e
Copy link

Mae6e commented May 5, 2023

hello.
Is it necessary that the user's usdt balance is a slightly higher than the amount for the trade to take place in .marketBuy function?

Is the transaction definitely done without the buffer amount?

amount = 0.2
price = binance.prices('BTCUSDT')
total = price * amount 

const buffer = 2; // set a buffer of 2 usdt
if (balance < total + buffer) {
  console.error('Insufficient USDT balance');
  return;
}
else{
  binance.marketBuy('BNBBTC', amount)
}
@GTedZ
Copy link

GTedZ commented Jul 1, 2023

If you do not have BNB to cover the commissions, yes I think so, since binance will need to take some BTC in order to pay your commission.

Binance prefers to take BNB for every order no matter the side (with a 25% discount)
BUT if BNB wasn't available:

  • for BUY orders, the baseAsset or BTC is deducted from your account to cover the commissions
  • for SELL orders, the quoteAsset or USDT is deducted from your account

It could be the opposite, but I think its baseAsset for BUY, and quoteAsset for SELL, since this is why your order is erroring out.

@jamestangeres
Copy link

I have issue on this also.

when futuresMarketBuy. I can buy with the usdt amount I need but when selling it some
0.19 USDT position will still remain.

I used the position.isolatedMargin to get the USDT amount to sell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants