const NAME_MAP={'0050':'元大台灣50','0056':'元大高股息','00690':'兆豐台灣藍籌30','00878':'國泰永續高股息','00918':'大華優利高填息30','00919':'群益台灣精選高息','00929':'復華台灣科技優息','00982A':'主動群益台灣強棒','009813':'貝萊德寶利優越50','2330':'台積電','VOO':'S&P500 ETF'}; const FUND_HARD={ 'ACDD04':{name:'安聯台灣科技基金',price:811.38}, 'ACPS10':{name:'統一奔騰基金',price:734.71}, 'AC0001':{name:'野村鴻運基金',price:312.08}, 'YUI117':{name:'元大台灣卓越50ETF連結基金TISA不配息',price:68.81}, 'ACYT209':{name:'元大台灣卓越50ETF連結基金TISA不配息',price:68.81}, 'SCH044':{name:'施羅德台灣樂活中小基金-TISA類型',price:37.37}, 'A42126':{name:'施羅德台灣樂活中小基金-TISA類型',price:37.37}, 'ACES125':{name:'施羅德台灣樂活中小基金-TISA類型',price:37.37} }; async function fetchTWSEMapDirect(){ try{ const r=await fetch('https://openapi.twse.com.tw/v1/exchangeReport/STOCK_DAY_ALL'); if(r.ok){ const arr=await r.json(); const map={}; arr.forEach(it=>{ const code=String(it.Code).toUpperCase(); const p=parseFloat(String(it.ClosingPrice).replace(/,/g,'')); if(!isNaN(p)) map[code]={price:p, name:(it.Name||'').trim()}; }); if(Object.keys(map).length>0) return map; } }catch(e){ console.log('TWSE direct fail', e); } try{ const proxy='https://api.allorigins.win/raw?url='+encodeURIComponent('https://openapi.twse.com.tw/v1/exchangeReport/STOCK_DAY_ALL'); const r=await fetch(proxy); if(r.ok){ const arr=await r.json(); const map={}; arr.forEach(it=>{ const code=String(it.Code).toUpperCase(); const p=parseFloat(String(it.ClosingPrice).replace(/,/g,'')); if(!isNaN(p)) map[code]={price:p, name:(it.Name||'').trim()}; }); if(Object.keys(map).length>0) return map; } }catch(e){ console.log('TWSE proxy fail', e); } return {}; } async function tryBackendPrice(code){ const urls=[`/api/stock?code=${encodeURIComponent(code)}`, `/.netlify/functions/stock?code=${encodeURIComponent(code)}`]; for(const u of urls){ try{ const r=await fetch(u); if(r.ok){ const j=await r.json(); if(j.price) return {price:j.price, name:j.name, source:j.source||u}; } }catch(e){} } return null; }
總資產=台股+基金+美股+勞退正確加總 · 每檔μ/σ獨立 · DCA逐檔跑GBM 1000次 P10/P50/P90
| 代號 | 名稱 | 股數 | 現價 | 市值 | μ年化% | σ波動% | 60歲未來值 |
|---|