ok now its faster

This commit is contained in:
zastian-dev
2026-02-10 15:39:52 +00:00
parent b77c09bc87
commit a19906560a
3 changed files with 6 additions and 5 deletions

View File

@@ -250,7 +250,7 @@ const HTML_TEMPLATE: &str = r#"<!DOCTYPE html>
responsive: true,
plugins: { legend: { display: false } },
scales: {
x: { grid: { color: 'rgba(255,255,255,0.05)' }, ticks: { color: '#888', maxTicksLimit: 10 } },
x: { grid: { color: 'rgba(255,255,255,0.05)' }, ticks: { color: '#888', maxTicksLimit: 20 } },
y: { grid: { color: 'rgba(255,255,255,0.05)' }, ticks: { color: '#888', callback: v => '$' + v.toLocaleString() } }
}
}
@@ -374,7 +374,7 @@ async fn api_equity() -> Json<EquityResponse> {
if let Ok(content) = std::fs::read_to_string(&*LIVE_EQUITY_FILE) {
if let Ok(data) = serde_json::from_str::<Vec<EquitySnapshot>>(&content) {
if !data.is_empty() {
const MAX_DATAPOINTS_TO_SHOW: usize = 240; // 4 hours of data (1 per minute)
const MAX_DATAPOINTS_TO_SHOW: usize = 960; // 4 hours of data (4 per minute at 15s intervals)
let start_index = if data.len() > MAX_DATAPOINTS_TO_SHOW {
data.len() - MAX_DATAPOINTS_TO_SHOW
} else {