瀏覽代碼

Refactor InfoCommands to simplify price formatting by removing quote precision parameter

- Updated price formatting calls in InfoCommands to eliminate the quote precision parameter, defaulting to base asset precision.
- Improved clarity in order summary display by correcting emoji representation for total orders.
Carles Sentis 2 天之前
父節點
當前提交
2f3a478417
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      src/commands/info_commands.py

+ 4 - 5
src/commands/info_commands.py

@@ -207,11 +207,10 @@ class InfoCommands:
                 # For direct use, we can fetch token_info if get_formatter() isn't what we expect
                 token_info = self.trading_engine.get_token_info(base_asset) # Ensure this method exists and works
                 base_precision = token_info.get('precision', {}).get('amount', 6) if token_info and token_info.get('precision') else 6 # Default amount precision
-                quote_precision = token_info.get('precision', {}).get('price', 2) if token_info and token_info.get('precision') else 2 # Default price precision
 
                 formatter = get_formatter() # Keep using if it wraps these precisions
-                entry_price_str = formatter.format_price_with_symbol(entry_price, base_asset, quote_precision)
-                mark_price_str = formatter.format_price_with_symbol(mark_price, base_asset, quote_precision)
+                entry_price_str = formatter.format_price_with_symbol(entry_price, base_asset)
+                mark_price_str = formatter.format_price_with_symbol(mark_price, base_asset)
                 
                 type_indicator = ""
                 # Determine type_indicator based on trade_lifecycle_id or trade_type
@@ -234,7 +233,7 @@ class InfoCommands:
                 if margin_used is not None:
                     positions_text += f"   💳 Margin Used: ${margin_used:,.2f}\n"
                 if position_trade.get('liquidation_price') is not None and position_trade.get('liquidation_price') > 0:
-                    liq_price_str = formatter.format_price_with_symbol(position_trade.get('liquidation_price'), base_asset, quote_precision)
+                    liq_price_str = formatter.format_price_with_symbol(position_trade.get('liquidation_price'), base_asset)
                     positions_text += f"   ⚠️ Liquidation: {liq_price_str}\n"
                 
                 # Show stop loss if linked
@@ -326,7 +325,7 @@ class InfoCommands:
                         
                         orders_text += "\n"
                 
-                orders_text += f"�� <b>Total Orders:</b> {len(orders)}\n"
+                orders_text += f"💼 <b>Total Orders:</b> {len(orders)}\n"
                 orders_text += f"💡 Use /coo [token] to cancel orders"
                 
             else: