From 0f061c4fef550d99fb29d8180f52de65604aab0b Mon Sep 17 00:00:00 2001 From: adamant-al Date: Mon, 20 Feb 2023 23:16:56 +0400 Subject: [PATCH] chore: log purpose in updateOrders() --- trade/mm_liquidity_provider.js | 2 +- trade/mm_orderbook_builder.js | 2 +- trade/mm_price_watcher.js | 2 +- trade/orderUtils.js | 8 ++++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/trade/mm_liquidity_provider.js b/trade/mm_liquidity_provider.js index ee940f34..4a80c5b4 100644 --- a/trade/mm_liquidity_provider.js +++ b/trade/mm_liquidity_provider.js @@ -85,7 +85,7 @@ module.exports = { return; } - liquidityOrders = await orderUtils.updateOrders(liquidityOrders, config.pair, utils.getModuleName(module.id)); // update orders which partially filled or not found + liquidityOrders = await orderUtils.updateOrders(liquidityOrders, config.pair, utils.getModuleName(module.id) + ':liq-'); // update orders which partially filled or not found liquidityOrders = await this.closeLiquidityOrders(liquidityOrders, orderBookInfo); // close orders which expired or out of spread let liqInfoString; let liqSsInfoString; diff --git a/trade/mm_orderbook_builder.js b/trade/mm_orderbook_builder.js index 1108b833..566a02fb 100644 --- a/trade/mm_orderbook_builder.js +++ b/trade/mm_orderbook_builder.js @@ -101,7 +101,7 @@ module.exports = { exchange: config.exchange, }); - orderBookOrders = await orderUtils.updateOrders(orderBookOrders, config.pair, utils.getModuleName(module.id)); // update orders which partially filled or not found + orderBookOrders = await orderUtils.updateOrders(orderBookOrders, config.pair, utils.getModuleName(module.id) + ':ob-'); // update orders which partially filled or not found orderBookOrders = await this.closeOrderBookOrders(orderBookOrders); log.log(`Orderbook builder: ${orderBookOrders.length} ob-orders opened.`); diff --git a/trade/mm_price_watcher.js b/trade/mm_price_watcher.js index 18e57041..b4883dc3 100644 --- a/trade/mm_price_watcher.js +++ b/trade/mm_price_watcher.js @@ -273,7 +273,7 @@ module.exports = { exchange: config.exchange, }); - pwOrders = await orderUtils.updateOrders(pwOrders, config.pair, utils.getModuleName(module.id), false); // update orders which partially filled or not found + pwOrders = await orderUtils.updateOrders(pwOrders, config.pair, utils.getModuleName(module.id) + ':pw-', false); // update orders which partially filled or not found pwOrders = await this.closePriceWatcherOrders(pwOrders); // close orders which expired await setPriceRange(); diff --git a/trade/orderUtils.js b/trade/orderUtils.js index ff5463d0..01b449e3 100644 --- a/trade/orderUtils.js +++ b/trade/orderUtils.js @@ -247,11 +247,15 @@ module.exports = { let updatedOrders = []; let ldFilledCount = 0; + let samePurpose; + [moduleName, samePurpose] = moduleName.split(':'); + samePurpose = samePurpose || ''; + try { const onWhichAccount = api.isSecondAccount ? ' (on second account)' : ''; const exchangeOrders = await api.getOpenOrders(pair); - log.log(`orderUtils: Updating ${dbOrders.length} dbOrders on ${pair} for ${moduleName}, noCache: ${noCache}, hideNotOpened: ${hideNotOpened}… Received ${exchangeOrders?.length} orders from exchange.`); + log.log(`orderUtils: Updating ${dbOrders.length} ${samePurpose}dbOrders on ${pair} for ${moduleName}, noCache: ${noCache}, hideNotOpened: ${hideNotOpened}… Received ${exchangeOrders?.length} orders from exchange.`); if (exchangeOrders) { for (const dbOrder of dbOrders) { @@ -357,7 +361,7 @@ module.exports = { } } - log.log(`orderUtils: dbOrders updated for ${moduleName} with ${updatedOrders.length} live orders${openOrdersString} on ${pair}.`); + log.log(`orderUtils: ${samePurpose}dbOrders updated for ${moduleName} with ${updatedOrders.length} live orders${openOrdersString} on ${pair}.`); if (ldFilledCount/tradeParams.mm_ladderCount > 0.7) { log.warn(`orderUtils: ${ldFilledCount} orders considered as filled.`); }