def __init__(self):
    try:
        self.keypair_path = os.path.join(os.getcwd(), "id.json")
        self.rust_trader = RaydiumTrader(self.keypair_path)
        
        # Retry logic for balance fetch
        retry_count = 3
        initial_balance = DEFAULT_INITIAL_BALANCE
        
        for _ in range(retry_count):
            try:
                initial_balance = float(self.rust_trader.get_token_balance(SOL_MINT))
                logger.info(f"Initial balance fetched: {initial_balance} SOL")
                break
            except Exception as e:
                logger.warning(f"Attempt to fetch balance failed: {e}")
                await asyncio.sleep(1)
        
        if initial_balance == DEFAULT_INITIAL_BALANCE:
            logger.warning(f"Using default balance: {DEFAULT_INITIAL_BALANCE} SOL")
        
        self.tracker = ProfitTracker(initial_balance)
        # ... rest of initialization code    async def update_display(self):
    try:
        table = Table(show_header=True, header_style="bold magenta", expand=True)
        table.add_column("Metric", style="cyan")
        table.add_column("Value", style="green", justify="right")
        
        with Live(Panel("Initializing...", title="[bold green]🚀 SOLANA SCALPER LIVE 🚀[/bold green]"), 
                 refresh_per_second=2, console=console) as live:
            self.live_display = live
            while True:
                await asyncio.sleep(0.5)
                if self.live_display:
                    stats = self.tracker.generate_stats()
                    table.clear()
                    for key, value in stats.items():
                        table.add_row(key, str(value))
                    
                    self.live_display.update(Panel(
                        table,
                        title="[bold green]🚀 SOLANA SCALPER LIVE 🚀[/bold green]",
                        border_style="green"
                    ))
    except Exception as e: 
        logger.error(f"Display update error: {e}")                 ERROR - Display update error: Unable to render {...}; A str, Segment or object with __rich_console__ method is required            async def process_raw_data(self, raw_data):
    try:
        # Check if raw_data is already a list
        if isinstance(raw_data, list):
            decoded_data = raw_data
        else:
            decoded_data = base64.b64decode(raw_data)
        pools = self.parse_pool_data(decoded_data)
        
        for pool in pools:
            await self.process_price("Pool_XYZ", pool['price'])
    except Exception as e:
        logger.error(f"Error processing raw data: {e}")   ERROR - Error processing raw data: argument should be a bytes-like object or ASCII string, not 'list'   WARNING - Failed to fetch initial balance: Account fetch failed: AccountNotFound: pubkey=CLT9Tv4QgQvxV3DkZaMz98Z8N8YZTkNAXfWXfxHtvTuFI notice a few errors in the output that we should address. Let me help fix these issues:

First Error - Account Balance:
This suggests the wallet address doesn't exist or isn't properly initialized on Solana. We                      should modify the initialization to handle this better.

Second Error - Raw Data Processing:
 There's a type mismatch in the process_raw_data method. Here's the fix:   The display update method needs to convert the stats dictionary to a table. Here's the fix:         Also, let's add better error handling for the wallet initialization:  These changes should resolve the errors you're seeing. The key fixes are:

Better handling of wallet initialization and balance fetching
More robust raw data processing that handles both base64 and list inputs
Proper formatting of the live display table

Would you like me to explain any of these changes in more detail or help with implementing them?   yes please into this script  import asyncio
import json
import base64
import time
from websockets import connect

WS_URL = "wss://marga-e56m84-fast-mainnet.helius-rpc.com/"

class RaydiumDataCracker:
    def __init__(self):
        self.ws = None
        self.pools = {}
        # Different byte position combinations to test
        self.byte_positions = [
            (32, 40, 40, 48),    # Test 1: Original positions
            (64, 72, 72, 80),    # Test 2: AMM v4 reserves
            (176, 184, 184, 192), # Test 3: Alternative layout
            (8, 16, 16, 24),     # Test 4: Header area
            (96, 104, 104, 112), # Test 5: Middle section
            (128, 136, 136, 144), # Test 6: Later section
            (144, 152, 152, 160), # Test 7: Extended area
            (160, 168, 168, 176), # Test 8: Further section
            (192, 200, 200, 208), # Test 9: End section
            (48, 56, 56, 64),    # Test 10: Early middle
            (80, 88, 88, 96),    # Test 11: Quarter point
            (112, 120, 120, 128), # Test 12: Mid section
            (24, 32, 32, 40),    # Test 13: Early section
            (40, 48, 48, 56),    # Test 14: Following early
            (56, 64, 64, 72),    # Test 15: Pre-reserves
            (88, 96, 96, 104),   # Test 16: Post-reserves
            (104, 112, 112, 120), # Test 17: Mid-later
            (120, 128, 128, 136), # Test 18: Three-quarter
            (136, 144, 144, 152), # Test 19: Pre-end
            (168, 176, 176, 184)  # Test 20: Near-end
        ]

    async def connect(self):
        print("🔌 INITIATING RAYDIUM DATA CRACK")
        self.ws = await connect(WS_URL)
        subscribe_msg = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "programSubscribe",
            "params": [
                "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8",
                {"encoding": "base64", "commitment": "confirmed"}
            ]
        }
        await self.ws.send(json.dumps(subscribe_msg))
        print("✅ CONNECTION ESTABLISHED")

    def test_all_positions(self, raw_data):
        results = []
        for i, (base_start, base_end, quote_start, quote_end) in enumerate(self.byte_positions, 1):
            try:
                base = int.from_bytes(raw_data[base_start:base_end], 'little')
                quote = int.from_bytes(raw_data[quote_start:quote_end], 'little')
                
                if base > 0 and quote > 0:
                    price = quote / base
                    volume = (quote * price) / 1e9
                    results.append({
                        'test_num': i,
                        'positions': f"Base: {base_start}-{base_end}, Quote: {quote_start}-{quote_end}",
                        'price': price,
                        'volume': volume,
                        'base': base,
                        'quote': quote
                    })
            except Exception as e:
                continue
        return results

    def display_results(self, pool_address, results):
        print(f"\n💥 POOL: {pool_address}")
        print("TEST | BYTE POSITIONS | PRICE | VOLUME | BASE | QUOTE")
        print("-" * 80)
        
        for r in results:
            print(
                f"#{r['test_num']:2d} | "
                f"{r['positions']} | "
                f"${r['price']:.4f} | "
                f"${r['volume']:.2f}M | "
                f"{r['base']:.0f} | "
                f"{r['quote']:.0f}"
            )

    async def run(self):
        await self.connect()
        print("🚀 STARTING DATA ANALYSIS")
        
        while True:
            try:
                msg = await self.ws.recv()
                data = json.loads(msg)
                
                if 'params' in data and 'result' in data['params']:
                    result = data['params']['result']['value']
                    pool_address = result['pubkey']
                    account_data = result['account']['data']
                    
                    if isinstance(account_data, list) and len(account_data) > 0:
                        raw_data = base64.b64decode(account_data[0])
                        results = self.test_all_positions(raw_data)
                        
                        if results:
                            self.display_results(pool_address, results)
                            print("\n🎯 VALID DATA STRUCTURES FOUND!")
                            print("Raw data preview:", raw_data[:32].hex())
                
                await asyncio.sleep(0.1)
                
            except Exception as e:
                print(f"🔄 Loop: {str(e)}")
                await asyncio.sleep(1)

if __name__ == "__main__":
    print("🔥 RAYDIUM DATA STRUCTURE ANALYZER v1.0")
    asyncio.run(RaydiumDataCracker().run())