from typing import Any


def _fix_float_type(data: Any) -> Any:
    """Recursively convert all stringified floats back to :obj:`float`.

    Convert only string that consist of the following characters:
    `0123456789.-`

    Background: Kraken Exchange API formats float values as string to
    keep information about decimal precision.

    Parameters
    ----------
    data : Any
        Dictionaries, lists, or primitive types (string / rest)

    Returns
    -------
    Any
        Same as input, strings converted to floats.
    """
    if isinstance(data, str):
        if data and all(c in "0123456789.-" for c in data):
            data = float(data)
    elif isinstance(data, dict):
        for k, v in data.items():
            data[k] = _fix_float_type(v)
    elif isinstance(data, list):
        for i in range(len(data)):
            data[i] = _fix_float_type(data[i])
    return data