Throttle OKX amp-stats candle pagination and retry on 429.

Add page pauses, exponential backoff, and cooldown before swap fallback to avoid rate limits.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-23 02:57:24 +08:00
parent 0a9e3aa95c
commit 910c938d0a
5 changed files with 142 additions and 35 deletions
+1 -1
View File
@@ -274,7 +274,7 @@
const startHour = Number(el("amp-start-hour")?.value || 16);
const period = el("amp-period")?.value || "2m";
const customDays = Number(el("amp-custom-days")?.value || 60);
setStatus("计算中…(首次拉取 OKX K 线可能需数十秒)");
setStatus("计算中…(长周期会分页拉 OKX,遇限频会自动重试,请稍候)");
try {
const data = await apiFetch("/api/amp-stats/compute", {
method: "POST",
+1 -1
View File
@@ -1508,7 +1508,7 @@
<script src="/assets/funds.js?v=20260717-funds-scroll-fix"></script>
<script src="/assets/dashboard.js?v=20260720-dash-sl-tp"></script>
<script src="/assets/strategy.js?v=9"></script>
<script src="/assets/amp_stats.js?v=4"></script>
<script src="/assets/amp_stats.js?v=5"></script>
<script src="/assets/help.js?v=1"></script>
<script src="/assets/logs.js?v=1"></script>
<script src="/assets/ai_review_render.js?v=3"></script>