deanpowers commited on
Commit
03df759
Β·
1 Parent(s): 97f01b9

feat(settings): move Max Funding Rate field into Futures Settings card (wired to riser min_funding)

Browse files
Files changed (1) hide show
  1. static/settings/index.html +21 -9
static/settings/index.html CHANGED
@@ -344,6 +344,12 @@
344
  <div class="hint">After profit reaches the TP level, the position runs until price retraces this % (0.1–10%)</div>
345
  </div>
346
 
 
 
 
 
 
 
347
  <div class="field">
348
  <label for="f-cap">Daily Cap ($)</label>
349
  <input type="number" id="f-cap" min="100" max="1000" step="10" value="500">
@@ -390,12 +396,6 @@
390
  <div class="hint">Maximum total invested in rising-coin positions per day</div>
391
  </div>
392
 
393
- <div class="field">
394
- <label for="r-fund">Max Funding Rate (%)</label>
395
- <input type="number" id="r-fund" min="-1" max="100" step="0.01" value="0">
396
- <div class="hint">Auto-open only when the coin's funding rate is at or below this (0 = longs are paid; 99 = gate off)</div>
397
- </div>
398
-
399
  <div class="buttons">
400
  <button class="btn-primary" id="riser-save-btn">πŸ’Ύ Save Rising Coins Settings</button>
401
  </div>
@@ -501,6 +501,12 @@
501
  } catch (err) {
502
  // futures settings unavailable β€” leave defaults
503
  }
 
 
 
 
 
 
504
  }
505
 
506
  async function saveFuturesSettings() {
@@ -536,6 +542,14 @@
536
  body: JSON.stringify(payload)
537
  });
538
  if (res.ok) {
 
 
 
 
 
 
 
 
539
  msg.textContent = 'βœ“ saved';
540
  msg.style.color = '#4ade80';
541
  } else {
@@ -563,7 +577,6 @@
563
  if (s.tp_percent != null) document.getElementById('r-tp').value = s.tp_percent;
564
  if (s.stop_loss_percent != null) document.getElementById('r-sl').value = s.stop_loss_percent;
565
  if (s.daily_cap != null) document.getElementById('r-cap').value = s.daily_cap;
566
- if (s.min_funding != null) document.getElementById('r-fund').value = s.min_funding;
567
  } catch (err) {
568
  // riser settings unavailable β€” leave defaults
569
  }
@@ -581,8 +594,7 @@
581
  leverage: Number(document.getElementById('r-lev').value),
582
  tp_percent: Number(document.getElementById('r-tp').value),
583
  stop_loss_percent: Number(document.getElementById('r-sl').value),
584
- daily_cap: Number(document.getElementById('r-cap').value),
585
- min_funding: Number(document.getElementById('r-fund').value)
586
  };
587
 
588
  try {
 
344
  <div class="hint">After profit reaches the TP level, the position runs until price retraces this % (0.1–10%)</div>
345
  </div>
346
 
347
+ <div class="field">
348
+ <label for="f-fund">Max Funding Rate (%)</label>
349
+ <input type="number" id="f-fund" min="-1" max="100" step="0.01" value="0">
350
+ <div class="hint">Futures auto-open only when the coin's funding rate is at or below this (0 = longs are paid; 99 = gate off)</div>
351
+ </div>
352
+
353
  <div class="field">
354
  <label for="f-cap">Daily Cap ($)</label>
355
  <input type="number" id="f-cap" min="100" max="1000" step="10" value="500">
 
396
  <div class="hint">Maximum total invested in rising-coin positions per day</div>
397
  </div>
398
 
 
 
 
 
 
 
399
  <div class="buttons">
400
  <button class="btn-primary" id="riser-save-btn">πŸ’Ύ Save Rising Coins Settings</button>
401
  </div>
 
501
  } catch (err) {
502
  // futures settings unavailable β€” leave defaults
503
  }
504
+ // Max Funding Rate lives in the riser rules β€” load it here too
505
+ try {
506
+ const res2 = await fetch(`${API_BASE}/api/riser-config`);
507
+ const r = await res2.json();
508
+ if (r.min_funding != null) document.getElementById('f-fund').value = r.min_funding;
509
+ } catch (err) { /* leave default */ }
510
  }
511
 
512
  async function saveFuturesSettings() {
 
542
  body: JSON.stringify(payload)
543
  });
544
  if (res.ok) {
545
+ // Max Funding Rate lives in the riser rules β€” save it too
546
+ try {
547
+ await fetch(`${API_BASE}/api/riser-config`, {
548
+ method: 'POST',
549
+ headers: { 'Content-Type': 'application/json' },
550
+ body: JSON.stringify({ min_funding: Number(document.getElementById('f-fund').value) })
551
+ });
552
+ } catch (err2) { /* funding gate unchanged */ }
553
  msg.textContent = 'βœ“ saved';
554
  msg.style.color = '#4ade80';
555
  } else {
 
577
  if (s.tp_percent != null) document.getElementById('r-tp').value = s.tp_percent;
578
  if (s.stop_loss_percent != null) document.getElementById('r-sl').value = s.stop_loss_percent;
579
  if (s.daily_cap != null) document.getElementById('r-cap').value = s.daily_cap;
 
580
  } catch (err) {
581
  // riser settings unavailable β€” leave defaults
582
  }
 
594
  leverage: Number(document.getElementById('r-lev').value),
595
  tp_percent: Number(document.getElementById('r-tp').value),
596
  stop_loss_percent: Number(document.getElementById('r-sl').value),
597
+ daily_cap: Number(document.getElementById('r-cap').value)
 
598
  };
599
 
600
  try {