Skip to content

Add AI stock rankings page with subscription gating - #80

Merged
danieldanielecki merged 15 commits into
mainfrom
cursor/ai-stock-rankings-6c91
Sep 25, 2026
Merged

danieldanielecki merged 15 commits into
mainfrom
cursor/ai-stock-rankings-6c91

Conversation

@danieldanielecki

@danieldanielecki danieldanielecki commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Follow-up: ETF / Crypto ranking still failing after 1862f8f

Root cause (remaining filter): Commit 1862f8f routed ETF and crypto enrichment through yahooFinanceService.getSymbolQuote only, while stocks still used marketDataService.getSymbolData (Finnhub when configured, then Yahoo). On preview/production with FINNHUB_API_KEY, stock rankings could enrich successfully; ETF/crypto candidates were dropped when Yahoo quote failed, falling below the minimum of 4 buy/sell rows and surfacing the insufficient-candidates error.

Fix (516db53):

  • Quote all categories via marketDataService.getSymbolData → Yahoo → synthetic fallback quote (same resilience pattern as AI prediction snapshots).
  • Relaxed crypto symbol normalization for Yahoo-style tickers (e.g. UNI7083-USD).
  • Ensure ranking validation errors (AI did not return… / AI returned an incomplete…) pass through userFacingApiError.

API proof (vitest route integration — real handlers, live enrichment):

  • GET ?category=etf → 200, buy=5, sell=5
  • GET ?category=crypto → 200, buy=5, sell=5
  • POST local-Ollama validation path for etf, crypto, stock → 200, buy/sell ≥ 4 each
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 15, 2026 16:01
Introduce /ai-rankings with short, medium, and long horizon tabs.
Each ranked stock includes AI rationale validated against live market data.
Reuse existing AI tier checks, SubscriptionGate, and local Ollama patterns.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 15, 2026 16:05 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-7jkhjopv7-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

Move page and API paths, add MAIN_NAV entry, redirect /ai-rankings,
and update user-facing copy and titles to Ranking.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 16, 2026 16:14 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-k5htib58r-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

Show rank, symbol, name, and why in a readable table with horizontal
scroll on narrow viewports. Keeps timeframe tabs and subscription gating.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 16, 2026 17:12 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-r70uj4mss-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

Keep MAIN_NAV to Home, News, Ranking, and Pricing. Move Sectors,
Calendars, Heatmaps, and Screener to a footer Tools section. Add
Resources legal placeholders, Ditectrev contact details, social links,
and dynamic copyright.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 17, 2026 08:48 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-qcqbem5bj-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

- Bring back react-github-btn star widget above footer content
- Replace social text links with SVG icons (aria-label preserved)
- Uppercase TOOLS/RESOURCES headings; keep link labels title case
- Center-align the tools heading and link column

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 17, 2026 12:32 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-hvi8ykroq-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

cursoragent and others added 2 commits September 17, 2026 12:51
- Raise contrast on ranking tabs, meta lines, table text, and footer
- Split ranking into buy and sell candidate lists with separate scoring
- Show side-by-side tables with stock-of-the-day accent styling
- Update AI prompt, API, and types for buyCandidates/sellCandidates

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 17, 2026 12:53 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-fb8hzknqw-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

- Code-split Footer and render it via LazySection below the fold
- Load GitHub star widget only when its slot enters the viewport
- Move footer top margin to the LazySection wrapper
- Ignore local Lighthouse CI artifacts

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 17, 2026 13:30 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-jmiifyui5-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

- Reuse HeatmapNavigation categories: etf, crypto, stock
- Category-aware AI prompts, parsing, API, and enrichment
- Heatmap-style category switcher on /ranking with per-category fetch

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 18, 2026 13:58 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-adw7pt6c8-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

Route category through enrichRankingCandidates, quote ETFs/crypto via
Yahoo instead of Finnhub stock paths, and tolerate missing forecast/
indicator data like AI predictions. Use category-aware insufficient-
candidate error messages.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 24, 2026 15:42 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-izpb4tbcx-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

Use marketDataService (Finnhub + Yahoo fallback) for all ranking categories
instead of Yahoo-only quotes for ETF/crypto, which failed on preview while
stocks used Finnhub. Add quote fallbacks and relax crypto symbol parsing.
Pass ranking validation errors through the API error helper and add route
integration tests for GET/POST ranking.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
Next.js type-checks vitest.config.ts during build; environmentMatchGlobs
is not in this Vitest InlineConfig type. Node ranking integration tests
still use per-file @vitest-environment node and the guarded setup file.

Co-authored-by: ✅ Daniel Danielecki <danieldanielecki@users.noreply.github.com>
@cursor
cursor Bot deployed to Preview September 25, 2026 17:44 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-qruzayxwi-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

@danieldanielecki
danieldanielecki marked this pull request as ready for review September 25, 2026 17:54

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread services/ai-market-insights.service.ts Outdated
Comment thread app/(main)/ranking/page.tsx
- Fix sell rankings inverting timeframe scores by applying direction multiplier to timeframe-specific adjustments (momentum, sentiment, runway, target upside)
- Fix stale ranking fetches overwriting newer results by adding cancellation flag to useEffect
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Mistral code review

Correctness

  • Footer.tsx: The footer component now includes a comprehensive set of links and contact information, which is a good addition. However, ensure that all links are correctly formatted and point to the right destinations.
  • HomeHub.tsx: The AI outlook section now includes links to the Stock of the day and Ranking pages, which is a good improvement for navigation.
  • LegalPlaceholderPage.tsx: This new component is a good addition for legal pages, but ensure that the content is correctly displayed and styled.
  • AIStockRankingsPanel.tsx: This new component is a good addition for displaying AI stock rankings. However, ensure that the data is correctly fetched and displayed.
  • ranking-api-get.integration.test.ts: This new test file is a good addition for testing the GET API endpoint for stock rankings. However, ensure that the test cases cover all scenarios.
  • ranking-api.integration.test.ts: This new test file is a good addition for testing the POST API endpoint for stock rankings. However, ensure that the test cases cover all scenarios.

Edge Cases

  • Footer.tsx: Ensure that the footer component handles edge cases such as missing links or contact information gracefully.
  • HomeHub.tsx: Ensure that the AI outlook section handles edge cases such as missing data or links gracefully.
  • LegalPlaceholderPage.tsx: Ensure that the legal placeholder page handles edge cases such as missing content gracefully.
  • AIStockRankingsPanel.tsx: Ensure that the AI stock rankings panel handles edge cases such as missing data or errors gracefully.
  • ranking-api-get.integration.test.ts: Ensure that the test cases cover edge cases such as invalid inputs or missing data.
  • ranking-api.integration.test.ts: Ensure that the test cases cover edge cases such as invalid inputs or missing data.

Security

  • Footer.tsx: Ensure that all links in the footer are secure and do not pose any security risks.
  • HomeHub.tsx: Ensure that all links in the AI outlook section are secure and do not pose any security risks.
  • LegalPlaceholderPage.tsx: Ensure that the legal placeholder page does not expose any sensitive information.
  • AIStockRankingsPanel.tsx: Ensure that the AI stock rankings panel does not expose any sensitive information.
  • ranking-api-get.integration.test.ts: Ensure that the test cases do not expose any sensitive information.
  • ranking-api.integration.test.ts: Ensure that the test cases do not expose any sensitive information.

Performance

  • Footer.tsx: Ensure that the footer component does not impact the overall performance of the application.
  • HomeHub.tsx: Ensure that the AI outlook section does not impact the overall performance of the application.
  • LegalPlaceholderPage.tsx: Ensure that the legal placeholder page does not impact the overall performance of the application.
  • AIStockRankingsPanel.tsx: Ensure that the AI stock rankings panel does not impact the overall performance of the application.
  • ranking-api-get.integration.test.ts: Ensure that the test cases do not impact the overall performance of the application.
  • ranking-api.integration.test.ts: Ensure that the test cases do not impact the overall performance of the application.

Maintainability

  • Footer.tsx: Ensure that the footer component is well-documented and easy to maintain.
  • HomeHub.tsx: Ensure that the AI outlook section is well-documented and easy to maintain.
  • LegalPlaceholderPage.tsx: Ensure that the legal placeholder page is well-documented and easy to maintain.
  • AIStockRankingsPanel.tsx: Ensure that the AI stock rankings panel is well-documented and easy to maintain.
  • ranking-api-get.integration.test.ts: Ensure that the test cases are well-documented and easy to maintain.
  • ranking-api.integration.test.ts: Ensure that the test cases are well-documented and easy to maintain.

Overall, the changes look good and address the requirements. Ensure that all edge cases are covered and the code is well-documented for maintainability.

@cursor
cursor Bot deployed to Preview September 25, 2026 18:05 Active

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Loading spinner stuck after access loss
    • Added setLoading(false) before the early return when hasAIAccess is false to properly clear the loading state when access is lost during an in-flight request.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 5f82ac1. Configure here.

Comment thread app/(main)/ranking/page.tsx
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-avycs2wkh-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

Clear loading state when hasAIAccess becomes false to prevent the spinner from getting stuck when access is lost during an in-flight ranking request.
@cursor
cursor Bot deployed to Preview September 25, 2026 18:09 Active
@github-actions

Copy link
Copy Markdown

🚀 Vercel Preview Deployment Ready!

Preview: https://stock-46tiyt0y9-ditectrevs-projects.vercel.app


This comment was automatically generated by GitHub Actions

@danieldanielecki
danieldanielecki merged commit ae33639 into main Sep 25, 2026
15 of 16 checks passed
@danieldanielecki
danieldanielecki deleted the cursor/ai-stock-rankings-6c91 branch September 25, 2026 18:58
@danieldanielecki danieldanielecki mentioned this pull request Sep 25, 2026

This branch had an error being deployed

1 failed deployment
Preview — 1e03cb34 Deployed Sep 25, 2026 by danieldanielecki via Deploy to Vercel #221
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.

2 participants