@rich-apis/poly-widgets
v1.0.0
Published
Embeddable Polymarket odds widgets for blogs and news sites
Downloads
96
Maintainers
Readme
Poly Widgets
Embeddable Polymarket odds widgets for blogs and news sites. One script tag gives you live probability bars that auto-refresh every 60 seconds. Under 10KB, no dependencies.
Quick Start
Add this to any HTML page:
<script src="https://your-domain.vercel.app/embed.js"
data-market-slug="will-donald-trump-win-the-2024-us-presidential-election"
data-theme="light">
</script>The widget renders itself right after the script tag. No extra divs, no CSS imports, no build step.
Configuration
All config goes through data- attributes on the script tag:
| Attribute | Default | Description |
|---|---|---|
| data-market-slug | required | Polymarket market slug |
| data-market-id | - | Alternative: use market ID instead of slug |
| data-theme | light | light or dark |
| data-width | 480px | Max width of the widget |
| data-key | - | API key (white-label/premium tiers) |
JavaScript API
For programmatic use:
// Include embed.js on the page first
var widget = PolyWidget.create('#my-container', {
slug: 'market-slug-here',
theme: 'dark',
apiBase: 'https://your-domain.vercel.app'
});
// Refresh manually
widget.refresh();
// Remove the widget
widget.destroy();npm Install
npm install @rich-apis/poly-widgetsrequire('@rich-apis/poly-widgets');
// PolyWidget is now available globallySelf-Hosting
Prerequisites
- Node.js 18+
- Vercel CLI (
npm i -g vercel)
Setup
- Clone the repo
- Copy
.env.exampleto.env - Run
vercel devfor local development - Deploy with
vercel --prod
API Endpoints
GET /api/v1/market?slug=xxx- Fetch a single market by slugGET /api/v1/market?id=xxx- Fetch a single market by IDGET /api/v1/markets?q=xxx&limit=10- Search/list markets
API Key Tiers
Set these in your .env to enable paid tiers:
WHITELABEL_KEYS- Comma-separated keys for the $9/mo tier (removes branding)PREMIUM_KEYS- Comma-separated keys for the $29/mo tier (extra data fields)
Pricing
| Tier | Price | What you get | |---|---|---| | Free | $0 | All features, "Powered by PolySignals" branding | | White Label | $9/mo | No branding | | Premium | $29/mo | No branding, extended market data, volume/liquidity details |
Project Structure
poly-widgets/
api/v1/
market.js # Single market endpoint
markets.js # List/search endpoint
public/
embed.js # The widget (include this on your site)
index.html # Landing page
demo.html # Live demo page
.env.example
vercel.json
package.jsonDisclaimer
This is an analytical tool. Not financial advice. Past data does not predict future results. Market data sourced from public Polymarket APIs.
