Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Add TradingView chart toggle to /coin pages

nirholase6d9c148b469
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bdb13c048..dc74ed80a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Concierge ships to npm and the MCP registry, with a full examples set** — The Concierge chat widget is now installable as the @three-ws/concierge npm package, and there is a companion Model Context Protocol server, @three-ws/concierge-mcp, on the official MCP registry. That server lets any AI assistant ask a website's concierge a question (it fetches the page and answers grounded in the real content), generate the copy-paste embed code for a site, and list the available 3D avatars. Six runnable examples now ship with the SDK, covering the one-tag install, the web component, the imperative API, a custom GLB avatar, a React wrapper, and pointing the widget at your own answer backend. (`/docs/concierge`) `[sdk, docs]`
- **Language links now always win, and the switcher stays out of the way** — Two fixes for the new 41-language experience. Opening a link with a language in the URL (like ?lang=te for Telugu) now always shows that language, even if you had previously browsed in another one; before, your first visit's language silently overrode every shared link. The floating language switcher also joins the site's shared bottom-corner layout, so it no longer overlaps the Getting Started guide. (`/what-is?lang=te`) `[fix, improvement]`
- **The assistant widget ships as an npm package and an MCP server** — The 3D avatar assistant widget is now installable three ways. Beyond the one-tag script, there is an npm package, @three-ws/assistant, for bundler projects (the one-tag build is generated from it, so they never drift), and a free MCP server, @three-ws/assistant-mcp, published to the official Model Context Protocol registry as io.github.nirholas/assistant-widget. Any AI agent (Claude Code, Cursor, Claude Desktop) can now ask for a widget in plain language and get back a paste-ready embed: build_assistant_widget turns a config into a script tag, a frame URL, and a ThreeAssistant.init() call, and list_assistant_options returns every avatar, background, and mode. Full developer docs at /docs/assistant-widget and a step-by-step tutorial walk through every option, the JavaScript API, and the agent workflow. (`/docs/assistant-widget`) `[sdk, feature, docs]`
+- **TradingView charts on every coin page** — Every /coin page (like /coin/bitcoin) now has a chart-source toggle: keep the fast native line chart or switch to a full TradingView advanced chart with candlesticks, indicators, and drawing tools. Your choice is remembered across coins and visits, and the widget follows the site theme. (`/coin/bitcoin`) `[feature]`
## 2026-07-18
diff --git a/data/changelog.json b/data/changelog.json
index 2763c47ff..bcbb18302 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,15 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-19",
+ "title": "TradingView charts on every coin page",
+ "summary": "Every /coin page (like /coin/bitcoin) now has a chart-source toggle: keep the fast native line chart or switch to a full TradingView advanced chart with candlesticks, indicators, and drawing tools. Your choice is remembered across coins and visits, and the widget follows the site theme.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/coin/bitcoin"
+ },
{
"date": "2026-07-19",
"title": "The assistant widget ships as an npm package and an MCP server",
diff --git a/pages/coin.html b/pages/coin.html
index 89b78ab29..6d904acc4 100644
--- a/pages/coin.html
+++ b/pages/coin.html
@@ -41,6 +41,45 @@
/* /coin/:id enrichment sections — same token/card system as coin-pages.css,
scoped here because only this page renders them. */
+ /* ── Chart source toggle (native line / TradingView) ── */
+ .cv-chart-controls {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 0.5rem 0.75rem;
+ }
+ .cv-chart-modes {
+ border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius);
+ background: var(--cv-surface-2);
+ padding: 2px;
+ }
+ .cv-tv-wrap {
+ height: 440px;
+ border-radius: 8px;
+ overflow: hidden;
+ /* The widget's own loader paints on this while the iframe boots. */
+ background: var(--cv-surface-2);
+ }
+ @media (min-width: 768px) {
+ .cv-tv-wrap {
+ height: 520px;
+ }
+ }
+ .cv-tv-credit {
+ margin: 0.625rem 0 0;
+ font-size: 0.6875rem;
+ }
+ .cv-tv-credit a {
+ color: var(--cv-text-3);
+ text-decoration: none;
+ }
+ .cv-tv-credit a:hover,
+ .cv-tv-credit a:focus-visible {
+ color: var(--cv-text-2);
+ text-decoration: underline;
+ }
+
/* ── Price performance matrix ── */
.cv-perf-grid {
display: grid;
diff --git a/public/changelog.json b/public/changelog.json
index a934fcf8c..e2b7bfd63 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-19T02:04:17.753Z",
+ "generated_at": "2026-07-19T03:48:34.503Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -60,6 +60,16 @@
"docs"
]
},
+ {
+ "date": "2026-07-19",
+ "type": "update",
+ "title": "TradingView charts on every coin page",
+ "summary": "Every /coin page (like /coin/bitcoin) now has a chart-source toggle: keep the fast native line chart or switch to a full TradingView advanced chart with candlesticks, indicators, and drawing tools. Your choice is remembered across coins and visits, and the widget follows the site theme.",
+ "link": "/coin/bitcoin",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-07-18",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index fb9016546..3f267bc50 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -46,6 +46,14 @@
<category>sdk</category>
<description>The 3D avatar assistant widget is now installable three ways. Beyond the one-tag script, there is an npm package, @three-ws/assistant, for bundler projects (the one-tag build is generated from it, so they never drift), and a free MCP server, @three-ws/assistant-mcp, published to the official Model Context Protocol registry as io.github.nirholas/assistant-widget. Any AI agent (Claude Code, Cursor, Claude Desktop) can now ask for a widget in plain language and get back a paste-ready embed: build_assistant_widget turns a config into a script tag, a frame URL, and a ThreeAssistant.init() call, and list_assistant_options returns every avatar, background, and mode. Full developer docs at /docs/assistant-widget and a step-by-step tutorial walk through every option, the JavaScript API, and the agent workflow.</description>
</item>
+ <item>
+ <title>TradingView charts on every coin page</title>
+ <link>https://three.ws/coin/bitcoin</link>
+ <guid isPermaLink="false">2026-07-19:TradingView charts on every coin page</guid>
+ <pubDate>Sun, 19 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Every /coin page (like /coin/bitcoin) now has a chart-source toggle: keep the fast native line chart or switch to a full TradingView advanced chart with candlesticks, indicators, and drawing tools. Your choice is remembered across coins and visits, and the widget follows the site theme.</description>
+ </item>
<item>
<title>Assistant widget</title>
<link>https://three.ws/assistant</link>
diff --git a/public/features.json b/public/features.json
index 33fe7cff4..3a993036c 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-19T02:04:17.739Z",
+ "generated_at": "2026-07-19T03:48:34.491Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/coin-page.js b/src/coin-page.js
index fe31ab10b..20f35ee4f 100644
--- a/src/coin-page.js
+++ b/src/coin-page.js
@@ -112,7 +112,83 @@ function renderHead(coin) {
// ── Chart ───────────────────────────────────────────────────────────────────
-const chartState = { days: 30, series: [], loading: true, error: null };
+// Two chart sources share the panel: the native SVG line chart (default, zero
+// third-party weight) and TradingView's advanced chart widget, lazy-mounted
+// only when the user switches to it. The choice persists across coins.
+const CHART_MODE_KEY = 'tws_coin_chart_mode';
+
+function storedChartMode() {
+ try {
+ return localStorage.getItem(CHART_MODE_KEY) === 'tradingview' ? 'tradingview' : 'simple';
+ } catch {
+ return 'simple';
+ }
+}
+
+const chartState = { days: 30, series: [], loading: true, error: null, mode: storedChartMode() };
+
+// TradingView resolves an unprefixed BASE+QUOTE pair (e.g. BTCUSD) to its
+// top-liquidity listing, so no exchange mapping table is needed.
+function tvSymbol(coin) {
+ const sym = (coin.symbol || '').toUpperCase();
+ return sym && /^[A-Z0-9]{1,15}$/.test(sym) ? `${sym}USD` : null;
+}
+
+let tvThemeObserver = null;
+
+function mountTradingView(coin) {
+ const host = $('cv-tv');
+ const symbol = tvSymbol(coin);
+ if (!host || !symbol) return;
+ const theme = document.documentElement.getAttribute('data-theme') === 'light' ? 'light' : 'dark';
+ const container = document.createElement('div');
+ container.className = 'tradingview-widget-container';
+ container.style.height = '100%';
+ const widget = document.createElement('div');
+ widget.className = 'tradingview-widget-container__widget';
+ widget.style.height = '100%';
+ container.appendChild(widget);
+ const script = document.createElement('script');
+ script.src = 'https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js';
+ script.type = 'text/javascript';
+ script.async = true;
+ script.text = JSON.stringify({
+ autosize: true,
+ symbol,
+ interval: 'D',
+ timezone: 'Etc/UTC',
+ theme,
+ style: '1',
+ locale: 'en',
+ allow_symbol_change: true,
+ save_image: false,
+ support_host: 'https://www.tradingview.com',
+ });
+ container.appendChild(script);
+ host.replaceChildren(container);
+
+ // The widget bakes its theme in at mount time, so a live theme switch
+ // needs a re-mount.
+ if (!tvThemeObserver) {
+ tvThemeObserver = new MutationObserver(() => {
+ if (chartState.mode === 'tradingview') mountTradingView(coin);
+ });
+ tvThemeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
+ }
+}
+
+function setChartMode(coin, mode) {
+ if (mode === chartState.mode) return;
+ chartState.mode = mode;
+ try {
+ localStorage.setItem(CHART_MODE_KEY, mode);
+ } catch {
+ // Private browsing: the toggle still works for this page view.
+ }
+ renderChart(coin);
+ // Entering native mode with no data yet loads it on demand.
+ if (mode === 'simple' && !chartState.series.length && !chartState.loading) loadChart(coin);
+}
const CHART_W = 800;
const CHART_H = 300;
@@ -146,15 +222,30 @@ function chartGeometry(series) {
function renderChart(coin) {
const el = $('cv-chart');
- const { days, series, loading, error } = chartState;
-
- const rangeBtns = TIME_RANGES.map(
- (r) =>
- `<button type="button" class="cv-range-btn" data-days="${r.days}" aria-pressed="${r.days === days}">${r.label}</button>`,
- ).join('');
+ const { days, series, loading, error, mode } = chartState;
+ const tvAvailable = tvSymbol(coin) != null;
+ const tv = mode === 'tradingview' && tvAvailable;
+
+ const rangeBtns = tv
+ ? ''
+ : TIME_RANGES.map(
+ (r) =>
+ `<button type="button" class="cv-range-btn" data-days="${r.days}" aria-pressed="${r.days === days}">${r.label}</button>`,
+ ).join('');
+
+ const modeBtns = tvAvailable
+ ? `<div class="cv-ranges cv-chart-modes" role="group" aria-label="Chart source">
+ <button type="button" class="cv-range-btn" data-mode="simple" aria-pressed="${!tv}">Line</button>
+ <button type="button" class="cv-range-btn" data-mode="tradingview" aria-pressed="${tv}">TradingView</button>
+ </div>`
+ : '';
let body;
- if (loading) {
+ if (tv) {
+ body = `
+ <div class="cv-tv-wrap" id="cv-tv" aria-label="TradingView chart for ${esc(coin.name)}"></div>
+ <p class="cv-tv-credit"><a href="https://www.tradingview.com/symbols/${esc(tvSymbol(coin))}/" target="_blank" rel="noopener nofollow noreferrer">${esc(coin.symbol || coin.name)} chart by TradingView ↗</a></p>`;
+ } else if (loading) {
body = '<div class="cv-chart-state"><span class="cv-spinner" aria-hidden="true"></span>Loading chart…</div>';
} else if (error || series.length < 2) {
body = '<div class="cv-chart-state">Chart data unavailable</div>';
@@ -194,7 +285,7 @@ function renderChart(coin) {
}
const pct =
- !loading && !error && series.length >= 2
+ !tv && !loading && !error && series.length >= 2
? (() => {
const g = chartGeometry(series);
return `<span class="pct ${g.up ? 'cv-up' : 'cv-down'} cv-mono">${esc(formatPercent(g.changePct))}</span>`;
@@ -205,12 +296,15 @@ function renderChart(coin) {
<div class="cv-chart-panel">
<div class="cv-chart-bar">
<div class="left"><span class="title">Price Chart</span>${pct}</div>
- <div class="cv-ranges" role="group" aria-label="Chart time range">${rangeBtns}</div>
+ <div class="cv-chart-controls">
+ ${rangeBtns ? `<div class="cv-ranges" role="group" aria-label="Chart time range">${rangeBtns}</div>` : ''}
+ ${modeBtns}
+ </div>
</div>
${body}
</div>`;
- el.querySelectorAll('.cv-range-btn').forEach((btn) => {
+ el.querySelectorAll('.cv-range-btn[data-days]').forEach((btn) => {
btn.addEventListener('click', () => {
const d = Number(btn.dataset.days);
if (d === chartState.days) return;
@@ -218,8 +312,12 @@ function renderChart(coin) {
loadChart(coin);
});
});
+ el.querySelectorAll('.cv-range-btn[data-mode]').forEach((btn) => {
+ btn.addEventListener('click', () => setChartMode(coin, btn.dataset.mode));
+ });
- wireChartPointer();
+ if (tv) mountTradingView(coin);
+ else wireChartPointer();
}
function wireChartPointer() {
@@ -788,7 +886,15 @@ async function main() {
upd.textContent = `Last updated: ${new Date(coin.last_updated).toLocaleString()}`;
}
// Chart, markets, and news stream in independently of the core profile.
- loadChart(coin);
+ // A remembered TradingView preference mounts the widget directly and
+ // defers the native OHLC fetch until the user switches back.
+ if (chartState.mode === 'tradingview' && tvSymbol(coin)) {
+ chartState.loading = false;
+ renderChart(coin);
+ } else {
+ chartState.mode = 'simple';
+ loadChart(coin);
+ }
loadMarkets(coin);
loadNews(coin);
}
diff --git a/tests/branding-allowlist.json b/tests/branding-allowlist.json
index 7728a878b..2ef46cca4 100644
--- a/tests/branding-allowlist.json
+++ b/tests/branding-allowlist.json
@@ -413,5 +413,10 @@
"pattern": "Avaturn",
"file": "docs/forge-pipeline.md",
"reason": "Rig-convention compatibility list - names the third-party skeleton naming conventions glb-canonicalize maps; technical compatibility statement, not brand promotion."
+ },
+ {
+ "pattern": "three.ws, R2, Ready Player Me)",
+ "file": "docs/assistant-widget.md",
+ "reason": "Documents the widget's external-GLB host allowlist, which genuinely includes models.readyplayer.me (see multiplayer/src/avatar-url.js): a factual capability listing, not user-facing promotion."
}
]