let indices=[".SPX",".IXIC",".DJI",".RUT",".VIX","US10Y",".KS11",".SSEC",".HSI",".N225",".GDAXI",".FTSE",".STOXX","@CL.1","@GC.1","KRW=","BTC.CB="];function realtime_indices(e){let t="";for(let n of e)t+=n+"|";let n="https://quote.cnbc.com/quote-html-webservice/restQuote/symbolType/symbol?";n+="symbols="+t,n+="&requestMethod=itv&noform=1&partnerId=2&fund=1&exthrs=1&output=json&events=1",fetch(n,{method:"GET",credentials:"same-origin"}).then(function(e){return e.json()}).then(function(e){const n=e.FormattedQuoteResult.FormattedQuote,o=(n.map(e=>e.symbol),n.map(e=>e.shortName)),a=n.map(e=>parseFloat(e.last.replace(",",""))),c=n.map(e=>parseFloat(e.change.replace(",",""))),d=n.map(e=>parseFloat(e.change_pct.replace(",","")));for(let e=0;e0?(t="+",document.getElementById("idx_last_"+e).className="color-u3",document.getElementById("idx_chg_pct_"+e).className="color-u2",document.getElementById("idx_box_"+e).style.backgroundImage="linear-gradient(rgba(102,255,217,.5),rgba(102,255,217,.4))"):c[e]<0?(document.getElementById("idx_last_"+e).className="color-d3",document.getElementById("idx_chg_pct_"+e).className="color-d2",document.getElementById("idx_box_"+e).style.backgroundImage="linear-gradient(rgba(255,204,0,.5),rgba(255,204,0,.4))"):(document.getElementById("idx_last_"+e).className="text-white",document.getElementById("idx_chg_pct_"+e).className="text-white-50",document.getElementById("idx_box_"+e).style.backgroundImage="linear-gradient(rgba(100,100,100,.5),rgba(100,100,100,.4))"),document.getElementById("idx_"+e).innerText=o[e],document.getElementById("idx_last_"+e).innerText=add_commas(a[e]),d[e]?document.getElementById("idx_chg_pct_"+e).innerText=t+add_commas(d[e],2)+"%":document.getElementById("idx_chg_pct_"+e).innerText="--"}}).catch(function(e){console.log(e)})}function go_idx(e){location.href="/trend/stock/"+indices[e]}