def add_currency_filter_to_query(query, currency):
    """
    Adds the currency filter to the query

    :param query: the query dictionary
    :type query: dict
    :param currency: currency type
    :type currency: str
    :return: the query dictionary
    :rtype: dict
    """
    if "filters" not in query["query"]:
        query["query"]["filters"] = {}
    if "trade_filters" not in query["query"]["filters"]:
        query["query"]["filters"]["trade_filters"] = {}
    if "filters" not in query["query"]["filters"]["trade_filters"]:
        query["query"]["filters"]["trade_filters"]["filters"] = {}
    if "price" not in query["query"]["filters"]["trade_filters"]["filters"]:
        query["query"]["filters"]["trade_filters"]["filters"]["price"] = {}
    if "option" not in query["query"]["filters"]["trade_filters"]["filters"]["price"] or \
            query["query"]["filters"]["trade_filters"]["filters"]["price"]["option"] != currency:
        query["query"]["filters"]["trade_filters"]["filters"]["price"]["option"] = currency

    return query