export function downloadFile(content, filename, mimeType) {
    const blob = new Blob([content], { type: mimeType });
    const url = URL.createObjectURL(blob);
    const link = document.createElement('a');
    link.href = url;
    link.download = filename;
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
    URL.revokeObjectURL(url);
}

export function formatDate(date) {
    return new Date(date).toISOString().slice(0, 16);
}

export function formatPrice(price, decimals = 2) {
    return price.toFixed(decimals);
}

export function formatPercent(value) {
    return (value >= 0 ? '+' : '') + value.toFixed(2) + '%';
}
