From f77d568498b5c0fd388146bc7526774ff3e34864 Mon Sep 17 00:00:00 2001 From: Piyush Dixit <79581397+PiyushDixit96@users.noreply.github.com> Date: Sun, 23 May 2021 01:37:35 +0530 Subject: fix market order issue --- index.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'index.js') diff --git a/index.js b/index.js index fc94a9f..55cd0a8 100644 --- a/index.js +++ b/index.js @@ -79,18 +79,27 @@ function process_data(data) { if (["BNB", "BTC", "XRP", "TRX", "ETH", "AUD", "BRL", "EUR", "GBP", "RUB", "TRY", "PAX", "DAI", "UAH", "NGN", "VAI"].includes(str3)) { sy = str3 } - let total = `${fixFloat(Number(price) * Number(quantity))} ${sy}` + let total if (orderType !== "LIMIT") { + total = `${fixFloat(Number(price) * Number(quantity))} ${sy}` let { - L: Lprice + L: Last_price } = data; - price = Lprice + price = Last_price } if (executionType === 'NEW') { if (orderStatus === 'NEW') { - txt = `✅ ✅ ✅\nSpot ${side} Order CREATED\nSymbol: #${symbol}\nPrice: ${price}\nQuantity: ${fixFloat(quantity)}\nTotal: ${total}\nOrder ID: #ID${orderId}` + if (orderType === "MARKET") { + txt = `✅ ✅ ✅\nSpot ${orderType} ${side} Order CREATED\nSymbol: #${symbol}\nQuantity: ${fixFloat(quantity)}\nOrder ID: #ID${orderId}` + }else { + txt = `✅ ✅ ✅\nSpot ${orderType} ${side} Order CREATED\nSymbol: #${symbol}\nPrice: ${price}\nQuantity: ${fixFloat(quantity)}\nTotal: ${total}\nOrder ID: #ID${orderId}` + } } else if (orderStatus === 'REJECTED') { - txt = `🚫 🚫 🚫\nSpot ${side} Order REJECTED\nSymbol: #${symbol}\nPrice: ${price}\nQuantity: ${fixFloat(quantity)}\nTotal: ${total}\nOrder ID: #ID${orderId}` + if (orderType === "MARKET") { + txt = txt = `🚫 🚫 🚫\nSpot ${orderType} ${side} Order CREATED\nSymbol: #${symbol}\nQuantity: ${fixFloat(quantity)}\nOrder ID: #ID${orderId}\nOrder reject reason: #ID${Order_reject_reason}` + }else { + txt = `🚫 🚫 🚫\nSpot ${orderType} ${side} Order REJECTED\nSymbol: #${symbol}\nPrice: ${price}\nQuantity: ${fixFloat(quantity)}\nTotal: ${total}\nOrder ID: #ID${orderId}\nOrder reject reason: #ID${Order_reject_reason}` + } } } else if (executionType === 'CANCELED') { if (orderStatus === 'CANCELED') { -- cgit v1.2.3