import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{n as t,t as n}from"./types-CgHs3Dg6.mjs";const r={path:`/positions/:address`,categories:[`finance`],example:`/polymarket/positions/0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b`,parameters:{address:`Wallet address (0x...)`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`User Positions`,url:`polymarket.com`,maintainers:[`heqi201255`],handler:i};async function i(r){let i=r.req.param(`address`),a=null,o=[];try{a=await e(`${t}/public-profile`,{query:{address:i}})}catch{}try{o=await e(`${n}/positions`,{query:{user:i,limit:50,sortBy:`CURRENT`,sortDirection:`DESC`}})}catch{}let s=a?.name||a?.pseudonym||i,c=o.map(e=>({title:e.title||`Position #${e.conditionId.slice(0,8)}`,description:`
            <p><strong>Outcome:</strong> ${e.outcome||`#${e.outcomeIndex}`}</p>
            <p><strong>Size:</strong> ${Number(e.size).toLocaleString()}</p>
            <p><strong>Avg Price:</strong> $${Number(e.avgPrice).toFixed(4)}</p>
            <p><strong>Current Price:</strong> $${Number(e.curPrice).toFixed(4)}</p>
            <p><strong>Current Value:</strong> $${Number(e.currentValue).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}</p>
            <p><strong>PnL:</strong> ${e.cashPnl>=0?`+`:``}$${Number(e.cashPnl).toFixed(2)} (${e.percentPnl>=0?`+`:``}${Number(e.percentPnl).toFixed(1)}%)</p>
            <img src="${e.icon}" alt="${e.title||`Position`}" style="max-width: 100%;">
        `,link:e.eventSlug?`https://polymarket.com/event/${e.eventSlug}`:e.slug?`https://polymarket.com/event/${e.slug}`:`https://polymarket.com`,author:s}));return{title:`Polymarket Positions - ${s}`,link:`https://polymarket.com/portfolio?address=${i}`,item:c}}export{r as route};