7.8 KiB
Real Money Enablement Roadmap
This app is currently paper trading only. The Live Money tab and /api/live
endpoint are readiness scaffolding: they make the required product and backend
interfaces visible without moving funds or placing orders.
What is configured now
.env.examplelists the environment variables the production app needs./api/livereports which live-money providers are configured or missing./api/liveaccepts order intents only as dry-runs and returns an audit event./api/accountscreates, logs into, and saves password-backed paper accounts through Vercel Blob storage./api/configexposes safe public provider configuration, including the Sentry browser DSN and Clerk publishable key once configured./api/livenow checks the selected provider stack: Clerk, Neon, Veriff, Circle, and Sentry./api/webhooks/clerk,/api/webhooks/veriff, and/api/webhooks/circlereceive provider events and store them in Neon./api/provider-eventsreports provider event counts for a quick health check./api/policiesexposes the active policy/readiness state./api/consentrecords versioned user consent after approved versions are configured./api/risk-profilestores wallet, jurisdiction, allocation, and agent permission settings server-side./api/incidentrecords incident events and can notify the configured incident webhook afterRISK_ADMIN_TOKENis set.- The Live Money tab shows launch checks, wallet/deposit settings, agent risk limits, provider webhook URLs, a dry-run order console, and an audit preview.
The app still refuses to place live orders. That is intentional until the legal, provider, wallet-signing, reconciliation, and monitoring steps below are done.
Required before live deposits or trading
-
Legal and eligibility
- Terms, risk disclosures, privacy policy, and jurisdiction policy.
- KYC / KYB provider.
- Age, location, sanctions, and restricted-market checks.
- Market category policy for elections, sports, finance, crypto, geopolitical events, manipulated markets, disputed markets, and restricted outcomes.
- Record of user consent to every active terms, privacy, and risk-disclosure version.
-
Account and wallet
- Real authentication for live-money users.
- Production account database. The current backend account API is enough for paper portfolios, but live money should use a real database with admin, audit, and compliance tooling.
- Password reset, sign-out, session expiry, and optional MFA path.
- Non-custodial wallet connection or Polymarket deposit-wallet flow.
- User-controlled permissions for each agent.
- Revocation path so a user can stop agent trading immediately.
-
Funds
- Deposit provider.
- Withdrawal provider.
- Payment webhooks and failure handling.
- Balance reconciliation, statements, support, and accounting exports.
- Withdrawal review rules for fraud, sanctions, chargeback, and settlement edge cases.
-
Execution
- Backend order router.
- Polymarket CLOB API credentials.
- EIP-712 order-signing flow.
- Order placement, cancellation, fill tracking, and position reconciliation.
- Idempotency keys, retry policy, rate limits, and stale-order protection.
- Server-side enforcement of user permissions and risk limits.
-
Risk and controls
- Per-agent max allocation.
- Per-market max position size.
- Category exclusions.
- Manual approval mode.
- Emergency pause and cancel-all.
- Always-available withdrawal path.
- Admin kill switch.
- Market blacklist and category exclusion controls.
-
Audit and monitoring
- Durable append-only audit log.
- Signal, approval, order, fill, cancellation, deposit, and withdrawal events.
- Admin monitoring and incident response.
- Error tracking, uptime monitoring, webhook monitoring, and alert routing.
- Customer support process and data retention policy.
-
Testing and launch operations
- Paper-to-live parity tests.
- Test wallets and dry-run order intents.
- KYC, payments, wallet, CLOB, and webhook integration tests.
- Reconciliation tests for partial fills, cancellations, market resolution, withdrawals, failed deposits, and duplicate webhooks.
- Rollback plan and incident response drill.
Environment variables expected by /api/live
Copy .env.example into your local environment for development, then add the
same variables in Vercel Project Settings -> Environment Variables for
production.
KYC_PROVIDERKYC_API_KEYKYC_WEBHOOK_SECRETSANCTIONS_PROVIDERSANCTIONS_API_KEYGEOIP_PROVIDERGEOIP_API_KEYRESTRICTED_JURISDICTIONSTERMS_VERSIONPRIVACY_VERSIONRISK_DISCLOSURE_VERSIONMARKET_POLICY_STOREAUTH_PROVIDERDATABASE_URLSESSION_SECRETENCRYPTION_KEYPAYMENTS_PROVIDERPAYMENTS_API_KEYPAYMENTS_WEBHOOK_SECRETWEBHOOK_BASE_URLWALLET_PROVIDERWALLET_PROJECT_IDWALLET_API_KEYDEPOSIT_WALLET_ADDRESSPOLYMARKET_SIGNATURE_TYPE=3POLYMARKET_CHAIN_ID=137SETTLEMENT_ASSET=pUSDSETTLEMENT_CHAIN=polygonPOLYMARKET_CLOB_API_KEYPOLYMARKET_CLOB_SECRETPOLYMARKET_CLOB_PASSPHRASERECONCILIATION_STOREACCOUNTING_EXPORT_STORERATE_LIMIT_STOREAUDIT_LOG_STOREMONITORING_DSNINCIDENT_WEBHOOK_URLADMIN_ALERT_EMAILCUSTOMER_SUPPORT_EMAILLIVE_TRADING_ENABLED=trueonly after final approval and end-to-end testing
Even when all variables are present, live order placement remains intentionally unimplemented until wallet signing, compliance approval, and safe order routing are completed.
Polymarket integration notes
Polymarket's public docs describe trading as non-custodial. Orders are signed
and matched through the CLOB, and new API users generally use the deposit-wallet
flow with signature type 3.
Useful official docs:
- Trading overview: https://docs.polymarket.com/trading/overview
- Trading quickstart: https://docs.polymarket.com/trading/quickstart
- Deposit wallets: https://docs.polymarket.com/trading/deposit-wallets
Final setup checklist
- Choose and contract the KYC / eligibility provider.
- Choose and contract the sanctions/watchlist and geo-IP/geofencing providers.
- Choose the deposit and withdrawal provider.
- Choose the wallet or embedded-wallet provider and create a deposit wallet.
- Build production accounts: auth, sessions, password reset, sign-out, account database, consent records, and portfolio history storage.
- Derive or create Polymarket CLOB credentials for the approved signing flow.
- Build the live order router with signing, submission, cancellation, fill tracking, idempotency, rate limits, and stale-order protection.
- Build continuous reconciliation for cash, open orders, fills, positions, withdrawals, fees, and resolved markets.
- Enforce every user permission and risk limit on the server, not only in the browser.
- Create durable append-only audit storage, statements, exports, monitoring, alerting, and support procedures.
- Complete legal review, terms, privacy policy, risk disclosures, restricted jurisdiction rules, market category policy, and incident response plan.
- Add all environment variables in Vercel.
- Run dry-runs and test-wallet trades; verify webhooks, audit events, reconciliation, and user withdrawal paths.
- Only then set
LIVE_TRADING_ENABLED=true.
What still cannot be completed from code alone
- Legal approval and jurisdiction-specific advice.
- KYC/KYB, sanctions, payments, wallet, and support vendor contracts.
- Real provider API keys, webhook secrets, CLOB credentials, and deposit wallet addresses.
- Bank, stablecoin, or payment settlement relationships.
- Production security review and incident-response ownership.
- Final decision to enable live trading.