Files
btc-trading/src/api/dashboard/static/js/utils/helpers.js
BTC Bot 30bedcbb67 Refactor dashboard JS to ES modules; fix collector strategy loading and add auto-backfill
- Split inline JS into separate ES module files (indicators/, strategies/, ui/, utils/)
- Fix brain.py strategy registry to use MAStrategy directly instead of missing modules
- Add auto-backfill for detected data gaps in collector monitoring loop
- Fix chart resize on sidebar toggle
- Fix chart scrollToTime -> setVisibleLogicalRange
2026-02-18 11:07:30 +01:00

24 lines
667 B
JavaScript

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) + '%';
}