def timeframe_str_to_int(timeframe: str) -> int:
    """
    Convert timeframe from string to integer
    :param timeframe: string representation from API (4h)
    :return: minutes per candle (240)
    """
    if "m" in timeframe:
        return int(timeframe.replace("m", ""))
    elif "h" in timeframe:
        return int(timeframe.replace("h", "")) * 60
    elif "d" in timeframe:
        return int(timeframe.replace("d", "")) * 1440
    else:
        raise Exception("Unsupported timeframe")