Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.91 KB

File metadata and controls

33 lines (26 loc) · 1.91 KB

API Reliability Options

You are facing "Too Many Requests" (Rate Limits) and "Wrong Price" issues with the default Yahoo Finance API. Here are 5 options to fix this, ranked by reliability:

1. Google Finance Fallback (Recommended & Implemented)

How it works: If Yahoo fails, the server will "read" the Google Finance webpage for the asset to get the live price.

  • Pros: Free, accurate, high reliability, no API key needed.
  • Cons: Slightly slower than an API, webpage layout changes can break it (rare).
  • Status: I am implementing this right now as a backup.

2. Use a Professional API (Alpha Vantage / Finnhub)

How it works: We switch to a dedicated stock market data provider.

  • Pros: Extremely reliable, official data.
  • Cons: Requires you to sign up for a free API key and add it to .env.
  • Action: If Option 1 fails, we can add this. You would need to get a key from Alpha Vantage.

3. Client-Side Fetching

How it works: Instead of your Server fetching the price (which gets blocked because many users share the same server IP), the User's Browser fetches the price.

  • Pros: Impossible to rate limit (distributed variance).
  • Cons: Requires a "CORS Proxy" to work (security restriction), which might need paid hosting.

4. Database Pre-Seeding ("Smart Cache")

How it works: We run a script once a day to fetch the prices of the top 500 stocks and save them to your database.

  • Pros: The app is instant for users. API never gets blocked because it runs once.
  • Cons: Only works for "Popular" assets. Obscure stocks would still fail.

5. Manual Override (Always Active)

How it works: You type the price yourself.

  • Pros: 100% reliable.
  • Cons: Bad user experience (manual work).

Next Step: I am deploying Option 1 (Google Finance Scraper) immediately to fix your issue without requiring you to do anything.