@@ -774,52 +774,51 @@ async def _status_msg(self, update: Update, context: CallbackContext) -> None:
774774 r ["realized_profit_r" ] = fmt_coin (r ["realized_profit" ], r ["quote_currency" ])
775775 r ["total_profit_abs_r" ] = fmt_coin (r ["total_profit_abs" ], r ["quote_currency" ])
776776 lines = [
777- "*Trade ID:* `{trade_id}`" + (" `(since {open_date_hum})`" if r ["is_open" ] else "" ),
778- "*Current Pair:* {pair}" ,
777+ f"*Trade ID:* `{ r ['trade_id' ]} `"
778+ + (f" `(since { r ['open_date_hum' ]} )`" if r ["is_open" ] else "" ),
779+ f"*Current Pair:* { r ['pair' ]} " ,
779780 (
780781 f"*Direction:* { '`Short`' if r .get ('is_short' ) else '`Long`' } "
781- + " ` ({leverage}x)`"
782- if r .get ("leverage" )
783- else ""
782+ + (f" ` ({ r ['leverage' ]} x)`" if r .get ("leverage" ) else "" )
784783 ),
785- "*Amount:* `{amount} ({stake_amount_r})`" ,
786- "*Total invested:* `{max_stake_amount_r}`" if position_adjust else "" ,
787- "*Enter Tag:* `{enter_tag}`" if r ["enter_tag" ] else "" ,
788- "*Exit Reason:* `{exit_reason}`" if r ["exit_reason" ] else "" ,
784+ f "*Amount:* `{ r [ ' amount' ] } ({ r [ ' stake_amount_r' ] } )`" ,
785+ f "*Total invested:* `{ r [ ' max_stake_amount_r' ] } `" if position_adjust else "" ,
786+ f "*Enter Tag:* `{ r [ ' enter_tag' ] } `" if r ["enter_tag" ] else "" ,
787+ f "*Exit Reason:* `{ r [ ' exit_reason' ] } `" if r ["exit_reason" ] else "" ,
789788 ]
790789
791790 if position_adjust :
792791 max_buy_str = f"/{ max_entries + 1 } " if (max_entries > 0 ) else ""
793792 lines .extend (
794793 [
795- "*Number of Entries:* `{num_entries}" + max_buy_str + " `" ,
796- "*Number of Exits:* `{num_exits}`" ,
794+ f "*Number of Entries:* `{ r [ ' num_entries' ] } { max_buy_str } `" ,
795+ f "*Number of Exits:* `{ r [ ' num_exits' ] } `" ,
797796 ]
798797 )
799798
800799 lines .extend (
801800 [
802801 f"*Open Rate:* `{ round_value (r ['open_rate' ], 8 )} `" ,
803802 f"*Close Rate:* `{ round_value (r ['close_rate' ], 8 )} `" if r ["close_rate" ] else "" ,
804- "*Open Date:* `{open_date}`" ,
805- "*Close Date:* `{close_date}`" if r ["close_date" ] else "" ,
803+ f "*Open Date:* `{ r [ ' open_date' ] } `" ,
804+ f "*Close Date:* `{ r [ ' close_date' ] } `" if r ["close_date" ] else "" ,
806805 (
807806 f" \n *Current Rate:* `{ round_value (r ['current_rate' ], 8 )} `"
808807 if r ["is_open" ]
809808 else ""
810809 ),
811810 ("*Unrealized Profit:* " if r ["is_open" ] else "*Close Profit: *" )
812- + "`{profit_ratio:.2%}` `({profit_abs_r})`" ,
811+ + f "`{ r [ ' profit_ratio' ] :.2%} ` `({ r [ ' profit_abs_r' ] } )`" ,
813812 ]
814813 )
815814
816815 if r ["is_open" ]:
817816 if r .get ("realized_profit" ):
818817 lines .extend (
819818 [
820- "*Realized Profit:* `{realized_profit_ratio:.2%} "
821- "({realized_profit_r})`" ,
822- "*Total Profit:* `{total_profit_ratio:.2%} ({total_profit_abs_r})`" ,
819+ f "*Realized Profit:* `{ r [ ' realized_profit_ratio' ] :.2%} "
820+ f "({ r [ ' realized_profit_r' ] } )`" ,
821+ f "*Total Profit:* `{ r [ ' total_profit_ratio' ] :.2%} ({ r [ ' total_profit_abs_r' ] } )`" ,
823822 ]
824823 )
825824
@@ -835,23 +834,23 @@ async def _status_msg(self, update: Update, context: CallbackContext) -> None:
835834 ):
836835 # Adding initial stoploss only if it is different from stoploss
837836 lines .append (
838- "*Initial Stoploss:* `{initial_stop_loss_abs:.8f}` "
839- "`({initial_stop_loss_ratio:.2%})`"
837+ f "*Initial Stoploss:* `{ r [ ' initial_stop_loss_abs' ] :.8f} ` "
838+ f "`({ r [ ' initial_stop_loss_ratio' ] :.2%} )`"
840839 )
841840
842841 # Adding stoploss and stoploss percentage only if it is not None
843842 lines .append (
844843 f"*Stoploss:* `{ round_value (r ['stop_loss_abs' ], 8 )} ` "
845- + ("`({stop_loss_ratio:.2%})`" if r ["stop_loss_ratio" ] else "" )
844+ + (f "`({ r [ ' stop_loss_ratio' ] :.2%} )`" if r ["stop_loss_ratio" ] else "" )
846845 )
847846 lines .append (
848847 f"*Stoploss distance:* `{ round_value (r ['stoploss_current_dist' ], 8 )} ` "
849- "`({stoploss_current_dist_ratio:.2%})`"
848+ f "`({ r [ ' stoploss_current_dist_ratio' ] :.2%} )`"
850849 )
851- if r .get ("open_orders" ):
850+ if open_orders := r .get ("open_orders" ):
852851 lines .append (
853- "*Open Order:* `{open_orders}`"
854- + ("- `{exit_order_status}`" if r ["exit_order_status" ] else "" )
852+ f "*Open Order:* `{ open_orders } `"
853+ + (f "- `{ r [ ' exit_order_status' ] } `" if r ["exit_order_status" ] else "" )
855854 )
856855
857856 await self .__send_status_msg (lines , r )
@@ -867,10 +866,10 @@ async def __send_status_msg(self, lines: list[str], r: dict[str, Any]) -> None:
867866 if (len (msg ) + len (line ) + 1 ) < MAX_MESSAGE_LENGTH :
868867 msg += line + "\n "
869868 else :
870- await self ._send_msg (msg . format ( ** r ) )
871- msg = "*Trade ID:* `{trade_id}` - continued\n " + line + "\n "
869+ await self ._send_msg (msg )
870+ msg = f "*Trade ID:* `{ r [ ' trade_id' ] } ` - continued\n " + line + "\n "
872871
873- await self ._send_msg (msg . format ( ** r ) )
872+ await self ._send_msg (msg )
874873
875874 @authorized_only
876875 async def _status_table (self , update : Update , context : CallbackContext ) -> None :
0 commit comments