코인 가격 예측도구
작성자 정보
- 차트분석 작성
- 작성일
컨텐츠 정보
- 4,349 조회
- 목록
본문
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>코인 가격 예측 도구</title>
<!-- Bootstrap 5 -->
<link href="bootstrap@5.3.0/dist/css/bootstrap.min.css"" TARGET="_blank" rel="nofollow">https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Chart.js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
body {
background-color: #f8f9fa;
}
.container {
max-width: 900px;
margin: 50px auto;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
}
.loading-spinner {
display: none;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h2 class="text-center text-primary">가격 예측 도구</h2>
<p class="text-center">코인마켓캡 90일CSV 파일을 업로드하면 이동 평균과 회귀 분석을 기반으로 미래 가격을 예측합니다.</p>
<!-- 파일 업로드 -->
<div class="mb-3">
<label for="csvFile" class="form-label">CSV 파일 업로드:</label>
<input type="file" class="form-control" id="csvFile" accept=".csv">
</div>
<button class="btn btn-primary w-100" onclick="loadCSV()"> CSV 업로드</button>
<!-- 로딩 스피너 -->
<div class="loading-spinner mt-3">
<div class="spinner-border text-primary" role="status"></div>
<p>데이터를 처리 중입니다...</p>
</div>
<!-- 차트 -->
<canvas id="priceChart" class="mt-4"></canvas>
<!-- 예측 결과 -->
<h3 class="mt-5 text-center text-secondary"> 미래 가격 예측</h3>
<table class="table table-bordered mt-3">
<thead class="table-light">
<tr>
<th>날짜</th>
<th>예측 가격</th>
</tr>
</thead>
<tbody id="predictionTable">
<!-- 예측된 가격이 여기에 추가됨 -->
</tbody>
</table>
</div>
<!-- Bootstrap 5 JS -->
<script src="bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"" TARGET="_blank" rel="nofollow">https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
function calculateSMA(data, period) {
let sma = [];
for (let i = 0; i < data.length; i++) {
if (i < period - 1) {
sma.push(null);
} else {
let sum = 0;
for (let j = 0; j < period; j++) {
sum += data[i - j];
}
sma.push(sum / period);
}
}
return sma;
}
function calculateEMA(data, period) {
let ema = [];
let multiplier = 2 / (period + 1);
let prevEMA = data[0];
for (let i = 0; i < data.length; i++) {
prevEMA = i === 0 ? data[i] : (data[i] - prevEMA) * multiplier + prevEMA;
ema.push(prevEMA);
}
return ema;
}
function linearRegressionPredict(data, days) {
const n = data.length;
const slope = (data[n - 1] - data[0]) / n;
return Array.from({ length: days }, (_, i) => data[n - 1] + slope * (i + 1));
}
document.getElementById('csvFile').addEventListener('change', handleFile);
function handleFile(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const csvData = e.target.result;
processCSV(csvData);
};
reader.readAsText(file);
}
}
function processCSV(csvData) {
const rows = csvData.split("\n").map(row => row.split(";")); // 세미콜론(;)을 구분자로 사용
const data = [];
document.querySelector('.loading-spinner').style.display = "block";
for (let i = 1; i < rows.length; i++) {
if (rows[i].length < 10) continue;
const dateStr = rows[i][0].split("T")[0];
const price = rows[i][8];
if (!dateStr || isNaN(price)) continue;
data.push({
date: new Date(dateStr),
actualPrice: parseFloat(price)
});
}
data.sort((a, b) => a.date - b.date);
const labels = data.map(d => d.date.toISOString().split("T")[0]);
const actualPrices = data.map(d => d.actualPrice);
const sma7 = calculateSMA(actualPrices, 7);
const sma14 = calculateSMA(actualPrices, 14);
const ema7 = calculateEMA(actualPrices, 7);
const futureLabels = [];
const futurePrices = linearRegressionPredict(actualPrices, 7);
for (let i = 1; i <= 7; i++) {
let futureDate = new Date(data[data.length - 1].date);
futureDate.setDate(futureDate.getDate() + i);
futureLabels.push(futureDate.toISOString().split("T")[0]);
}
updatePredictionTable(futureLabels, futurePrices);
document.querySelector('.loading-spinner').style.display = "none";
drawChart(labels, actualPrices, sma7, sma14, ema7, futureLabels, futurePrices);
}
function updatePredictionTable(futureLabels, futurePrices) {
const tableBody = document.getElementById("predictionTable");
tableBody.innerHTML = "";
for (let i = 0; i < futureLabels.length; i++) {
const row = `<tr>
<td>${futureLabels[i]}</td>
<td>${futurePrices[i].toFixed(2)}</td>
</tr>`;
tableBody.innerHTML += row;
}
}
function drawChart(labels, actualPrices, sma7, sma14, ema7, futureLabels, futurePrices) {
const ctx = document.getElementById('priceChart').getContext('2d');
if (window.myChart) {
window.myChart.destroy();
}
window.myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [...labels, ...futureLabels],
datasets: [
{ label: "실제 가격", data: actualPrices, borderColor: "red", fill: false },
{ label: "7일 이동 평균 (SMA)", data: sma7, borderColor: "blue", fill: false },
{ label: "14일 이동 평균 (SMA)", data: sma14, borderColor: "green", fill: false },
{ label: "7일 지수 이동 평균 (EMA)", data: ema7, borderColor: "orange", fill: false },
{ label: "회귀 분석 기반 예측", data: [...Array(labels.length).fill(null), ...futurePrices], borderColor: "purple", borderDash: [5, 5], fill: false }
]
}
});
}
</script>
</body>
</html>
주의사항
예측 결과는 100% 정확하지 않습니다.
이 도구는 과거 데이터의 패턴을 기반으로 미래 가격을 예측합니다.
그러나 실제 시장은 다양한 변수(뉴스, 경제 상황, 투자 심리 등)에 의해 변동하므로, 예측 값이 항상 맞지는 않습니다.
투자 결정을 내릴 때는 추가적인 분석과 리스크 관리가 필요합니다.
데이터의 품질이 예측 정확도에 영향을 줍니다.
업로드한 CSV 데이터가 정확하고 최신 데이터일수록 예측 결과도 신뢰성이 높아집니다.
잘못된 데이터(예: 결측값, 오류 데이터)가 포함되면 부정확한 결과를 초래할 수 있음
단기적인 변동성이 반영되지 않을 수 있습니다.
이동 평균(SMA, EMA)은 장기적인 트렌드를 분석하는 데 유용하지만, 급격한 가격 변동에는 반응이 느릴 수 있음
단기적인 가격 급등락(뉴스, 이벤트 등)은 반영되지 않음
회귀 분석(Linear Regression)은 직선적인 예측을 제공
시장은 비선형적인 변동성을 가지므로, 단순 선형 회귀 분석이 항상 적절하지 않을 수 있음
추세 분석에는 유용하지만, 가격 예측에는 한계가 있음
장기 예측보다 단기 예측이 더 신뢰성 있음
회귀 분석 기반 예측은 7일 정도의 짧은 기간 예측에 적합
장기 예측(1개월 이상)은 시장 변수의 영향이 커서 신뢰성이 낮아질 수 있음
도구 활용 방법
코인(또는 다른 자산)의 과거 데이터를 CSV 파일로 업로드
이동 평균과 회귀 분석을 활용하여 가격 추세를 분석
단기적인 가격 흐름을 예측하고 투자 전략 수립에 활용
다른 기술적 분석 지표와 함께 사용하여 리스크 관리
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>코인 가격 예측 도구</title>
<!-- Bootstrap 5 -->
<link href="bootstrap@5.3.0/dist/css/bootstrap.min.css"" TARGET="_blank" rel="nofollow">https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Chart.js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
body {
background-color: #f8f9fa;
}
.container {
max-width: 900px;
margin: 50px auto;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
}
.loading-spinner {
display: none;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h2 class="text-center text-primary">가격 예측 도구</h2>
<p class="text-center">코인마켓캡 90일CSV 파일을 업로드하면 이동 평균과 회귀 분석을 기반으로 미래 가격을 예측합니다.</p>
<!-- 파일 업로드 -->
<div class="mb-3">
<label for="csvFile" class="form-label">CSV 파일 업로드:</label>
<input type="file" class="form-control" id="csvFile" accept=".csv">
</div>
<button class="btn btn-primary w-100" onclick="loadCSV()"> CSV 업로드</button>
<!-- 로딩 스피너 -->
<div class="loading-spinner mt-3">
<div class="spinner-border text-primary" role="status"></div>
<p>데이터를 처리 중입니다...</p>
</div>
<!-- 차트 -->
<canvas id="priceChart" class="mt-4"></canvas>
<!-- 예측 결과 -->
<h3 class="mt-5 text-center text-secondary"> 미래 가격 예측</h3>
<table class="table table-bordered mt-3">
<thead class="table-light">
<tr>
<th>날짜</th>
<th>예측 가격</th>
</tr>
</thead>
<tbody id="predictionTable">
<!-- 예측된 가격이 여기에 추가됨 -->
</tbody>
</table>
</div>
<!-- Bootstrap 5 JS -->
<script src="bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"" TARGET="_blank" rel="nofollow">https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
function calculateSMA(data, period) {
let sma = [];
for (let i = 0; i < data.length; i++) {
if (i < period - 1) {
sma.push(null);
} else {
let sum = 0;
for (let j = 0; j < period; j++) {
sum += data[i - j];
}
sma.push(sum / period);
}
}
return sma;
}
function calculateEMA(data, period) {
let ema = [];
let multiplier = 2 / (period + 1);
let prevEMA = data[0];
for (let i = 0; i < data.length; i++) {
prevEMA = i === 0 ? data[i] : (data[i] - prevEMA) * multiplier + prevEMA;
ema.push(prevEMA);
}
return ema;
}
function linearRegressionPredict(data, days) {
const n = data.length;
const slope = (data[n - 1] - data[0]) / n;
return Array.from({ length: days }, (_, i) => data[n - 1] + slope * (i + 1));
}
document.getElementById('csvFile').addEventListener('change', handleFile);
function handleFile(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const csvData = e.target.result;
processCSV(csvData);
};
reader.readAsText(file);
}
}
function processCSV(csvData) {
const rows = csvData.split("\n").map(row => row.split(";")); // 세미콜론(;)을 구분자로 사용
const data = [];
document.querySelector('.loading-spinner').style.display = "block";
for (let i = 1; i < rows.length; i++) {
if (rows[i].length < 10) continue;
const dateStr = rows[i][0].split("T")[0];
const price = rows[i][8];
if (!dateStr || isNaN(price)) continue;
data.push({
date: new Date(dateStr),
actualPrice: parseFloat(price)
});
}
data.sort((a, b) => a.date - b.date);
const labels = data.map(d => d.date.toISOString().split("T")[0]);
const actualPrices = data.map(d => d.actualPrice);
const sma7 = calculateSMA(actualPrices, 7);
const sma14 = calculateSMA(actualPrices, 14);
const ema7 = calculateEMA(actualPrices, 7);
const futureLabels = [];
const futurePrices = linearRegressionPredict(actualPrices, 7);
for (let i = 1; i <= 7; i++) {
let futureDate = new Date(data[data.length - 1].date);
futureDate.setDate(futureDate.getDate() + i);
futureLabels.push(futureDate.toISOString().split("T")[0]);
}
updatePredictionTable(futureLabels, futurePrices);
document.querySelector('.loading-spinner').style.display = "none";
drawChart(labels, actualPrices, sma7, sma14, ema7, futureLabels, futurePrices);
}
function updatePredictionTable(futureLabels, futurePrices) {
const tableBody = document.getElementById("predictionTable");
tableBody.innerHTML = "";
for (let i = 0; i < futureLabels.length; i++) {
const row = `<tr>
<td>${futureLabels[i]}</td>
<td>${futurePrices[i].toFixed(2)}</td>
</tr>`;
tableBody.innerHTML += row;
}
}
function drawChart(labels, actualPrices, sma7, sma14, ema7, futureLabels, futurePrices) {
const ctx = document.getElementById('priceChart').getContext('2d');
if (window.myChart) {
window.myChart.destroy();
}
window.myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [...labels, ...futureLabels],
datasets: [
{ label: "실제 가격", data: actualPrices, borderColor: "red", fill: false },
{ label: "7일 이동 평균 (SMA)", data: sma7, borderColor: "blue", fill: false },
{ label: "14일 이동 평균 (SMA)", data: sma14, borderColor: "green", fill: false },
{ label: "7일 지수 이동 평균 (EMA)", data: ema7, borderColor: "orange", fill: false },
{ label: "회귀 분석 기반 예측", data: [...Array(labels.length).fill(null), ...futurePrices], borderColor: "purple", borderDash: [5, 5], fill: false }
]
}
});
}
</script>
</body>
</html>
주의사항
예측 결과는 100% 정확하지 않습니다.
이 도구는 과거 데이터의 패턴을 기반으로 미래 가격을 예측합니다.
그러나 실제 시장은 다양한 변수(뉴스, 경제 상황, 투자 심리 등)에 의해 변동하므로, 예측 값이 항상 맞지는 않습니다.
투자 결정을 내릴 때는 추가적인 분석과 리스크 관리가 필요합니다.
데이터의 품질이 예측 정확도에 영향을 줍니다.
업로드한 CSV 데이터가 정확하고 최신 데이터일수록 예측 결과도 신뢰성이 높아집니다.
잘못된 데이터(예: 결측값, 오류 데이터)가 포함되면 부정확한 결과를 초래할 수 있음
단기적인 변동성이 반영되지 않을 수 있습니다.
이동 평균(SMA, EMA)은 장기적인 트렌드를 분석하는 데 유용하지만, 급격한 가격 변동에는 반응이 느릴 수 있음
단기적인 가격 급등락(뉴스, 이벤트 등)은 반영되지 않음
회귀 분석(Linear Regression)은 직선적인 예측을 제공
시장은 비선형적인 변동성을 가지므로, 단순 선형 회귀 분석이 항상 적절하지 않을 수 있음
추세 분석에는 유용하지만, 가격 예측에는 한계가 있음
장기 예측보다 단기 예측이 더 신뢰성 있음
회귀 분석 기반 예측은 7일 정도의 짧은 기간 예측에 적합
장기 예측(1개월 이상)은 시장 변수의 영향이 커서 신뢰성이 낮아질 수 있음
도구 활용 방법
코인(또는 다른 자산)의 과거 데이터를 CSV 파일로 업로드
이동 평균과 회귀 분석을 활용하여 가격 추세를 분석
단기적인 가격 흐름을 예측하고 투자 전략 수립에 활용
다른 기술적 분석 지표와 함께 사용하여 리스크 관리
가격 예측 도구
코인마켓캡 90일CSV 파일을 업로드하면 이동 평균과 회귀 분석을 기반으로 미래 가격을 예측합니다.
데이터를 처리 중입니다...
미래 가격 예측
날짜 | 예측 가격 |
---|