From f2a71c0e67ab25fa8592fe9203970dfa4b08a140 Mon Sep 17 00:00:00 2001 From: wartertall Date: Thu, 27 Oct 2022 09:01:18 +0700 Subject: [PATCH] Update node-binance-api.js Add quoteOrderQty for margin BUY with type = MARKET --- node-binance-api.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node-binance-api.js b/node-binance-api.js index 615485fc..1cc7bfa1 100644 --- a/node-binance-api.js +++ b/node-binance-api.js @@ -462,6 +462,10 @@ let api = function Binance( options = {} ) { opt.stopPrice = flags.stopPrice; if ( opt.type === 'LIMIT' ) throw Error( 'stopPrice: Must set "type" to one of the following: STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT' ); } + if (opt.type == 'MARKET' && typeof flags.quoteOrderQty !== 'undefined') { + opt.quoteOrderQty = flags.quoteOrderQty + delete opt.quantity; + } signedRequest( sapi + endpoint, opt, function ( error, response ) { if ( !response ) { if ( callback ) callback( error, response );