def compute_progress(price, limit):
    """Function that computes the progress toward the set threshold."""
    price = float(price)
    limit = float(limit)
    if not price or not limit:
        return None
    if max(price, limit) == limit:  # price<limit
        gap = limit - price
        progress = gap / price
    else:                           # limit<price
        gap = price - limit
        progress = gap / price
    return round(progress, 4)