{"uid":"cap_jrkXca-jGS-dVE_j5Dtwd","slug":"layer-prediction-market-position-sizer-e3d51555","name":"Layer Prediction Market Position Sizer","description":"One API for prediction markets. Find markets, stream normalized data, place orders, and track positions across Kalshi and Polymarket.","url":"https://uselayer.sh/v0/size?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"kalshi":{"type":"object","required":["asks"],"properties":{"asks":{"type":"array"}}},"min_edge":{"type":"number"},"polymarket":{"type":"object","properties":{"asks":{"type":"array"}}},"polymarket_us":{"type":"object","properties":{"asks":{"type":"array"}}}}},"responseSchema":{"type":"json","example":{"contracts":100,"limited_by":"kalshi_book","net_profit":1.2,"profitable":true,"edge_at_best":0.012}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_OfWZqnDh2ooYO-QgSOu8A","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates the optimal contract size to trade across Kalshi and Polymarket order books, returning profitability, edge, and limiting venue given ask arrays and a minimum edge threshold.","exampleAgentPrompt":"I want to trade the 'Fed rate cut by December' market — here are the ask arrays from Kalshi and Polymarket, can you calculate the optimal number of contracts to buy given a minimum edge of 1.5% and tell me if the trade is profitable?","exampleUseCases":[{"title":"Pre-trade position sizing check","prompt":"Before I place this order on Kalshi, run the position sizer with these ask arrays and a minimum edge of 2% — how many contracts should I buy and what's my expected net profit?"},{"title":"Cross-venue arbitrage sizing","prompt":"I see the same election market on both Kalshi and Polymarket. Here are the ask arrays from both — what's the maximum number of contracts I can trade profitably with at least 1% edge, and which venue is limiting me?"},{"title":"Automated trading bot edge validation","prompt":"My bot is about to fire an order. Feed these Kalshi and Polymarket US ask arrays through the position sizer with a 0.5% minimum edge threshold and confirm the trade is profitable before I proceed."}],"resultDescription":"Returns a JSON object with: 'contracts' (integer number of contracts to trade), 'net_profit' (expected profit in dollars), 'profitable' (boolean), 'edge_at_best' (fractional edge at the best price level), and 'limited_by' (string identifying which venue's order book is the binding constraint, e.g. 'kalshi_book').","failureModes":["Empty or malformed ask arrays return an error or zero contracts","No profitable size found when min_edge is too high returns profitable: false with contracts: 0","Missing required kalshi.asks field causes a 400 validation error","Stale order book data may cause calculated edge to differ from live market","Payment failure (x402) causes the call to be rejected before computation"],"whenToPreferThis":"Use this endpoint when you need to compute an optimal trade size across Kalshi and/or Polymarket before placing an order, especially when you want to enforce a minimum edge threshold and understand which venue's liquidity is the binding constraint. Prefer this over manual calculation or generic math tools because it understands prediction market order book structure and returns venue-aware sizing natively. Best suited for algorithmic trading workflows where position sizing must be computed programmatically in real time.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-17T18:34:29.282Z","isFirstParty":false,"canonicalSlug":"layer-prediction-market-position-sizer-e3d51555"}