Skip to content

Commit

Permalink
chore: log purpose in updateOrders()
Browse files Browse the repository at this point in the history
  • Loading branch information
adamant-al committed Feb 20, 2023
1 parent b0d6ae7 commit 0f061c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion trade/mm_liquidity_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion trade/mm_orderbook_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);

Expand Down
2 changes: 1 addition & 1 deletion trade/mm_price_watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions trade/orderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.`);
}
Expand Down

0 comments on commit 0f061c4

Please sign in to comment.