@@ -546,53 +546,24 @@ def filter(self, record):
546546# Add strict symbol filtering
547547ALLOWED_SYMBOLS = {'BTCUSDC' , 'ETHUSDC' }
548548
549- def debug_symbol_sources ():
550- """Debug function to see where symbols are coming from"""
551- print ("=== SYMBOL SOURCE DEBUGGING ===" )
552-
553- # Check YAML file
554- yaml_symbols = []
555- if os .path .exists (YAML_SYMBOLS_FILE ):
556- try :
557- with open (YAML_SYMBOLS_FILE , 'r' ) as f :
558- yaml_data = yaml .safe_load (f )
559- yaml_symbols = list (yaml_data .keys ()) if yaml_data else []
560- print (f"YAML symbols: { yaml_symbols } " )
561- except Exception as e :
562- print (f"Error reading YAML: { e } " )
563-
564- # Check current positions
565- position_symbols = list (positions .keys ())
566- print (f"Position symbols: { position_symbols } " )
567-
568- # Check WebSocket manager
569- websocket_symbols = []
570- if ws_price_manager :
571- websocket_symbols = ws_price_manager .get_monitored_symbols ()
572- print (f"WebSocket monitoring: { websocket_symbols } " )
573-
574- # Check price cache
575- with price_cache_lock :
576- cached_symbols = list (price_cache .keys ())
577- print (f"Price cache symbols: { cached_symbols } " )
549+ def get_trading_status ():
550+ """Get current trading status summary"""
551+ status = {
552+ 'allowed_symbols' : list (ALLOWED_SYMBOLS ),
553+ 'positions' : list (positions .keys ()),
554+ 'websocket_monitoring' : ws_price_manager .get_monitored_symbols () if ws_price_manager else [],
555+ 'balance_usd' : balance .get ('usd' , 0 ),
556+ 'total_positions' : len (positions )
557+ }
578558
579- # Check if get_ticker() calls are fetching all symbols
580- try :
581- print ("Checking if any functions call get_ticker() for all symbols..." )
582- # This would show ALL USDC symbols available on Binance
583- all_tickers = client .get_ticker ()
584- usdc_tickers = [t ['symbol' ] for t in all_tickers if t ['symbol' ].endswith ('USDC' )]
585- print (f"Total USDC symbols on Binance: { len (usdc_tickers )} " )
586- print (f"Sample USDC symbols: { usdc_tickers [:10 ]} " )
587- except Exception as e :
588- print (f"Error checking tickers: { e } " )
559+ print ("=== TRADING STATUS ===" )
560+ print (f"Allowed symbols: { status ['allowed_symbols' ]} " )
561+ print (f"Current positions: { status ['positions' ]} " )
562+ print (f"WebSocket monitoring: { status ['websocket_monitoring' ]} " )
563+ print (f"USD balance: ${ status ['balance_usd' ]:.2f} " )
564+ print (f"Total positions: { status ['total_positions' ]} " )
589565
590- return {
591- 'yaml' : yaml_symbols ,
592- 'positions' : position_symbols ,
593- 'websocket' : websocket_symbols ,
594- 'cached' : cached_symbols
595- }
566+ return status
596567
597568def filter_to_allowed_symbols (symbols ):
598569 """Filter symbols to only allowed ones"""
@@ -914,8 +885,8 @@ async def telegram_handle_message(update: Update, context: ContextTypes.DEFAULT_
914885 except Exception as e :
915886 await send_with_keyboard (update , f"❌ Momentum check failed: { str (e )} " )
916887
917- elif text == "🔍 Debug Symbols " :
918- await send_with_keyboard (update , "🔍 Running symbol source debugging ..." )
888+ elif text == "� Trading Status " :
889+ await send_with_keyboard (update , "� Getting trading status ..." )
919890
920891 # Capture debug output
921892 import io
@@ -925,7 +896,7 @@ async def telegram_handle_message(update: Update, context: ContextTypes.DEFAULT_
925896 sys .stdout = captured_output = io .StringIO ()
926897
927898 try :
928- debug_info = debug_symbol_sources ()
899+ status_info = get_trading_status ()
929900 debug_text = captured_output .getvalue ()
930901 finally :
931902 sys .stdout = old_stdout
@@ -935,9 +906,9 @@ async def telegram_handle_message(update: Update, context: ContextTypes.DEFAULT_
935906 # Split long messages
936907 chunks = [debug_text [i :i + 4000 ] for i in range (0 , len (debug_text ), 4000 )]
937908 for i , chunk in enumerate (chunks ):
938- await send_with_keyboard (update , f"```\n Debug Info ({ i + 1 } /{ len (chunks )} ):\n { chunk } \n ```" , parse_mode = 'Markdown' )
909+ await send_with_keyboard (update , f"```\n Trading Status ({ i + 1 } /{ len (chunks )} ):\n { chunk } \n ```" , parse_mode = 'Markdown' )
939910 else :
940- await send_with_keyboard (update , f"```\n Symbol Debug Info :\n { debug_text } \n ```" , parse_mode = 'Markdown' )
911+ await send_with_keyboard (update , f"```\n Trading Status :\n { debug_text } \n ```" , parse_mode = 'Markdown' )
941912
942913 elif text == "⚡ Fast Check" :
943914 await send_with_keyboard (update , "⚡ Running fast momentum check for immediate opportunities..." )
@@ -1005,7 +976,7 @@ def is_paused():
1005976 ["⏸ Pause Trading" , "▶️ Resume Trading" ],
1006977 ["📝 Trade Log" , "🔍 Diagnose" ],
1007978 ["🔄 WebSocket Status" , "⚡ Check Momentum" ],
1008- ["🔍 Debug Symbols " , "⚡ Fast Check" ],
979+ ["� Trading Status " , "⚡ Fast Check" ],
1009980 ["📈 Status" ]
1010981]
1011982
0 commit comments