/* Chan web API client helpers */ window.ChanApi = { analyze: function(params) { const q = new URLSearchParams(params); return fetch('/api/analyze?' + q.toString()).then(r => r.json()); }, chartMetadata: function() { return fetch('/api/chart_metadata').then(r => r.json()); }, symbols: function() { return fetch('/api/symbols').then(r => r.json()); }, macdConfig: function(body) { if (body === undefined) return fetch('/api/macd_config').then(r => r.json()); return fetch('/api/macd_config', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(body) }).then(r => r.json()); } };