CORE TERMINAL
WEB BOT HELP & OLD BOY : 웹 봇 & 올드보이 도움말
업비트 개인 자산 입출근 데이터 출력 코드
DATE: 2026-03-11 23:22
* 업비트 개인 자산 매매 데이터 출력 코드
1. 개인 자산 입출금 데이터 웹 출력 코드
2. 100개의 데이터 당 1페이지 구성
3. 해당 데이터 호출 값 출력
4. 해당 테이터 SQL 값 출력
1. 개인 자산 입출금 데이터 웹 출력 코드
2. 100개의 데이터 당 1페이지 구성
3. 해당 데이터 호출 값 출력
4. 해당 테이터 SQL 값 출력
EXTRA CODE SNIPPET
<?php
date_default_timezone_set('Asia/Seoul');
set_time_limit(120);
require '/home/www/DB/key_upbit_trade.php';
$ACCESS_KEY = $UPBIT_ACCESS_KEY ?? '';
$SECRET_KEY = $UPBIT_SECRET_KEY ?? '';
$SERVER_URL = $UPBIT_SERVER_URL ?? "https://api.upbit.com";
$b64url = function($d) { return rtrim(strtr(base64_encode($d), '+/', '-_'), '='); };
$make_jwt = function($ak, $sk, $query = []) use ($b64url) {
$h = ['alg'=>'HS256','typ'=>'JWT'];
$p = ['access_key'=>$ak,'nonce'=>uniqid('',true)];
if (!empty($query)) {
$qs = http_build_query($query);
$p['query_hash'] = hash('sha512', $qs);
$p['query_hash_alg'] = 'SHA512';
}
$hh = $b64url(json_encode($h));
$pp = $b64url(json_encode($p));
$ss = $b64url(hash_hmac('sha256', "$hh.$pp", $sk, true));
return "$hh.$pp.$ss";
};
function api_call($url, $jwt) {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$jwt}", "Content-Type: application/json"],
CURLOPT_TIMEOUT => 10,
]);
$resp = curl_exec($ch);
curl_close($ch);
return json_decode($resp, true);
}
// 입금 전체 뽑기 (루프)
$all_deposits = [];
$page = 1;
while (true) {
$params = ['currency'=>'KRW','limit'=>100,'page'=>$page];
$jwt = $make_jwt($ACCESS_KEY, $SECRET_KEY, $params);
$data = api_call($SERVER_URL."/v1/deposits?".http_build_query($params), $jwt);
if (!is_array($data) || count($data) === 0) break;
foreach ($data as $d) {
$d['_kind'] = 'deposit';
$all_deposits[] = $d;
}
if (count($data) < 100) break;
$page++;
usleep(200000);
}
// 출금 전체 뽑기 (루프)
$all_withdraws = [];
$page = 1;
while (true) {
$params = ['currency'=>'KRW','limit'=>100,'page'=>$page];
$jwt = $make_jwt($ACCESS_KEY, $SECRET_KEY, $params);
$data = api_call($SERVER_URL."/v1/withdraws?".http_build_query($params), $jwt);
if (!is_array($data) || count($data) === 0) break;
foreach ($data as $w) {
$w['_kind'] = 'withdraw';
$all_withdraws[] = $w;
}
if (count($data) < 100) break;
$page++;
usleep(200000);
}
// 합치기
$all = array_merge($all_deposits, $all_withdraws);
// 날짜 오름차순 정렬
usort($all, function($a, $b) {
return strtotime($a['created_at'] ?? 0) - strtotime($b['created_at'] ?? 0);
});
$total = count($all);
$dep_count = count($all_deposits);
$wit_count = count($all_withdraws);
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>업비트 입출금 전체</title>
<style>
body { background:#111; color:#eee; font-family:sans-serif; padding:20px; }
h2 { color:#f0a500; }
.info { margin-bottom:20px; color:#94a3b8; font-size:14px; }
table { width:100%; border-collapse:collapse; margin-bottom:40px; font-size:12px; }
th { background:#1e1e1e; color:#94a3b8; padding:6px 10px; text-align:left; border-bottom:1px solid #333; }
td { padding:6px 10px; border-bottom:1px solid #222; }
tr:hover td { background:#1a1a1a; }
.dep { color:#fb7185; }
.wit { color:#60a5fa; }
.sql-box { background:#0c1224; border:1px solid #232e42; border-radius:8px; padding:16px; margin-bottom:40px; }
.sql-box pre { margin:0; font-size:11px; color:#94a3b8; white-space:pre-wrap; word-break:break-all; }
</style>
</head>
<body>
<h2>업비트 입출금 전체 (날짜 오름차순)</h2>
<div class="info">
입금: <?= $dep_count ?>건 | 출금: <?= $wit_count ?>건 | 합계: <?= $total ?>건
</div>
<table>
<tr>
<th>날짜</th><th>구분</th><th>화폐</th><th>금액</th><th>수수료</th><th>상태</th><th>거래유형</th><th>UUID</th>
</tr>
<?php foreach ($all as $r): ?>
<?php
$is_dep = ($r['_kind'] === 'deposit');
$cls = $is_dep ? 'dep' : 'wit';
$label = $is_dep ? '입금' : '출금';
$dt = date('Y-m-d H:i:s', strtotime($r['created_at'] ?? 'now'));
$tx_type = $is_dep ? ($r['transaction_type'] ?? 'default') : 'withdraw';
?>
<tr>
<td><?= $dt ?></td>
<td class="<?= $cls ?>"><?= $label ?></td>
<td><?= htmlspecialchars($r['currency'] ?? 'KRW') ?></td>
<td class="<?= $cls ?>"><?= number_format((float)($r['amount'] ?? 0)) ?></td>
<td><?= $r['fee'] ?? '0' ?></td>
<td><?= htmlspecialchars($r['state'] ?? '') ?></td>
<td style="color:#f0a500;"><?= htmlspecialchars($tx_type) ?></td>
<td style="font-size:10px;color:#555;"><?= htmlspecialchars($r['uuid'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
</table>
<h2>INSERT SQL (날짜 오름차순)</h2>
<div class="sql-box"><pre><?php
foreach ($all as $r) {
$is_dep = ($r['_kind'] === 'deposit');
$label = $is_dep ? '입금' : '출금';
$dt = date('Y-m-d H:i:s', strtotime($r['created_at'] ?? 'now'));
$amount = $r['amount'] ?? '0';
$fee = $r['fee'] ?? '0';
$uuid = addslashes($r['uuid'] ?? '');
$state = addslashes($r['state'] ?? '');
$time = addslashes($r['created_at'] ?? '');
$currency = addslashes($r['currency'] ?? 'KRW');
$tx_type = $is_dep ? addslashes($r['transaction_type'] ?? 'default') : 'withdraw';
echo "INSERT INTO g5_write_moving_assets (wr_num, wr_reply, wr_parent, wr_is_comment, wr_comment, wr_comment_reply, ca_name, wr_option, wr_subject, wr_content, wr_seo_title, wr_link1, wr_link2, wr_link1_hit, wr_link2_hit, wr_hit, wr_good, wr_nogood, mb_id, wr_password, wr_name, wr_email, wr_homepage, wr_datetime, wr_file, wr_last, wr_ip, wr_facebook_user, wr_twitter_user, x2_type, x2_direction, x2_amount, x2_fee, x2_uuid, x2_state, x2_address, x2_time, x2_transaction_type) VALUES (0, '', 0, 0, 0, '', '', '', '{$label}', '', '', '', '', 0, 0, 0, 0, 0, 'admin', '', 'admin', '', '', '{$dt}', 0, '{$dt}', '127.0.0.1', '', '', '{$currency}', '{$label}', '{$amount}', '{$fee}', '{$uuid}', '{$state}', '', '{$time}', '{$tx_type}');\n";
}
?></pre></div>
</body>
</html>