Skip to content

Commit affa244

Browse files
committed
Fix TypeError
The error: UnhandledPromiseRejectionWarning: TypeError: qty.toFixed is not a function
1 parent d8adb12 commit affa244

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

node-binance-api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2578,7 +2578,7 @@ let api = function Binance( options = {} ) {
25782578
roundStep: function ( qty, stepSize ) {
25792579
// Integers do not require rounding
25802580
if ( Number.isInteger( qty ) ) return qty;
2581-
const qtyString = qty.toFixed( 16 );
2581+
const qtyString = parseFloat( qty ).toFixed( 16 );
25822582
const desiredDecimals = Math.max( stepSize.indexOf( '1' ) - 1, 0 );
25832583
const decimalIndex = qtyString.indexOf( '.' );
25842584
return parseFloat( qtyString.slice( 0, decimalIndex + desiredDecimals + 1 ) );

0 commit comments

Comments
 (0)