From 989af492cc1f007a9b2f021d34d6ab4be23b23fb Mon Sep 17 00:00:00 2001 From: Jonas Thelemann Date: Wed, 3 Mar 2021 19:18:38 +0100 Subject: [PATCH] fix(trader): correct merge --- src/trader.js | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/trader.js b/src/trader.js index 2330dd1..399fa6b 100644 --- a/src/trader.js +++ b/src/trader.js @@ -417,25 +417,10 @@ socket.on("sell_signal", async (signal) => { } if (tradingData.user_payload[tresult].trading_type === "real") { - bnb_client.mgBorrow( - alt, - Number(qty), - (error, response) => { - if (error) { - console.log( - "ERROR 55555555555", - alt, - Number(qty), - JSON.stringify(error) - ) - return - } - - console.log( - "SUCESS 444444444 mgMarketSell 44444444" - ) - bnb_client.mgMarketSell( - alt + "BTC", + const job = async () => { + return new Promise((resolve, reject) => { + bnb_client.mgBorrow( + alt, Number(qty), (error, response) => { if (error) { @@ -445,7 +430,6 @@ socket.on("sell_signal", async (signal) => { Number(qty), JSON.stringify(error) ) - reject(error) return } @@ -486,8 +470,8 @@ socket.on("sell_signal", async (signal) => { ) } ) - } - ) + }) + } const task = new Task(job) tradeQueue.addToQueue(task)