FigJam Diagram: Polymarket Lab — Prediction Market Research Platform (expires 2026-04-13)
Automated prediction market research and analysis platform. Ingests Polymarket data, builds vector embeddings for semantic similarity, and is designed for AI-driven market research.
| Namespace | polymarket-lab |
| Status | Scaffolded — 6 services at replicas: 0, not yet active |
| Active | market-ingestor (replicas: 1), rag-bridge CronJob (python:3.12-slim, script in ConfigMap) |
| Images | ghcr.io/zolty-mat/polymarket-lab:sha-placeholder (services only — CI/CD not wired) |
| Database | timescale/timescaledb:2.18.2-pg16 (PostgreSQL with time-series extensions) |
| PSS | baseline |
Deployment note: Most services are scaffolded at
replicas: 0pending CI/CD and integration work. Onlymarket-ingestorandrag-bridgeare actively usable. Therag-bridgeCronJob usespython:3.12-slimdirectly with a script embedded in a ConfigMap — it has no dependency on the GHCR image.
| Service | Replicas | Purpose |
|---|---|---|
market-ingestor |
1 (active) | Polls Polymarket API, stores to TimescaleDB. Exposes HTTP :8000, metrics :9090 |
rag-bridge (CronJob) |
*/15 * * * * |
Reads TimescaleDB → embeds via Ollama → upserts to Qdrant polymarket-markets |
strategy-engine |
0 (scaffolded) | Market analysis + trading signal generation |
risk-manager |
0 (scaffolded) | Position sizing + risk limits |
execution-service |
0 (scaffolded) | Order placement |
ai-research-agents |
0 (scaffolded) | Claude research pipeline (Haiku + Sonnet) |
backtest-engine |
0 (scaffolded) | Historical strategy backtesting (on-demand) |
analytics-engine |
0 (scaffolded) | Performance metrics + reporting |
All services load from polymarket-lab-config ConfigMap:
| Key | Value |
|---|---|
STRATEGY_MODE |
paper |
EXECUTION_MODE |
paper |
POLYMARKET_SOURCE |
polymarket |
PGHOST |
postgres.polymarket-lab.svc.cluster.local |
PGDATABASE / PGUSER |
polymarket |
OLLAMA_URL |
http://192.168.1.214:11434 |
OLLAMA_ROUTER_MODEL / OLLAMA_CHAT_MODEL |
llama3.2 |
NEWS_EVAL_BACKEND |
anthropic |
HAIKU_MODEL |
claude-haiku-4-5-20251001 |
SONNET_MODEL |
claude-sonnet-4-6 |
MAX_SONNET_CALLS |
20 |
Model naming note:
HAIKU_MODELandSONNET_MODELuse raw Anthropic model IDs becauseNEWS_EVAL_BACKEND=anthropic— these services call the Anthropic API directly, not through LiteLLM. If the backend is ever switched to LiteLLM, replace with cluster aliases (claude-haiku,claude-sonnet). Do NOT mix raw model IDs with LiteLLM routing.
| Component | Details |
|---|---|
| TimescaleDB | timescale/timescaledb:2.18.2-pg16 — time-series market history, prices, resolutions. 20Gi Longhorn PVC |
| Redis | redis — persistent task queue and cache (10Gi Longhorn PVC, appendonly enabled) |
Qdrant polymarket-markets |
Vector embeddings of market data (via RAG Platform in rag namespace) |
The rag-bridge CronJob runs every 15 minutes and:
nomic-embed-text at 192.168.1.214:11434 (batches of 32)polymarket-markets Qdrant collection (one point per market, stable ID from market UUID)Uses python:3.12-slim with psycopg2-binary + requests installed by an init container. No Harbor image needed.
Secret name: polymarket-lab-secrets
| Key | Purpose |
|---|---|
POLYMARKET_API_KEY |
Polymarket API key for market data access |
POLYMARKET_PRIVATE_KEY |
Polymarket wallet private key for order execution |
OPENAI_API_KEY |
OpenAI/compatible API key (for future OpenAI provider support) |
POSTGRES_PASSWORD |
TimescaleDB password (also read by rag-bridge directly) |
POSTGRES_URI |
Full connection string: postgresql://polymarket:<password>@postgres.polymarket-lab.svc.cluster.local:5432/polymarket |
REDIS_URL |
redis://redis.polymarket-lab.svc.cluster.local:6379/0 |
Bootstrap (see kubernetes/apps/polymarket-lab/secrets.example.yaml for key names):
PW="$(openssl rand -base64 32)"
kubectl create secret generic polymarket-lab-secrets --namespace polymarket-lab \
--from-literal=POLYMARKET_API_KEY=<api-key> \
--from-literal=POLYMARKET_PRIVATE_KEY=<private-key> \
--from-literal=OPENAI_API_KEY=<openai-api-key> \
--from-literal=POSTGRES_PASSWORD="${PW}" \
--from-literal=POSTGRES_URI="postgresql://polymarket:${PW}@postgres.polymarket-lab.svc.cluster.local:5432/polymarket" \
--from-literal=REDIS_URL="redis://redis.polymarket-lab.svc.cluster.local:6379/0"
# AWS credentials for S3 backup
kubectl create secret generic postgres-backup-aws-credentials --namespace polymarket-lab \
--from-literal=AWS_ACCESS_KEY_ID=<from-terraform-output> \
--from-literal=AWS_SECRET_ACCESS_KEY=<from-terraform-output>
All
services.yamlimages useghcr.io/zolty-mat/polymarket-lab:sha-placeholder. No CI/CD workflow has been wired to build and push to GHCR. The 6 scaffolded services + market-ingestor cannot be deployed until a real image exists. Therag-bridgeCronJob is unaffected (usespython:3.12-slim).
Steps to unblock:
ghcr.io/zolty-mat/polymarket-lab:<sha> on commitservices.yaml image tagsreplicas: 1
rag-bridge.yamlnot inkustomization.yaml: Apply manually withkubectl apply -f kubernetes/apps/polymarket-lab/rag-bridge.yaml
postgres-backup-cronjob.yamlnot inkustomization.yaml: Apply manually withkubectl apply -f kubernetes/apps/polymarket-lab/postgres-backup-cronjob.yaml
CronJob schedule: daily at 4:05 AM UTC → s3://k3s-homelab-backups-855878721457/postgres-backups/polymarket-lab/
TimescaleDB compatibility note:
pg_dumprestores hypertables as regular tables. For full chunk-level recovery, migrate totimescaledb-backupin a future iteration.
To activate a scaffolded service (after CI/CD is wired):
kubectl scale deployment -n polymarket-lab <service> --replicas=1:9090/metricskubernetes/apps/polymarket-lab/
namespace.yaml — Namespace, RBAC
postgres.yaml — TimescaleDB StatefulSet + 20Gi PVC
redis.yaml — Redis StatefulSet + 10Gi PVC
services.yaml — ConfigMap, 7 Deployments (1 active + 6 @ replicas:0), Services
rag-bridge.yaml — RAG bridge CronJob (*/15 min) [NOT in kustomization.yaml]
postgres-backup-cronjob.yaml — S3 backup CronJob (4:05 AM) [NOT in kustomization.yaml]
secrets.example.yaml — Secret key reference template
grafana-dashboard.yaml — Pre-provisioned Grafana dashboard
servicemonitor.yaml — Prometheus ServiceMonitor
kubernetes/core/pod-security-standards.yaml
— baseline PSS enforcement
rag-bridge