@agg-build/sdk 1.0.1 → 1.2.11
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 +9 -0
- package/dist/index.d.mts +434 -5
- package/dist/index.d.ts +434 -5
- package/dist/index.js +155 -2
- package/dist/index.mjs +153 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76,12 +76,14 @@ __export(index_exports, {
|
|
|
76
76
|
Venue: () => Venue,
|
|
77
77
|
aggregateMidpoint: () => aggregateMidpoint,
|
|
78
78
|
applyOrderbookDelta: () => applyOrderbookDelta,
|
|
79
|
+
buildVenueUrl: () => buildVenueUrl,
|
|
79
80
|
computeBestSplitsByAmount: () => computeBestSplitsByAmount2,
|
|
80
81
|
computeChecksum: () => computeChecksum,
|
|
81
82
|
createAggClient: () => createAggClient,
|
|
82
83
|
enumGuard: () => enumGuard,
|
|
83
84
|
formatMarketQuestion: () => formatMarketQuestion,
|
|
84
85
|
formatOutcomeLabel: () => formatOutcomeLabel,
|
|
86
|
+
formatOutcomeTitle: () => formatOutcomeTitle,
|
|
85
87
|
getWalletAddressFromUserProfile: () => getWalletAddressFromUserProfile,
|
|
86
88
|
hasShape: () => hasShape,
|
|
87
89
|
isEmail: () => isEmail,
|
|
@@ -214,6 +216,29 @@ function formatMarketQuestion(venue, market) {
|
|
|
214
216
|
}
|
|
215
217
|
return market.question.trim();
|
|
216
218
|
}
|
|
219
|
+
function formatOutcomeTitle(_venue, outcome, market) {
|
|
220
|
+
var _a, _b;
|
|
221
|
+
const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
|
|
222
|
+
if (outcomes.length >= 2) {
|
|
223
|
+
const normalized = outcomes.map((o) => {
|
|
224
|
+
var _a2, _b2;
|
|
225
|
+
return (_b2 = (_a2 = o.title) == null ? void 0 : _a2.trim()) != null ? _b2 : "";
|
|
226
|
+
});
|
|
227
|
+
const hasAnyTitle = normalized.some((t) => t.length > 0);
|
|
228
|
+
if (hasAnyTitle && normalized.every((t) => t === normalized[0])) return null;
|
|
229
|
+
}
|
|
230
|
+
const title = (_b = outcome.title) == null ? void 0 : _b.trim();
|
|
231
|
+
if (title) return title;
|
|
232
|
+
return deriveOverUnderTitle(outcome.label, market.question);
|
|
233
|
+
}
|
|
234
|
+
var OVER_UNDER_QUESTION = /\bO\/U\s+\d/i;
|
|
235
|
+
function deriveOverUnderTitle(label, question) {
|
|
236
|
+
if (!question || !OVER_UNDER_QUESTION.test(question)) return null;
|
|
237
|
+
const normalized = label.trim().toLowerCase();
|
|
238
|
+
if (normalized === "yes") return "Over";
|
|
239
|
+
if (normalized === "no") return "Under";
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
217
242
|
|
|
218
243
|
// ../common/src/utils/auth.ts
|
|
219
244
|
function getWalletAddressFromUserProfile(user) {
|
|
@@ -560,6 +585,51 @@ var getVenueOrder = (venue) => {
|
|
|
560
585
|
};
|
|
561
586
|
var sortVenues = (venues) => [...venues].sort((a, b) => getVenueOrder(a) - getVenueOrder(b));
|
|
562
587
|
|
|
588
|
+
// ../common/src/utils/venue-url.ts
|
|
589
|
+
function buildVenueUrl(venue, opts) {
|
|
590
|
+
switch (venue) {
|
|
591
|
+
case "kalshi": {
|
|
592
|
+
const series = opts.seriesExternalId;
|
|
593
|
+
const event = opts.eventExternalId;
|
|
594
|
+
if (series && event) {
|
|
595
|
+
return `https://kalshi.com/markets/${series.toLowerCase()}/${event.toLowerCase()}`;
|
|
596
|
+
}
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
case "polymarket": {
|
|
600
|
+
if (opts.eventSlug) return `https://polymarket.com/event/${opts.eventSlug}`;
|
|
601
|
+
if (opts.conditionId) return `https://polymarket.com/market/${opts.conditionId}`;
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
case "predict": {
|
|
605
|
+
if (opts.eventSlug) return `https://predict.fun/market/${opts.eventSlug}`;
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
case "limitless": {
|
|
609
|
+
if (opts.eventSlug) return `https://limitless.exchange/markets/${opts.eventSlug}`;
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
case "opinion": {
|
|
613
|
+
if (opts.eventSlug) return `https://www.opinion.trade/market/${opts.eventSlug}`;
|
|
614
|
+
return null;
|
|
615
|
+
}
|
|
616
|
+
case "myriad": {
|
|
617
|
+
if (opts.eventSlug) return `https://myriad.markets/markets/${opts.eventSlug}`;
|
|
618
|
+
return null;
|
|
619
|
+
}
|
|
620
|
+
case "hyperliquid": {
|
|
621
|
+
if (opts.eventSlug) return `https://app.hyperliquid.xyz/trade/${opts.eventSlug}`;
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
case "probable": {
|
|
625
|
+
if (opts.eventSlug) return `https://probable.markets/event/${opts.eventSlug}`;
|
|
626
|
+
return null;
|
|
627
|
+
}
|
|
628
|
+
default:
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
563
633
|
// src/orderbook-utils.ts
|
|
564
634
|
var PRICE_KEY_SCALE = 1e9;
|
|
565
635
|
function crc32(str) {
|
|
@@ -1592,6 +1662,7 @@ var AggClient = class {
|
|
|
1592
1662
|
let message = response.status === 404 ? "Market not found" : `AGG API error: ${response.status} ${response.statusText}`;
|
|
1593
1663
|
let code;
|
|
1594
1664
|
let retryable;
|
|
1665
|
+
let errors;
|
|
1595
1666
|
try {
|
|
1596
1667
|
const body = yield response.json();
|
|
1597
1668
|
if (typeof body.message === "string" && body.message.length > 0) {
|
|
@@ -1603,12 +1674,20 @@ var AggClient = class {
|
|
|
1603
1674
|
if (typeof body.retryable === "boolean") {
|
|
1604
1675
|
retryable = body.retryable;
|
|
1605
1676
|
}
|
|
1677
|
+
if (Array.isArray(body.errors)) {
|
|
1678
|
+
const parsed = body.errors.map((e) => ({
|
|
1679
|
+
field: typeof (e == null ? void 0 : e.field) === "string" ? e.field : "",
|
|
1680
|
+
message: typeof (e == null ? void 0 : e.message) === "string" ? e.message : ""
|
|
1681
|
+
})).filter((e) => e.message.length > 0);
|
|
1682
|
+
if (parsed.length > 0) errors = parsed;
|
|
1683
|
+
}
|
|
1606
1684
|
} catch (e) {
|
|
1607
1685
|
}
|
|
1608
1686
|
const error = new Error(message);
|
|
1609
1687
|
error.status = response.status;
|
|
1610
1688
|
if (code) error.code = code;
|
|
1611
1689
|
if (retryable !== void 0) error.retryable = retryable;
|
|
1690
|
+
if (errors) error.errors = errors;
|
|
1612
1691
|
throw error;
|
|
1613
1692
|
});
|
|
1614
1693
|
}
|
|
@@ -1999,11 +2078,18 @@ Issued At: ${issuedAt}`;
|
|
|
1999
2078
|
});
|
|
2000
2079
|
});
|
|
2001
2080
|
}
|
|
2002
|
-
/**
|
|
2081
|
+
/**
|
|
2082
|
+
* List execution orders for the authenticated user (cursor pagination).
|
|
2083
|
+
*
|
|
2084
|
+
* Pass `quoteId` to fetch every leg of a multi-venue split route in
|
|
2085
|
+
* one call — `useQuoteSummary(quoteId)` reduces the list into a
|
|
2086
|
+
* rollup (total cost, share-weighted avg price, to-win).
|
|
2087
|
+
*/
|
|
2003
2088
|
getExecutionOrders() {
|
|
2004
2089
|
return __async(this, arguments, function* (params = {}) {
|
|
2005
2090
|
const query = {};
|
|
2006
2091
|
if (params.orderId) query.orderId = params.orderId;
|
|
2092
|
+
if (params.quoteId) query.quoteId = params.quoteId;
|
|
2007
2093
|
if (params.status) query.status = params.status;
|
|
2008
2094
|
if (params.cursor) query.cursor = params.cursor;
|
|
2009
2095
|
if (params.limit != null) query.limit = String(params.limit);
|
|
@@ -2126,7 +2212,14 @@ Issued At: ${issuedAt}`;
|
|
|
2126
2212
|
return this.request("/app/config", init);
|
|
2127
2213
|
});
|
|
2128
2214
|
}
|
|
2129
|
-
/**
|
|
2215
|
+
/**
|
|
2216
|
+
* Search events or markets by query string. Supports cursor-based pagination.
|
|
2217
|
+
*
|
|
2218
|
+
* Pass `deep: true` on submit (Enter / Search button) to opt in to the
|
|
2219
|
+
* server-side reranker. Leave it off for debounced typeahead — the wire
|
|
2220
|
+
* format intentionally omits the param so the server hits the cheaper
|
|
2221
|
+
* (and longer-TTL) light cache slot.
|
|
2222
|
+
*/
|
|
2130
2223
|
search(params) {
|
|
2131
2224
|
return __async(this, null, function* () {
|
|
2132
2225
|
const query = {
|
|
@@ -2136,11 +2229,66 @@ Issued At: ${issuedAt}`;
|
|
|
2136
2229
|
if (params.categoryIds && params.categoryIds.length > 0) query.categoryIds = params.categoryIds;
|
|
2137
2230
|
if (params.limit != null) query.limit = String(params.limit);
|
|
2138
2231
|
if (params.cursor) query.cursor = params.cursor;
|
|
2232
|
+
if (params.deep) query.deepSearch = "true";
|
|
2139
2233
|
return this.request("/search", {
|
|
2140
2234
|
query
|
|
2141
2235
|
});
|
|
2142
2236
|
});
|
|
2143
2237
|
}
|
|
2238
|
+
/** Get Correlated Markets processing and embedding coverage. */
|
|
2239
|
+
getCorrelatedMarketsStatus(options) {
|
|
2240
|
+
return __async(this, null, function* () {
|
|
2241
|
+
return this.request("/correlated-markets/status", {
|
|
2242
|
+
signal: options == null ? void 0 : options.signal
|
|
2243
|
+
});
|
|
2244
|
+
});
|
|
2245
|
+
}
|
|
2246
|
+
/** Get the generated correlated market signals for a market. */
|
|
2247
|
+
getMarketCorrelatedSignals(venueMarketId, options) {
|
|
2248
|
+
return __async(this, null, function* () {
|
|
2249
|
+
const query = {};
|
|
2250
|
+
if ((options == null ? void 0 : options.includeResolved) != null) query.includeResolved = String(options.includeResolved);
|
|
2251
|
+
return this.request(
|
|
2252
|
+
`/correlated-markets/${encodeURIComponent(venueMarketId)}`,
|
|
2253
|
+
{ query, signal: options == null ? void 0 : options.signal }
|
|
2254
|
+
);
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
/** Search markets by Correlated Markets signal similarity. */
|
|
2258
|
+
queryCorrelatedMarkets(params, options) {
|
|
2259
|
+
return __async(this, null, function* () {
|
|
2260
|
+
return this.request("/correlated-markets/query", {
|
|
2261
|
+
method: "POST",
|
|
2262
|
+
body: JSON.stringify(params),
|
|
2263
|
+
signal: options == null ? void 0 : options.signal
|
|
2264
|
+
});
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
/** Get expansion and hedge candidates for an already-processed market. */
|
|
2268
|
+
getCorrelatedMarketCascade(params, options) {
|
|
2269
|
+
return __async(this, null, function* () {
|
|
2270
|
+
const query = {};
|
|
2271
|
+
if (params.side) query.side = params.side;
|
|
2272
|
+
if (params.mode) query.mode = params.mode;
|
|
2273
|
+
if (params.limit != null) query.limit = String(params.limit);
|
|
2274
|
+
if (params.cursor) query.cursor = params.cursor;
|
|
2275
|
+
if (params.includeResolved != null) query.includeResolved = String(params.includeResolved);
|
|
2276
|
+
return this.request(
|
|
2277
|
+
`/correlated-markets/cascade/${encodeURIComponent(params.venueMarketId)}`,
|
|
2278
|
+
{ query, signal: options == null ? void 0 : options.signal }
|
|
2279
|
+
);
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
/** Resolve a market by ID, venue identifier, slug, conditionId, or text, then return candidates. */
|
|
2283
|
+
resolveCorrelatedMarkets(params, options) {
|
|
2284
|
+
return __async(this, null, function* () {
|
|
2285
|
+
return this.request("/correlated-markets/resolve", {
|
|
2286
|
+
method: "POST",
|
|
2287
|
+
body: JSON.stringify(params),
|
|
2288
|
+
signal: options == null ? void 0 : options.signal
|
|
2289
|
+
});
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2144
2292
|
// --- Chart data ---
|
|
2145
2293
|
/** Get the canonical TradingView-style bar series for a single venue market outcome. */
|
|
2146
2294
|
getChartBars(params, options) {
|
|
@@ -2176,7 +2324,9 @@ Issued At: ${issuedAt}`;
|
|
|
2176
2324
|
getMidpoints(paramsOrVenueMarketIds, options) {
|
|
2177
2325
|
return __async(this, null, function* () {
|
|
2178
2326
|
const venueMarketIds = Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds : paramsOrVenueMarketIds.venueMarketIds;
|
|
2327
|
+
const bestPrice = !Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds.bestPrice : options == null ? void 0 : options.bestPrice;
|
|
2179
2328
|
const query = { venueMarketIds };
|
|
2329
|
+
if (bestPrice) query.bestPrice = "true";
|
|
2180
2330
|
return this.request("/midpoints", {
|
|
2181
2331
|
query,
|
|
2182
2332
|
signal: options == null ? void 0 : options.signal
|
|
@@ -2220,6 +2370,7 @@ Issued At: ${issuedAt}`;
|
|
|
2220
2370
|
if (params.slipCapBps != null) query.slipCapBps = String(params.slipCapBps);
|
|
2221
2371
|
if (params.compareVenues) query.compareVenues = "true";
|
|
2222
2372
|
if (params.tradeSide) query.side = params.tradeSide;
|
|
2373
|
+
if (params.deepEstimate) query.deepEstimate = "true";
|
|
2223
2374
|
const response = yield this.request(
|
|
2224
2375
|
`/orderbook/${encodeURIComponent(venueMarketOutcomeId)}/route`,
|
|
2225
2376
|
{ query, signal: options == null ? void 0 : options.signal }
|
|
@@ -2576,12 +2727,14 @@ function createAggClient(options) {
|
|
|
2576
2727
|
Venue,
|
|
2577
2728
|
aggregateMidpoint,
|
|
2578
2729
|
applyOrderbookDelta,
|
|
2730
|
+
buildVenueUrl,
|
|
2579
2731
|
computeBestSplitsByAmount,
|
|
2580
2732
|
computeChecksum,
|
|
2581
2733
|
createAggClient,
|
|
2582
2734
|
enumGuard,
|
|
2583
2735
|
formatMarketQuestion,
|
|
2584
2736
|
formatOutcomeLabel,
|
|
2737
|
+
formatOutcomeTitle,
|
|
2585
2738
|
getWalletAddressFromUserProfile,
|
|
2586
2739
|
hasShape,
|
|
2587
2740
|
isEmail,
|
package/dist/index.mjs
CHANGED
|
@@ -117,6 +117,29 @@ function formatMarketQuestion(venue, market) {
|
|
|
117
117
|
}
|
|
118
118
|
return market.question.trim();
|
|
119
119
|
}
|
|
120
|
+
function formatOutcomeTitle(_venue, outcome, market) {
|
|
121
|
+
var _a, _b;
|
|
122
|
+
const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
|
|
123
|
+
if (outcomes.length >= 2) {
|
|
124
|
+
const normalized = outcomes.map((o) => {
|
|
125
|
+
var _a2, _b2;
|
|
126
|
+
return (_b2 = (_a2 = o.title) == null ? void 0 : _a2.trim()) != null ? _b2 : "";
|
|
127
|
+
});
|
|
128
|
+
const hasAnyTitle = normalized.some((t) => t.length > 0);
|
|
129
|
+
if (hasAnyTitle && normalized.every((t) => t === normalized[0])) return null;
|
|
130
|
+
}
|
|
131
|
+
const title = (_b = outcome.title) == null ? void 0 : _b.trim();
|
|
132
|
+
if (title) return title;
|
|
133
|
+
return deriveOverUnderTitle(outcome.label, market.question);
|
|
134
|
+
}
|
|
135
|
+
var OVER_UNDER_QUESTION = /\bO\/U\s+\d/i;
|
|
136
|
+
function deriveOverUnderTitle(label, question) {
|
|
137
|
+
if (!question || !OVER_UNDER_QUESTION.test(question)) return null;
|
|
138
|
+
const normalized = label.trim().toLowerCase();
|
|
139
|
+
if (normalized === "yes") return "Over";
|
|
140
|
+
if (normalized === "no") return "Under";
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
120
143
|
|
|
121
144
|
// ../common/src/utils/auth.ts
|
|
122
145
|
function getWalletAddressFromUserProfile(user) {
|
|
@@ -463,6 +486,51 @@ var getVenueOrder = (venue) => {
|
|
|
463
486
|
};
|
|
464
487
|
var sortVenues = (venues) => [...venues].sort((a, b) => getVenueOrder(a) - getVenueOrder(b));
|
|
465
488
|
|
|
489
|
+
// ../common/src/utils/venue-url.ts
|
|
490
|
+
function buildVenueUrl(venue, opts) {
|
|
491
|
+
switch (venue) {
|
|
492
|
+
case "kalshi": {
|
|
493
|
+
const series = opts.seriesExternalId;
|
|
494
|
+
const event = opts.eventExternalId;
|
|
495
|
+
if (series && event) {
|
|
496
|
+
return `https://kalshi.com/markets/${series.toLowerCase()}/${event.toLowerCase()}`;
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
case "polymarket": {
|
|
501
|
+
if (opts.eventSlug) return `https://polymarket.com/event/${opts.eventSlug}`;
|
|
502
|
+
if (opts.conditionId) return `https://polymarket.com/market/${opts.conditionId}`;
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
case "predict": {
|
|
506
|
+
if (opts.eventSlug) return `https://predict.fun/market/${opts.eventSlug}`;
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
case "limitless": {
|
|
510
|
+
if (opts.eventSlug) return `https://limitless.exchange/markets/${opts.eventSlug}`;
|
|
511
|
+
return null;
|
|
512
|
+
}
|
|
513
|
+
case "opinion": {
|
|
514
|
+
if (opts.eventSlug) return `https://www.opinion.trade/market/${opts.eventSlug}`;
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
case "myriad": {
|
|
518
|
+
if (opts.eventSlug) return `https://myriad.markets/markets/${opts.eventSlug}`;
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
case "hyperliquid": {
|
|
522
|
+
if (opts.eventSlug) return `https://app.hyperliquid.xyz/trade/${opts.eventSlug}`;
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
case "probable": {
|
|
526
|
+
if (opts.eventSlug) return `https://probable.markets/event/${opts.eventSlug}`;
|
|
527
|
+
return null;
|
|
528
|
+
}
|
|
529
|
+
default:
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
466
534
|
// src/orderbook-utils.ts
|
|
467
535
|
var PRICE_KEY_SCALE = 1e9;
|
|
468
536
|
function crc32(str) {
|
|
@@ -1495,6 +1563,7 @@ var AggClient = class {
|
|
|
1495
1563
|
let message = response.status === 404 ? "Market not found" : `AGG API error: ${response.status} ${response.statusText}`;
|
|
1496
1564
|
let code;
|
|
1497
1565
|
let retryable;
|
|
1566
|
+
let errors;
|
|
1498
1567
|
try {
|
|
1499
1568
|
const body = yield response.json();
|
|
1500
1569
|
if (typeof body.message === "string" && body.message.length > 0) {
|
|
@@ -1506,12 +1575,20 @@ var AggClient = class {
|
|
|
1506
1575
|
if (typeof body.retryable === "boolean") {
|
|
1507
1576
|
retryable = body.retryable;
|
|
1508
1577
|
}
|
|
1578
|
+
if (Array.isArray(body.errors)) {
|
|
1579
|
+
const parsed = body.errors.map((e) => ({
|
|
1580
|
+
field: typeof (e == null ? void 0 : e.field) === "string" ? e.field : "",
|
|
1581
|
+
message: typeof (e == null ? void 0 : e.message) === "string" ? e.message : ""
|
|
1582
|
+
})).filter((e) => e.message.length > 0);
|
|
1583
|
+
if (parsed.length > 0) errors = parsed;
|
|
1584
|
+
}
|
|
1509
1585
|
} catch (e) {
|
|
1510
1586
|
}
|
|
1511
1587
|
const error = new Error(message);
|
|
1512
1588
|
error.status = response.status;
|
|
1513
1589
|
if (code) error.code = code;
|
|
1514
1590
|
if (retryable !== void 0) error.retryable = retryable;
|
|
1591
|
+
if (errors) error.errors = errors;
|
|
1515
1592
|
throw error;
|
|
1516
1593
|
});
|
|
1517
1594
|
}
|
|
@@ -1902,11 +1979,18 @@ Issued At: ${issuedAt}`;
|
|
|
1902
1979
|
});
|
|
1903
1980
|
});
|
|
1904
1981
|
}
|
|
1905
|
-
/**
|
|
1982
|
+
/**
|
|
1983
|
+
* List execution orders for the authenticated user (cursor pagination).
|
|
1984
|
+
*
|
|
1985
|
+
* Pass `quoteId` to fetch every leg of a multi-venue split route in
|
|
1986
|
+
* one call — `useQuoteSummary(quoteId)` reduces the list into a
|
|
1987
|
+
* rollup (total cost, share-weighted avg price, to-win).
|
|
1988
|
+
*/
|
|
1906
1989
|
getExecutionOrders() {
|
|
1907
1990
|
return __async(this, arguments, function* (params = {}) {
|
|
1908
1991
|
const query = {};
|
|
1909
1992
|
if (params.orderId) query.orderId = params.orderId;
|
|
1993
|
+
if (params.quoteId) query.quoteId = params.quoteId;
|
|
1910
1994
|
if (params.status) query.status = params.status;
|
|
1911
1995
|
if (params.cursor) query.cursor = params.cursor;
|
|
1912
1996
|
if (params.limit != null) query.limit = String(params.limit);
|
|
@@ -2029,7 +2113,14 @@ Issued At: ${issuedAt}`;
|
|
|
2029
2113
|
return this.request("/app/config", init);
|
|
2030
2114
|
});
|
|
2031
2115
|
}
|
|
2032
|
-
/**
|
|
2116
|
+
/**
|
|
2117
|
+
* Search events or markets by query string. Supports cursor-based pagination.
|
|
2118
|
+
*
|
|
2119
|
+
* Pass `deep: true` on submit (Enter / Search button) to opt in to the
|
|
2120
|
+
* server-side reranker. Leave it off for debounced typeahead — the wire
|
|
2121
|
+
* format intentionally omits the param so the server hits the cheaper
|
|
2122
|
+
* (and longer-TTL) light cache slot.
|
|
2123
|
+
*/
|
|
2033
2124
|
search(params) {
|
|
2034
2125
|
return __async(this, null, function* () {
|
|
2035
2126
|
const query = {
|
|
@@ -2039,11 +2130,66 @@ Issued At: ${issuedAt}`;
|
|
|
2039
2130
|
if (params.categoryIds && params.categoryIds.length > 0) query.categoryIds = params.categoryIds;
|
|
2040
2131
|
if (params.limit != null) query.limit = String(params.limit);
|
|
2041
2132
|
if (params.cursor) query.cursor = params.cursor;
|
|
2133
|
+
if (params.deep) query.deepSearch = "true";
|
|
2042
2134
|
return this.request("/search", {
|
|
2043
2135
|
query
|
|
2044
2136
|
});
|
|
2045
2137
|
});
|
|
2046
2138
|
}
|
|
2139
|
+
/** Get Correlated Markets processing and embedding coverage. */
|
|
2140
|
+
getCorrelatedMarketsStatus(options) {
|
|
2141
|
+
return __async(this, null, function* () {
|
|
2142
|
+
return this.request("/correlated-markets/status", {
|
|
2143
|
+
signal: options == null ? void 0 : options.signal
|
|
2144
|
+
});
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
/** Get the generated correlated market signals for a market. */
|
|
2148
|
+
getMarketCorrelatedSignals(venueMarketId, options) {
|
|
2149
|
+
return __async(this, null, function* () {
|
|
2150
|
+
const query = {};
|
|
2151
|
+
if ((options == null ? void 0 : options.includeResolved) != null) query.includeResolved = String(options.includeResolved);
|
|
2152
|
+
return this.request(
|
|
2153
|
+
`/correlated-markets/${encodeURIComponent(venueMarketId)}`,
|
|
2154
|
+
{ query, signal: options == null ? void 0 : options.signal }
|
|
2155
|
+
);
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
/** Search markets by Correlated Markets signal similarity. */
|
|
2159
|
+
queryCorrelatedMarkets(params, options) {
|
|
2160
|
+
return __async(this, null, function* () {
|
|
2161
|
+
return this.request("/correlated-markets/query", {
|
|
2162
|
+
method: "POST",
|
|
2163
|
+
body: JSON.stringify(params),
|
|
2164
|
+
signal: options == null ? void 0 : options.signal
|
|
2165
|
+
});
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
/** Get expansion and hedge candidates for an already-processed market. */
|
|
2169
|
+
getCorrelatedMarketCascade(params, options) {
|
|
2170
|
+
return __async(this, null, function* () {
|
|
2171
|
+
const query = {};
|
|
2172
|
+
if (params.side) query.side = params.side;
|
|
2173
|
+
if (params.mode) query.mode = params.mode;
|
|
2174
|
+
if (params.limit != null) query.limit = String(params.limit);
|
|
2175
|
+
if (params.cursor) query.cursor = params.cursor;
|
|
2176
|
+
if (params.includeResolved != null) query.includeResolved = String(params.includeResolved);
|
|
2177
|
+
return this.request(
|
|
2178
|
+
`/correlated-markets/cascade/${encodeURIComponent(params.venueMarketId)}`,
|
|
2179
|
+
{ query, signal: options == null ? void 0 : options.signal }
|
|
2180
|
+
);
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
/** Resolve a market by ID, venue identifier, slug, conditionId, or text, then return candidates. */
|
|
2184
|
+
resolveCorrelatedMarkets(params, options) {
|
|
2185
|
+
return __async(this, null, function* () {
|
|
2186
|
+
return this.request("/correlated-markets/resolve", {
|
|
2187
|
+
method: "POST",
|
|
2188
|
+
body: JSON.stringify(params),
|
|
2189
|
+
signal: options == null ? void 0 : options.signal
|
|
2190
|
+
});
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2047
2193
|
// --- Chart data ---
|
|
2048
2194
|
/** Get the canonical TradingView-style bar series for a single venue market outcome. */
|
|
2049
2195
|
getChartBars(params, options) {
|
|
@@ -2079,7 +2225,9 @@ Issued At: ${issuedAt}`;
|
|
|
2079
2225
|
getMidpoints(paramsOrVenueMarketIds, options) {
|
|
2080
2226
|
return __async(this, null, function* () {
|
|
2081
2227
|
const venueMarketIds = Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds : paramsOrVenueMarketIds.venueMarketIds;
|
|
2228
|
+
const bestPrice = !Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds.bestPrice : options == null ? void 0 : options.bestPrice;
|
|
2082
2229
|
const query = { venueMarketIds };
|
|
2230
|
+
if (bestPrice) query.bestPrice = "true";
|
|
2083
2231
|
return this.request("/midpoints", {
|
|
2084
2232
|
query,
|
|
2085
2233
|
signal: options == null ? void 0 : options.signal
|
|
@@ -2123,6 +2271,7 @@ Issued At: ${issuedAt}`;
|
|
|
2123
2271
|
if (params.slipCapBps != null) query.slipCapBps = String(params.slipCapBps);
|
|
2124
2272
|
if (params.compareVenues) query.compareVenues = "true";
|
|
2125
2273
|
if (params.tradeSide) query.side = params.tradeSide;
|
|
2274
|
+
if (params.deepEstimate) query.deepEstimate = "true";
|
|
2126
2275
|
const response = yield this.request(
|
|
2127
2276
|
`/orderbook/${encodeURIComponent(venueMarketOutcomeId)}/route`,
|
|
2128
2277
|
{ query, signal: options == null ? void 0 : options.signal }
|
|
@@ -2478,12 +2627,14 @@ export {
|
|
|
2478
2627
|
Venue,
|
|
2479
2628
|
aggregateMidpoint,
|
|
2480
2629
|
applyOrderbookDelta,
|
|
2630
|
+
buildVenueUrl,
|
|
2481
2631
|
computeBestSplitsByAmount2 as computeBestSplitsByAmount,
|
|
2482
2632
|
computeChecksum,
|
|
2483
2633
|
createAggClient,
|
|
2484
2634
|
enumGuard,
|
|
2485
2635
|
formatMarketQuestion,
|
|
2486
2636
|
formatOutcomeLabel,
|
|
2637
|
+
formatOutcomeTitle,
|
|
2487
2638
|
getWalletAddressFromUserProfile,
|
|
2488
2639
|
hasShape,
|
|
2489
2640
|
isEmail,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"description": "Vanilla TypeScript client for the AGG prediction market aggregator (auth, markets, orderbooks, charts, trading, managed execution, WebSockets). Works in browsers, Node.js, and React Native.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|