topsecrettraders commited on
Commit
fbb255b
·
verified ·
1 Parent(s): 9d3a029

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -651,19 +651,19 @@ HTML_TEMPLATE = """
651
  }
652
 
653
  const centerIdx = kList.indexOf(closestK);
654
- // Modified: 20 up / 20 down
655
- const start = Math.max(0, centerIdx - 20);
656
- const end = Math.min(kList.length, centerIdx + 20);
657
- const viewKs = kList.slice(start, end);
658
-
659
- OPT_SYMS.forEach(o => {
660
- if(viewKs.includes(o.k)) symbolsToFetch.push(o.s);
661
- });
662
  } else {
 
663
  const kList = Array.from(document.querySelectorAll('.row')).map(r => parseFloat(r.dataset.k));
664
  const mid = Math.floor(kList.length/2);
665
- // Modified: 20 up / 20 down
666
- const viewKs = kList.slice(Math.max(0, mid-20), mid+20);
667
  OPT_SYMS.forEach(o => { if(viewKs.includes(o.k)) symbolsToFetch.push(o.s); });
668
  }
669
 
 
651
  }
652
 
653
  const centerIdx = kList.indexOf(closestK);
654
+ const start = Math.max(0, centerIdx - 12);
655
+ const end = Math.min(kList.length, centerIdx + 12);
656
+ const viewKs = kList.slice(start, end);
657
+
658
+ OPT_SYMS.forEach(o => {
659
+ if(viewKs.includes(o.k)) symbolsToFetch.push(o.s);
660
+ });
661
+ }
662
  } else {
663
+ // Fallback if no spot price yet (initial load)
664
  const kList = Array.from(document.querySelectorAll('.row')).map(r => parseFloat(r.dataset.k));
665
  const mid = Math.floor(kList.length/2);
666
+ const viewKs = kList.slice(Math.max(0, mid-10), mid+10);
 
667
  OPT_SYMS.forEach(o => { if(viewKs.includes(o.k)) symbolsToFetch.push(o.s); });
668
  }
669