investing 0.1.183 → 0.1.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -150
- package/dist/{archiver-web.es-BAZhTohv.js → archiver-web.es-B69gABHP.js} +1 -1
- package/dist/{archiver-web.es-CXGzGjgP.cjs → archiver-web.es-fg4bLLZa.cjs} +1 -1
- package/dist/bookmakerAnalysis-Bfo1zUVm.js +1 -0
- package/dist/bookmakerAnalysis-CHn1W8uX.cjs +1 -0
- package/dist/callGrok-D0D7zBHK.js +1 -0
- package/dist/callGrok-DWO719mN.cjs +1 -0
- package/dist/db/index.d.ts +0 -17
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/schema.d.ts +0 -17
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/events-BJOyGWeU.cjs +1 -0
- package/dist/events-OvBb8rgy.js +1 -0
- package/dist/index-D7fsk2gy.js +15 -0
- package/dist/index-_V1Ql5Es.cjs +13 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/live-data/dukascopy-client.d.ts +2 -19
- package/dist/live-data/dukascopy-client.d.ts.map +1 -1
- package/dist/polymarket-updown-15-limit-order-bot-DCC8HE9Z.cjs +1 -0
- package/dist/polymarket-updown-15-limit-order-bot-Dv5oGAF4.js +1 -0
- package/dist/predictos/agents/bookmaker-agent.d.ts.map +1 -0
- package/dist/predictos/agents/event-analysis-agent.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/agents/index.d.ts +1 -5
- package/dist/predictos/agents/index.d.ts.map +1 -0
- package/dist/predictos/agents/index.js +1 -0
- package/dist/predictos/agents/index.mjs +1 -0
- package/dist/predictos/agents/mapper-agent.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/agents/polyfactual-research.d.ts +1 -1
- package/dist/predictos/agents/polyfactual-research.d.ts.map +1 -0
- package/dist/predictos/agents/polymarket-position-tracker.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/agents/polymarket-put-order.d.ts +1 -1
- package/dist/predictos/agents/polymarket-put-order.d.ts.map +1 -0
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts.map +1 -0
- package/dist/predictos/agents/x402-seller.d.ts.map +1 -0
- package/dist/predictos/ai/callBlockRun.d.ts.map +1 -0
- package/dist/predictos/ai/callGrok.d.ts.map +1 -0
- package/dist/predictos/ai/callOpenAI.d.ts.map +1 -0
- package/dist/predictos/ai/http.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/ai/index.d.ts +1 -1
- package/dist/predictos/ai/index.d.ts.map +1 -0
- package/dist/predictos/ai/index.js +1 -0
- package/dist/predictos/ai/index.mjs +1 -0
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts.map +1 -0
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts.map +1 -0
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts.map +1 -0
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts.map +1 -0
- package/dist/predictos/ai/types.d.ts.map +1 -0
- package/dist/predictos/arbitrage.d.ts.map +1 -0
- package/dist/predictos/arbitrage.js +1 -0
- package/dist/predictos/arbitrage.mjs +1 -0
- package/dist/{prediction-markets → predictos}/clients/polyfactual.d.ts +1 -1
- package/dist/predictos/clients/polyfactual.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/clients/polymarket.d.ts +1 -1
- package/dist/predictos/clients/polymarket.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/clients/x402.d.ts +1 -1
- package/dist/predictos/clients/x402.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/data/kalshi.d.ts +1 -1
- package/dist/predictos/data/kalshi.d.ts.map +1 -0
- package/dist/predictos/data/kalshi.js +1 -0
- package/dist/predictos/data/kalshi.mjs +1 -0
- package/dist/{prediction-markets → predictos}/data/polymarket.d.ts +1 -1
- package/dist/predictos/data/polymarket.d.ts.map +1 -0
- package/dist/predictos/data/polymarket.js +1 -0
- package/dist/predictos/data/polymarket.mjs +1 -0
- package/dist/predictos/events.d.ts.map +1 -0
- package/dist/{prediction-markets → predictos}/index.d.ts +5 -7
- package/dist/predictos/index.d.ts.map +1 -0
- package/dist/predictos/index.js +1 -0
- package/dist/predictos/index.mjs +1 -0
- package/dist/{prediction-markets → predictos}/types.d.ts +2 -118
- package/dist/predictos/types.d.ts.map +1 -0
- package/dist/searchQueryGenerator-DIIs9xw5.js +1 -0
- package/dist/searchQueryGenerator-rCVblXJS.cjs +1 -0
- package/dist/stocks/index.d.ts +1 -0
- package/dist/stocks/index.d.ts.map +1 -1
- package/dist/stocks/quote-cache-service.d.ts +2 -11
- package/dist/stocks/quote-cache-service.d.ts.map +1 -1
- package/dist/stocks/unified-quote-service.d.ts +6 -15
- package/dist/stocks/unified-quote-service.d.ts.map +1 -1
- package/dist/stocks/yahoo-finance-wrapper.d.ts +3 -39
- package/dist/stocks/yahoo-finance-wrapper.d.ts.map +1 -1
- package/dist/trading-agents/agents/debate-facilitator.d.ts +3 -3
- package/dist/trading-agents/agents/debate-facilitator.d.ts.map +1 -1
- package/dist/trading-agents/agents/fund-manager.d.ts +2 -4
- package/dist/trading-agents/agents/fund-manager.d.ts.map +1 -1
- package/dist/trading-agents/agents/improved-researchers.d.ts +3 -3
- package/dist/trading-agents/agents/improved-researchers.d.ts.map +1 -1
- package/dist/trading-agents/agents/market-analyst.d.ts +2 -2
- package/dist/trading-agents/agents/market-analyst.d.ts.map +1 -1
- package/dist/trading-agents/agents/news-analyst.d.ts +2 -2
- package/dist/trading-agents/agents/news-analyst.d.ts.map +1 -1
- package/dist/trading-agents/agents/researchers.d.ts +4 -4
- package/dist/trading-agents/agents/researchers.d.ts.map +1 -1
- package/dist/trading-agents/agents/risk-team.d.ts +4 -4
- package/dist/trading-agents/agents/risk-team.d.ts.map +1 -1
- package/dist/trading-agents/agents/trader.d.ts +2 -2
- package/dist/trading-agents/agents/trader.d.ts.map +1 -1
- package/dist/trading-agents/graph/trading-graph.d.ts +2 -28
- package/dist/trading-agents/graph/trading-graph.d.ts.map +1 -1
- package/dist/trading-agents/index.d.ts +0 -4
- package/dist/trading-agents/index.d.ts.map +1 -1
- package/dist/trading-agents/types/index.d.ts +4 -11
- package/dist/trading-agents/types/index.d.ts.map +1 -1
- package/dist/trading-agents/utils/llm-client.d.ts +1 -4
- package/dist/trading-agents/utils/llm-client.d.ts.map +1 -1
- package/package.json +49 -17
- package/THIRD_PARTY_NOTICES.md +0 -144
- package/dist/index-CLCVLpr3.js +0 -15
- package/dist/index-XMmZpaC-.cjs +0 -13
- package/dist/prediction-markets/agents/bookmaker-agent.d.ts.map +0 -1
- package/dist/prediction-markets/agents/event-analysis-agent.d.ts.map +0 -1
- package/dist/prediction-markets/agents/index.d.ts.map +0 -1
- package/dist/prediction-markets/agents/kalshi-momentum-agent.d.ts +0 -4
- package/dist/prediction-markets/agents/kalshi-momentum-agent.d.ts.map +0 -1
- package/dist/prediction-markets/agents/mapper-agent.d.ts.map +0 -1
- package/dist/prediction-markets/agents/polyfactual-research.d.ts.map +0 -1
- package/dist/prediction-markets/agents/polymarket-position-tracker.d.ts.map +0 -1
- package/dist/prediction-markets/agents/polymarket-put-order.d.ts.map +0 -1
- package/dist/prediction-markets/agents/polymarket-updown-15-limit-order-bot.d.ts.map +0 -1
- package/dist/prediction-markets/agents/x402-seller.d.ts.map +0 -1
- package/dist/prediction-markets/ai/callBlockRun.d.ts.map +0 -1
- package/dist/prediction-markets/ai/callGrok.d.ts.map +0 -1
- package/dist/prediction-markets/ai/callOpenAI.d.ts.map +0 -1
- package/dist/prediction-markets/ai/http.d.ts.map +0 -1
- package/dist/prediction-markets/ai/index.d.ts.map +0 -1
- package/dist/prediction-markets/ai/prompts/analyzeEventMarkets.d.ts.map +0 -1
- package/dist/prediction-markets/ai/prompts/arbitrageAnalysis.d.ts.map +0 -1
- package/dist/prediction-markets/ai/prompts/bookmakerAnalysis.d.ts.map +0 -1
- package/dist/prediction-markets/ai/prompts/searchQueryGenerator.d.ts.map +0 -1
- package/dist/prediction-markets/ai/types.d.ts.map +0 -1
- package/dist/prediction-markets/arbitrage.d.ts.map +0 -1
- package/dist/prediction-markets/clients/polyfactual.d.ts.map +0 -1
- package/dist/prediction-markets/clients/polymarket.d.ts.map +0 -1
- package/dist/prediction-markets/clients/x402.d.ts.map +0 -1
- package/dist/prediction-markets/data/kalshi.d.ts.map +0 -1
- package/dist/prediction-markets/data/polymarket.d.ts.map +0 -1
- package/dist/prediction-markets/events.d.ts.map +0 -1
- package/dist/prediction-markets/execution/paper.d.ts +0 -18
- package/dist/prediction-markets/execution/paper.d.ts.map +0 -1
- package/dist/prediction-markets/index.d.ts.map +0 -1
- package/dist/prediction-markets/strategies/btc15m-fusion.d.ts +0 -27
- package/dist/prediction-markets/strategies/btc15m-fusion.d.ts.map +0 -1
- package/dist/prediction-markets/strategies/copy-trade-sizing.d.ts +0 -27
- package/dist/prediction-markets/strategies/copy-trade-sizing.d.ts.map +0 -1
- package/dist/prediction-markets/strategies/gabagool.d.ts +0 -26
- package/dist/prediction-markets/strategies/gabagool.d.ts.map +0 -1
- package/dist/prediction-markets/strategies/kalshi-momentum.d.ts +0 -12
- package/dist/prediction-markets/strategies/kalshi-momentum.d.ts.map +0 -1
- package/dist/prediction-markets/types.d.ts.map +0 -1
- package/dist/strategy-signals/data/fixture-data-provider.d.ts +0 -8
- package/dist/strategy-signals/data/fixture-data-provider.d.ts.map +0 -1
- package/dist/strategy-signals/data/openbb-mapping.d.ts +0 -7
- package/dist/strategy-signals/data/openbb-mapping.d.ts.map +0 -1
- package/dist/strategy-signals/demo.d.ts +0 -446
- package/dist/strategy-signals/demo.d.ts.map +0 -1
- package/dist/strategy-signals/execution.d.ts +0 -18
- package/dist/strategy-signals/execution.d.ts.map +0 -1
- package/dist/strategy-signals/fixtures/openbb-data/bars.d.ts +0 -10
- package/dist/strategy-signals/fixtures/openbb-data/bars.d.ts.map +0 -1
- package/dist/strategy-signals/index.d.ts +0 -32
- package/dist/strategy-signals/index.d.ts.map +0 -1
- package/dist/strategy-signals/proposal.d.ts +0 -10
- package/dist/strategy-signals/proposal.d.ts.map +0 -1
- package/dist/strategy-signals/report.d.ts +0 -6
- package/dist/strategy-signals/report.d.ts.map +0 -1
- package/dist/strategy-signals/risk-gate.d.ts +0 -3
- package/dist/strategy-signals/risk-gate.d.ts.map +0 -1
- package/dist/strategy-signals/sources/btc15m-fusion.d.ts +0 -16
- package/dist/strategy-signals/sources/btc15m-fusion.d.ts.map +0 -1
- package/dist/strategy-signals/sources/copy-trade-sizing.d.ts +0 -15
- package/dist/strategy-signals/sources/copy-trade-sizing.d.ts.map +0 -1
- package/dist/strategy-signals/sources/gabagool.d.ts +0 -12
- package/dist/strategy-signals/sources/gabagool.d.ts.map +0 -1
- package/dist/strategy-signals/sources/hedge-fund-technicals.d.ts +0 -42
- package/dist/strategy-signals/sources/hedge-fund-technicals.d.ts.map +0 -1
- package/dist/strategy-signals/sources/kalshi-momentum.d.ts +0 -10
- package/dist/strategy-signals/sources/kalshi-momentum.d.ts.map +0 -1
- package/dist/strategy-signals/sources/kalshi-vibe-guards.d.ts +0 -15
- package/dist/strategy-signals/sources/kalshi-vibe-guards.d.ts.map +0 -1
- package/dist/strategy-signals/sources/kalshi-vibe.d.ts +0 -11
- package/dist/strategy-signals/sources/kalshi-vibe.d.ts.map +0 -1
- package/dist/strategy-signals/sources/red-flags.d.ts +0 -13
- package/dist/strategy-signals/sources/red-flags.d.ts.map +0 -1
- package/dist/strategy-signals/survival-posture.d.ts +0 -13
- package/dist/strategy-signals/survival-posture.d.ts.map +0 -1
- package/dist/strategy-signals/types.d.ts +0 -138
- package/dist/strategy-signals/types.d.ts.map +0 -1
- package/dist/strategy-signals/validate.d.ts +0 -15
- package/dist/strategy-signals/validate.d.ts.map +0 -1
- package/dist/strategy-signals/venues/kalshi-venue-mapping.d.ts +0 -3
- package/dist/strategy-signals/venues/kalshi-venue-mapping.d.ts.map +0 -1
- package/dist/strategy-signals/venues/mock-equity-broker.d.ts +0 -16
- package/dist/strategy-signals/venues/mock-equity-broker.d.ts.map +0 -1
- package/dist/strategy-signals/venues/mock-venue.d.ts +0 -14
- package/dist/strategy-signals/venues/mock-venue.d.ts.map +0 -1
- package/dist/strategy-signals/venues/pmxt-venue-mapping.d.ts +0 -7
- package/dist/strategy-signals/venues/pmxt-venue-mapping.d.ts.map +0 -1
- package/dist/trading-agents/agents/risk-judge.d.ts +0 -13
- package/dist/trading-agents/agents/risk-judge.d.ts.map +0 -1
- package/dist/trading-agents/utils/parse-final-line.d.ts +0 -7
- package/dist/trading-agents/utils/parse-final-line.d.ts.map +0 -1
- package/dist/trading-agents/utils/scripted-llm.d.ts +0 -17
- package/dist/trading-agents/utils/scripted-llm.d.ts.map +0 -1
- package/dist/trading-agents/utils/strategy-prompt.d.ts +0 -6
- package/dist/trading-agents/utils/strategy-prompt.d.ts.map +0 -1
- /package/dist/{prediction-markets → predictos}/agents/bookmaker-agent.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/agents/event-analysis-agent.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/agents/mapper-agent.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/agents/polymarket-position-tracker.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/agents/polymarket-updown-15-limit-order-bot.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/agents/x402-seller.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/callBlockRun.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/callGrok.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/callOpenAI.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/http.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/prompts/analyzeEventMarkets.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/prompts/arbitrageAnalysis.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/prompts/bookmakerAnalysis.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/prompts/searchQueryGenerator.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/ai/types.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/arbitrage.d.ts +0 -0
- /package/dist/{prediction-markets → predictos}/events.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../searchQueryGenerator-rCVblXJS.cjs"),t=require("../callGrok-DWO719mN.cjs"),r=require("./data/kalshi.js"),s="https://gamma-api.polymarket.com",o=["gpt-5.2","gpt-5.1","gpt-5-nano","gpt-4.1","gpt-4.1-mini"];function a(e){return o.includes(e)||e.startsWith("gpt-")}function n(e,t){return"polymarket"===e?`https://polymarket.com/event/${t}`:`https://kalshi.com/events/${t}`}exports.findArbitrage=async function(o,i={}){const c=Date.now(),{url:l,model:m}=o;if(!l)throw new Error("Missing required parameter: 'url'");if(!m)throw new Error("Missing required parameter: 'model'");const u=function(e){const t=e.toLowerCase();return t.includes("polymarket.com")?"polymarket":t.includes("kalshi.com")?"kalshi":null}(l);if(!u)throw new Error("Invalid URL. Must be a Polymarket or Kalshi market URL.");let p=null;const y="polymarket"===u?"kalshi":"polymarket";if("polymarket"===u){const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return"event"===t[0]&&t.length>=2?t[1]:null}catch{return null}}(l);if(!e)throw new Error("Could not extract event slug from Polymarket URL");p=await async function(e){try{const t=`${s}/events/slug/${e}`,r=await fetch(t);if(!r.ok)return console.error("Polymarket event fetch error:",r.status),null;const o=await r.json(),a=[];if(o.markets&&Array.isArray(o.markets))for(const e of o.markets){const t=e.question||e.title||"";let r=50;if(e.outcomePrices)try{const t=JSON.parse(e.outcomePrices);r=100*parseFloat(t[0])}catch{}t&&a.push({title:t,yesPrice:r})}return{eventTitle:o.title||e.replace(/-/g," "),markets:a,source:"polymarket",identifier:o.slug||e}}catch(t){return console.error("Error fetching Polymarket event:",t),null}}(e)}else{const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return("markets"===t[0]||"events"===t[0])&&t.length>=2?(t.length>=4?t[t.length-1]:t[1]).toUpperCase():null}catch{return null}}(l);if(!e)throw new Error("Could not extract ticker from Kalshi URL");p=await async function(e,t){try{const s=await r.dflowRequest(`/event/${e}`,{params:{withNestedMarkets:!0},apiKey:t}),o=[];if(s.markets&&Array.isArray(s.markets))for(const e of s.markets){const t=e.yesSubTitle||"";let r=50;if(e.yesBid&&e.yesAsk){r=(parseFloat(e.yesBid)+parseFloat(e.yesAsk))/2*100}else e.yesBid?r=100*parseFloat(e.yesBid):e.yesAsk&&(r=100*parseFloat(e.yesAsk));t&&o.push({title:t,yesPrice:r})}return{eventTitle:s.title||e,markets:o,source:"kalshi",identifier:e}}catch(s){return console.error("Error fetching Kalshi event:",s),null}}(e,i.dflowApiKey)}if(!p||0===p.markets.length)throw new Error(`Could not fetch event data from ${u}. The event may not exist or have no markets.`);const f=await async function(r,s,o,n,i){const{systemPrompt:c,userPrompt:l}=e.searchQueryGeneratorPrompt({title:r,sourcePlatform:s,targetPlatform:o});let m;if(a(n)){const e=await t.callOpenAIResponses(l,c,"text",n,1,{apiKey:i.openaiApiKey}),r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}m=r.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}else{const e=await t.callGrokResponses(l,c,"text",n,1,void 0,{apiKey:i.xaiApiKey}),r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}m=r.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}return m.replace(/['"]/g,"").trim().split(/\s+/).slice(0,2).join(" ")}(p.eventTitle,u,y,m,i);let k;if(k="polymarket"===y?await async function(e){try{const t=`${s}/public-search?q=${encodeURIComponent(e)}&events_status=open`,r=await fetch(t);if(!r.ok)return console.error("Polymarket search error:",r.status),[];const o=await r.json(),a=[];if(o.events&&Array.isArray(o.events))for(const e of o.events){const t=e.slug;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.question||r.title||"";let s=50;if(r.outcomePrices)try{const e=JSON.parse(r.outcomePrices);s=100*parseFloat(e[0])}catch{}e&&a.push({title:e,yesPrice:s,identifier:t})}}return a}catch(t){return console.error("Error searching Polymarket:",t),[]}}(f):await async function(e,t){try{const s=await r.dflowRequest("/search",{params:{q:e,event_status:"open",withNestedMarkets:!0},apiKey:t}),o=[];if(s.events&&Array.isArray(s.events))for(const e of s.events){const t=e.ticker;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.yesSubTitle||r.title||"";let s=50;if(r.yesAsk&&r.yesBid){s=(parseFloat(r.yesAsk)+parseFloat(r.yesBid))/2*100}else r.yesAsk?s=100*parseFloat(r.yesAsk):r.yesBid&&(s=100*parseFloat(r.yesBid));e&&o.push({title:e,yesPrice:s,identifier:t})}}return o}catch(s){return console.error("Error searching Kalshi:",s),[]}}(f,i.dflowApiKey),0===k.length){const e={source:u,name:p.eventTitle,identifier:p.identifier,yesPrice:p.markets[0]?.yesPrice||50,noPrice:100-(p.markets[0]?.yesPrice||50),url:n(u,p.identifier),rawData:{eventTitle:p.eventTitle,markets:p.markets}};return{analysis:{isSameMarket:!1,sameMarketConfidence:0,marketComparisonReasoning:`No matching markets found on ${y} for query "${f}"`,polymarketData:"polymarket"===u?e:void 0,kalshiData:"kalshi"===u?e:void 0,arbitrage:{hasArbitrage:!1},summary:`No matching markets found on ${y}. Cannot determine arbitrage opportunity.`,risks:["No matching market found on the other platform"],recommendation:"Try a different event or check if the market exists on both platforms."},model:"none",sourceMarket:u,searchedMarket:y,processingTimeMs:Date.now()-c}}const{analysis:h,modelUsed:d,tokensUsed:g}=await async function(r,s,o,i,c){const l={source:r.source,name:r.eventTitle,identifier:r.identifier,yesPrice:r.markets[0]?.yesPrice||50,noPrice:100-(r.markets[0]?.yesPrice||50),url:n(r.source,r.identifier)};l.rawData={eventTitle:r.eventTitle,markets:r.markets};const{systemPrompt:m,userPrompt:u}=e.arbitrageAnalysisPrompt({sourceMarket:l,searchResults:s,searchPlatform:o});let p,y,f;if(a(i)){const e=await t.callOpenAIResponses(u,m,"json_object",i,3,{apiKey:c.openaiApiKey});y=e.model,f=e.usage?.total_tokens;const r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}p=r.map(e=>e.text).filter(e=>void 0!==e).join("\n")}else{const e=await t.callGrokResponses(u,m,"json_object",i,3,void 0,{apiKey:c.xaiApiKey});y=e.model,f=e.usage?.total_tokens;const r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}p=r.map(e=>e.text).filter(e=>void 0!==e).join("\n")}const k=JSON.parse(p);return{analysis:{isSameMarket:k.isSameMarket,sameMarketConfidence:k.sameMarketConfidence,marketComparisonReasoning:k.marketComparisonReasoning,polymarketData:"polymarket"===r.source?l:k.matchedMarket||void 0,kalshiData:"kalshi"===r.source?l:k.matchedMarket||void 0,arbitrage:k.arbitrage,summary:k.summary,risks:k.risks,recommendation:k.recommendation},modelUsed:y,tokensUsed:f}}(p,k,y,m,i);return{analysis:h,model:d,tokensUsed:g,sourceMarket:u,searchedMarket:y,processingTimeMs:Date.now()-c}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,a as t}from"../searchQueryGenerator-DIIs9xw5.js";import{a as r,c as s}from"../callGrok-D0D7zBHK.js";import{dflowRequest as o}from"./data/kalshi.mjs";const a="https://gamma-api.polymarket.com",n=["gpt-5.2","gpt-5.1","gpt-5-nano","gpt-4.1","gpt-4.1-mini"];function i(e){return n.includes(e)||e.startsWith("gpt-")}function c(e,t){return"polymarket"===e?`https://polymarket.com/event/${t}`:`https://kalshi.com/events/${t}`}async function l(n,l={}){const m=Date.now(),{url:u,model:p}=n;if(!u)throw new Error("Missing required parameter: 'url'");if(!p)throw new Error("Missing required parameter: 'model'");const y=function(e){const t=e.toLowerCase();return t.includes("polymarket.com")?"polymarket":t.includes("kalshi.com")?"kalshi":null}(u);if(!y)throw new Error("Invalid URL. Must be a Polymarket or Kalshi market URL.");let f=null;const k="polymarket"===y?"kalshi":"polymarket";if("polymarket"===y){const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return"event"===t[0]&&t.length>=2?t[1]:null}catch{return null}}(u);if(!e)throw new Error("Could not extract event slug from Polymarket URL");f=await async function(e){try{const t=`${a}/events/slug/${e}`,r=await fetch(t);if(!r.ok)return console.error("Polymarket event fetch error:",r.status),null;const s=await r.json(),o=[];if(s.markets&&Array.isArray(s.markets))for(const e of s.markets){const t=e.question||e.title||"";let r=50;if(e.outcomePrices)try{const t=JSON.parse(e.outcomePrices);r=100*parseFloat(t[0])}catch{}t&&o.push({title:t,yesPrice:r})}return{eventTitle:s.title||e.replace(/-/g," "),markets:o,source:"polymarket",identifier:s.slug||e}}catch(t){return console.error("Error fetching Polymarket event:",t),null}}(e)}else{const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return("markets"===t[0]||"events"===t[0])&&t.length>=2?(t.length>=4?t[t.length-1]:t[1]).toUpperCase():null}catch{return null}}(u);if(!e)throw new Error("Could not extract ticker from Kalshi URL");f=await async function(e,t){try{const r=await o(`/event/${e}`,{params:{withNestedMarkets:!0},apiKey:t}),s=[];if(r.markets&&Array.isArray(r.markets))for(const e of r.markets){const t=e.yesSubTitle||"";let r=50;if(e.yesBid&&e.yesAsk){r=(parseFloat(e.yesBid)+parseFloat(e.yesAsk))/2*100}else e.yesBid?r=100*parseFloat(e.yesBid):e.yesAsk&&(r=100*parseFloat(e.yesAsk));t&&s.push({title:t,yesPrice:r})}return{eventTitle:r.title||e,markets:s,source:"kalshi",identifier:e}}catch(r){return console.error("Error fetching Kalshi event:",r),null}}(e,l.dflowApiKey)}if(!f||0===f.markets.length)throw new Error(`Could not fetch event data from ${y}. The event may not exist or have no markets.`);const h=await async function(t,o,a,n,c){const{systemPrompt:l,userPrompt:m}=e({title:t,sourcePlatform:o,targetPlatform:a});let u;if(i(n)){const e=await r(m,l,"text",n,1,{apiKey:c.openaiApiKey}),t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}u=t.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}else{const e=await s(m,l,"text",n,1,void 0,{apiKey:c.xaiApiKey}),t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}u=t.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}return u.replace(/['"]/g,"").trim().split(/\s+/).slice(0,2).join(" ")}(f.eventTitle,y,k,p,l);let d;if(d="polymarket"===k?await async function(e){try{const t=`${a}/public-search?q=${encodeURIComponent(e)}&events_status=open`,r=await fetch(t);if(!r.ok)return console.error("Polymarket search error:",r.status),[];const s=await r.json(),o=[];if(s.events&&Array.isArray(s.events))for(const e of s.events){const t=e.slug;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.question||r.title||"";let s=50;if(r.outcomePrices)try{const e=JSON.parse(r.outcomePrices);s=100*parseFloat(e[0])}catch{}e&&o.push({title:e,yesPrice:s,identifier:t})}}return o}catch(t){return console.error("Error searching Polymarket:",t),[]}}(h):await async function(e,t){try{const r=await o("/search",{params:{q:e,event_status:"open",withNestedMarkets:!0},apiKey:t}),s=[];if(r.events&&Array.isArray(r.events))for(const e of r.events){const t=e.ticker;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.yesSubTitle||r.title||"";let o=50;if(r.yesAsk&&r.yesBid){o=(parseFloat(r.yesAsk)+parseFloat(r.yesBid))/2*100}else r.yesAsk?o=100*parseFloat(r.yesAsk):r.yesBid&&(o=100*parseFloat(r.yesBid));e&&s.push({title:e,yesPrice:o,identifier:t})}}return s}catch(r){return console.error("Error searching Kalshi:",r),[]}}(h,l.dflowApiKey),0===d.length){const e={source:y,name:f.eventTitle,identifier:f.identifier,yesPrice:f.markets[0]?.yesPrice||50,noPrice:100-(f.markets[0]?.yesPrice||50),url:c(y,f.identifier),rawData:{eventTitle:f.eventTitle,markets:f.markets}};return{analysis:{isSameMarket:!1,sameMarketConfidence:0,marketComparisonReasoning:`No matching markets found on ${k} for query "${h}"`,polymarketData:"polymarket"===y?e:void 0,kalshiData:"kalshi"===y?e:void 0,arbitrage:{hasArbitrage:!1},summary:`No matching markets found on ${k}. Cannot determine arbitrage opportunity.`,risks:["No matching market found on the other platform"],recommendation:"Try a different event or check if the market exists on both platforms."},model:"none",sourceMarket:y,searchedMarket:k,processingTimeMs:Date.now()-m}}const{analysis:g,modelUsed:v,tokensUsed:w}=await async function(e,o,a,n,l){const m={source:e.source,name:e.eventTitle,identifier:e.identifier,yesPrice:e.markets[0]?.yesPrice||50,noPrice:100-(e.markets[0]?.yesPrice||50),url:c(e.source,e.identifier)};m.rawData={eventTitle:e.eventTitle,markets:e.markets};const{systemPrompt:u,userPrompt:p}=t({sourceMarket:m,searchResults:o,searchPlatform:a});let y,f,k;if(i(n)){const e=await r(p,u,"json_object",n,3,{apiKey:l.openaiApiKey});f=e.model,k=e.usage?.total_tokens;const t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}y=t.map(e=>e.text).filter(e=>void 0!==e).join("\n")}else{const e=await s(p,u,"json_object",n,3,void 0,{apiKey:l.xaiApiKey});f=e.model,k=e.usage?.total_tokens;const t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}y=t.map(e=>e.text).filter(e=>void 0!==e).join("\n")}const h=JSON.parse(y);return{analysis:{isSameMarket:h.isSameMarket,sameMarketConfidence:h.sameMarketConfidence,marketComparisonReasoning:h.marketComparisonReasoning,polymarketData:"polymarket"===e.source?m:h.matchedMarket||void 0,kalshiData:"kalshi"===e.source?m:h.matchedMarket||void 0,arbitrage:h.arbitrage,summary:h.summary,risks:h.risks,recommendation:h.recommendation},modelUsed:f,tokensUsed:k}}(f,d,k,p,l);return{analysis:g,model:v,tokensUsed:w,sourceMarket:y,searchedMarket:k,processingTimeMs:Date.now()-m}}export{l as findArbitrage};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Polyfactual Deep Research API client.
|
|
3
3
|
*
|
|
4
4
|
* A client for the Polyfactual Deep Research API that provides research
|
|
5
|
-
* capabilities with citations. Ported from the
|
|
5
|
+
* capabilities with citations. Ported from the PredictOS `polyfactual` shared
|
|
6
6
|
* client.
|
|
7
7
|
*
|
|
8
8
|
* API Documentation:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfactual.d.ts","sourceRoot":"","sources":["../../../src/predictos/clients/polyfactual.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,iDAAiD;AACjD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,IAAI,CAAC;IACd,wCAAwC;IACxC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,KAAK,CAAC;IACf,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,GAAG,wBAAwB,CAAC;AAExF,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,0BAA0B;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0BAA0B;AAC1B,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,KAAK,CAAC,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AevF;AA0VD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAgD9E;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,CAAC,EAAE;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAkF5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC,CAgPD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAkBxD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Kalshi market data client (via the DFlow API).
|
|
3
3
|
*
|
|
4
|
-
* DFlow provides Kalshi market data. Ported from the
|
|
4
|
+
* DFlow provides Kalshi market data. Ported from the PredictOS `dflow`
|
|
5
5
|
* shared client. The API key is read from the `apiKey` option, falling back
|
|
6
6
|
* to `process.env.DFLOW_API_KEY`.
|
|
7
7
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kalshi.d.ts","sourceRoot":"","sources":["../../../src/predictos/data/kalshi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,mBAAmB;IACl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AAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function t(t,e={}){const{method:r="GET",headers:o={},params:a={},apiKey:s}=e,n=function(t){const e=t??process.env.DFLOW_API_KEY;if(!e)throw new Error("DFLOW_API_KEY is not configured. Get your API key from DFlow: https://x.com/dflow");return e}(s),i=new URLSearchParams;Object.entries(a).forEach(([t,e])=>{null!=e&&i.append(t,String(e))});const p=i.toString(),c=`https://a.prediction-markets-api.dflow.net/api/v1${t}${p?`?${p}`:""}`,u=await fetch(c,{method:r,headers:{"Content-Type":"application/json","x-api-key":n,...o}});if(!u.ok){const t=await u.text();throw new Error(`DFlow API error: ${u.status} ${u.statusText} - ${t}`)}return await u.json()}exports.buildKalshiMarketUrl=function(t){return`https://kalshi.com/markets/${t.split("-")[0]}`},exports.dflowRequest=t,exports.getKalshiMarketsByEvent=async function(e,r){return(await t(`/event/${e}`,{params:{withNestedMarkets:!0},apiKey:r})).markets};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function t(t,e={}){const{method:r="GET",headers:n={},params:a={},apiKey:o}=e,s=function(t){const e=t??process.env.DFLOW_API_KEY;if(!e)throw new Error("DFLOW_API_KEY is not configured. Get your API key from DFlow: https://x.com/dflow");return e}(o),i=new URLSearchParams;Object.entries(a).forEach(([t,e])=>{null!=e&&i.append(t,String(e))});const c=i.toString(),p=`https://a.prediction-markets-api.dflow.net/api/v1${t}${c?`?${c}`:""}`,h=await fetch(p,{method:r,headers:{"Content-Type":"application/json","x-api-key":s,...n}});if(!h.ok){const t=await h.text();throw new Error(`DFlow API error: ${h.status} ${h.statusText} - ${t}`)}return await h.json()}async function e(e,r){return(await t(`/event/${e}`,{params:{withNestedMarkets:!0},apiKey:r})).markets}function r(t){return`https://kalshi.com/markets/${t.split("-")[0]}`}export{r as buildKalshiMarketUrl,t as dflowRequest,e as getKalshiMarketsByEvent};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Polymarket (and Kalshi) market data client via the Dome API.
|
|
3
3
|
*
|
|
4
|
-
* Ported from the
|
|
4
|
+
* Ported from the PredictOS `dome` shared client. The API key is read from
|
|
5
5
|
* the `apiKey` option, falling back to `process.env.DOME_API_KEY`.
|
|
6
6
|
*
|
|
7
7
|
* @see https://docs.domeapi.io/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymarket.d.ts","sourceRoot":"","sources":["../../../src/predictos/data/polymarket.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/D,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yB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GAUG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,MAAM,GAAG,QAAQ,GAAG,SAAkB,EAC9C,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,EAAE,CAAC,CAUzB;AAMD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(t){const e=t??process.env.DOME_API_KEY;if(!e)throw new Error("DOME_API_KEY environment variable is not set");return e}async function e(e,r={}){const{method:a="GET",headers:n={},params:s={},apiKey:o}=r,i=new URLSearchParams;Object.entries(s).forEach(([t,e])=>{null!=e&&i.append(t,String(e))});const c=i.toString(),u=`https://api.domeapi.io/v1${e}${c?`?${c}`:""}`,p=await fetch(u,{method:a,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t(o)}`,...n}});if(!p.ok){const t=await p.text();throw new Error(`Dome API error: ${p.status} ${p.statusText} - ${t}`)}return await p.json()}exports.buildKalshiMarketUrl=function(t){return`https://kalshi.com/markets/${t.split("-")[0]}`},exports.buildPolymarketUrl=function(t){return`https://polymarket.com/event/${t}`},exports.domeRequest=e,exports.getKalshiMarketsByEvent=async function(t,r="open",a){return(await async function(t,r){return e("/kalshi/markets",{params:{cursor:t?.cursor,limit:t?.limit,event_ticker:t?.eventTicker,status:t?.status},apiKey:r})}({eventTicker:t,status:r,limit:100},a)).markets},exports.getPolymarketMarkets=async function(t,r){return e("/polymarket/markets",{params:t,apiKey:r})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){const e=t??process.env.DOME_API_KEY;if(!e)throw new Error("DOME_API_KEY environment variable is not set");return e}async function e(e,r={}){const{method:n="GET",headers:a={},params:s={},apiKey:o}=r,i=new URLSearchParams;Object.entries(s).forEach(([t,e])=>{null!=e&&i.append(t,String(e))});const c=i.toString(),u=`https://api.domeapi.io/v1${e}${c?`?${c}`:""}`,p=await fetch(u,{method:n,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t(o)}`,...a}});if(!p.ok){const t=await p.text();throw new Error(`Dome API error: ${p.status} ${p.statusText} - ${t}`)}return await p.json()}async function r(t,r){return e("/polymarket/markets",{params:t,apiKey:r})}async function n(t,r="open",n){const a=await async function(t,r){return e("/kalshi/markets",{params:{cursor:t?.cursor,limit:t?.limit,event_ticker:t?.eventTicker,status:t?.status},apiKey:r})}({eventTicker:t,status:r,limit:100},n);return a.markets}function a(t){return`https://kalshi.com/markets/${t.split("-")[0]}`}function s(t){return`https://polymarket.com/event/${t}`}export{a as buildKalshiMarketUrl,s as buildPolymarketUrl,e as domeRequest,n as getKalshiMarketsByEvent,r as getPolymarketMarkets};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/predictos/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AA4GnG;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,gBAAgB,EACzB,MAAM,GAAE,UAAe,GACtB,OAAO,CAAC,eAAe,CAAC,CA6F1B"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* investing/predictos - PredictOS "Super Intelligence" core, refactored for
|
|
3
|
+
* Node/TypeScript ESM and merged into the `investing` package.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* import { runEventAnalysisAgent, findArbitrage, getEvents } from "investing/prediction-markets";
|
|
5
|
+
* Adapted from PredictOS by PredictionXBT (https://github.com/PredictionXBT/PredictOS),
|
|
6
|
+
* MIT licensed. The original Deno/Supabase edge functions have been refactored into
|
|
7
|
+
* plain, typed async library functions.
|
|
10
8
|
*
|
|
11
9
|
* This module provides:
|
|
12
10
|
* - AI provider clients (OpenAI, Grok/xAI, BlockRun) and prompt builders
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/predictos/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAQ9B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,IAAI,2BAA2B,EACtD,oBAAoB,IAAI,wBAAwB,GACjD,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,IAAI,gBAAgB,EAChC,qBAAqB,IAAI,yBAAyB,EAClD,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAG9B,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../callGrok-DWO719mN.cjs"),r=require("../bookmakerAnalysis-CHn1W8uX.cjs"),t=require("../searchQueryGenerator-rCVblXJS.cjs"),o=require("./data/kalshi.js"),s=require("./data/polymarket.js"),a=require("../polymarket-updown-15-limit-order-bot-DCC8HE9Z.cjs"),l=require("./arbitrage.js"),n=require("../events-BJOyGWeU.cjs");exports.callGrokResponses=e.callGrokResponses,exports.callOpenAIResponses=e.callOpenAIResponses,exports.fetchWithTimeout=e.fetchWithTimeout,exports.isRetryableError=e.isRetryableError,exports.sleep=e.sleep,exports.BLOCKRUN_MODELS=r.BLOCKRUN_MODELS,exports.analyzeEventMarketsPrompt=r.analyzeEventMarketsPrompt,exports.bookmakerAnalysisPrompt=r.bookmakerAnalysisPrompt,exports.callBlockRunResponses=r.callBlockRunResponses,exports.isBlockRunModel=r.isBlockRunModel,exports.listBlockRunModels=r.listBlockRunModels,exports.arbitrageAnalysisPrompt=t.arbitrageAnalysisPrompt,exports.searchQueryGeneratorPrompt=t.searchQueryGeneratorPrompt,exports.buildKalshiMarketUrl=o.buildKalshiMarketUrl,exports.dflowRequest=o.dflowRequest,exports.getKalshiMarketsByEvent=o.getKalshiMarketsByEvent,exports.buildDomeKalshiMarketUrl=s.buildKalshiMarketUrl,exports.buildPolymarketUrl=s.buildPolymarketUrl,exports.domeRequest=s.domeRequest,exports.getDomeKalshiMarketsByEvent=s.getKalshiMarketsByEvent,exports.getPolymarketMarkets=s.getPolymarketMarkets,exports.NoTradeError=a.NoTradeError,exports.polyfactual=a.polyfactual,exports.polymarketClob=a.polymarket,exports.runBookmakerAgent=a.runBookmakerAgent,exports.runEventAnalysisAgent=a.runEventAnalysisAgent,exports.runMapperAgent=a.runMapperAgent,exports.runPolyfactualResearch=a.runPolyfactualResearch,exports.runPolymarketPositionTracker=a.runPolymarketPositionTracker,exports.runPolymarketPutOrder=a.runPolymarketPutOrder,exports.runPolymarketUpDown15LimitOrderBot=a.runPolymarketUpDown15LimitOrderBot,exports.runX402Seller=a.runX402Seller,exports.x402=a.x402,exports.findArbitrage=l.findArbitrage,exports.getEvents=n.getEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,a as s,f as r,i as e,s as o}from"../callGrok-D0D7zBHK.js";import{B as t,a as l,b as m,c as n,i,l as p}from"../bookmakerAnalysis-Bfo1zUVm.js";import{a as k,s as u}from"../searchQueryGenerator-DIIs9xw5.js";import{buildKalshiMarketUrl as y,dflowRequest as c,getKalshiMarketsByEvent as f}from"./data/kalshi.mjs";import{buildKalshiMarketUrl as d,buildPolymarketUrl as b,domeRequest as h,getKalshiMarketsByEvent as P,getPolymarketMarkets as g}from"./data/polymarket.mjs";import{N as M,p as R,h as j,r as A,a as B,b as E,c as v,d as K,e as O,f as D,g as G,x as U}from"../polymarket-updown-15-limit-order-bot-Dv5oGAF4.js";import{findArbitrage as L}from"./arbitrage.mjs";import{g as T}from"../events-OvBb8rgy.js";export{t as BLOCKRUN_MODELS,M as NoTradeError,l as analyzeEventMarketsPrompt,k as arbitrageAnalysisPrompt,m as bookmakerAnalysisPrompt,d as buildDomeKalshiMarketUrl,y as buildKalshiMarketUrl,b as buildPolymarketUrl,n as callBlockRunResponses,a as callGrokResponses,s as callOpenAIResponses,c as dflowRequest,h as domeRequest,r as fetchWithTimeout,L as findArbitrage,P as getDomeKalshiMarketsByEvent,T as getEvents,f as getKalshiMarketsByEvent,g as getPolymarketMarkets,i as isBlockRunModel,e as isRetryableError,p as listBlockRunModels,R as polyfactual,j as polymarketClob,A as runBookmakerAgent,B as runEventAnalysisAgent,E as runMapperAgent,v as runPolyfactualResearch,K as runPolymarketPositionTracker,O as runPolymarketPutOrder,D as runPolymarketUpDown15LimitOrderBot,G as runX402Seller,u as searchQueryGeneratorPrompt,o as sleep,U as x402};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared domain types for the
|
|
2
|
+
* Shared domain types for the PredictOS core pipeline.
|
|
3
3
|
*
|
|
4
4
|
* Consolidated from the per-function `types.ts` files of the original
|
|
5
|
-
*
|
|
5
|
+
* PredictOS Supabase edge functions.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* API credentials for the AI providers used by the analysis agents.
|
|
@@ -40,122 +40,6 @@ export type UrlSource = "kalshi" | "polymarket" | "jupiter";
|
|
|
40
40
|
export type DataProvider = "dome" | "dflow" | "gamma";
|
|
41
41
|
/** Tool types available for Grok models. */
|
|
42
42
|
export type GrokTool = "x_search" | "web_search";
|
|
43
|
-
/** A binary prediction-market outcome. */
|
|
44
|
-
export type PredictionMarketOutcome = "YES" | "NO";
|
|
45
|
-
/**
|
|
46
|
-
* A recorded Kalshi market observation.
|
|
47
|
-
*
|
|
48
|
-
* `yesPriceCents` is an integer from 0 through 100 representing the price of
|
|
49
|
-
* one YES contract in cents. The corresponding NO price is
|
|
50
|
-
* `100 - yesPriceCents`.
|
|
51
|
-
*/
|
|
52
|
-
export interface KalshiMarketTick {
|
|
53
|
-
ticker: string;
|
|
54
|
-
timestamp: string;
|
|
55
|
-
yesPriceCents: number;
|
|
56
|
-
}
|
|
57
|
-
/** Configuration for the deterministic Kalshi momentum strategy. */
|
|
58
|
-
export interface KalshiMomentumConfig {
|
|
59
|
-
/** Maximum number of price directions retained. */
|
|
60
|
-
lookback: number;
|
|
61
|
-
/** Consecutive moves required to enter a position. */
|
|
62
|
-
momentumThreshold: number;
|
|
63
|
-
/** Contracts requested for each entry. */
|
|
64
|
-
positionSize: number;
|
|
65
|
-
/** Profit per contract, in cents, that triggers an exit. */
|
|
66
|
-
profitTargetCents: number;
|
|
67
|
-
/** Loss per contract, in cents, that triggers an exit. */
|
|
68
|
-
stopLossCents: number;
|
|
69
|
-
/** Maximum contracts allowed in one ticker/outcome position. */
|
|
70
|
-
maxPosition: number;
|
|
71
|
-
}
|
|
72
|
-
/** Open position tracked by the momentum strategy. Prices are cents/contract. */
|
|
73
|
-
export interface KalshiMomentumPosition {
|
|
74
|
-
ticker: string;
|
|
75
|
-
outcome: PredictionMarketOutcome;
|
|
76
|
-
quantity: number;
|
|
77
|
-
entryPriceCents: number;
|
|
78
|
-
}
|
|
79
|
-
/** Serializable state used to replay the strategy deterministically. */
|
|
80
|
-
export interface KalshiMomentumStrategyState {
|
|
81
|
-
/** Recent YES-price directions: 1 = up, -1 = down, 0 = flat. */
|
|
82
|
-
directions: Array<-1 | 0 | 1>;
|
|
83
|
-
/** Most recently observed YES price, in cents/contract. */
|
|
84
|
-
lastYesPriceCents?: number;
|
|
85
|
-
position?: KalshiMomentumPosition;
|
|
86
|
-
tradesExecuted: number;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Venue-neutral instruction produced by a prediction-market strategy.
|
|
90
|
-
*
|
|
91
|
-
* `action` describes portfolio behavior. `outcome` describes the binary
|
|
92
|
-
* contract. A SELL YES closes YES contracts; it does not mean BUY NO.
|
|
93
|
-
* `priceCents` is cents per contract, from 0 through 100.
|
|
94
|
-
*/
|
|
95
|
-
export interface PredictionMarketTradeIntent {
|
|
96
|
-
action: "BUY" | "SELL" | "HOLD";
|
|
97
|
-
outcome: PredictionMarketOutcome | null;
|
|
98
|
-
ticker: string;
|
|
99
|
-
quantity: number;
|
|
100
|
-
priceCents: number;
|
|
101
|
-
timestamp: string;
|
|
102
|
-
reason: string;
|
|
103
|
-
}
|
|
104
|
-
/** Position held by the in-memory paper executor. */
|
|
105
|
-
export interface PaperPosition {
|
|
106
|
-
ticker: string;
|
|
107
|
-
outcome: PredictionMarketOutcome;
|
|
108
|
-
quantity: number;
|
|
109
|
-
averageEntryPriceCents: number;
|
|
110
|
-
markPriceCents: number;
|
|
111
|
-
unrealizedPnlCents: number;
|
|
112
|
-
}
|
|
113
|
-
/** Complete serializable portfolio snapshot. All money values are cents. */
|
|
114
|
-
export interface PaperPortfolioState {
|
|
115
|
-
initialCashCents: number;
|
|
116
|
-
cashCents: number;
|
|
117
|
-
positions: Record<string, PaperPosition>;
|
|
118
|
-
realizedPnlCents: number;
|
|
119
|
-
unrealizedPnlCents: number;
|
|
120
|
-
equityCents: number;
|
|
121
|
-
}
|
|
122
|
-
/** Result of deterministically applying one intent to the paper portfolio. */
|
|
123
|
-
export interface PaperExecutionResult {
|
|
124
|
-
status: "FILLED" | "REJECTED" | "SKIPPED";
|
|
125
|
-
intent: PredictionMarketTradeIntent;
|
|
126
|
-
fill?: {
|
|
127
|
-
priceCents: number;
|
|
128
|
-
quantity: number;
|
|
129
|
-
cashChangeCents: number;
|
|
130
|
-
realizedPnlCents: number;
|
|
131
|
-
};
|
|
132
|
-
reason?: string;
|
|
133
|
-
portfolio: PaperPortfolioState;
|
|
134
|
-
}
|
|
135
|
-
/** One tick's strategy decision and paper-execution result. */
|
|
136
|
-
export interface KalshiMomentumAgentStep {
|
|
137
|
-
tick: KalshiMarketTick;
|
|
138
|
-
intent: PredictionMarketTradeIntent;
|
|
139
|
-
execution: PaperExecutionResult;
|
|
140
|
-
strategyState: KalshiMomentumStrategyState;
|
|
141
|
-
}
|
|
142
|
-
/** Input for a credential-free recorded-tick momentum replay. */
|
|
143
|
-
export interface KalshiMomentumAgentRequest {
|
|
144
|
-
ticks: KalshiMarketTick[];
|
|
145
|
-
config?: Partial<KalshiMomentumConfig>;
|
|
146
|
-
initialCashCents?: number;
|
|
147
|
-
initialStrategyState?: KalshiMomentumStrategyState;
|
|
148
|
-
initialPortfolio?: PaperPortfolioState;
|
|
149
|
-
}
|
|
150
|
-
/** Structured output from the Kalshi momentum paper agent. */
|
|
151
|
-
export interface KalshiMomentumAgentResult {
|
|
152
|
-
mode: "paper";
|
|
153
|
-
config: KalshiMomentumConfig;
|
|
154
|
-
steps: KalshiMomentumAgentStep[];
|
|
155
|
-
strategyState: KalshiMomentumStrategyState;
|
|
156
|
-
portfolio: PaperPortfolioState;
|
|
157
|
-
report: string;
|
|
158
|
-
}
|
|
159
43
|
/**
|
|
160
44
|
* AI analysis result for an event's markets.
|
|
161
45
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/predictos/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mEA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,MAAM,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,YAAY,EAAE,qBAAqB,CAAC;IACpC,uDAAuD;IACvD,cAAc,EAAE,qBAAqB,CAAC;IACtC,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAMD,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,SAAS,EAAE,SAAS,CAAC;IACrB,wCAAwC;IACxC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){const{sourceMarket:n,searchResults:t,searchPlatform:r}=e,a="polymarket"===r?"Polymarket":"Kalshi";return{systemPrompt:"You are an expert financial analyst specializing in prediction market arbitrage opportunities.\n\nYour task is to:\n1. Determine if the source market and any of the search results represent the SAME underlying event/question\n2. If they do, calculate whether there's an arbitrage opportunity based on price differences\n3. Provide clear, actionable analysis\n\nYou understand that arbitrage in prediction markets works as follows:\n- If you can buy YES on one market and NO on another market for the same event\n- And the combined cost is less than $1.00 (or 100%), you have guaranteed profit\n- The profit = $1.00 - (YES price + NO price)\n\nImportant considerations:\n- Markets must represent the EXACT same event with the same resolution criteria\n- Even small wording differences can lead to different outcomes\n- Be conservative in matching - when in doubt, say they're NOT the same market\n- Consider timing differences (different end dates = different markets)\n\nYour output must be valid JSON matching the exact schema specified.",userPrompt:`# Arbitrage Analysis Task\n\n## Source Market (from ${"polymarket"===n.source?"Polymarket":"Kalshi"})\n\n**Name:** ${n.name}\n**Identifier:** ${n.identifier}\n**YES Price:** ${n.yesPrice}% \n**NO Price:** ${n.noPrice}%\n**URL:** ${n.url}\n\n${n.rawData?`**Raw Data:**\n\`\`\`json\n${JSON.stringify(n.rawData,null,2)}\n\`\`\``:""}\n\n## Search Results from ${a}\n\n${0===t.length?"No matching markets found on "+a:`Found ${t.length} potential matches:\n\n\`\`\`json\n${JSON.stringify(t,null,2)}\n\`\`\``}\n\n## Your Analysis Task\n\n1. **Market Matching**: Examine each search result and determine if ANY of them represent the SAME event as the source market. Consider:\n - Is the question/title asking about the same thing?\n - Are the resolution criteria likely to be the same?\n - Are the time frames compatible?\n - Could slight wording differences lead to different outcomes?\n\n2. **If Same Market Found**: Calculate the arbitrage opportunity:\n - Compare YES prices across both markets\n - Compare NO prices across both markets\n - The arb exists if: (lowest YES price) + (lowest NO price) < 100\n - Calculate exact profit percentage\n\n3. **Build Response**: Return your analysis in the exact JSON format below.\n\n## Output Format\n\nReturn a JSON object with this exact structure:\n\n{\n "isSameMarket": boolean,\n "sameMarketConfidence": number (0-100),\n "marketComparisonReasoning": "string explaining why you believe the markets are/aren't the same",\n "matchedMarket": {\n "source": "${r}",\n "name": "string - market title/name",\n "identifier": "string - the identifier field from the matched search result",\n "yesPrice": number (0-100),\n "noPrice": number (0-100),\n "volume": number or null,\n "liquidity": number or null,\n "url": "string - market URL (see URL format below)"\n } or null if no match found,\n "arbitrage": {\n "hasArbitrage": boolean,\n "profitPercent": number or null,\n "strategy": {\n "buyYesOn": "${n.source}" or "${r}",\n "buyYesPrice": number,\n "buyNoOn": "${n.source}" or "${r}",\n "buyNoPrice": number,\n "totalCost": number,\n "guaranteedPayout": 100,\n "netProfit": number\n } or null\n },\n "summary": "string - 2-3 sentence summary of findings",\n "risks": ["array of strings - potential risks or caveats"],\n "recommendation": "string - clear actionable recommendation"\n}\n\n## Important Notes\n\n- For Polymarket markets, the URL format is: https://polymarket.com/event/[identifier]\n- For Kalshi markets, the URL format is: https://kalshi.com/events/[identifier]\n- Each search result has an "identifier" field - use it to build the URL\n- ${"polymarket"===r?"Polymarket prices in outcomePrices are decimals (0.45 = 45%)":"Kalshi prices are already in percentage (45 = 45%)"}\n- Only report arbitrage if you're at least 80% confident the markets are the same\n- If no matching market is found, set isSameMarket to false and explain why\n\nNow analyze the markets and provide your assessment.`}}function n(e){const{title:n,sourcePlatform:t,targetPlatform:r}=e;return{systemPrompt:'You are a search query optimizer for prediction markets.\n\nYour task is to extract the 1-2 MOST IMPORTANT keywords from an event title that would best match similar events on another platform.\n\nRules:\n1. Return ONLY 1-2 words, no more\n2. Focus on unique identifiers: names, specific events, dates, numbers\n3. Remove common words like "will", "the", "be", "in", etc.\n4. Prioritize proper nouns (people, companies, places)\n5. If there\'s a person\'s name, that\'s usually the best keyword\n6. For numeric targets (prices, percentages), include the key number\n\nExamples:\n- "Will Bitcoin reach $100,000 by end of 2025?" → "Bitcoin"\n- "Will Elon Musk tweet about Dogecoin this week?" → "Elon Musk"\n- "Jensen Huang mentions at CES 2026" → "Jensen"\n- "Will the Fed cut interest rates in January?" → "Fed rates"\n- "Trump wins 2024 election" → "Trump"\n- "Apple stock above $200" → "Apple"\n\nReturn ONLY the search query, nothing else. No quotes, no explanation.',userPrompt:`Extract the best 1-2 word search query from this ${t} event title to search on ${r}:\n\n"${n}"\n\nSearch query:`}}export{e as a,n as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.arbitrageAnalysisPrompt=function(e){const{sourceMarket:n,searchResults:t,searchPlatform:r}=e,a="polymarket"===r?"Polymarket":"Kalshi";return{systemPrompt:"You are an expert financial analyst specializing in prediction market arbitrage opportunities.\n\nYour task is to:\n1. Determine if the source market and any of the search results represent the SAME underlying event/question\n2. If they do, calculate whether there's an arbitrage opportunity based on price differences\n3. Provide clear, actionable analysis\n\nYou understand that arbitrage in prediction markets works as follows:\n- If you can buy YES on one market and NO on another market for the same event\n- And the combined cost is less than $1.00 (or 100%), you have guaranteed profit\n- The profit = $1.00 - (YES price + NO price)\n\nImportant considerations:\n- Markets must represent the EXACT same event with the same resolution criteria\n- Even small wording differences can lead to different outcomes\n- Be conservative in matching - when in doubt, say they're NOT the same market\n- Consider timing differences (different end dates = different markets)\n\nYour output must be valid JSON matching the exact schema specified.",userPrompt:`# Arbitrage Analysis Task\n\n## Source Market (from ${"polymarket"===n.source?"Polymarket":"Kalshi"})\n\n**Name:** ${n.name}\n**Identifier:** ${n.identifier}\n**YES Price:** ${n.yesPrice}% \n**NO Price:** ${n.noPrice}%\n**URL:** ${n.url}\n\n${n.rawData?`**Raw Data:**\n\`\`\`json\n${JSON.stringify(n.rawData,null,2)}\n\`\`\``:""}\n\n## Search Results from ${a}\n\n${0===t.length?"No matching markets found on "+a:`Found ${t.length} potential matches:\n\n\`\`\`json\n${JSON.stringify(t,null,2)}\n\`\`\``}\n\n## Your Analysis Task\n\n1. **Market Matching**: Examine each search result and determine if ANY of them represent the SAME event as the source market. Consider:\n - Is the question/title asking about the same thing?\n - Are the resolution criteria likely to be the same?\n - Are the time frames compatible?\n - Could slight wording differences lead to different outcomes?\n\n2. **If Same Market Found**: Calculate the arbitrage opportunity:\n - Compare YES prices across both markets\n - Compare NO prices across both markets\n - The arb exists if: (lowest YES price) + (lowest NO price) < 100\n - Calculate exact profit percentage\n\n3. **Build Response**: Return your analysis in the exact JSON format below.\n\n## Output Format\n\nReturn a JSON object with this exact structure:\n\n{\n "isSameMarket": boolean,\n "sameMarketConfidence": number (0-100),\n "marketComparisonReasoning": "string explaining why you believe the markets are/aren't the same",\n "matchedMarket": {\n "source": "${r}",\n "name": "string - market title/name",\n "identifier": "string - the identifier field from the matched search result",\n "yesPrice": number (0-100),\n "noPrice": number (0-100),\n "volume": number or null,\n "liquidity": number or null,\n "url": "string - market URL (see URL format below)"\n } or null if no match found,\n "arbitrage": {\n "hasArbitrage": boolean,\n "profitPercent": number or null,\n "strategy": {\n "buyYesOn": "${n.source}" or "${r}",\n "buyYesPrice": number,\n "buyNoOn": "${n.source}" or "${r}",\n "buyNoPrice": number,\n "totalCost": number,\n "guaranteedPayout": 100,\n "netProfit": number\n } or null\n },\n "summary": "string - 2-3 sentence summary of findings",\n "risks": ["array of strings - potential risks or caveats"],\n "recommendation": "string - clear actionable recommendation"\n}\n\n## Important Notes\n\n- For Polymarket markets, the URL format is: https://polymarket.com/event/[identifier]\n- For Kalshi markets, the URL format is: https://kalshi.com/events/[identifier]\n- Each search result has an "identifier" field - use it to build the URL\n- ${"polymarket"===r?"Polymarket prices in outcomePrices are decimals (0.45 = 45%)":"Kalshi prices are already in percentage (45 = 45%)"}\n- Only report arbitrage if you're at least 80% confident the markets are the same\n- If no matching market is found, set isSameMarket to false and explain why\n\nNow analyze the markets and provide your assessment.`}},exports.searchQueryGeneratorPrompt=function(e){const{title:n,sourcePlatform:t,targetPlatform:r}=e;return{systemPrompt:'You are a search query optimizer for prediction markets.\n\nYour task is to extract the 1-2 MOST IMPORTANT keywords from an event title that would best match similar events on another platform.\n\nRules:\n1. Return ONLY 1-2 words, no more\n2. Focus on unique identifiers: names, specific events, dates, numbers\n3. Remove common words like "will", "the", "be", "in", etc.\n4. Prioritize proper nouns (people, companies, places)\n5. If there\'s a person\'s name, that\'s usually the best keyword\n6. For numeric targets (prices, percentages), include the key number\n\nExamples:\n- "Will Bitcoin reach $100,000 by end of 2025?" → "Bitcoin"\n- "Will Elon Musk tweet about Dogecoin this week?" → "Elon Musk"\n- "Jensen Huang mentions at CES 2026" → "Jensen"\n- "Will the Fed cut interest rates in January?" → "Fed rates"\n- "Trump wins 2024 election" → "Trump"\n- "Apple stock above $200" → "Apple"\n\nReturn ONLY the search query, nothing else. No quotes, no explanation.',userPrompt:`Extract the best 1-2 word search query from this ${t} event title to search on ${r}:\n\n"${n}"\n\nSearch query:`}};
|
package/dist/stocks/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './stock-names';
|
|
|
5
5
|
export * from './yfinance-wrapper';
|
|
6
6
|
export * from './yahoo-finance-wrapper';
|
|
7
7
|
export * from './sec-filing-api';
|
|
8
|
+
export * from './import-stock-names';
|
|
8
9
|
export * from './finnhub-wrapper';
|
|
9
10
|
export * from './types';
|
|
10
11
|
export * from './unified-quote-service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stocks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stocks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { NormalizedQuote } from './unified-quote-service';
|
|
2
|
-
/** Default freshness window for a cached quote when the caller names none. */
|
|
3
|
-
export declare const QUOTE_CACHE_TTL: number;
|
|
4
2
|
export interface CachedQuote {
|
|
5
3
|
symbol: string;
|
|
6
4
|
price: number;
|
|
@@ -27,16 +25,9 @@ export declare class QuoteCacheService {
|
|
|
27
25
|
*/
|
|
28
26
|
private roundPrice;
|
|
29
27
|
/**
|
|
30
|
-
* Get cached quote if available
|
|
31
|
-
*
|
|
32
|
-
* @param symbol - Ticker to look up; matched case-insensitively.
|
|
33
|
-
* @param cacheTTL - Maximum age in milliseconds. Defaults to
|
|
34
|
-
* {@link QUOTE_CACHE_TTL}. A row older than this — or one with no
|
|
35
|
-
* timestamp, which is how rows written before the column existed read back
|
|
36
|
-
* — is treated as a miss so the caller refetches. Pass `Infinity` to accept
|
|
37
|
-
* a cached quote at any age.
|
|
28
|
+
* Get cached quote if available
|
|
38
29
|
*/
|
|
39
|
-
getCachedQuote(symbol: string
|
|
30
|
+
getCachedQuote(symbol: string): Promise<CachedQuote | null>;
|
|
40
31
|
/**
|
|
41
32
|
* Save quote to cache
|
|
42
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-cache-service.d.ts","sourceRoot":"","sources":["../../src/stocks/quote-cache-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"quote-cache-service.d.ts","sourceRoot":"","sources":["../../src/stocks/quote-cache-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAS/D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,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C,EAAE,MAAM,CAAC;QAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,IAAI,CAAC;IAsDhB;;OAEG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;IA6B1C;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAKzC;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AACzD,eAAe,iBAAiB,CAAC"}
|
|
@@ -55,7 +55,7 @@ export declare class UnifiedQuoteService {
|
|
|
55
55
|
* @param symbol - Stock symbol to fetch
|
|
56
56
|
* @param options - Options object with useCache flag (default: true) and cacheTTL in milliseconds
|
|
57
57
|
*/
|
|
58
|
-
getQuote(
|
|
58
|
+
getQuote(symbol: string, options?: {
|
|
59
59
|
useCache?: boolean;
|
|
60
60
|
cacheTTL?: number;
|
|
61
61
|
}): Promise<QuoteServiceResponse>;
|
|
@@ -97,21 +97,12 @@ export declare class UnifiedQuoteService {
|
|
|
97
97
|
getQuoteFromSource(symbol: string, source: "yfinance" | "finnhub" | "alpaca"): Promise<QuoteServiceResponse>;
|
|
98
98
|
}
|
|
99
99
|
export declare const unifiedQuoteService: UnifiedQuoteService;
|
|
100
|
-
|
|
101
|
-
* Options accepted by the quote helpers.
|
|
102
|
-
*
|
|
103
|
-
* `cacheTTL` belongs in the type: the methods behind these wrappers have always
|
|
104
|
-
* taken it and callers have always passed it, but omitting it here made every
|
|
105
|
-
* such call a type error.
|
|
106
|
-
*/
|
|
107
|
-
export interface GetQuoteOptions {
|
|
108
|
-
/** Read from the quote cache before calling a provider. Defaults to true. */
|
|
100
|
+
export declare function getQuote(symbol: string, options?: {
|
|
109
101
|
useCache?: boolean;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
export declare function getQuotes(symbols: string[], options?: GetQuoteOptions): Promise<QuotesServiceResponse>;
|
|
102
|
+
}): Promise<QuoteServiceResponse>;
|
|
103
|
+
export declare function getQuotes(symbols: string[], options?: {
|
|
104
|
+
useCache?: boolean;
|
|
105
|
+
}): Promise<QuotesServiceResponse>;
|
|
115
106
|
export declare function getQuoteFromSource(symbol: string, source: "yfinance" | "finnhub" | "alpaca"): Promise<QuoteServiceResponse>;
|
|
116
107
|
export declare function getHistoricalQuotes(symbol: string, startDate: string | Date, endDate: string | Date, options?: {
|
|
117
108
|
forceRefreshRecent?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-quote-service.d.ts","sourceRoot":"","sources":["../../src/stocks/unified-quote-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGhF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,eAAe,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE;YACL,MAAM,EAAE,MAAM,CAAC;YACf,WAAW,EAAE,MAAM,CAAC;YACpB,YAAY,EAAE,MAAM,CAAC;YACrB,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;SACtC,CAAC;KACH,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MA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AC,qBAAqB,CAAC,CAEvH;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GACxC,OAAO,CAAC,oBAAoB,CAAC,CAE/B;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,OAAO,GAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7C,OAAO,CAAC,sBAAsB,CAAC,CAEjC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import { default as YahooFinance } from 'yahoo-finance2';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* yahoo-finance2 routes every fetch through one module-level queue (default
|
|
7
|
-
* concurrency 4). When the queue is full, a waiting job is started from the
|
|
8
|
-
* `.finally()` of whichever job finished before it - i.e. inside a *different*
|
|
9
|
-
* request's async context. On Workers the Response is then bound to that other
|
|
10
|
-
* request, and reading its body throws "Cannot perform I/O on behalf of a
|
|
11
|
-
* different request (I/O type: ReadableStreamSource)".
|
|
12
|
-
*
|
|
13
|
-
* With unlimited concurrency and no interval the queue never defers a job, so
|
|
14
|
-
* every fetch starts synchronously in the request that asked for it. The queue
|
|
15
|
-
* is shared by every YahooFinance instance in the isolate and each call
|
|
16
|
-
* re-applies its instance's queue options, so every instance must use these.
|
|
2
|
+
* Yahoo Finance 2 Wrapper
|
|
3
|
+
* Full-featured wrapper around yahoo-finance2 library
|
|
4
|
+
* Supports: quote, quoteSummary, chart, historical, search, options, recommendations, and more
|
|
17
5
|
*/
|
|
18
|
-
export declare const WORKER_SAFE_YAHOO_FINANCE_OPTIONS: {
|
|
19
|
-
readonly queue: {
|
|
20
|
-
readonly concurrency: number;
|
|
21
|
-
readonly interval: 0;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
/** Create a YahooFinance client that never runs one request's fetch in another's context. */
|
|
25
|
-
export declare function createYahooFinance(options?: ConstructorParameters<typeof YahooFinance>[0]): import('yahoo-finance2/createYahooFinance').YahooFinance & {
|
|
26
|
-
readonly quoteCombine: typeof import('yahoo-finance2/other').quoteCombine;
|
|
27
|
-
readonly autoc: typeof import('yahoo-finance2/modules').autoc;
|
|
28
|
-
readonly chart: typeof import('yahoo-finance2/modules').chart;
|
|
29
|
-
readonly dailyGainers: typeof import('yahoo-finance2/modules').dailyGainers;
|
|
30
|
-
readonly dailyLosers: typeof import('yahoo-finance2/modules').dailyLosers;
|
|
31
|
-
readonly fundamentalsTimeSeries: typeof import('yahoo-finance2/modules').fundamentalsTimeSeries;
|
|
32
|
-
readonly historical: typeof import('yahoo-finance2/modules').historical;
|
|
33
|
-
readonly insights: typeof import('yahoo-finance2/modules').insights;
|
|
34
|
-
readonly options: typeof import('yahoo-finance2/modules').options;
|
|
35
|
-
readonly quote: typeof import('yahoo-finance2/modules').quote;
|
|
36
|
-
readonly quoteSummary: typeof import('yahoo-finance2/modules').quoteSummary;
|
|
37
|
-
readonly recommendationsBySymbol: typeof import('yahoo-finance2/modules').recommendationsBySymbol;
|
|
38
|
-
readonly screener: typeof import('yahoo-finance2/modules').screener;
|
|
39
|
-
readonly search: typeof import('yahoo-finance2/modules').search;
|
|
40
|
-
readonly trendingSymbols: typeof import('yahoo-finance2/modules').trendingSymbols;
|
|
41
|
-
};
|
|
42
6
|
/**
|
|
43
7
|
* A single row of historical price data, shaped like the rows the deprecated
|
|
44
8
|
* `yahooFinance.historical()` helper used to return.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yahoo-finance-wrapper.d.ts","sourceRoot":"","sources":["../../src/stocks/yahoo-finance-wrapper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"yahoo-finance-wrapper.d.ts","sourceRoot":"","sources":["../../src/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C,MAAM,EAAE,MAAM;;;;;;;;;;;;;;CAgC1C;AAGD,eAAO,MAAM,mBAAmB,qBAA4B,CAAC;AAG7D,eAAO,MAAM,YAAY,qBAAsB,CAAC;AAGhD,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AgentState, InvestDebateState, RiskDebateState } from '../types';
|
|
2
|
-
import {
|
|
2
|
+
import { UnifiedLLMClient } from '../utils/llm-client';
|
|
3
3
|
export declare class InvestmentDebateFacilitator {
|
|
4
4
|
private llm;
|
|
5
5
|
private maxRounds;
|
|
6
|
-
constructor(llm:
|
|
6
|
+
constructor(llm: UnifiedLLMClient, maxRounds?: number);
|
|
7
7
|
/**
|
|
8
8
|
* Determine if the debate should continue or conclude
|
|
9
9
|
*/
|
|
@@ -16,7 +16,7 @@ export declare class InvestmentDebateFacilitator {
|
|
|
16
16
|
export declare class RiskDebateFacilitator {
|
|
17
17
|
private llm;
|
|
18
18
|
private maxRounds;
|
|
19
|
-
constructor(llm:
|
|
19
|
+
constructor(llm: UnifiedLLMClient, maxRounds?: number);
|
|
20
20
|
shouldContinue(debateState: RiskDebateState): boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Synthesize risk debate and adjust trading plan
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debate-facilitator.d.ts","sourceRoot":"","sources":["../../../src/trading-agents/agents/debate-facilitator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"debate-facilitator.d.ts","sourceRoot":"","sources":["../../../src/trading-agents/agents/debate-facilitator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,qBAAa,2BAA2B;IACtC,OAAO,CAAC,GAAG,CAAkB;IAC7B,OAAO,CAAC,SAAS,CAAQ;gBAEb,GAAG,EAAE,gBAAgB,EAAE,SAAS,GAAE,MAAU;IAKxD;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO;IAmBvD;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CA8DpE;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,GAAG,CAAkB;IAC7B,OAAO,CAAC,SAAS,CAAQ;gBAEb,GAAG,EAAE,gBAAgB,EAAE,SAAS,GAAE,MAAU;IAKxD,cAAc,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO;IAIrD;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CAiDpE"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { AgentState } from '../types';
|
|
2
|
-
import {
|
|
3
|
-
import { FundManagerApproval } from '../../strategy-signals/types';
|
|
4
|
-
export declare function parseFundManagerApproval(text: string, proposalId: string): FundManagerApproval;
|
|
2
|
+
import { UnifiedLLMClient } from '../utils/llm-client';
|
|
5
3
|
export declare class FundManager {
|
|
6
4
|
private llm;
|
|
7
|
-
constructor(llm:
|
|
5
|
+
constructor(llm: UnifiedLLMClient);
|
|
8
6
|
/**
|
|
9
7
|
* Review all analysis and make final approval decision
|
|
10
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fund-manager.d.ts","sourceRoot":"","sources":["../../../src/trading-agents/agents/fund-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"fund-manager.d.ts","sourceRoot":"","sources":["../../../src/trading-agents/agents/fund-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,qBAAa,WAAW;IACtB,OAAO,CAAC,GAAG,CAAkB;gBAEjB,GAAG,EAAE,gBAAgB;IAIjC;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CAoFpE"}
|