fix: improve signal accuracy and optimize tweet ingestion#17
Open
Anniew31 wants to merge 1 commit into
Open
Conversation
|
@Anniew31 is attempting to deploy a commit to the Victor's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
Bug A — sentiment-analyzer.ts:18 — keywords 'will happen' and 'going to' were in BULLISH_KEYWORDS but the analyzer tokenizes text word-by-word. Can't be matched to so got rid of a word to make exactly one word long
Bug B — sentiment-analyzer.ts:56 — negation skips through modifiers. "not very bullish" → prevWord of "bullish" is "very" so the "not" two positions back was invisible and the phrase scored as bullish. Fixed to scan 2 words back, skipping modifiers when determining negation.
Bug C — signal-generator.ts:175 — HOLD threshold out of sync with bot cofig generateSuggestedAction returned HOLD for edge < 0.10, while the bot's
default BOT_MIN_EDGE=0.05 and computeUrgency labelled 0.05–0.10 as
"medium urgency" Lowered threshold to 0.05 to match.
Bug D — kalshi-client.ts:168 — all-time volume as 24h fallback
volume24h: km.volume_24h ?? km.volume ?? 0 fell back to km.volume, which
is Kalshi's total lifetime volume. Changed to use 0 when volume_24h is absent.
Bug E — api/cron/collect-tweets.ts — sequential KV writes
storeTweet was called with await inside a for...of loop, blocking on each write before processing the next tweet. Changed to collect AnalyzedTweet objects into an array first, then fire all writes in parallel with Promise.allSettled(tweetsToStore.map(storeTweet)).
Bug G — src/analysis/keyword-matcher.ts — emojis double-counted so a single emoji like 🚀 contributes 2 to emojiCount. That meant the threshold was triggered at 8 emojis. Fixed by replacing the regex with [...text].filter(c => (c.codePointAt(0) ?? 0) > 0xFFFF).length which made each emoji count as 1. Also Adjusted the threshold to 8 to keep behavior same