Jump to content

Recommended Posts

Posted

Hi everyone,

Built this for a financial news site that needed live stock quotes embedded inline in editorial content. Drop a ticker into any text field and it renders as a live badge with price, change, and direction - clicking opens a full detail popup.

GitHub: https://github.com/mxmsmnv/Stocks

screenshot.jpg.8b27865fd38e557ad87bc8f17cedc364.jpg

What it does:

  • Live price badges - ticker, price, change amount/%, direction arrow; click opens a popup with open/high/low, 52-week range, P/E, volume, market state
  • Three data providers - Yahoo Finance (free, no key needed), Finnhub, Alpha Vantage
  • TextFormatter with three parse modes:
    • Explicit [stock:AAPL] tags
    • Cashtag/hashtag - $AAPL, #TSLA
    • Auto-detection by company name and aliases in text
  • Company Manager - tracked companies with names, aliases, enable/disable toggles, bulk CSV import
  • Four CSS frameworks - Vanilla CSS (built-in), Tailwind, Bootstrap 5, UIkit 3; auto-detected or manually set
  • File-based cache with configurable TTL and per-ticker clear from admin
  • Circuit breaker - pauses API calls after repeated failures, serves stale cache with ~ marker
  • Custom provider API - add any data source by extending StocksProviderBase
$stocks = $modules->get('Stocks');
echo $stocks->renderBadge('AAPL');
echo $stocks->renderBadgeAs('TSLA', 'bootstrap');

Requirements: ProcessWire 3.0+, PHP 8.2+

MIT License.

  • Like 5

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...