import time
from datetime import datetime


def get_current_chart(charts):
    """Get the current relevant chart"""

    current_unix_time = time.mktime(datetime.now().timetuple())
    current_chart = charts[-1]

    for chart in charts:
        if float(chart.datetimestamp) <= current_unix_time:
            current_chart = chart

    return current_chart