README
Binance Min Amount
This module was created to format the values in case there is a need to avoid LOT_SIZE errors due to the formatting of the quantity field. Then we create the formatMinAmount function, you can also capture the minimum value to make the order in the quantity field that is the function getMinAmount, this will avoid simple problems and no more LOT_SIZE will occur.
Installation
NPM
npm install @clubinvestbr/binance-min-amount --save
YARN
yarn add @clubinvestbr/binance-min-amount
Getting started
formatMinAmount
const { formatMinAmount } = require('@clubinvestbr/binance-min-amount');
await formatMinAmount(0.11100000, "ETHBTC");
// "0.111"
await formatMinAmount(5.11100000, "ETHBTC");
// "5.111"
getMinAmount
const { getMinAmount } = require('@clubinvestbr/binance-min-amount');
await getMinAmount("ETHBTC");
// "0.001"
Test
$ ./node_modules/.bin/jest
PASS src/index.test.js
✓ should format the value 0.001 in pair ADABTC to 0 (6ms)
✓ should format the value 5.000 in pair ADABTC to 5
✓ should format the value 1 in pair ADABTC to 1 (1ms)
✓ should format the value 500.00 in pair ADABTC to 500
✓ should format the value 0.00000000 in pair ADABTC to 0 (1ms)
✓ should format the value 3.000 in pair EOSETH to 3
✓ should format the value 0.010 in pair BCCETH to 0.01
✓ should format the value 0.020 in pair BCCETH to 0.02 (1ms)
✓ should format the value 10 in pair BCCETH to 10
✓ should format the value 0.00179 in pair BCCBNB to 0.00179 (1ms)
✓ should format the value 0.00179000 in pair BCCBNB to 0.00179
✓ should format the value 0.99 in pair AEETH to 0.99
✓ should format the value 0.999 in pair AEETH to 0.99 (1ms)
✓ should format the value 0.9 in pair AEETH to 0.9
✓ should format the value 0.90000000 in pair AEETH to 0.9
✓ should format the value 1.103 in pair ZENBNB to 1.103 (1ms)
✓ should format the value 0.103 in pair ZENBNB to 0.103
✓ should format the value 0.10300 in pair ZENBNB to 0.103
✓ should show the minQty value of the symbol ADABTC
✓ should show the minQty value of the symbol EOSETH (1ms)
✓ should show the minQty value of the symbol BCCETH
✓ should show the minQty value of the symbol BCCBNB
✓ should show the minQty value of the symbol AEETH
✓ should show the minQty value of the symbol ZENBNB (1ms)