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(c){let a="";for(let d of c)a+=d+"|";let b="https://quote.cnbc.com/quote-html-webservice/restQuote/symbolType/symbol?";b+="symbols="+a,fetch(b+="&requestMethod=itv&noform=1&partnerId=2&fund=1&exthrs=1&output=json&events=1",{method:"GET",credentials:"same-origin"}).then(function(a){return a.json()}).then(function(g){let b=g.FormattedQuoteResult.FormattedQuote;b.map(a=>a.symbol);let h=b.map(a=>a.shortName),i=b.map(a=>parseFloat(a.last.replace(",",""))),d=b.map(a=>parseFloat(a.change.replace(",",""))),e=b.map(a=>parseFloat(a.change_pct.replace(",","")));for(let a=0;a0?(f="+",document.getElementById("idx_last_"+a).style.color="rgba(102,255,217,1)",document.getElementById("idx_chg_pct_"+a).style.color="rgba(102,255,217,1)"):d[a]<0?(document.getElementById("idx_last_"+a).style.color="rgba(255,204,0,1)",document.getElementById("idx_chg_pct_"+a).style.color="rgba(255,204,0,1)"):(document.getElementById("idx_last_"+a).style.color="rgba(200,200,200,1)",document.getElementById("idx_chg_pct_"+a).style.color="rgba(200,200,200,1)"),document.getElementById("idx_"+a).innerText=h[a],document.getElementById("idx_last_"+a).innerText=add_commas(i[a]),e[a]?document.getElementById("idx_chg_pct_"+a).innerText=f+add_commas(e[a],2)+"%":document.getElementById("idx_chg_pct_"+a).innerText="--"}}).catch(function(a){console.log(a)})}function go_idx(a){location.href="/trend/stock/"+indices[a]}