import requests
import logging


def recently_traded(symbol):
    """Check if a ticker was recently traded on thetagang.com."""
    url = "https://api.thetagang.com/trades"
    params = {"ticker": symbol}
    trades = requests.get(url, params=params).json()['data']['trades']

    # Skip this message if nobody has traded this ticker.
    if trades:
        logging.info(f"Found {len(trades)} trades on thetagang.com for {symbol}")
    else:
        logging.info(f"Message skipped due to no trades for {symbol}")
        return False

    return True