VALID_CRYPTOCURRENCY_SYMBOLS = set([
    'BTC', 'ETH', 'XRP', 'ADA', 'SOL', 'UNI', 'DOT', 'LINK', 'ATOM', 'LTC',
    'DOGE', 'HOOK', 'TWT', 'BNB', 'AUDIO', 'MANA', 'APE', 'LEVER', 'LUNC',
    'FLOW', 'NEO', 'WAVES', 'REEF', 'ACH', 'BAND', 'REN', 'VET', 'API3',
    'SUSHI', 'ENJ', 'XTZ', 'FTM', 'CHZ', 'JASMY', 'THETA', 'TRX', 'ONE',
    'RUNE', 'AXS', 'ETC', 'BAL', 'RSR', 'FIL', 'AVAX', 'MATIC', 'GMT',
    'ZRX', 'MTL', 'LUNA2', 'HOT', 'CRV', 'APT', 'XEM', 'MASK', 'CELO',
    'ZEC', 'EGLD', 'MAGIC', 'GALA', 'ALICE', 'LRC', 'BNXOLD', 'EOS',
    'STORJ', 'DENT', 'GRT', 'CVX', 'AR', 'IMX', 'QTUM', 'CELR', 'BAKE',
    'OGN', 'ALPHA', 'OCEAN', 'QNT', 'KLAY', 'RVN', 'MKR', 'LDO', 'ZIL',
    'ALGO', 'GAL', 'GMX', 'XMR', 'C98', 'CHR', 'BCH', 'KAVA', 'FLUX',
    'SNX', 'BAT', 'NEAR', 'TOMO', 'YFI', 'ROSE', 'ENS', 'SPELL', 'FOOTBALL',
    'SAND', 'PAXG', 'GTC', 'XLM', 'SKL', 'YFII', 'HNT', 'DYDX', 'INJ',
    'ARPA', 'AAVE', 'AGLD', 'DASH', 'ONT', 'CTK', 'SFP', 'FLM', 'LIT',
    'OP', '1INCH', 'LINA', 'DODO', 'STG', 'ICP', 'COTI', 'LPT', 'KNC',
    'HFT', 'KSM', 'GOLD', 'IOTX', 'GLMR', 'COMP', 'MINA', 'ANKR', 'ZEN',
    'SXP', 'SLP', 'PROS', 'MOVROLD', 'OMG', 'WOO', 'YGG', 'PEOPLE', 'IOST',
    'T', 'FXS', 'FET', 'RNDR', 'HIGH', 'DAR', 'BLUR', 'ASTR', 'AGIX',
    'PHB', 'FLOKI', 'CFX', 'STX', 'COCOS', 'BNX', 'SSV', 'HBAR', 'CKB',
    'AMB', 'RLC', 'TRU', 'PERP', 'LQTY', 'VGX', 'GNS', 'ARB', 'ID', 'GPT',
    'TLM', 'ICX', 'NKN', 'BEL', 'JOE', 'CTSI', 'RPL', 'SUI', 'RDNT',
    'EDU', 'STMX', 'RAD', 'ORDI', 'MAV', 'XVG', 'WLD', 'PENDLE', 'AUCTION',
    'FORTH', 'ARKM', 'SEI', 'CYBER', 'BLZ', 'UNFI', 'TRB', 'XVS', 'DUSK',
    'HIFI', 'NMR', 'ARK', 'LOOM', 'BIGTIME', 'STRAX', 'BOND', 'BNT',
    'ORBS', 'ALPACA', 'STPT', 'WAXP', 'POLYX', 'GAS', 'TIA', 'SNT',
    'MEME', 'CAKE', 'TOKEN', 'STEEM', 'NTRN', 'ILV', 'BADGER', 'MBL',
    'KAS', 'BEAM', 'PYTH', 'SUPER', 'USTC', 'ETHW', 'ONG', 'JTO', 'ACE',
    'MOVR', 'NFP', 'POWR', 'AI', 'XAI', 'WIF', 'MANTA', 'ONDO', 'UMA',
    'LSK', 'ALT', 'JUP', 'ZETA', 'RON', 'DYM', 'OM', 'MAVIA', 'PROM',
    'PIXEL', 'STRK', 'GLM', 'PORTAL', 'TON', 'AXL', 'MYRO', 'METIS',
    'AEVO', 'VANRY', 'BOME', 'FRONT', 'ETHFI', 'SLERF', 'ZKJ', 'POPCAT',
    'PUNDU', 'W', 'ENA', 'DEGEN', 'CORE', 'TNSR', 'SAGA', 'TAO', 'FOXY',
    'ZEUS', 'OMNI', 'MERL', 'MEW', 'ZBCN', 'ATA', 'REZ', 'LAI', 'BRETT',
    'BB', 'PT', 'NOT', 'TURBO', 'IO', 'ZK', 'LISTA', 'ZRO', 'BLAST',
    'BANANA', 'RENDER', 'L3', 'MAX', 'RARE', 'G', 'SYN', 'SYS', 'VOXEL',
    'SUN', 'DOGS', 'NULS', 'VIDT', 'ORDER', 'MBOX', 'BSW', 'CHESS',
    'NEIROETH', 'AERGO', 'NEIRO', 'UXLINK', 'BABYDOGE', 'CATI', 'KDA', 'FIDA', 'POL', 'FIO'
])

SPECIAL_SYMBOLS = {
    'SHIB': '1000 SHIB/USDT:USDT',
    'LADYS': '10000 LADYS/USDT:USDT',
    'AIDOGE': '10000000 AIDOGE/USDT:USDT',
    'PEPE': '1000 PEPE/USDT:USDT',
    'FLOKI': '1000 FLOKI/USDT:USDT',
    'XEC': '1000 XEC/USDT:USDT',
    'SATS': '1000 SATS/USDT:USDT',
    'RATS': '1000 RATS/USDT:USDT',
    'BONK': '1000 BONK/USDT:USDT',
    'BEER': '1000 BEER/USDT:USDT',
    'BABYDOGE': '1000000 BABYDOGE/USDT:USDT'
}

def format_symbols(symbols):
    formatted = []
    for symbol in symbols:
        # Split the symbol in case it contains commas
        for sub_symbol in symbol.split(','):
            # Remove leading/trailing whitespace
            clean_symbol = sub_symbol.strip()

            # Check for "SYMBOL/USDT:USDT" format
            if clean_symbol.upper().endswith('/USDT:USDT'):
                symbol_name = clean_symbol.split('/')[0].upper()
                if symbol_name in VALID_CRYPTOCURRENCY_SYMBOLS:
                    formatted.append(f"{symbol_name}/USDT:USDT")
                elif symbol_name in SPECIAL_SYMBOLS:
                    formatted.append(SPECIAL_SYMBOLS[symbol_name])
                continue

            # New regex to match patterns like "1000PEPE" or "10000BTC"
            special_match = re.match(r'^(\d+)(\w+)$', clean_symbol, re.IGNORECASE)
            if special_match:
                quantity, symbol_name = special_match.groups()
                symbol_name = symbol_name.upper()
                if symbol_name in VALID_CRYPTOCURRENCY_SYMBOLS:
                    formatted.append(f"{symbol_name}/USDT:USDT")
                elif symbol_name in SPECIAL_SYMBOLS:
                    formatted.append(SPECIAL_SYMBOLS[symbol_name])
                continue

            # Check for special symbol format (e.g., "1000 FLOKI")
            special_match = re.match(r'^(\d+)\s+(\w+)$', clean_symbol, re.IGNORECASE)
            if special_match:
                quantity, symbol_name = special_match.groups()
                symbol_name = symbol_name.upper()
                if symbol_name in SPECIAL_SYMBOLS:
                    formatted.append(SPECIAL_SYMBOLS[symbol_name])
                continue

            # Handle regular symbols
            clean_symbol = clean_symbol.upper()
            if clean_symbol in SPECIAL_SYMBOLS:
                formatted.append(SPECIAL_SYMBOLS[clean_symbol])
            elif clean_symbol in VALID_CRYPTOCURRENCY_SYMBOLS:
                formatted.append(f"{clean_symbol}/USDT:USDT")

    return formatted

@app.route('/format_symbols', methods=['POST'])
@require_api_key
@limiter.limit("30 per minute")
def format_symbols_route():
    try:
        data = request.get_json()
        if not data or 'text' not in data:
            return jsonify({"status": "error", "message": "Invalid input. Expected 'text' key with a list of symbols."}), 400

        symbols = data['text']
        if not isinstance(symbols, list):
            return jsonify({"status": "error", "message": "Invalid input. 'text' should be a list of symbols."}), 400

        formatted_symbols = format_symbols(symbols)
        return jsonify({"symbols": formatted_symbols}), 200
    except Exception as e:
        logging.error(f"Error in format_symbols_route: {str(e)}")
        return jsonify({"status": "error", "message": f"An unexpected error occurred: {str(e)}"}), 500


It output this: 


**NO MATCH**
2024-09-23 17:54:43,697: Request Body: {"text":["1000PEPE/USDT:USDT"]}
2024-09-23 17:54:43,699: Response Status: 200 OK
2024-09-23 17:54:43,699: Response Headers: Content-Type: application/json#015
Content-Length: 15#015
#015
**NO MATCH**
2024-09-23 17:54:43,699: Response Body: {"symbols":[]}
**NO MATCH**



IT should output: 1000 PEPE/USDT:USDT