Skip to content

Fix: consensus endpoint matched on username, which is usually empty - #11

Open
mpont91 wants to merge 1 commit into
ent0n29:mainfrom
mpont91:fix/consensus-username-join
Open

Fix: consensus endpoint matched on username, which is usually empty#11
mpont91 wants to merge 1 commit into
ent0n29:mainfrom
mpont91:fix/consensus-username-join

Conversation

@mpont91

@mpont91 mpont91 commented Aug 27, 2026

Copy link
Copy Markdown

/api/consensus/markets selects smart traders by username, then filters trades with it:

WITH smart_traders AS (
    SELECT username FROM polybot.aware_smart_money_scores FINAL
    WHERE total_score >= 45 LIMIT 100
)
...
WHERE username IN (SELECT username FROM smart_traders)

Most Polymarket wallets have no username set, so both sides are the empty string for the majority of rows. The subquery matches almost nothing real, and the endpoint returns signal_count: 0 even when smart money is clearly clustered in the same markets.

proxy_address is always populated and is the key the rest of the scoring pipeline already uses.

Verified

Same database, same thresholds, before and after:

before:  {"signal_count": 0, "signals": []}
after:   20 signals — e.g. 5 traders on "Bitcoin Up or Down - Aug 25",
                           3 traders on "Will Southampton FC win on 2026-08-25?"

Most Polymarket wallets have no username, so filtering aware_global_trades
by `username IN (SELECT username FROM smart_traders)` matched only the
empty string and /api/consensus/markets returned no signals.

Keyed on proxy_address instead.
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