Giter VIP home page Giter VIP logo

Comments (3)

aadon94 avatar aadon94 commented on June 22, 2024 1

I suspect this the cause of your error. Can you confirm if you had BNB balance in your account at the time of the error?

Yep that was the cause of it. Brilliant, thanks.

from binance-oco.

tony-ho avatar tony-ho commented on June 22, 2024

@aadon94 Thanks for the feedback and for raising this issue.

The current behaviour is to reduce the sell amount by the fee paid, but only if the fee is not paid using BNB. This is to allow user who have selected to use BNB to pay fees (https://support.binance.com/hc/en-us/articles/115000583311) to trade the entire amount.

The logic is here:

binance-oco/binance-oco.js

Lines 161 to 166 in 3321bf4

const NON_BNB_TRADING_FEE = 0.001;
const calculateSellAmount = function (commissionAsset, sellAmount) {
// Adjust sell amount if BNB not used for trading fee
return (commissionAsset === 'BNB') ? sellAmount : (sellAmount * (1 - NON_BNB_TRADING_FEE));
};

However, this causes an issue when:

  • BNB is the asset being purchased eg. when trading BNBBTC, BNBETH, BNBUSDT pairs, and
  • there is insufficient BNB in the account to cover fees before the buy order is filled, meaning the fee is deducted from the buy amount

The reason is that orders for BNB pairs will always pay fees using BNB. As the script does not reduce the sell amount when fees are paid using BNB, there will be insufficient balance for the sell order if the account does not already have enough BNB to pays fees.

I suspect this the cause of your error. Can you confirm if you had BNB balance in your account at the time of the error?

from binance-oco.

tony-ho avatar tony-ho commented on June 22, 2024

@aadon94 This issue has been addressed in v1.5.0.

This release adds a -F/--non-bnb-fees option to force non-BNB fee calculation ie. the sell order amount will be reduced by 0.1%.

from binance-oco.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.