investing 0.1.113 → 0.1.114
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 +8 -139
- package/dist/{archiver-web.es-fg4bLLZa.cjs → archiver-web.es-BLUo1_F6.cjs} +1 -1
- package/dist/{archiver-web.es-B69gABHP.js → archiver-web.es-xMR6Vwo7.js} +1 -1
- package/dist/db/index.d.ts +17 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/schema.d.ts +17 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/index-Cigf2mm8.cjs +13 -0
- package/dist/index-D3i3mNfo.js +15 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/predictos/index.d.ts +7 -22
- package/dist/predictos/index.d.ts.map +1 -1
- package/dist/stocks/index.d.ts +0 -1
- package/dist/stocks/index.d.ts.map +1 -1
- package/dist/stocks/quote-cache-service.d.ts +11 -2
- package/dist/stocks/quote-cache-service.d.ts.map +1 -1
- package/dist/stocks/unified-quote-service.d.ts +15 -6
- package/dist/stocks/unified-quote-service.d.ts.map +1 -1
- package/package.json +6 -45
- package/dist/bookmakerAnalysis-Bfo1zUVm.js +0 -1
- package/dist/bookmakerAnalysis-CHn1W8uX.cjs +0 -1
- package/dist/callGrok-D0D7zBHK.js +0 -1
- package/dist/callGrok-DWO719mN.cjs +0 -1
- package/dist/events-BJOyGWeU.cjs +0 -1
- package/dist/events-OvBb8rgy.js +0 -1
- package/dist/index-D7fsk2gy.js +0 -15
- package/dist/index-_V1Ql5Es.cjs +0 -13
- package/dist/polymarket-updown-15-limit-order-bot-DCC8HE9Z.cjs +0 -1
- package/dist/polymarket-updown-15-limit-order-bot-Dv5oGAF4.js +0 -1
- package/dist/predictos/agents/bookmaker-agent.d.ts +0 -8
- package/dist/predictos/agents/bookmaker-agent.d.ts.map +0 -1
- package/dist/predictos/agents/event-analysis-agent.d.ts +0 -8
- package/dist/predictos/agents/event-analysis-agent.d.ts.map +0 -1
- package/dist/predictos/agents/index.d.ts +0 -21
- package/dist/predictos/agents/index.d.ts.map +0 -1
- package/dist/predictos/agents/index.js +0 -1
- package/dist/predictos/agents/index.mjs +0 -1
- package/dist/predictos/agents/mapper-agent.d.ts +0 -17
- package/dist/predictos/agents/mapper-agent.d.ts.map +0 -1
- package/dist/predictos/agents/polyfactual-research.d.ts +0 -47
- package/dist/predictos/agents/polyfactual-research.d.ts.map +0 -1
- package/dist/predictos/agents/polymarket-position-tracker.d.ts +0 -31
- package/dist/predictos/agents/polymarket-position-tracker.d.ts.map +0 -1
- package/dist/predictos/agents/polymarket-put-order.d.ts +0 -88
- package/dist/predictos/agents/polymarket-put-order.d.ts.map +0 -1
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts +0 -92
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts.map +0 -1
- package/dist/predictos/agents/x402-seller.d.ts +0 -34
- package/dist/predictos/agents/x402-seller.d.ts.map +0 -1
- package/dist/predictos/ai/callBlockRun.d.ts +0 -54
- package/dist/predictos/ai/callBlockRun.d.ts.map +0 -1
- package/dist/predictos/ai/callGrok.d.ts +0 -22
- package/dist/predictos/ai/callGrok.d.ts.map +0 -1
- package/dist/predictos/ai/callOpenAI.d.ts +0 -19
- package/dist/predictos/ai/callOpenAI.d.ts.map +0 -1
- package/dist/predictos/ai/http.d.ts +0 -19
- package/dist/predictos/ai/http.d.ts.map +0 -1
- package/dist/predictos/ai/index.d.ts +0 -19
- package/dist/predictos/ai/index.d.ts.map +0 -1
- package/dist/predictos/ai/index.js +0 -1
- package/dist/predictos/ai/index.mjs +0 -1
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts +0 -12
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts.map +0 -1
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts +0 -14
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts.map +0 -1
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts +0 -17
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts.map +0 -1
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts +0 -18
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts.map +0 -1
- package/dist/predictos/ai/types.d.ts +0 -214
- package/dist/predictos/ai/types.d.ts.map +0 -1
- package/dist/predictos/arbitrage.d.ts +0 -8
- package/dist/predictos/arbitrage.d.ts.map +0 -1
- package/dist/predictos/arbitrage.js +0 -1
- package/dist/predictos/arbitrage.mjs +0 -1
- package/dist/predictos/clients/polyfactual.d.ts +0 -72
- package/dist/predictos/clients/polyfactual.d.ts.map +0 -1
- package/dist/predictos/clients/polymarket.d.ts +0 -283
- package/dist/predictos/clients/polymarket.d.ts.map +0 -1
- package/dist/predictos/clients/x402.d.ts +0 -213
- package/dist/predictos/clients/x402.d.ts.map +0 -1
- package/dist/predictos/data/kalshi.d.ts +0 -66
- package/dist/predictos/data/kalshi.d.ts.map +0 -1
- package/dist/predictos/data/kalshi.js +0 -1
- package/dist/predictos/data/kalshi.mjs +0 -1
- package/dist/predictos/data/polymarket.d.ts +0 -105
- package/dist/predictos/data/polymarket.d.ts.map +0 -1
- package/dist/predictos/data/polymarket.js +0 -1
- package/dist/predictos/data/polymarket.mjs +0 -1
- package/dist/predictos/events.d.ts +0 -9
- package/dist/predictos/events.d.ts.map +0 -1
- package/dist/predictos/index.js +0 -1
- package/dist/predictos/index.mjs +0 -1
- package/dist/predictos/types.d.ts +0 -408
- package/dist/predictos/types.d.ts.map +0 -1
- package/dist/searchQueryGenerator-DIIs9xw5.js +0 -1
- package/dist/searchQueryGenerator-rCVblXJS.cjs +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Polymarket (and Kalshi) market data client via the Dome API.
|
|
3
|
-
*
|
|
4
|
-
* Ported from the PredictOS `dome` shared client. The API key is read from
|
|
5
|
-
* the `apiKey` option, falling back to `process.env.DOME_API_KEY`.
|
|
6
|
-
*
|
|
7
|
-
* @see https://docs.domeapi.io/
|
|
8
|
-
*/
|
|
9
|
-
export interface DomeRequestOptions {
|
|
10
|
-
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
11
|
-
headers?: Record<string, string>;
|
|
12
|
-
params?: Record<string, string | number | boolean | undefined>;
|
|
13
|
-
/** Dome API key; falls back to `process.env.DOME_API_KEY`. */
|
|
14
|
-
apiKey?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface PolymarketMarket {
|
|
17
|
-
token_id: string;
|
|
18
|
-
condition_id: string;
|
|
19
|
-
question: string;
|
|
20
|
-
slug: string;
|
|
21
|
-
end_date: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
outcomes: string[];
|
|
24
|
-
outcome_prices: number[];
|
|
25
|
-
volume: number;
|
|
26
|
-
liquidity: number;
|
|
27
|
-
active: boolean;
|
|
28
|
-
closed: boolean;
|
|
29
|
-
image?: string;
|
|
30
|
-
icon?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface PolymarketMarketsResponse {
|
|
33
|
-
markets: PolymarketMarket[];
|
|
34
|
-
next_cursor?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface KalshiMarket {
|
|
37
|
-
ticker: string;
|
|
38
|
-
event_ticker: string;
|
|
39
|
-
title: string;
|
|
40
|
-
subtitle?: string;
|
|
41
|
-
status: string;
|
|
42
|
-
close_time: string;
|
|
43
|
-
yes_bid: number;
|
|
44
|
-
yes_ask: number;
|
|
45
|
-
no_bid: number;
|
|
46
|
-
no_ask: number;
|
|
47
|
-
last_price: number;
|
|
48
|
-
volume: number;
|
|
49
|
-
volume_24h: number;
|
|
50
|
-
liquidity: number;
|
|
51
|
-
open_interest: number;
|
|
52
|
-
}
|
|
53
|
-
export interface KalshiMarketsResponse {
|
|
54
|
-
markets: KalshiMarket[];
|
|
55
|
-
cursor?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface PaginationParams {
|
|
58
|
-
cursor?: string;
|
|
59
|
-
limit?: number;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Makes a request to the Dome API.
|
|
63
|
-
*
|
|
64
|
-
* @param endpoint The API endpoint (e.g., '/polymarket/markets')
|
|
65
|
-
* @param options Request options including method, headers, params, and apiKey
|
|
66
|
-
* @returns Promise resolving to the parsed JSON response
|
|
67
|
-
*/
|
|
68
|
-
export declare function domeRequest<T>(endpoint: string, options?: DomeRequestOptions): Promise<T>;
|
|
69
|
-
/**
|
|
70
|
-
* Gets Polymarket markets.
|
|
71
|
-
*
|
|
72
|
-
* @param params Pagination and filter parameters
|
|
73
|
-
* @param apiKey Optional Dome API key (falls back to `DOME_API_KEY`)
|
|
74
|
-
* @returns Promise resolving to markets list
|
|
75
|
-
*/
|
|
76
|
-
export declare function getPolymarketMarkets(params?: PaginationParams & {
|
|
77
|
-
active?: boolean;
|
|
78
|
-
closed?: boolean;
|
|
79
|
-
market_slug?: string;
|
|
80
|
-
slug?: string;
|
|
81
|
-
}, apiKey?: string): Promise<PolymarketMarketsResponse>;
|
|
82
|
-
/**
|
|
83
|
-
* Gets Kalshi markets by event ticker via Dome.
|
|
84
|
-
*
|
|
85
|
-
* @param eventTicker Event ticker identifier
|
|
86
|
-
* @param status Market status filter
|
|
87
|
-
* @param apiKey Optional Dome API key (falls back to `DOME_API_KEY`)
|
|
88
|
-
* @returns Promise resolving to markets list
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* getKalshiMarketsByEvent("KXBTC-25DEC")
|
|
92
|
-
*/
|
|
93
|
-
export declare function getKalshiMarketsByEvent(eventTicker: string, status?: "open" | "closed" | "settled", apiKey?: string): Promise<KalshiMarket[]>;
|
|
94
|
-
/**
|
|
95
|
-
* Builds a Kalshi market URL from a market ticker.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* buildKalshiMarketUrl("KXBTCD-25DEC1217-T89999.99") // "https://kalshi.com/markets/KXBTCD"
|
|
99
|
-
*/
|
|
100
|
-
export declare function buildKalshiMarketUrl(ticker: string): string;
|
|
101
|
-
/**
|
|
102
|
-
* Builds a Polymarket event URL from a market slug.
|
|
103
|
-
*/
|
|
104
|
-
export declare function buildPolymarketUrl(slug: string): string;
|
|
105
|
-
//# sourceMappingURL=polymarket.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,yBAAyB;IACxC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAA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,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"}
|
|
@@ -1 +0,0 @@
|
|
|
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})};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DataConfig, GetEventsRequest, GetEventsResult } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Fetch event markets from a prediction market URL.
|
|
4
|
-
*
|
|
5
|
-
* @throws Error on invalid input, unknown platforms, or when the event/markets
|
|
6
|
-
* cannot be fetched.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getEvents(request: GetEventsRequest, config?: DataConfig): Promise<GetEventsResult>;
|
|
9
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/predictos/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|
package/dist/predictos/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,408 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared domain types for the PredictOS core pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Consolidated from the per-function `types.ts` files of the original
|
|
5
|
-
* PredictOS Supabase edge functions.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* API credentials for the AI providers used by the analysis agents.
|
|
9
|
-
*
|
|
10
|
-
* Any field left undefined falls back to the corresponding environment
|
|
11
|
-
* variable (`OPENAI_API_KEY`, `XAI_API_KEY`, `BLOCKRUN_WALLET_KEY`).
|
|
12
|
-
*/
|
|
13
|
-
export interface AIConfig {
|
|
14
|
-
/** OpenAI API key (falls back to `process.env.OPENAI_API_KEY`) */
|
|
15
|
-
openaiApiKey?: string;
|
|
16
|
-
/** xAI / Grok API key (falls back to `process.env.XAI_API_KEY`) */
|
|
17
|
-
xaiApiKey?: string;
|
|
18
|
-
/** BlockRun Base-chain wallet private key (falls back to `process.env.BLOCKRUN_WALLET_KEY`) */
|
|
19
|
-
blockrunWalletKey?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* API credentials for the market data providers.
|
|
23
|
-
*
|
|
24
|
-
* Any field left undefined falls back to the corresponding environment
|
|
25
|
-
* variable (`DOME_API_KEY`, `DFLOW_API_KEY`).
|
|
26
|
-
*/
|
|
27
|
-
export interface DataConfig {
|
|
28
|
-
/** Dome API key (falls back to `process.env.DOME_API_KEY`) */
|
|
29
|
-
domeApiKey?: string;
|
|
30
|
-
/** DFlow API key (falls back to `process.env.DFLOW_API_KEY`) */
|
|
31
|
-
dflowApiKey?: string;
|
|
32
|
-
}
|
|
33
|
-
/** Prediction market platform. */
|
|
34
|
-
export type PmType = "Kalshi" | "Polymarket";
|
|
35
|
-
/** Source market platform (lowercase form used by the arbitrage module). */
|
|
36
|
-
export type ArbitrageMarketSource = "polymarket" | "kalshi";
|
|
37
|
-
/** URL source type (tracks if a URL came from a wrapper like Jupiter). */
|
|
38
|
-
export type UrlSource = "kalshi" | "polymarket" | "jupiter";
|
|
39
|
-
/** Data provider for market data. */
|
|
40
|
-
export type DataProvider = "dome" | "dflow" | "gamma";
|
|
41
|
-
/** Tool types available for Grok models. */
|
|
42
|
-
export type GrokTool = "x_search" | "web_search";
|
|
43
|
-
/**
|
|
44
|
-
* AI analysis result for an event's markets.
|
|
45
|
-
*/
|
|
46
|
-
export interface MarketAnalysis {
|
|
47
|
-
/** Event ticker identifier */
|
|
48
|
-
event_ticker: string;
|
|
49
|
-
/** Market ticker with the best alpha opportunity (if any) */
|
|
50
|
-
ticker: string;
|
|
51
|
-
/** Market title/question */
|
|
52
|
-
title: string;
|
|
53
|
-
/** Current market probability (0-100) */
|
|
54
|
-
marketProbability: number;
|
|
55
|
-
/** AI's estimated actual probability (0-100) */
|
|
56
|
-
estimatedActualProbability: number;
|
|
57
|
-
/** Difference between estimated and market probability (positive = buy yes, negative = buy no) */
|
|
58
|
-
alphaOpportunity: number;
|
|
59
|
-
/** Whether there is meaningful alpha opportunity */
|
|
60
|
-
hasAlpha: boolean;
|
|
61
|
-
/** Which side the AI predicts will win */
|
|
62
|
-
predictedWinner: "YES" | "NO";
|
|
63
|
-
/** Confidence that the predicted winner will win (0-100) */
|
|
64
|
-
winnerConfidence: number;
|
|
65
|
-
/** Recommended trading action */
|
|
66
|
-
recommendedAction: "BUY YES" | "BUY NO" | "NO TRADE";
|
|
67
|
-
/** Detailed explanation of the analysis */
|
|
68
|
-
reasoning: string;
|
|
69
|
-
/** AI's confidence in this overall assessment (0-100) */
|
|
70
|
-
confidence: number;
|
|
71
|
-
/** Key factors influencing the assessment */
|
|
72
|
-
keyFactors: string[];
|
|
73
|
-
/** Risks that could affect the prediction */
|
|
74
|
-
risks: string[];
|
|
75
|
-
/** Direct answer to the user's specific question */
|
|
76
|
-
questionAnswer: string;
|
|
77
|
-
/** Brief summary of the analysis findings (under 270 characters) */
|
|
78
|
-
analysisSummary: string;
|
|
79
|
-
/** X (Twitter) post URLs backing the analysis (when x_search tool is used) */
|
|
80
|
-
xSources?: string[];
|
|
81
|
-
/** Web URLs (news, articles) backing the analysis (when web_search tool is used) */
|
|
82
|
-
webSources?: string[];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Input for the event analysis agent.
|
|
86
|
-
*/
|
|
87
|
-
export interface EventAnalysisAgentRequest {
|
|
88
|
-
/** Raw market data from the provider */
|
|
89
|
-
markets: unknown[];
|
|
90
|
-
/** Event identifier (ticker for Kalshi, slug for Polymarket) */
|
|
91
|
-
eventIdentifier: string;
|
|
92
|
-
/** Prediction market type */
|
|
93
|
-
pmType: PmType;
|
|
94
|
-
/** AI model to use for analysis */
|
|
95
|
-
model: string;
|
|
96
|
-
/** Optional custom question for analysis */
|
|
97
|
-
question?: string;
|
|
98
|
-
/** Optional tools for Grok models (X Search, Web Search) */
|
|
99
|
-
tools?: GrokTool[];
|
|
100
|
-
/** Optional user command to prioritize in the analysis */
|
|
101
|
-
userCommand?: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Result of the event analysis agent.
|
|
105
|
-
*/
|
|
106
|
-
export interface EventAnalysisAgentResult {
|
|
107
|
-
/** Parsed analysis */
|
|
108
|
-
analysis: MarketAnalysis;
|
|
109
|
-
/** Model that produced the analysis */
|
|
110
|
-
model: string;
|
|
111
|
-
/** Total tokens used, when reported by the provider */
|
|
112
|
-
tokensUsed?: number;
|
|
113
|
-
/** BlockRun-specific USDC cost, when applicable (e.g. "$0.001234") */
|
|
114
|
-
paymentCost?: string;
|
|
115
|
-
/** Wall-clock processing time in milliseconds */
|
|
116
|
-
processingTimeMs: number;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Individual agent's analysis input for the bookmaker agent.
|
|
120
|
-
*/
|
|
121
|
-
export interface AgentAnalysisInput {
|
|
122
|
-
/** Unique agent identifier */
|
|
123
|
-
agentId: string;
|
|
124
|
-
/** Model used by this agent */
|
|
125
|
-
model: string;
|
|
126
|
-
/** The analysis result from this agent */
|
|
127
|
-
analysis: MarketAnalysis;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* External data-source (PayAI / x402 seller) result input.
|
|
131
|
-
*/
|
|
132
|
-
export interface X402ResultInput {
|
|
133
|
-
/** Agent identifier that used this seller */
|
|
134
|
-
agentId: string;
|
|
135
|
-
/** Name of the PayAI seller */
|
|
136
|
-
seller: string;
|
|
137
|
-
/** Query sent to the seller */
|
|
138
|
-
query: string;
|
|
139
|
-
/** Response from the seller (truncated to 3000 chars) */
|
|
140
|
-
response: string;
|
|
141
|
-
}
|
|
142
|
-
/** Agent consensus information. */
|
|
143
|
-
export interface AgentConsensus {
|
|
144
|
-
/** Level of agreement among agents */
|
|
145
|
-
agreementLevel: "high" | "medium" | "low";
|
|
146
|
-
/** What most agents recommended */
|
|
147
|
-
majorityRecommendation: string;
|
|
148
|
-
/** Dissenting opinions summarized */
|
|
149
|
-
dissenting: string[];
|
|
150
|
-
}
|
|
151
|
-
/** Aggregated analysis result. */
|
|
152
|
-
export interface AggregatedAnalysis extends MarketAnalysis {
|
|
153
|
-
/** Information about agent consensus */
|
|
154
|
-
agentConsensus: AgentConsensus;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Input for the bookmaker (aggregator) agent.
|
|
158
|
-
*/
|
|
159
|
-
export interface BookmakerAgentRequest {
|
|
160
|
-
/** List of all agent analyses to aggregate */
|
|
161
|
-
analyses: AgentAnalysisInput[];
|
|
162
|
-
/** List of external PayAI/x402 seller results to include */
|
|
163
|
-
x402Results?: X402ResultInput[];
|
|
164
|
-
/** Event identifier (ticker for Kalshi, slug for Polymarket) */
|
|
165
|
-
eventIdentifier: string;
|
|
166
|
-
/** Prediction market type */
|
|
167
|
-
pmType: PmType;
|
|
168
|
-
/** AI model to use for aggregation */
|
|
169
|
-
model: string;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Result of the bookmaker (aggregator) agent.
|
|
173
|
-
*/
|
|
174
|
-
export interface BookmakerAgentResult {
|
|
175
|
-
/** Consolidated analysis */
|
|
176
|
-
analysis: AggregatedAnalysis;
|
|
177
|
-
/** Model that produced the analysis */
|
|
178
|
-
model: string;
|
|
179
|
-
/** Total tokens used, when reported by the provider */
|
|
180
|
-
tokensUsed?: number;
|
|
181
|
-
/** Number of data sources aggregated */
|
|
182
|
-
agentsAggregated: number;
|
|
183
|
-
/** Wall-clock processing time in milliseconds */
|
|
184
|
-
processingTimeMs: number;
|
|
185
|
-
}
|
|
186
|
-
/** Supported prediction market platforms for order mapping. */
|
|
187
|
-
export type PlatformType = "Polymarket" | "Kalshi";
|
|
188
|
-
/**
|
|
189
|
-
* Analysis result consumed by the mapper agent.
|
|
190
|
-
*/
|
|
191
|
-
export interface AnalysisResult {
|
|
192
|
-
/** Recommended trading action */
|
|
193
|
-
recommendedAction: "BUY YES" | "BUY NO" | "NO TRADE";
|
|
194
|
-
/** Which side is predicted to win */
|
|
195
|
-
predictedWinner: "YES" | "NO";
|
|
196
|
-
/** Confidence in the prediction (0-100) */
|
|
197
|
-
winnerConfidence: number;
|
|
198
|
-
/** Current market probability (0-100) */
|
|
199
|
-
marketProbability: number;
|
|
200
|
-
/** Estimated actual probability (0-100) */
|
|
201
|
-
estimatedActualProbability: number;
|
|
202
|
-
/** Market ticker */
|
|
203
|
-
ticker: string;
|
|
204
|
-
/** Market title */
|
|
205
|
-
title: string;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Raw market data from data providers (Dome/Gamma for Polymarket).
|
|
209
|
-
*/
|
|
210
|
-
export interface MarketData {
|
|
211
|
-
/** Market condition ID */
|
|
212
|
-
conditionId?: string;
|
|
213
|
-
/** Market slug/identifier */
|
|
214
|
-
slug?: string;
|
|
215
|
-
/** CLOB token IDs (JSON string array) */
|
|
216
|
-
clobTokenIds?: string;
|
|
217
|
-
/** Outcomes (JSON string array like '["Yes", "No"]') */
|
|
218
|
-
outcomes?: string;
|
|
219
|
-
/** Outcome prices (JSON string array like '["0.65", "0.35"]') */
|
|
220
|
-
outcomePrices?: string;
|
|
221
|
-
/** Whether market is accepting orders */
|
|
222
|
-
acceptingOrders?: boolean;
|
|
223
|
-
/** Whether market is active */
|
|
224
|
-
active?: boolean;
|
|
225
|
-
/** Whether market is closed */
|
|
226
|
-
closed?: boolean;
|
|
227
|
-
/** Minimum tick size for orders */
|
|
228
|
-
minimumTickSize?: string;
|
|
229
|
-
/** Whether this is a negative risk market */
|
|
230
|
-
negRisk?: boolean;
|
|
231
|
-
/** Market title */
|
|
232
|
-
title?: string;
|
|
233
|
-
/** Market question */
|
|
234
|
-
question?: string;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Input for the mapper agent.
|
|
238
|
-
*/
|
|
239
|
-
export interface MapperAgentRequest {
|
|
240
|
-
/** Platform type (Polymarket or Kalshi) */
|
|
241
|
-
platform: PlatformType;
|
|
242
|
-
/** Analysis result from bookmaker/analysis agent */
|
|
243
|
-
analysisResult: AnalysisResult;
|
|
244
|
-
/** Raw market data from data provider */
|
|
245
|
-
marketData: MarketData;
|
|
246
|
-
/** Budget in USD for the order */
|
|
247
|
-
budgetUsd: number;
|
|
248
|
-
}
|
|
249
|
-
/** Polymarket-specific order parameters. */
|
|
250
|
-
export interface PolymarketOrderParams {
|
|
251
|
-
/** Token ID for the outcome to buy */
|
|
252
|
-
tokenId: string;
|
|
253
|
-
/** Order price (0-1 decimal) */
|
|
254
|
-
price: number;
|
|
255
|
-
/** Order side (BUY or SELL) */
|
|
256
|
-
side: "BUY" | "SELL";
|
|
257
|
-
/** Number of shares to buy */
|
|
258
|
-
size: number;
|
|
259
|
-
/** Fee rate in basis points */
|
|
260
|
-
feeRateBps: number;
|
|
261
|
-
/** Tick size for the market */
|
|
262
|
-
tickSize: string;
|
|
263
|
-
/** Whether this is a negative risk market */
|
|
264
|
-
negRisk: boolean;
|
|
265
|
-
/** Market condition ID */
|
|
266
|
-
conditionId: string;
|
|
267
|
-
/** Market slug for reference */
|
|
268
|
-
marketSlug: string;
|
|
269
|
-
/** Human-readable description of the order */
|
|
270
|
-
orderDescription: string;
|
|
271
|
-
}
|
|
272
|
-
/** Kalshi-specific order parameters (not yet implemented). */
|
|
273
|
-
export interface KalshiOrderParams {
|
|
274
|
-
ticker: string;
|
|
275
|
-
side: "yes" | "no";
|
|
276
|
-
count: number;
|
|
277
|
-
limitPrice: number;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Result of the mapper agent.
|
|
281
|
-
*/
|
|
282
|
-
export interface MapperAgentResult {
|
|
283
|
-
/** Platform the order targets */
|
|
284
|
-
platform: PlatformType;
|
|
285
|
-
/** Platform-specific order parameters */
|
|
286
|
-
orderParams: PolymarketOrderParams | KalshiOrderParams;
|
|
287
|
-
/** Summary of the analysis that produced the order */
|
|
288
|
-
analysis: {
|
|
289
|
-
recommendedAction: string;
|
|
290
|
-
side: "YES" | "NO";
|
|
291
|
-
confidence: number;
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
/** Individual market data for arbitrage comparison. */
|
|
295
|
-
export interface ArbitrageMarketData {
|
|
296
|
-
/** Source platform */
|
|
297
|
-
source: ArbitrageMarketSource;
|
|
298
|
-
/** Market/event name or title */
|
|
299
|
-
name: string;
|
|
300
|
-
/** Unique identifier (slug for Polymarket, ticker for Kalshi) */
|
|
301
|
-
identifier: string;
|
|
302
|
-
/** Yes price (normalized to 0-100) */
|
|
303
|
-
yesPrice: number;
|
|
304
|
-
/** No price (normalized to 0-100) */
|
|
305
|
-
noPrice: number;
|
|
306
|
-
/** Volume (if available) */
|
|
307
|
-
volume?: number;
|
|
308
|
-
/** Liquidity (if available) */
|
|
309
|
-
liquidity?: number;
|
|
310
|
-
/** Market URL */
|
|
311
|
-
url: string;
|
|
312
|
-
/** OkBet URL for this market */
|
|
313
|
-
okbetUrl?: string;
|
|
314
|
-
/** Raw market data from API */
|
|
315
|
-
rawData?: unknown;
|
|
316
|
-
}
|
|
317
|
-
/** Arbitrage opportunity details. */
|
|
318
|
-
export interface ArbitrageOpportunity {
|
|
319
|
-
/** Whether an arb opportunity exists */
|
|
320
|
-
hasArbitrage: boolean;
|
|
321
|
-
/** Profit percentage if arb exists */
|
|
322
|
-
profitPercent?: number;
|
|
323
|
-
/** Recommended strategy */
|
|
324
|
-
strategy?: {
|
|
325
|
-
/** Which market to buy YES on */
|
|
326
|
-
buyYesOn: ArbitrageMarketSource;
|
|
327
|
-
/** Price to buy YES */
|
|
328
|
-
buyYesPrice: number;
|
|
329
|
-
/** Which market to buy NO on */
|
|
330
|
-
buyNoOn: ArbitrageMarketSource;
|
|
331
|
-
/** Price to buy NO */
|
|
332
|
-
buyNoPrice: number;
|
|
333
|
-
/** Total cost for $100 bet on each side */
|
|
334
|
-
totalCost: number;
|
|
335
|
-
/** Guaranteed payout ($100) */
|
|
336
|
-
guaranteedPayout: number;
|
|
337
|
-
/** Net profit */
|
|
338
|
-
netProfit: number;
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
/** AI analysis result for arbitrage. */
|
|
342
|
-
export interface ArbitrageAnalysis {
|
|
343
|
-
/** Whether the markets represent the same underlying event */
|
|
344
|
-
isSameMarket: boolean;
|
|
345
|
-
/** Confidence that markets are the same (0-100) */
|
|
346
|
-
sameMarketConfidence: number;
|
|
347
|
-
/** Explanation of why markets are/aren't the same */
|
|
348
|
-
marketComparisonReasoning: string;
|
|
349
|
-
/** Polymarket data (if found) */
|
|
350
|
-
polymarketData?: ArbitrageMarketData;
|
|
351
|
-
/** Kalshi data (if found) */
|
|
352
|
-
kalshiData?: ArbitrageMarketData;
|
|
353
|
-
/** Arbitrage opportunity analysis */
|
|
354
|
-
arbitrage: ArbitrageOpportunity;
|
|
355
|
-
/** Overall summary of findings */
|
|
356
|
-
summary: string;
|
|
357
|
-
/** Key risks or caveats */
|
|
358
|
-
risks: string[];
|
|
359
|
-
/** Recommended action */
|
|
360
|
-
recommendation: string;
|
|
361
|
-
}
|
|
362
|
-
/** Input for the arbitrage finder. */
|
|
363
|
-
export interface ArbitrageRequest {
|
|
364
|
-
/** URL pasted by user (Polymarket or Kalshi) */
|
|
365
|
-
url: string;
|
|
366
|
-
/** AI model to use */
|
|
367
|
-
model: string;
|
|
368
|
-
}
|
|
369
|
-
/** Result of the arbitrage finder. */
|
|
370
|
-
export interface ArbitrageResult {
|
|
371
|
-
/** Arbitrage analysis */
|
|
372
|
-
analysis: ArbitrageAnalysis;
|
|
373
|
-
/** Model that produced the analysis (may be "none" if no search results) */
|
|
374
|
-
model: string;
|
|
375
|
-
/** Total tokens used, when reported by the provider */
|
|
376
|
-
tokensUsed?: number;
|
|
377
|
-
/** Source platform (parsed from the URL) */
|
|
378
|
-
sourceMarket: ArbitrageMarketSource;
|
|
379
|
-
/** Platform that was searched for a matching market */
|
|
380
|
-
searchedMarket: ArbitrageMarketSource;
|
|
381
|
-
/** Wall-clock processing time in milliseconds */
|
|
382
|
-
processingTimeMs: number;
|
|
383
|
-
}
|
|
384
|
-
/** Input for the events fetcher. */
|
|
385
|
-
export interface GetEventsRequest {
|
|
386
|
-
/** Prediction market URL */
|
|
387
|
-
url: string;
|
|
388
|
-
}
|
|
389
|
-
/** Result of the events fetcher. */
|
|
390
|
-
export interface GetEventsResult {
|
|
391
|
-
/** Event identifier (ticker for Kalshi, slug for Polymarket) */
|
|
392
|
-
eventIdentifier: string;
|
|
393
|
-
/** Event ID (for Polymarket - used for OkBet links) */
|
|
394
|
-
eventId?: string;
|
|
395
|
-
/** Prediction market type */
|
|
396
|
-
pmType: PmType;
|
|
397
|
-
/** Original URL source (e.g., 'jupiter' for Jupiter prediction market links) */
|
|
398
|
-
urlSource: UrlSource;
|
|
399
|
-
/** Raw market data from the provider */
|
|
400
|
-
markets: unknown[];
|
|
401
|
-
/** Number of markets found */
|
|
402
|
-
marketsCount: number;
|
|
403
|
-
/** Data provider used */
|
|
404
|
-
dataProvider: DataProvider;
|
|
405
|
-
/** Wall-clock processing time in milliseconds */
|
|
406
|
-
processingTimeMs: number;
|
|
407
|
-
}
|
|
408
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d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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};
|
|
@@ -1 +0,0 @@
|
|
|
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:`}};
|