import axios from 'axios';
export async function getExchange(amount, currencyFk, dated, decimalPlaces = 2) {
    try {
        const { data } = await axios.get('ReferenceRates/findOne', {
            params: {
                filter: {
                    fields: ['value'],
                    where: { currencyFk, dated },
                },
            },
        });
        return (amount / data.value).toFixed(decimalPlaces);
    } catch (e) {
        return null;
    }
}
