Add a free scrolling stock ticker tape to any website (two lines of HTML, no API key)
Finance blogs, investing newsletters and club sites keep asking for the same thing: a strip of stock prices across the top of the page. The usual options are a heavy iframe from a broker, a paid data feed, or a weekend s
Finance blogs, investing newsletters and club sites keep asking for the same thing: a strip of stock prices across the top of the page. The usual options are a heavy iframe from a broker, a paid data feed, or a weekend spent wiring up an API, caching and a marquee animation.
So we built a small one you can drop into any page. Here it is running live:
And the same two tapes on a mock blog page (the light one full width across the header, the dark one boxed inside a post):
The whole embed
<div class="ql-tickertape" data-symbols="AAPL,MSFT,NVDA,AMZN,SPY,QQQ" data-theme="light">
Stock quotes by <a href="https://www.quotelinks.com/">Quotelinks</a>
</div>
<script src="https://www.quotelinks.com/widgets/tickertape.js" async></script>
That's it. No sign-up, no API key, no build step. The div marks where the strip goes and lists the symbols; the script finds every .ql-tickertape on the page and draws it.
If you'd rather click than type, the Ticker Tape generator has a live preview and a Copy button.
Options
Everything is a data- attribute on the div:
| Attribute | Values | What it does |
|---|---|---|
data-symbols |
e.g. AAPL,MSFT,SPY
|
Up to 20 US stocks and ETFs, in the order shown. BRK.B and BRK-B both work. Leave it out for the largest US companies plus SPY and QQQ. |
data-size |
regular (default), compact
|
Regular (40 px): symbol, price and change. Compact (32 px): symbol and change. |
data-theme |
light (default), dark, auto
|
auto follows each visitor's light or dark system setting. |
data-style |
boxed |
Rounded border, for a strip inside an article or sidebar. Leave it out for a full-width strip. |
data-speed |
slow, normal (default), fast, still
|
still turns scrolling off; visitors swipe the strip instead. |
A dark, compact strip for a sidebar:
<div class="ql-tickertape"
data-symbols="JPM,V,XOM,COST,NFLX,AMD,DIA,IWM"
data-theme="dark" data-size="compact" data-style="boxed">
Stock quotes by <a href="https://www.quotelinks.com/">Quotelinks</a>
</div>
<script src="https://www.quotelinks.com/widgets/tickertape.js" async></script>
Several tapes on one page are fine. Include the script once; it picks up all of them.
What the prices are
During US market hours the tape shows delayed prices and labels them, for example "As of 11:42 AM ET". After the close it shows the closing price, labelled "Close Nov 27". Each symbol links to its quote page on Quotelinks and opens in a new tab, so your page stays open.
The script fetches once per page view and never polls, so a visitor who leaves the tab open isn't hammering anything.
The parts that took longer than expected
A scrolling strip looks trivial. Making it behave on other people's sites wasn't.
Shadow DOM, so your CSS can't break it (and it can't break yours). The strip renders inside a shadow root. A theme with * { box-sizing: content-box } or a global a { text-decoration: underline } doesn't touch it, and none of its styles leak into the host page.
The credit link stays in your HTML. The "Stock quotes by Quotelinks" link lives in the light DOM and is projected into the strip through a named slot (<slot name="brand">). If JavaScript is off or the script is blocked, visitors still see a normal link instead of an empty box.
It stops moving when nobody is looking. An IntersectionObserver pauses the CSS animation (animation-play-state: paused) when the strip scrolls off screen, so a tape in your header doesn't burn CPU while someone reads the bottom of a long post.
Hover and keyboard focus pause it. You can't click a moving target, so hovering pauses the scroll. Keyboard users get the same via :focus-visible. We first used :focus-within, which had a nasty side effect: clicking a symbol (opens a new tab) left the link focused, and the strip stayed frozen when the visitor came back. Switching to :focus-visible fixed it.
Reduced motion is respected. Visitors with "reduce motion" turned on in their OS get the still version automatically, whatever data-speed says.
It works with page builders and SPAs. A MutationObserver watches for new .ql-tickertape elements, so tapes added after load (React, Vue, a Wix section that renders late, an infinite-scroll page) get drawn too. If you need to trigger it yourself, call window.qlTickertape.scan().
Small. About 4 KB gzipped, loaded with async, no cookies, one small JSON request per tape.
Where to paste it
- WordPress: a Custom HTML block for one page. For every page, use your theme's header widget area or a header-and-footer code plugin and paste it into the top-of-body section.
- Blogger: Layout, then Add a Gadget in the header section, HTML/JavaScript.
- Squarespace: a Code block (leave "Display Source" off).
- Wix: Add, Embed Code, Embed HTML, choose "Code". Stretch the frame to full width and make it 42 px high (34 px for compact).
-
Ghost: an HTML card in a post, or your theme's
default.hbsright after<body>for every page. -
Plain HTML: right after
<body>for a top strip, or anywhere in the page.
Other widgets that work the same way
Same pattern, a div plus one script, no key:
- Stock Chart: an interactive candlestick or line chart for any US stock or ETF, one month to five years.
- Stock Card: price, daily change, a one-month chart, the 52-week range and key stats for one symbol.
- Market Movers: the day's top gainers, losers and most active US stocks or ETFs, in tabs.
- Economic Charts: charts such as the US inflation rate for your posts.
All of them are on the free stock widgets page.
The fine print
The widgets are free for personal and non-commercial websites; commercial sites need a written agreement (see the Terms of Service). The one condition is that the Quotelinks link in the embed code stays visible and unchanged. Prices are for information only and are not investment advice.
If you put a tape on your site, I'd love to see it. Drop the link in the comments, along with any symbol or option you wish it had.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.