PolyMas Developer Docs
Complete guide to building with Christmas prediction markets
What is PolyMas?
PolyMas curates real prediction markets from Polymarket that resolve before Christmas 2025. We aggregate the most compelling markets across politics, economics, technology, and world events—giving you a festive countdown to see which predictions come true before the holidays.
Real Markets
Live data from Polymarket
Before Christmas
All markets resolve by Dec 25
Community Driven
Powered by crowd wisdom
Code Examples
Authentication with Supabase
PolyMas uses Supabase for authentication. Here's how to sign up and log in users:
import { createBrowserClient } from '@/lib/supabase/client'
async function handleSignUp(email: string, password: string) {
const supabase = createBrowserClient()
const { data, error } = await supabase.auth.signUp({
email,
password,
options: {
emailRedirectTo: process.env.NEXT_PUBLIC_DEV_SUPABASE_REDIRECT_URL
|| window.location.origin
}
})
if (error) {
console.error('Sign up error:', error.message)
return
}
// User created successfully
console.log('User signed up:', data.user)
}import { createBrowserClient } from '@/lib/supabase/client'
async function handleLogin(email: string, password: string) {
const supabase = createBrowserClient()
const { data, error } = await supabase.auth.signInWithPassword({
email,
password
})
if (error) {
console.error('Login error:', error.message)
return
}
// User logged in successfully
console.log('User logged in:', data.user)
router.push('/')
}Adding Favorites
Users can bookmark markets to track them. Here's how to implement favorites:
import { createBrowserClient } from '@/lib/supabase/client'
async function toggleFavorite(marketId: string, userId: string) {
const supabase = createBrowserClient()
// Check if already favorited
const { data: existing } = await supabase
.from('favorites')
.select('*')
.eq('user_id', userId)
.eq('market_id', marketId)
.single()
if (existing) {
// Remove favorite
await supabase
.from('favorites')
.delete()
.eq('user_id', userId)
.eq('market_id', marketId)
} else {
// Add favorite
await supabase
.from('favorites')
.insert({ user_id: userId, market_id: marketId })
}
}Search & Filter Markets
Implement client-side filtering for markets by keyword and category:
const [searchQuery, setSearchQuery] = useState('')
const [selectedCategory, setSelectedCategory] = useState('All')
const filteredMarkets = markets.filter((market) => {
// Filter by search query
const matchesSearch = market.question
.toLowerCase()
.includes(searchQuery.toLowerCase())
// Filter by category
const matchesCategory =
selectedCategory === 'All' ||
market.category === selectedCategory
return matchesSearch && matchesCategory
})
// Render filtered markets
{filteredMarkets.map((market) => (
<MarketCard key={market.id} market={market} />
))}Theme Toggle (Light/Dim/Dark)
PolyMas supports three themes: light, dim, and dark. Here's how to implement the theme toggle:
const [theme, setTheme] = useState<'light' | 'dim' | 'dark'>('dim')
useEffect(() => {
// Load saved theme from localStorage
const savedTheme = localStorage.getItem('theme')
if (savedTheme) {
setTheme(savedTheme as 'light' | 'dim' | 'dark')
}
}, [])
useEffect(() => {
// Apply theme to document
document.documentElement.classList.remove('light', 'dim', 'dark')
document.documentElement.classList.add(theme)
localStorage.setItem('theme', theme)
}, [theme])
const cycleTheme = () => {
setTheme((current) => {
if (current === 'light') return 'dim'
if (current === 'dim') return 'dark'
return 'light'
})
}API Reference
Market Data Structure
interface Market {
id: string
question: string
category: 'Politics' | 'Crypto' | 'Economy' | 'Sports' | 'Entertainment' | 'World'
image: string
endDate: string
volume: string
traders: string
yesPrice: number
noPrice: number
url: string
}
// Example market object
const market: Market = {
id: 'us-recession-2025',
question: 'US recession before Christmas?',
category: 'Economy',
image: '/us-economy-recession-stock-market-chart.jpg',
endDate: 'Dec 25, 2025',
volume: '$5.0M',
traders: '8,234',
yesPrice: 4,
noPrice: 96,
url: 'https://polymarket.com/event/us-recession-in-2025'
}Database Schema
PolyMas uses Supabase with the following database schema:
CREATE TABLE IF NOT EXISTS favorites (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
market_id TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
UNIQUE(user_id, market_id)
);
-- Enable Row Level Security
ALTER TABLE favorites ENABLE ROW LEVEL SECURITY;
-- Users can only see their own favorites
CREATE POLICY "Users can view own favorites"
ON favorites FOR SELECT
USING (auth.uid() = user_id);
-- Users can only insert their own favorites
CREATE POLICY "Users can insert own favorites"
ON favorites FOR INSERT
WITH CHECK (auth.uid() = user_id);
-- Users can only delete their own favorites
CREATE POLICY "Users can delete own favorites"
ON favorites FOR DELETE
USING (auth.uid() = user_id);Key Features
Secure Authentication
Email/password authentication with Supabase, session management, and protected routes
Favorites System
Bookmark markets to track, stored in Supabase with RLS policies for security
Search & Filter
Real-time search by keyword and filter by category (Politics, Crypto, Economy, etc.)
Theme Support
Three themes (light, dim, dark) with smooth transitions and localStorage persistence
Live Countdown
Real-time countdown to Christmas with days, hours, minutes, and seconds
Market Analytics
View probability charts, trading volume, and market statistics
How Prediction Markets Work
Prediction markets let you bet on future events. Each market has two outcomes: Yes or No.
Yes Shares
Buy Yes shares if you believe the event will happen. If it does, each share pays out $1.00.
No Shares
Buy No shares if you believe the event won't happen. If it doesn't, each share pays out $1.00.
Understanding Prices
Market prices represent the crowd's probability that an event will occur:
71¢ Yes price = 71% chance the event happens
29¢ No price = 29% chance the event doesn't happen
Yes price + No price always equals $1.00
Example:
If "NVIDIA largest company before Christmas" trades at 71¢, the market believes there's a 71% probability NVIDIA will be the world's largest company by market cap before December 25, 2025.
Getting Started
Ready to participate in prediction markets?
- 1
Browse markets on PolyMas to find interesting predictions
- 2
Click Yes or No to select your prediction
- 3
Review the market details in the confirmation panel
- 4
Click 'Continue to Polymarket' to complete your trade
- 5
Watch the countdown and see if your prediction comes true!
Important Disclaimer
PolyMas is an independent aggregator and is not affiliated with Polymarket. All markets, prices, and data are sourced from Polymarket. Market data displayed on PolyMas may not reflect real-time prices—visit Polymarket directly for live trading data. Trading involves risk, and you should only participate with funds you can afford to lose. Past performance does not guarantee future results. Please review Polymarket's terms of service before trading.
