INNER CODE UNIT · Python
pnl_perc
jptsantossilva/BEC · bec/main.py:303
pnl_perc = ((current_price - buy_price) / buy_price) * 100
pnl_perc = round(pnl_perc, 2)
return pnl_perc
except Exception as e:
msg = sys._getframe().f_code.co_name + " - " + repr(e)
msg = telegram_prefix_sl + msg
print(msg)
telegram.send_error_event(
action="calculate current PnL",
symbol=symbol,
timeframe=timeframe,
reason="Unexpected exception",
impact="PnL-dependent exit checks may be incomplete for this symbol.",
next_step="Check position data and logs.",
exception=e,
main_token=telegram_token,