Spaces:
Running
Running
Update index.html
Browse files- index.html +185 -186
index.html
CHANGED
|
@@ -1,222 +1,221 @@
|
|
| 1 |
-
<!DOCTYPE
|
| 2 |
-
<html
|
| 3 |
<head>
|
| 4 |
-
<meta
|
| 5 |
-
<title>大仁哥曝險與
|
| 6 |
<style>
|
| 7 |
-
body,div,input,select,button,p,h1,h2,h3,span,label,strong{box-sizing:border-box;font-family:"Microsoft
|
| 8 |
-
body{background-color:rgb(245,247,250);
|
| 9 |
-
.container{background-color:rgb(255,255,255);padding:
|
| 10 |
-
.
|
| 11 |
-
|
| 12 |
-
.
|
| 13 |
-
.
|
| 14 |
-
.
|
| 15 |
-
.
|
| 16 |
-
.
|
| 17 |
-
.
|
| 18 |
-
.
|
| 19 |
-
.
|
| 20 |
-
.
|
| 21 |
-
.
|
| 22 |
-
.
|
| 23 |
-
.
|
| 24 |
-
.
|
| 25 |
-
.legend-
|
| 26 |
-
.
|
| 27 |
-
.
|
| 28 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
</style>
|
| 30 |
</head>
|
| 31 |
<body>
|
| 32 |
-
<div
|
| 33 |
-
<div
|
| 34 |
-
<
|
| 35 |
-
<div
|
| 36 |
-
<label>槓桿ETF(正2)市值
|
| 37 |
-
<input
|
| 38 |
</div>
|
| 39 |
-
<div
|
| 40 |
-
<label>原型
|
| 41 |
-
<input
|
| 42 |
</div>
|
| 43 |
-
<div
|
| 44 |
-
<label>現金額度</label>
|
| 45 |
-
<input
|
| 46 |
</div>
|
| 47 |
-
<
|
| 48 |
-
<div
|
| 49 |
-
<label>
|
| 50 |
-
<input
|
| 51 |
-
</div>
|
| 52 |
-
<div class="input-group">
|
| 53 |
-
<label>預計調整工具</label>
|
| 54 |
-
<select class="adjust-select" onchange="calculate()">
|
| 55 |
-
<option value="lev">買賣槓桿ETF(正2)</option>
|
| 56 |
-
<option value="pro">買賣原型ETF(0050)</option>
|
| 57 |
-
</select>
|
| 58 |
</div>
|
| 59 |
</div>
|
| 60 |
-
<div
|
| 61 |
-
<
|
| 62 |
-
<div
|
| 63 |
-
<div
|
| 64 |
-
<span>總資產:</span>
|
| 65 |
-
<span
|
| 66 |
</div>
|
| 67 |
-
<div
|
| 68 |
<span>當前總曝險金額:</span>
|
| 69 |
-
<span
|
| 70 |
</div>
|
| 71 |
-
<div
|
| 72 |
-
<span>實際曝險比
|
| 73 |
-
<span
|
| 74 |
</div>
|
| 75 |
-
<div
|
| 76 |
-
<div
|
| 77 |
</div>
|
| 78 |
</div>
|
| 79 |
-
<div
|
| 80 |
-
<div
|
| 81 |
-
<span>資
|
| 82 |
-
<span
|
| 83 |
</div>
|
| 84 |
-
<div
|
| 85 |
-
<div
|
| 86 |
-
<div
|
| 87 |
-
<div
|
| 88 |
</div>
|
| 89 |
-
<div
|
| 90 |
-
<div
|
| 91 |
-
<div
|
| 92 |
-
<div
|
| 93 |
</div>
|
| 94 |
</div>
|
| 95 |
-
<
|
| 96 |
-
<div
|
|
|
|
|
|
|
| 97 |
</div>
|
| 98 |
</div>
|
| 99 |
<script>
|
| 100 |
-
function
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
const
|
| 105 |
-
const
|
| 106 |
-
const
|
| 107 |
-
const
|
| 108 |
-
const
|
| 109 |
-
const
|
| 110 |
-
const
|
| 111 |
-
const
|
| 112 |
-
const
|
| 113 |
-
const
|
| 114 |
-
const
|
| 115 |
-
const
|
| 116 |
-
const
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
adviceBox.
|
| 128 |
return;
|
| 129 |
}
|
| 130 |
-
const
|
| 131 |
-
const
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
let
|
| 136 |
-
if(
|
| 137 |
-
|
| 138 |
-
if(
|
| 139 |
-
|
| 140 |
-
}else
|
| 141 |
-
|
| 142 |
}else{
|
| 143 |
-
|
| 144 |
}
|
| 145 |
-
let
|
| 146 |
-
let
|
| 147 |
-
let
|
| 148 |
-
let
|
| 149 |
-
let
|
| 150 |
-
let
|
| 151 |
-
let
|
| 152 |
-
let
|
| 153 |
-
{
|
| 154 |
-
{
|
| 155 |
-
{
|
| 156 |
];
|
| 157 |
-
fractions.sort(function(a,b){return
|
| 158 |
-
for(let
|
| 159 |
-
if(fractions[i].
|
| 160 |
-
else
|
| 161 |
-
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
|
|
|
| 173 |
}else{
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
adviceBox.className='advice-box\tadvice-text';
|
| 179 |
-
elAdvice.innerHTML='建議將現金轉買入槓桿ETF額度:<br><strong>'+Math.round(changeAmount).toLocaleString()+'</strong>';
|
| 180 |
-
}else{
|
| 181 |
-
adviceBox.className='advice-box\tadvice-text\twarning';
|
| 182 |
-
elAdvice.innerHTML='目標需要買入槓桿ETF額度:<strong>'+Math.round(changeAmount).toLocaleString()+'</strong><br>警告:現金餘額不足!';
|
| 183 |
-
}
|
| 184 |
-
}else{
|
| 185 |
-
const sellAmount=Math.abs(changeAmount);
|
| 186 |
-
if(lev>=sellAmount){
|
| 187 |
-
adviceBox.className='advice-box\tadvice-text';
|
| 188 |
-
elAdvice.innerHTML='建議賣出槓桿ETF轉為現金額度:<br><strong>'+Math.round(sellAmount).toLocaleString()+'</strong>';
|
| 189 |
-
}else{
|
| 190 |
-
adviceBox.className='advice-box\tadvice-text\twarning';
|
| 191 |
-
elAdvice.innerHTML='目標需要賣出槓桿ETF額度:<strong>'+Math.round(sellAmount).toLocaleString()+'</strong><br>警告:槓桿ETF餘額不足以賣出!';
|
| 192 |
-
}
|
| 193 |
-
}
|
| 194 |
-
}else{
|
| 195 |
-
const changeAmount=diffExposure;
|
| 196 |
-
if(changeAmount>0){
|
| 197 |
-
if(cash>=changeAmount){
|
| 198 |
-
adviceBox.className='advice-box\tadvice-text';
|
| 199 |
-
elAdvice.innerHTML='建議將現金轉買入原型ETF額度:<br><strong>'+Math.round(changeAmount).toLocaleString()+'</strong>';
|
| 200 |
-
}else{
|
| 201 |
-
adviceBox.className='advice-box\tadvice-text\twarning';
|
| 202 |
-
elAdvice.innerHTML='目標需要買入原型ETF額度:<strong>'+Math.round(changeAmount).toLocaleString()+'</strong><br>警告:現金餘額不足!';
|
| 203 |
-
}
|
| 204 |
-
}else{
|
| 205 |
-
const sellAmount=Math.abs(changeAmount);
|
| 206 |
-
if(pro>=sellAmount){
|
| 207 |
-
adviceBox.className='advice-box\tadvice-text';
|
| 208 |
-
elAdvice.innerHTML='建議賣出原型ETF轉為現金額度:<br><strong>'+Math.round(sellAmount).toLocaleString()+'</strong>';
|
| 209 |
-
}else{
|
| 210 |
-
adviceBox.className='advice-box\tadvice-text\twarning';
|
| 211 |
-
elAdvice.innerHTML='目標需要賣出原型ETF額度:<strong>'+Math.round(sellAmount).toLocaleString()+'</strong><br>警告:原型ETF餘額不足以賣出!';
|
| 212 |
-
}
|
| 213 |
-
}
|
| 214 |
-
}
|
| 215 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
}else{
|
| 217 |
-
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
}
|
|
|
|
| 220 |
}
|
| 221 |
</script>
|
| 222 |
</body>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="zh-TW">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>大仁哥曝險與資產動態平衡計算機</title>
|
| 6 |
<style>
|
| 7 |
+
html,body,div,input,select,button,p,h1,h2,h3,span,label,strong,ol,li{box-sizing:border-box;font-family:"Microsoft JhengHei",sans-serif;margin:0;padding:0;}
|
| 8 |
+
body{background-color:rgb(245,247,250);padding:24px;display:flex;justify-content:center;}
|
| 9 |
+
.app-container{background-color:rgb(255,255,255);padding:32px;border-radius:14px;box-shadow:0 6px 16px rgba(0,0,0,0.08);max-width:960px;width:100%;display:flex;flex-wrap:wrap;gap:32px;}
|
| 10 |
+
.input-col,.output-col{flex:1;min-width:320px;}
|
| 11 |
+
.section-title{color:rgb(33,37,41);font-size:20px;font-weight:bold;border-bottom:2px solid rgb(226,232,240);padding-bottom:12px;margin-bottom:20px;}
|
| 12 |
+
.field-group{margin-bottom:16px;}
|
| 13 |
+
.field-group label{display:block;margin-bottom:6px;color:rgb(73,80,87);font-weight:bold;font-size:15px;}
|
| 14 |
+
.field-group input{width:100%;padding:12px;border:1px solid rgb(206,212,218);border-radius:8px;font-size:16px;outline:none;transition:border-color 0.2s;}
|
| 15 |
+
.field-group input:focus{border-color:rgb(13,110,253);}
|
| 16 |
+
.metric-card{background-color:rgb(248,249,250);padding:18px;border-radius:10px;margin-bottom:18px;border:1px solid rgb(233,236,239);}
|
| 17 |
+
.metric-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-size:16px;}
|
| 18 |
+
.metric-row.accent{color:rgb(220,53,69);font-weight:bold;font-size:20px;}
|
| 19 |
+
.meter-bg{background-color:rgb(226,232,240);border-radius:8px;height:18px;width:100%;overflow:hidden;margin-top:8px;}
|
| 20 |
+
.meter-fill{height:100%;background-color:rgb(40,167,69);transition:width 0.3s,background-color 0.3s;}
|
| 21 |
+
.split-bar{display:flex;height:18px;border-radius:8px;overflow:hidden;margin-top:8px;}
|
| 22 |
+
.bar-lev{background-color:rgb(220,53,69);}
|
| 23 |
+
.bar-pro{background-color:rgb(255,193,7);}
|
| 24 |
+
.bar-cash{background-color:rgb(40,167,69);}
|
| 25 |
+
.legend-group{display:flex;gap:14px;font-size:13px;margin-top:8px;color:rgb(108,117,125);}
|
| 26 |
+
.legend-point{display:flex;align-items:center;gap:5px;}
|
| 27 |
+
.badge-dot{width:10px;height:10px;border-radius:50%;}
|
| 28 |
+
.advice-panel{display:flex;flex-direction:column;gap:14px;}
|
| 29 |
+
.plan-card{background-color:rgb(241,248,255);border:1px solid rgb(184,218,255);border-left:5px solid rgb(13,110,253);padding:16px;border-radius:8px;color:rgb(10,54,115);}
|
| 30 |
+
.plan-card.neutral{background-color:rgb(248,249,250);border:1px solid rgb(222,226,230);border-left:5px solid rgb(108,117,125);color:rgb(73,80,87);}
|
| 31 |
+
.plan-card.warn{background-color:rgb(255,243,205);border:1px solid rgb(255,238,186);border-left:5px solid rgb(255,193,7);color:rgb(133,100,4);}
|
| 32 |
+
.plan-header{font-weight:bold;font-size:16px;margin-bottom:8px;}
|
| 33 |
+
.plan-desc{font-size:14px;line-height:1.6;margin-bottom:10px;}
|
| 34 |
+
.action-steps{padding-left:20px;font-size:14px;line-height:1.7;margin-bottom:10px;}
|
| 35 |
+
.balance-preview{background-color:rgba(255,255,255,0.7);border-radius:6px;padding:8px 12px;font-size:13px;display:flex;flex-wrap:wrap;gap:12px;border:1px dashed rgb(184,218,255);}
|
| 36 |
</style>
|
| 37 |
</head>
|
| 38 |
<body>
|
| 39 |
+
<div class="app-container">
|
| 40 |
+
<div class="input-col">
|
| 41 |
+
<div class="section-title">第一步:現有資產額度</div>
|
| 42 |
+
<div class="field-group">
|
| 43 |
+
<label>槓桿ETF(正2)市值</label>
|
| 44 |
+
<input type="number" class="val-lev" placeholder="例如:300000" oninput="runCalculations()">
|
| 45 |
</div>
|
| 46 |
+
<div class="field-group">
|
| 47 |
+
<label>原型0050市值</label>
|
| 48 |
+
<input type="number" class="val-pro" placeholder="例如:400000" oninput="runCalculations()">
|
| 49 |
</div>
|
| 50 |
+
<div class="field-group">
|
| 51 |
+
<label>現金儲備額度</label>
|
| 52 |
+
<input type="number" class="val-cash" placeholder="例如:300000" oninput="runCalculations()">
|
| 53 |
</div>
|
| 54 |
+
<div class="section-title">第二步:目標曝險設定</div>
|
| 55 |
+
<div class="field-group">
|
| 56 |
+
<label>期望總曝險比例(%)</label>
|
| 57 |
+
<input type="number" class="val-target" placeholder="例如:100 或 120" oninput="runCalculations()">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
</div>
|
| 59 |
</div>
|
| 60 |
+
<div class="output-col">
|
| 61 |
+
<div class="section-title">現況曝險與資產結構</div>
|
| 62 |
+
<div class="metric-card">
|
| 63 |
+
<div class="metric-row">
|
| 64 |
+
<span>可投資總資產:</span>
|
| 65 |
+
<span class="txt-assets">0 元</span>
|
| 66 |
</div>
|
| 67 |
+
<div class="metric-row">
|
| 68 |
<span>當前總曝險金額:</span>
|
| 69 |
+
<span class="txt-exposure">0 元</span>
|
| 70 |
</div>
|
| 71 |
+
<div class="metric-row accent">
|
| 72 |
+
<span>實際總曝險比:</span>
|
| 73 |
+
<span class="txt-exp-pct">0%</span>
|
| 74 |
</div>
|
| 75 |
+
<div class="meter-bg">
|
| 76 |
+
<div class="meter-fill" style="width:0%;"></div>
|
| 77 |
</div>
|
| 78 |
</div>
|
| 79 |
+
<div class="metric-card">
|
| 80 |
+
<div class="metric-row">
|
| 81 |
+
<span>資金配置佔比(正2:原型:現金):</span>
|
| 82 |
+
<span class="txt-ratio">0:0:0</span>
|
| 83 |
</div>
|
| 84 |
+
<div class="split-bar">
|
| 85 |
+
<div class="bar-lev" style="width:0%;"></div>
|
| 86 |
+
<div class="bar-pro" style="width:0%;"></div>
|
| 87 |
+
<div class="bar-cash" style="width:0%;"></div>
|
| 88 |
</div>
|
| 89 |
+
<div class="legend-group">
|
| 90 |
+
<div class="legend-point"><div class="badge-dot bar-lev"></div>正2部位</div>
|
| 91 |
+
<div class="legend-point"><div class="badge-dot bar-pro"></div>原型部位</div>
|
| 92 |
+
<div class="legend-point"><div class="badge-dot bar-cash"></div>現金部位</div>
|
| 93 |
</div>
|
| 94 |
</div>
|
| 95 |
+
<div class="section-title">大仁哥既有部位調整策略</div>
|
| 96 |
+
<div class="advice-panel">
|
| 97 |
+
<div class="plan-card neutral">請於左側輸入各項額度與期望目標曝險比例以取得分析。</div>
|
| 98 |
+
</div>
|
| 99 |
</div>
|
| 100 |
</div>
|
| 101 |
<script>
|
| 102 |
+
function fmt(val){
|
| 103 |
+
return Math.round(val).toLocaleString();
|
| 104 |
+
}
|
| 105 |
+
function runCalculations(){
|
| 106 |
+
const levVal=parseFloat(document.querySelector('.val-lev').value)||0;
|
| 107 |
+
const proVal=parseFloat(document.querySelector('.val-pro').value)||0;
|
| 108 |
+
const cashVal=parseFloat(document.querySelector('.val-cash').value)||0;
|
| 109 |
+
const targetPct=parseFloat(document.querySelector('.val-target').value)||0;
|
| 110 |
+
const total=levVal+proVal+cashVal;
|
| 111 |
+
const txtAssets=document.querySelector('.txt-assets');
|
| 112 |
+
const txtExp=document.querySelector('.txt-exposure');
|
| 113 |
+
const txtExpPct=document.querySelector('.txt-exp-pct');
|
| 114 |
+
const meterFill=document.querySelector('.meter-fill');
|
| 115 |
+
const txtRatio=document.querySelector('.txt-ratio');
|
| 116 |
+
const barLev=document.querySelector('.bar-lev');
|
| 117 |
+
const barPro=document.querySelector('.bar-pro');
|
| 118 |
+
const barCash=document.querySelector('.bar-cash');
|
| 119 |
+
const adviceBox=document.querySelector('.advice-panel');
|
| 120 |
+
if(total===0){
|
| 121 |
+
txtAssets.textContent='0 元';
|
| 122 |
+
txtExp.textContent='0 元';
|
| 123 |
+
txtExpPct.textContent='0%';
|
| 124 |
+
meterFill.style.width='0%';
|
| 125 |
+
txtRatio.textContent='0:0:0';
|
| 126 |
+
barLev.style.width='0%';
|
| 127 |
+
barPro.style.width='0%';
|
| 128 |
+
barCash.style.width='0%';
|
| 129 |
+
adviceBox.innerHTML='<div class="plan-card neutral">請於左側輸入各項額度與期望目標曝險比例以取得分析。</div>';
|
| 130 |
return;
|
| 131 |
}
|
| 132 |
+
const currentExposure=levVal+levVal+proVal;
|
| 133 |
+
const currentPct=(currentExposure/total)/(1/100);
|
| 134 |
+
txtAssets.textContent=fmt(total)+' 元';
|
| 135 |
+
txtExp.textContent=fmt(currentExposure)+' 元';
|
| 136 |
+
txtExpPct.textContent=currentPct.toFixed(2)+'%';
|
| 137 |
+
let fillWidth=currentPct;
|
| 138 |
+
if(fillWidth>100)fillWidth=100;
|
| 139 |
+
meterFill.style.width=fillWidth+'%';
|
| 140 |
+
if(currentPct<=100){
|
| 141 |
+
meterFill.style.backgroundColor='rgb(40,167,69)';
|
| 142 |
+
}else if(currentPct<=150){
|
| 143 |
+
meterFill.style.backgroundColor='rgb(255,193,7)';
|
| 144 |
}else{
|
| 145 |
+
meterFill.style.backgroundColor='rgb(220,53,69)';
|
| 146 |
}
|
| 147 |
+
let rLev=(levVal/total)/(1/100);
|
| 148 |
+
let rPro=(proVal/total)/(1/100);
|
| 149 |
+
let rCash=(cashVal/total)/(1/100);
|
| 150 |
+
let floorLev=Math.floor(rLev);
|
| 151 |
+
let floorPro=Math.floor(rPro);
|
| 152 |
+
let floorCash=Math.floor(rCash);
|
| 153 |
+
let rem=100-(floorLev+floorPro+floorCash);
|
| 154 |
+
let fractions=[
|
| 155 |
+
{k:'lev',v:rLev-floorLev},
|
| 156 |
+
{k:'pro',v:rPro-floorPro},
|
| 157 |
+
{k:'cash',v:rCash-floorCash}
|
| 158 |
];
|
| 159 |
+
fractions.sort(function(a,b){return b.v-a.v;});
|
| 160 |
+
for(let i=0;i<rem;i++){
|
| 161 |
+
if(fractions[i].k==='lev')floorLev++;
|
| 162 |
+
else if(fractions[i].k==='pro')floorPro++;
|
| 163 |
+
else if(fractions[i].k==='cash')floorCash++;
|
| 164 |
+
}
|
| 165 |
+
txtRatio.textContent=floorLev+':'+floorPro+':'+floorCash;
|
| 166 |
+
barLev.style.width=floorLev+'%';
|
| 167 |
+
barPro.style.width=floorPro+'%';
|
| 168 |
+
barCash.style.width=floorCash+'%';
|
| 169 |
+
if(targetPct<=0){
|
| 170 |
+
adviceBox.innerHTML='<div class="plan-card neutral">請於左側設定大於0的期望總曝險比例(%)。</div>';
|
| 171 |
+
return;
|
| 172 |
+
}
|
| 173 |
+
if(targetPct>200){
|
| 174 |
+
adviceBox.innerHTML='<div class="plan-card warn"><div class="plan-header">超出工具內建極限(200%)</div><div class="plan-desc">在不進行額外融資或向券商借貸的前提下,即便將100%資產全數押入槓桿ETF(正2),最大極限曝險即為200%。若欲追求超過200%的曝險,需引進外部信貸或期貨部位。</div></div>';
|
| 175 |
+
return;
|
| 176 |
}
|
| 177 |
+
const targetExposureAmount=total/(100/targetPct);
|
| 178 |
+
const diffExp=targetExposureAmount-currentExposure;
|
| 179 |
+
if(Math.abs(diffExp)<1){
|
| 180 |
+
adviceBox.innerHTML='<div class="plan-card" style="border-left-color:rgb(40,167,69);"><div class="plan-header">目前配置已精準達標</div><div class="plan-desc">當前總曝險為 '+fmt(currentExposure)+' 元('+currentPct.toFixed(1)+'%),已完美吻合目標,維持既有紀律即可。</div></div>';
|
| 181 |
+
return;
|
| 182 |
+
}
|
| 183 |
+
let cardsHtml='';
|
| 184 |
+
if(diffExp>0){
|
| 185 |
+
if(proVal>=diffExp){
|
| 186 |
+
const swapVal=diffExp;
|
| 187 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略一:大仁哥零現金置換法(推薦)</div><div class="plan-desc">核心思維:<strong>「以正2換取原型,釋放資金效率」</strong>。將原型0050賣出轉入正2,每轉1元即可提升1元曝險,<strong>完全不消耗任何防禦現金</strong>:</div><ol class="action-steps"><li>賣出原型0050額度:'+fmt(swapVal)+' 元</li><li>將取得資金全數買入槓桿正2:'+fmt(swapVal)+' 元</li><li>現金部位完全不動:保留 '+fmt(cashVal)+' 元作為生活與心理安全閥</li></ol><div class="balance-preview"><span>調整後正2:'+fmt(levVal+swapVal)+' 元</span><span>調整後0050:'+fmt(proVal-swapVal)+' 元</span><span>調整後現金:'+fmt(cashVal)+' 元</span></div></div>';
|
| 188 |
}else{
|
| 189 |
+
const swapAllPro=proVal;
|
| 190 |
+
const remainExp=diffExp-swapAllPro;
|
| 191 |
+
const cashBuyLev=remainExp/2;
|
| 192 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略一:既有資產梯次補足法</div><div class="plan-desc">現有原型0050全數換為正2後仍有曝險缺口,由既有現金補足:</div><ol class="action-steps"><li>賣出全部原型0050:'+fmt(swapAllPro)+' 元,轉買槓桿正2</li><li>動用現金儲備額度:'+fmt(cashBuyLev)+' 元,買入槓桿正2</li><li>調整後剩餘現金:'+fmt(cashVal-cashBuyLev)+' 元</li></ol><div class="balance-preview"><span>調整後正2:'+fmt(levVal+swapAllPro+cashBuyLev)+' 元</span><span>調整後0050:0 元</span><span>調整後現金:'+fmt(cashVal-cashBuyLev)+' 元</span></div></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
}
|
| 194 |
+
const pureLevTarget=total/(200/targetPct);
|
| 195 |
+
const pureCashTarget=total-pureLevTarget;
|
| 196 |
+
const levGap=pureLevTarget-levVal;
|
| 197 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略二:大仁哥50/50極簡純化架構</div><div class="plan-desc">大仁哥旗艦理念:<strong>「持有一倍槓桿時,原型ETF屬於低效冗餘資產」</strong>。出清原型0050,專注維持正2與強大現金護城河:</div><ol class="action-steps"><li>出清全部原型0050:賣出 '+fmt(proVal)+' 元變現</li><li>槓桿正2調整至目標額度:'+(levGap>=0?'買入 '+fmt(levGap):'賣出 '+fmt(Math.abs(levGap)))+' 元(持倉目標為 '+fmt(pureLevTarget)+' 元)</li><li>剩餘額度全數留存為現金儲備:持倉目標為 '+fmt(pureCashTarget)+' 元</li></ol><div class="balance-preview"><span>調整後正2:'+fmt(pureLevTarget)+' 元</span><span>調整後0050:0 元</span><span>調整後現金:'+fmt(pureCashTarget)+' 元</span></div></div>';
|
| 198 |
}else{
|
| 199 |
+
const dropExp=Math.abs(diffExp);
|
| 200 |
+
if(levVal>=(dropExp/2)){
|
| 201 |
+
const sellLev=dropExp/2;
|
| 202 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略一:正2獲利調節・壯大現金護城河(推薦)</div><div class="plan-desc">核心思維:<strong>「股市大漲後適度賣出槓桿,鎖定利潤轉化為現金儲備」</strong>:</div><ol class="action-steps"><li>賣出槓桿正2額度:'+fmt(sellLev)+' 元轉為現金</li><li>原型0050額度不動:維持 '+fmt(proVal)+' 元</li><li>實體現金池增長:從 '+fmt(cashVal)+' 元提升至 '+fmt(cashVal+sellLev)+' 元(擴大未來回檔加碼餘裕)</li></ol><div class="balance-preview"><span>調整後正2:'+fmt(levVal-sellLev)+' 元</span><span>調整後0050:'+fmt(proVal)+' 元</span><span>調整後現金:'+fmt(cashVal+sellLev)+' 元</span></div></div>';
|
| 203 |
+
}else{
|
| 204 |
+
const sellAllLev=levVal;
|
| 205 |
+
const remainDrop=dropExp-(levVal+levVal);
|
| 206 |
+
const sellPro=remainDrop;
|
| 207 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略一:雙向降槓桿獲利變現法</div><div class="plan-desc">欲調降之曝險幅度較大,需同步減碼正2與原型以收回充裕現金:</div><ol class="action-steps"><li>賣出全部槓桿正2:'+fmt(sellAllLev)+' 元轉為現金</li><li>賣出原型0050額度:'+fmt(sellPro)+' 元轉為現金</li><li>保留原型0050部位:'+fmt(proVal-sellPro)+' 元</li></ol><div class="balance-preview"><span>調整後正2:0 元</span><span>調整後0050:'+fmt(proVal-sellPro)+' 元</span><span>調整後現金:'+fmt(cashVal+sellAllLev+sellPro)+' 元</span></div></div>';
|
| 208 |
+
}
|
| 209 |
+
if(levVal>=dropExp){
|
| 210 |
+
const swapLevToPro=dropExp;
|
| 211 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略二:降槓桿不降股票・正2轉原型法</div><div class="plan-desc">若欲平抑波動風險,但不想增加手上閒置現金,可將正2轉為原型0050(每轉1元降低1元曝險):</div><ol class="action-steps"><li>賣出槓桿正2額度:'+fmt(swapLevToPro)+' 元</li><li>全數轉買入原型0050:'+fmt(swapLevToPro)+' 元</li><li>現金儲備維持不動:'+fmt(cashVal)+' 元</li></ol><div class="balance-preview"><span>調整後正2:'+fmt(levVal-swapLevToPro)+' 元</span><span>調整後0050:'+fmt(proVal+swapLevToPro)+' 元</span><span>調整後現金:'+fmt(cashVal)+' 元</span></div></div>';
|
| 212 |
+
}else{
|
| 213 |
+
const pureLevTarget=total/(200/targetPct);
|
| 214 |
+
const pureCashTarget=total-pureLevTarget;
|
| 215 |
+
cardsHtml+='<div class="plan-card"><div class="plan-header">策略二:大仁哥50/50極簡純化架構</div><div class="plan-desc">出清原型0050,將資產結構徹底重塑為純粹的正2加現金:</div><ol class="action-steps"><li>出清全部原型0050:賣出 '+fmt(proVal)+' 元</li><li>調整槓桿正2至目標持倉:'+fmt(pureLevTarget)+' 元</li><li>充實防禦現金池至目標:'+fmt(pureCashTarget)+' 元</li></ol><div class="balance-preview"><span>調整後正2:'+fmt(pureLevTarget)+' 元</span><span>調整後0050:0 元</span><span>調整後現金:'+fmt(pureCashTarget)+' 元</span></div></div>';
|
| 216 |
+
}
|
| 217 |
}
|
| 218 |
+
adviceBox.innerHTML=cardsHtml;
|
| 219 |
}
|
| 220 |
</script>
|
| 221 |
</body>
|