MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / updatePrice

Function updatePrice

examples/candlestick-streaming/main.ts:488–502  ·  view source on GitHub ↗
(price: number)

Source from the content-addressed store, hash-verified

486}
487
488function updatePrice(price: number) {
489 const priceEl = document.getElementById('current-price')!;
490 const prevPrice = parseFloat(priceEl.dataset.price || '0');
491
492 priceEl.textContent = `$${price.toFixed(2)}`;
493 priceEl.dataset.price = price.toString();
494
495 // Flash color on change
496 priceEl.classList.remove('price-up', 'price-down');
497 if (price > prevPrice) {
498 priceEl.classList.add('price-up');
499 } else if (price < prevPrice) {
500 priceEl.classList.add('price-down');
501 }
502}
503
504function startStatsLoop() {
505 function updateLoop() {

Callers 1

handleTickFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected