calculateLastBuyPrice = async (logger, symbol, order) => {
  const { type, executedQty, cummulativeQuoteQty } = order;
  const lastBuyPriceDoc = await getLastBuyPrice(logger, symbol);

  const orgLastBuyPrice = _.get(lastBuyPriceDoc, 'lastBuyPrice', 0);
  const orgQuantity = _.get(lastBuyPriceDoc, 'quantity', 0);
  const orgTotalAmount = orgLastBuyPrice * orgQuantity;

  logger.info(
    { orgLastBuyPrice, orgQuantity, orgTotalAmount },
    'Existing last buy price'
  );

  const filledQuoteQty = parseFloat(cummulativeQuoteQty);
  const filledQuantity = parseFloat(executedQty);

  const newQuantity = orgQuantity + filledQuantity;
  const newTotalAmount = orgTotalAmount + filledQuoteQty;

  const newLastBuyPrice = newTotalAmount / newQuantity;

  const notifyDebug = config.get('featureToggle.notifyDebug');
  const notifyOrderConfirm = config.get('featureToggle.notifyOrderConfirm');

  logger.info(
    { newLastBuyPrice, newTotalAmount, newQuantity, saveLog: true },
    `The last buy price will be saved. New last buy price: ${newLastBuyPrice}`
  );
  await saveLastBuyPrice(logger, symbol, {
    lastBuyPrice: newLastBuyPrice,
    quantity: newQuantity
  });

  PubSub.publish('frontend-notification', {
    type: 'success',
    title: `New last buy price for ${symbol} has been updated.`
  });

  if (notifyDebug || notifyOrderConfirm)
    slack.sendMessage(
      `*${symbol}* Last buy price Updated: *${type}*\n` +
        `- Order Result: \`\`\`${JSON.stringify(
          {
            orgLastBuyPrice,
            orgQuantity,
            orgTotalAmount,
            newLastBuyPrice,
            newQuantity,
            newTotalAmount
          },
          undefined,
          2
        )}\`\`\``,
      { symbol, apiLimit: getAPILimit(logger) }
    );
}
Retrieve last buy price and recalculate new last buy price

@param {*} logger
@param {*} symbol
@param {*} order