Skip to content

Stable Release

Choose a tag to compare

@jaggedsoft jaggedsoft released this 08 Sep 11:35
· 735 commits to master since this release
9b25bf7

Add roundTicks function to fix PRICE_FILTER errors
Usage: binance.roundTicks(price, tickSize)

tickSize is provided via exchangeInfo

function roundTicks(number, tickSize) {
    const formatter = new Intl.NumberFormat('en-US', { style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 8 });
    const precision = formatter.format(tickSize).split('.')[1].length || 0;
    if ( typeof number === 'string' ) number = parseFloat(number);
    return number.toFixed(precision);
}