📊 实时行情
ETH 价格
$--,---
--%
BTC 价格
$--,---
--%
BTC/ETH 汇率
--
ETH 持仓
355 ETH
成本 $4,957.78
--
BTC 持仓
3.1 BTC
成本 $124,867
--
总盈亏(USD):$--
总盈亏(CNY):¥--
🎯 卖出档位矩阵
累计已卖出
0 / 75 ETH
累计回收 USDT
$0
🧠 反人性清单
👁️
盯盘检测:0/5 次/小时
⏱️
停留时间:0/30 分钟
🎨 画饼模拟器
卖出计划回收
$0
剩余持仓价值
$0
BTC 本位身价
0 BTC
综合身价
$0
💳 负债清算联动
总负债
¥3,500,000
已回收资金可还
¥0
剩余负债
¥3,500,000
10万USDT储备进度
$0 / $100,000
📋 交易记录
累计回收 USDT
$0
平均卖出价
$0
已释放 ETH
0 ETH
| 时间 |
卖出价 |
数量 |
回收 USDT |
档位 |
备注 |
操作 |
🔮 后悔模拟器 — "如果当时没卖..."
// === 后悔模拟器 ===
let regMode='hold';
function setMode(m,btn){regMode=m;document.querySelectorAll('.regret-tab').forEach(b=>b.classList.remove('active'));btn.classList.add('active')}
function identifyAsset(input){
const s=input.trim().toUpperCase();
const crypto={'BTC':{t:'crypto',sym:'BTCUSDT',n:'比特币'},'ETH':{t:'crypto',sym:'ETHUSDT',n:'以太坊'},'BNB':{t:'crypto',sym:'BNBUSDT',n:'BNB'},'SOL':{t:'crypto',sym:'SOLUSDT',n:'Solana'},'DOGE':{t:'crypto',sym:'DOGEUSDT',n:'狗狗币'}};
if(crypto[s])return crypto[s];
if(/^\d{6}$/.test(s))return{t:'cn',sym:s,n:s,market:s.startsWith('6')?'1':'0'};
if(/^\d{5}$/.test(s))return{t:'hk',sym:s,n:s};
if(/^[A-Z]{1,6}$/.test(s))return{t:'us',sym:s,n:s};
return null;
}
// 统一通过后端代理获取数据,避免浏览器CORS问题
async function fetchViaProxy(type,code,market){
let url='/api/regret-simulator?type='+type+'&code='+code;
if(market)url+='&market='+market;
const r=await fetch(url);
if(!r.ok){const e=await r.json().catch(()=>({error:'请求失败'}));throw new Error(e.error||'获取数据失败')}
const d=await r.json();
if(!d.data||!d.data.length)throw new Error('无数据');
return d.data;
}
async function runRegret(){
const input=document.getElementById('regretInput').value.trim();
if(!input)return;
const btn=document.getElementById('regretBtn'),ld=document.getElementById('regretLoad'),res=document.getElementById('regretResult'),err=document.getElementById('regretErr');
btn.disabled=true;ld.style.display='block';res.classList.remove('show');err.classList.remove('show');
try{
const asset=identifyAsset(input);
if(!asset){err.textContent='❌ 无法识别代码,请检查格式';err.classList.add('show');return}
let hist;
if(asset.t==='crypto')hist=await fetchViaProxy('crypto',asset.sym);
else if(asset.t==='cn')hist=await fetchViaProxy('cn',asset.sym,asset.market);
else if(asset.t==='hk')hist=await fetchViaProxy('hk',asset.sym);
else hist=await fetchViaProxy('us',asset.sym);
if(!hist||hist.length<30){err.textContent='❌ 历史数据不足,无法回测';err.classList.add('show');return}
const first=hist[0],last=hist[hist.length-1];
const totalReturn=((last.p-first.p)/first.p*100);
const years=hist.length/365;
const annual=years>0?(Math.pow(last.p/first.p,1/years)-1)*100:0;
const maxP=Math.max(...hist.map(h=>h.p)),maxD=hist.find(h=>h.p===maxP).dt;
const minP=Math.min(...hist.map(h=>h.p)),minD=hist.find(h=>h.p===minP).dt;
const maxDD=maxP>0?((maxP-minP)/maxP*100):0;
let html='
📊 '+asset.n+' ('+input+') '+first.dt+' → '+last.dt+'
';
if(regMode==='hold'){
html+='
买入价'+first.p.toFixed(2)+'
';
html+='
现价'+last.p.toFixed(2)+'
';
html+='
持有收益率'+(totalReturn>=0?'+':'')+totalReturn.toFixed(2)+'%
';
html+='
如果当时投1万现在值 ¥'+(10000*(1+totalReturn/100)).toFixed(0)+'
';
html+='
年化收益率'+(annual>=0?'+':'')+annual.toFixed(2)+'%
';
html+='
期间最高'+maxP.toFixed(2)+' ('+maxD+')
';
html+='
期间最低'+minP.toFixed(2)+' ('+minD+')
';
html+='
最大回撤-'+maxDD.toFixed(1)+'%
';
html+='
回测天数'+hist.length+' 天 ('+years.toFixed(1)+'年)
';
}else{
const monthly=1000;
let totalInvested=0,totalUnits=0,months=0,lastMonth='';
hist.forEach(h=>{
const m=h.dt.slice(0,7);
if(m!==lastMonth){totalInvested+=monthly;totalUnits+=monthly/h.p;lastMonth=m;months++}
});
const curValue=totalUnits*last.p,profit=curValue-totalInvested;
const profitPct=totalInvested>0?(profit/totalInvested*100):0;
html+='
每月定投¥'+monthly.toLocaleString()+'
';
html+='
定投月数'+months+' 个月
';
html+='
累计投入¥'+totalInvested.toLocaleString()+'
';
html+='
当前价值¥'+curValue.toFixed(0)+'
';
html+='
总收益'+(profit>=0?'+':'')+'¥'+profit.toFixed(0)+' ('+(profitPct>=0?'+':'')+profitPct.toFixed(1)+'%)
';
}
res.innerHTML=html;res.classList.add('show');
}catch(e){err.textContent='❌ '+e.message;err.classList.add('show')}
finally{btn.disabled=false;ld.style.display='none'}
}
document.getElementById('regretInput').addEventListener('keypress',e=>{if(e.key==='Enter')runRegret()});
// === 那年今天 — 投资回忆录 ===
async function loadInvestmentMemory(){
try{
const r=await fetch('/api/eth/investment-memory');
if(!r.ok)throw new Error('请求失败');
const d=await r.json();
document.getElementById('memory-load').style.display='none';
if(d.narrative){
document.getElementById('memory-narrative').textContent=d.narrative;
document.getElementById('memory-narrative').style.display='block';
}
if(d.memories&&d.memories.length>0){
const c=document.getElementById('memory-items');
c.style.display='flex';
d.memories.forEach(m=>{
const div=document.createElement('div');
div.className='memory-item';
div.innerHTML='
'+escHtml(m.title)+'
'+(m.content?'
'+escHtml(m.content)+'
':'');
c.appendChild(div);
});
}
if(d.portfolio){
const pg=document.getElementById('memory-portfolio');
const grid=document.getElementById('portfolio-grid');
pg.style.display='block';
[{l:'BTC',c:'$'+d.portfolio.BTC.cost.toLocaleString(),n:d.portfolio.BTC.name},{l:'ETH',c:'$'+d.portfolio.ETH.cost.toLocaleString(),n:d.portfolio.ETH.name},{l:'腾讯',c:'HK$'+d.portfolio.TENCENT.cost,n:d.portfolio.TENCENT.name},{l:'阿里',c:'HK$'+d.portfolio.ALIBABA.cost,n:d.portfolio.ALIBABA.name}].forEach(it=>{
grid.innerHTML+='
';
});
}
}catch(e){
document.getElementById('memory-load').innerHTML='
❌ '+escHtml(e.message)+'
';
}
}
function escHtml(s){var d=document.createElement('div');d.textContent=s;return d.innerHTML}
loadInvestmentMemory();