1<!DOCTYPE html> 2<html lang="tr"> 3<head> 4 <meta charset="UTF-8"> 5 <title>BTC Yeni Ay - Bilimsel Korelasyon Analizi</title> 6
6<script src="https://unpkg.com/[email protected]/dist/lightweight-charts.standalone.production.js"></script>
6 7
7<script src="https://cdn.jsdelivr.net/npm/[email protected]/astronomy.browser.min.js"></script>
7 8 <style> 9 body { margin: 0; background: #0b0e11; color: #d1d4dc; font-family: sans-serif; padding: 20px; } 10 #chart { width: 100%; height: 550px; border: 1px solid #2b2f36; } 11 .ui { margin-bottom: 10px; display: flex; gap: 15px; align-items: center; background: #1e222d; padding: 15px; border-radius: 8px; } 12 .stats-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; background: #161a1e; padding: 15px; border-radius: 8px; margin-bottom: 10px; border-left: 5px solid #2962ff; } 13 .stat-item { display: flex; flex-direction: column; } 14 .stat-value { font-size: 20px; font-weight: bold; color: white; } 15 .stat-label { font-size: 11px; color: #848e9c; text-transform: uppercase; margin-bottom: 4px; } 16 .correlation-result { margin-top: 10px; padding: 10px; border-radius: 4px; font-weight: bold; font-size: 14px; text-align: center; } 17 .significant { background: rgba(38, 166, 154, 0.2); color: #26a69a; border: 1px solid #26a69a; } 18 .not-significant { background: rgba(239, 83, 80, 0.2); color: #ef5350; border: 1px solid #ef5350; } 19 input { background: #0b0e11; border: 1px solid #363c4e; color: white; padding: 8px; border-radius: 4px; } 20 .day-input { width: 50px; text-align: center; } 21 button { background: #2962ff; color: white; border: none; padding: 10px 20px; cursor: pointer; border-radius: 4px; font-weight: bold; } 22 </style> 23</head> 24<body> 25 26<div class="ui"> 27 <label>BaÅlangıç:</label> 28 <input type="date" id="start" value="2022-01-01"> 29 <label>Analiz Süreci (Gün):</label> 30 <input type="number" id="checkDays" class="day-input" value="4"> 31 <button id="run">ANALİZİ BAÅLAT</button> 32</div> 33 34<div class="stats-panel"> 35 <div class="stat-item"><span class="stat-label">Ãrneklem (N)</span><span class="stat-value" id="totalCount">-</span></div> 36 <div class="stat-item"><span class="stat-label">DüÅüŠSayısı</span><span class="stat-value" id="downCount" style="color: #ef5350;">-</span></div> 37 <div class="stat-item"><span class="stat-label">DüÅüŠOranı</span><span class="stat-value" id="ratio">-</span></div> 38 <div class="stat-item"><span class="stat-label">P-DeÄeri</span><span class="stat-value" id="pvalue">-</span></div> 39</div> 40 41<div id="correlationBox" class="correlation-result" style="display:none;"></div> 42<div id="chart"></div> 43
44<script> 45 // Binom DaÄılımı üzerinden P-DeÄeri hesaplama (Sadece DüÅüŠOlasılıÄı için) 46 function calculatePValue(n, k) { 47 if (n === 0) return 1; 48 let p = 0; 49 const prob = 0.5; // Åans eseri (yazı-tura) olasılıÄı 50 51 function combinations(n, k) { 52 if (k < 0 || k > n) return 0; 53 if (k === 0 || k === n) return 1; 54 if (k > n / 2) k = n - k; 55 let res = 1; 56 for (let i = 1; i <= k; i++) res = res * (n - i + 1) / i; 57 return res; 58 } 59 60 // Kümülatif Binom OlasılıÄı (En az k baÅarı gelme ihtimali) 61 for (let i = k; i <= n; i++) { 62 p += combinations(n, i) * Math.pow(prob, i) * Math.pow(1 - prob, n - i); 63 } 64 return p; 65 } 66 67 const chart = LightweightCharts.createChart(document.getElementById('chart'), { 68 layout: { background: { color: '#0b0e11' }, textColor: '#d1d4dc' }, 69 grid: { vertLines: { color: '#1f2226' }, horzLines: { color: '#1f2226' } }, 70 timeScale: { borderColor: '#2b2f36', timeVisible: true } 71 }); 72 const candleSeries = chart.addCandlestickSeries({ upColor: '#26a69a', downColor: '#ef5350' }); 73 74 async function runAnalysis() { 75 const startVal = document.getElementById('start').value; 76 const checkDays = parseInt(document.getElementById('checkDays').value) || 1; 77 const startTimestamp = new Date(startVal).getTime(); 78 79 try { 80 const resp = await fetch(`https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1d&startTime=${startTimestamp}&limit=1000`); 81 const candles = await resp.json(); 82 const btcData = candles.map(c => ({ 83 time: c[0] / 1000, 84 open: parseFloat(c[1]), high: parseFloat(c[2]), low: parseFloat(c[3]), close: parseFloat(c[4]) 85 })); 86 candleSeries.setData(btcData); 87 88 const astro = window.Astronomy || Astronomy; 89 let total = 0, downs = 0; 90 const markers = []; 91 let searchDate = new Date(startTimestamp); 92 93 while (searchDate < new Date()) { 94 const nm = astro.SearchMoonPhase(0, searchDate, 40); 95 if (!nm) break; 96 const moonUnix = Math.floor(nm.date.getTime() / 1000); 97 const idx = btcData.findIndex(d => Math.abs(d.time - moonUnix) < 43200); 98 99 if (idx !== -1 && idx + checkDays < btcData.length) { 100 total++; 101 const isDown = btcData[idx + checkDays].close < btcData[idx].close; 102 if (isDown) downs++; 103 104 markers.push({ 105 time: btcData[idx].time, 106 position: 'aboveBar', 107 color: isDown ? '#ef5350' : '#26a69a', 108 shape: 'circle', 109 text: isDown ? 'ð' : 'ð' 110 }); 111 } 112 searchDate = new Date(nm.date.getTime() + 25 * 24 * 60 * 60 * 1000); 113 } 114 115 // İstatistiksel Sonuçlandırma 116 const pVal = calculatePValue(total, downs); 117 const ratio = ((downs / total) * 100).toFixed(1); 118 119 document.getElementById('totalCount').innerText = total; 120 document.getElementById('downCount').innerText = downs; 121 document.getElementById('ratio').innerText = `%${ratio}`; 122 document.getElementById('pvalue').innerText = pVal.toFixed(4); 123 124 const box = document.getElementById('correlationBox'); 125 box.style.display = 'block'; 126 127 if (pVal < 0.05) { 128 box.className = 'correlation-result significant'; 129 box.innerText = `ANLAMLI KORELASYON: Yeni Ay sonrası ${checkDays} günlük düÅüŠeÄilimi rastlantısal deÄildir (Güven düzeyi %95+).`; 130 } else { 131 box.className = 'correlation-result not-significant'; 132 box.innerText = `ANLAMSIZ KORELASYON: Yeni Ay ve düÅüŠarasında istatistiksel olarak rastlantıyı aÅan bir baÄ bulunamadı.`; 133 } 134 135 candleSeries.setMarkers(markers); 136 chart.timeScale().fitContent(); 137 } catch (e) { alert("Hata oluÅtu."); } 138 } 139 document.getElementById('run').addEventListener('click', runAnalysis); 140 window.onload = runAnalysis; 141</script>
141 142</body> 143</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.