mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 01:35:36 +00:00
fix(screen): fetch the full list before sorting performers screens
MSN orders screener lists by 1-year return, but top/worst-performers re-sort by day change after truncating to --limit. So `--limit 3` sorted an arbitrary 3 stocks (worst-performers returned -1.33%, +0.25%, +0.95%) and gave different stocks than `--limit 25`. Fetch the whole list for these filters, as high-volume and large-cap already do. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ld3fDSDiBzAaQvgZJX5NKM
This commit is contained in:
parent
135034966c
commit
8a294d6728
1 changed files with 7 additions and 3 deletions
|
|
@ -613,9 +613,13 @@ pub fn handle(
|
|||
} => {
|
||||
let filter_key = screener_filter_key(filter)?;
|
||||
let region_key = screener_region_key(region)?;
|
||||
// For filters that fall back to topperfs, fetch all stocks so
|
||||
// client-side sorting picks the correct top N.
|
||||
let needs_full_fetch = matches!(filter.as_str(), "high-volume" | "large-cap");
|
||||
// Filters re-sorted client-side need the whole MSN list: MSN orders
|
||||
// by 1-year return, so truncating first and then sorting by day
|
||||
// change made `--limit 3` return different stocks than `--limit 25`.
|
||||
let needs_full_fetch = matches!(
|
||||
filter.as_str(),
|
||||
"high-volume" | "large-cap" | "top-performers" | "worst-performers"
|
||||
);
|
||||
let fetch_limit = if needs_full_fetch { 500 } else { *limit };
|
||||
let bucket = cache_bucket(provider.kind(), "screen");
|
||||
let key = format!("{filter}:{region}:{fetch_limit}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue