Skip to content

Support all Up/Down markets for price to beat and add time to resolution - #9

Merged
novatechflow merged 1 commit into
mainfrom
feature/updown-price-to-beat-and-resolution-time
Sep 19, 2026
Merged

novatechflow merged 1 commit into
mainfrom
feature/updown-price-to-beat-and-resolution-time

Conversation

@novatechflow

Copy link
Copy Markdown
Owner

Summary

This PR addresses two key improvements for Polymarket positions display:

  1. Fix missing "Price to Beat" across Up/Down markets (server.go):

    • Generalized Up/Down market detection (isUpDown) across outcome ("Up"/"Down"), eventSlug, slug, and title (handling updown, up-or-down, up/down, up-down), rather than only matching btc-updown-.
    • Supports ETH, SOL, XRP, DOGE, hourly Bitcoin (bitcoin-up-or-down-*), and any other crypto interval / daily Up/Down markets.
    • Added slug field to Position struct.
    • Normalized condition IDs to lowercase (normID) and deduplicated query batches to avoid case mismatch and redundant Gamma queries.
    • Preserved previously cached PriceToBeat values across subsequent polls.
  2. Add "Time to Resolution" in device's local timezone (index.html):

    • Added fmtResolution(endStr) to convert UTC timestamps (e.g. 2026-09-19T10:00:00Z) to the viewer's local device timezone.
    • Formats the resolution time (HH:MM for today, Tomorrow HH:MM, or MMM D HH:MM) alongside a countdown (<1m left, Xm left, Xh Ym left, Xd Yh left, or ended).
    • Renders a dedicated time to resolution row on position cards when endDate is present.
    • Prevents JavaScript UTC midnight timezone-shift pitfalls on date-only strings.
  3. Tests & Docs (server_test.go, README.md):

    • Added TestFetchPositionsAddsAllUpDownMarketsPriceToBeat.
    • Added TestIndexShowsTimeToResolutionWhenAvailable.
    • Updated README.md.

@novatechflow
novatechflow merged commit 0a9f1c8 into main Sep 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant