pmxtjs 2.33.4 → 2.34.0
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/dist/esm/generated/src/apis/DefaultApi.d.ts +72 -7
- package/dist/esm/generated/src/apis/DefaultApi.js +107 -6
- package/dist/esm/generated/src/models/ArbitrageOpportunity.d.ts +23 -0
- package/dist/esm/generated/src/models/ArbitrageOpportunity.js +14 -0
- package/dist/esm/generated/src/models/CompareMarketPricesRequest.d.ts +3 -3
- package/dist/esm/generated/src/models/CompareMarketPricesRequest.js +3 -3
- package/dist/esm/generated/src/models/FetchArbitrageParams.d.ts +17 -0
- package/dist/esm/generated/src/models/FetchArbitrageParams.js +12 -0
- package/dist/esm/generated/src/models/FetchEventMatchesParams.d.ts +7 -0
- package/dist/esm/generated/src/models/FetchEventMatchesParams.js +3 -0
- package/dist/esm/generated/src/models/FetchMarketMatches200Response.d.ts +46 -0
- package/dist/esm/generated/src/models/{FetchMatches200Response.js → FetchMarketMatches200Response.js} +8 -8
- package/dist/esm/generated/src/models/FetchMarketMatchesParams.d.ts +86 -0
- package/dist/esm/generated/src/models/{FetchMatchesParams.js → FetchMarketMatchesParams.js} +12 -9
- package/dist/esm/generated/src/models/UnifiedEvent.d.ts +6 -0
- package/dist/esm/generated/src/models/UnifiedEvent.js +2 -0
- package/dist/esm/generated/src/models/UnifiedMarket.d.ts +6 -0
- package/dist/esm/generated/src/models/UnifiedMarket.js +2 -0
- package/dist/esm/generated/src/models/index.d.ts +2 -2
- package/dist/esm/generated/src/models/index.js +2 -2
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/pmxt/client.js +2 -0
- package/dist/esm/pmxt/models.d.ts +66 -0
- package/dist/esm/pmxt/router.d.ts +133 -0
- package/dist/esm/pmxt/router.js +338 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +72 -7
- package/dist/generated/src/apis/DefaultApi.js +108 -7
- package/dist/generated/src/models/ArbitrageOpportunity.d.ts +23 -0
- package/dist/generated/src/models/ArbitrageOpportunity.js +15 -0
- package/dist/generated/src/models/CompareMarketPricesRequest.d.ts +3 -3
- package/dist/generated/src/models/CompareMarketPricesRequest.js +3 -3
- package/dist/generated/src/models/FetchArbitrageParams.d.ts +17 -0
- package/dist/generated/src/models/FetchArbitrageParams.js +13 -0
- package/dist/generated/src/models/FetchEventMatchesParams.d.ts +7 -0
- package/dist/generated/src/models/FetchEventMatchesParams.js +3 -0
- package/dist/generated/src/models/FetchMarketMatches200Response.d.ts +46 -0
- package/dist/generated/src/models/{FetchMatches200Response.js → FetchMarketMatches200Response.js} +13 -13
- package/dist/generated/src/models/FetchMarketMatchesParams.d.ts +86 -0
- package/dist/generated/src/models/{FetchMatchesParams.js → FetchMarketMatchesParams.js} +18 -15
- package/dist/generated/src/models/UnifiedEvent.d.ts +6 -0
- package/dist/generated/src/models/UnifiedEvent.js +2 -0
- package/dist/generated/src/models/UnifiedMarket.d.ts +6 -0
- package/dist/generated/src/models/UnifiedMarket.js +2 -0
- package/dist/generated/src/models/index.d.ts +2 -2
- package/dist/generated/src/models/index.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -1
- package/dist/pmxt/client.js +2 -0
- package/dist/pmxt/models.d.ts +66 -0
- package/dist/pmxt/router.d.ts +133 -0
- package/dist/pmxt/router.js +375 -0
- package/generated/.openapi-generator/FILES +4 -4
- package/generated/docs/ArbitrageOpportunity.md +4 -0
- package/generated/docs/CompareMarketPricesRequest.md +1 -1
- package/generated/docs/DefaultApi.md +112 -10
- package/generated/docs/FetchArbitrageParams.md +2 -0
- package/generated/docs/FetchEventMatchesParams.md +2 -0
- package/generated/docs/{FetchMatches200Response.md → FetchMarketMatches200Response.md} +4 -4
- package/generated/docs/{FetchMatchesParams.md → FetchMarketMatchesParams.md} +6 -4
- package/generated/docs/UnifiedEvent.md +2 -0
- package/generated/docs/UnifiedMarket.md +2 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +159 -10
- package/generated/src/models/ArbitrageOpportunity.ts +30 -0
- package/generated/src/models/CompareMarketPricesRequest.ts +11 -11
- package/generated/src/models/FetchArbitrageParams.ts +22 -0
- package/generated/src/models/FetchEventMatchesParams.ts +16 -0
- package/generated/src/models/{FetchMatches200Response.ts → FetchMarketMatches200Response.ts} +13 -13
- package/generated/src/models/{FetchMatchesParams.ts → FetchMarketMatchesParams.ts} +36 -20
- package/generated/src/models/UnifiedEvent.ts +8 -0
- package/generated/src/models/UnifiedMarket.ts +8 -0
- package/generated/src/models/index.ts +2 -2
- package/index.ts +3 -0
- package/package.json +2 -2
- package/pmxt/client.ts +2 -0
- package/pmxt/models.ts +97 -0
- package/pmxt/router.ts +385 -0
- package/dist/esm/generated/src/models/FetchMatches200Response.d.ts +0 -46
- package/dist/esm/generated/src/models/FetchMatchesParams.d.ts +0 -79
- package/dist/generated/src/models/FetchMatches200Response.d.ts +0 -46
- package/dist/generated/src/models/FetchMatchesParams.d.ts +0 -79
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.4.4
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { UnifiedMarket } from './UnifiedMarket.js';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface FetchMarketMatchesParams
|
|
17
|
+
*/
|
|
18
|
+
export interface FetchMarketMatchesParams {
|
|
19
|
+
/**
|
|
20
|
+
* Pass a UnifiedMarket directly instead of marketId/slug/url.
|
|
21
|
+
* @type {UnifiedMarket}
|
|
22
|
+
* @memberof FetchMarketMatchesParams
|
|
23
|
+
*/
|
|
24
|
+
market?: UnifiedMarket;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof FetchMarketMatchesParams
|
|
29
|
+
*/
|
|
30
|
+
marketId?: string;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @memberof FetchMarketMatchesParams
|
|
35
|
+
*/
|
|
36
|
+
slug?: string;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof FetchMarketMatchesParams
|
|
41
|
+
*/
|
|
42
|
+
url?: string;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @type {string}
|
|
46
|
+
* @memberof FetchMarketMatchesParams
|
|
47
|
+
*/
|
|
48
|
+
relation?: FetchMarketMatchesParamsRelationEnum;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @type {number}
|
|
52
|
+
* @memberof FetchMarketMatchesParams
|
|
53
|
+
*/
|
|
54
|
+
minConfidence?: number;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @type {number}
|
|
58
|
+
* @memberof FetchMarketMatchesParams
|
|
59
|
+
*/
|
|
60
|
+
limit?: number;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @type {boolean}
|
|
64
|
+
* @memberof FetchMarketMatchesParams
|
|
65
|
+
*/
|
|
66
|
+
includePrices?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @export
|
|
70
|
+
*/
|
|
71
|
+
export declare const FetchMarketMatchesParamsRelationEnum: {
|
|
72
|
+
readonly Identity: "identity";
|
|
73
|
+
readonly Subset: "subset";
|
|
74
|
+
readonly Superset: "superset";
|
|
75
|
+
readonly Overlap: "overlap";
|
|
76
|
+
readonly Disjoint: "disjoint";
|
|
77
|
+
};
|
|
78
|
+
export type FetchMarketMatchesParamsRelationEnum = typeof FetchMarketMatchesParamsRelationEnum[keyof typeof FetchMarketMatchesParamsRelationEnum];
|
|
79
|
+
/**
|
|
80
|
+
* Check if a given object implements the FetchMarketMatchesParams interface.
|
|
81
|
+
*/
|
|
82
|
+
export declare function instanceOfFetchMarketMatchesParams(value: object): value is FetchMarketMatchesParams;
|
|
83
|
+
export declare function FetchMarketMatchesParamsFromJSON(json: any): FetchMarketMatchesParams;
|
|
84
|
+
export declare function FetchMarketMatchesParamsFromJSONTyped(json: any, ignoreDiscriminator: boolean): FetchMarketMatchesParams;
|
|
85
|
+
export declare function FetchMarketMatchesParamsToJSON(json: any): FetchMarketMatchesParams;
|
|
86
|
+
export declare function FetchMarketMatchesParamsToJSONTyped(value?: FetchMarketMatchesParams | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
* https://openapi-generator.tech
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
|
+
import { UnifiedMarketFromJSON, UnifiedMarketToJSON, } from './UnifiedMarket.js';
|
|
14
15
|
/**
|
|
15
16
|
* @export
|
|
16
17
|
*/
|
|
17
|
-
export const
|
|
18
|
+
export const FetchMarketMatchesParamsRelationEnum = {
|
|
18
19
|
Identity: 'identity',
|
|
19
20
|
Subset: 'subset',
|
|
20
21
|
Superset: 'superset',
|
|
@@ -22,19 +23,20 @@ export const FetchMatchesParamsRelationEnum = {
|
|
|
22
23
|
Disjoint: 'disjoint'
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
|
-
* Check if a given object implements the
|
|
26
|
+
* Check if a given object implements the FetchMarketMatchesParams interface.
|
|
26
27
|
*/
|
|
27
|
-
export function
|
|
28
|
+
export function instanceOfFetchMarketMatchesParams(value) {
|
|
28
29
|
return true;
|
|
29
30
|
}
|
|
30
|
-
export function
|
|
31
|
-
return
|
|
31
|
+
export function FetchMarketMatchesParamsFromJSON(json) {
|
|
32
|
+
return FetchMarketMatchesParamsFromJSONTyped(json, false);
|
|
32
33
|
}
|
|
33
|
-
export function
|
|
34
|
+
export function FetchMarketMatchesParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
34
35
|
if (json == null) {
|
|
35
36
|
return json;
|
|
36
37
|
}
|
|
37
38
|
return {
|
|
39
|
+
'market': json['market'] == null ? undefined : UnifiedMarketFromJSON(json['market']),
|
|
38
40
|
'marketId': json['marketId'] == null ? undefined : json['marketId'],
|
|
39
41
|
'slug': json['slug'] == null ? undefined : json['slug'],
|
|
40
42
|
'url': json['url'] == null ? undefined : json['url'],
|
|
@@ -44,14 +46,15 @@ export function FetchMatchesParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
44
46
|
'includePrices': json['includePrices'] == null ? undefined : json['includePrices'],
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
|
-
export function
|
|
48
|
-
return
|
|
49
|
+
export function FetchMarketMatchesParamsToJSON(json) {
|
|
50
|
+
return FetchMarketMatchesParamsToJSONTyped(json, false);
|
|
49
51
|
}
|
|
50
|
-
export function
|
|
52
|
+
export function FetchMarketMatchesParamsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
51
53
|
if (value == null) {
|
|
52
54
|
return value;
|
|
53
55
|
}
|
|
54
56
|
return {
|
|
57
|
+
'market': UnifiedMarketToJSON(value['market']),
|
|
55
58
|
'marketId': value['marketId'],
|
|
56
59
|
'slug': value['slug'],
|
|
57
60
|
'url': value['url'],
|
|
@@ -82,6 +82,12 @@ export interface UnifiedEvent {
|
|
|
82
82
|
* @memberof UnifiedEvent
|
|
83
83
|
*/
|
|
84
84
|
tags?: Array<string>;
|
|
85
|
+
/**
|
|
86
|
+
* The exchange/venue this event originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router.
|
|
87
|
+
* @type {string}
|
|
88
|
+
* @memberof UnifiedEvent
|
|
89
|
+
*/
|
|
90
|
+
sourceExchange?: string;
|
|
85
91
|
}
|
|
86
92
|
/**
|
|
87
93
|
* Check if a given object implements the UnifiedEvent interface.
|
|
@@ -51,6 +51,7 @@ export function UnifiedEventFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
51
51
|
'image': json['image'] == null ? undefined : json['image'],
|
|
52
52
|
'category': json['category'] == null ? undefined : json['category'],
|
|
53
53
|
'tags': json['tags'] == null ? undefined : json['tags'],
|
|
54
|
+
'sourceExchange': json['sourceExchange'] == null ? undefined : json['sourceExchange'],
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
export function UnifiedEventToJSON(json) {
|
|
@@ -72,5 +73,6 @@ export function UnifiedEventToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
72
73
|
'image': value['image'],
|
|
73
74
|
'category': value['category'],
|
|
74
75
|
'tags': value['tags'],
|
|
76
|
+
'sourceExchange': value['sourceExchange'],
|
|
75
77
|
};
|
|
76
78
|
}
|
|
@@ -124,6 +124,12 @@ export interface UnifiedMarket {
|
|
|
124
124
|
* @memberof UnifiedMarket
|
|
125
125
|
*/
|
|
126
126
|
contractAddress?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The exchange/venue this market originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router.
|
|
129
|
+
* @type {string}
|
|
130
|
+
* @memberof UnifiedMarket
|
|
131
|
+
*/
|
|
132
|
+
sourceExchange?: string;
|
|
127
133
|
/**
|
|
128
134
|
* Convenience accessor for the YES outcome on a binary market.
|
|
129
135
|
* @type {MarketOutcome}
|
|
@@ -60,6 +60,7 @@ export function UnifiedMarketFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
60
60
|
'tickSize': json['tickSize'] == null ? undefined : json['tickSize'],
|
|
61
61
|
'status': json['status'] == null ? undefined : json['status'],
|
|
62
62
|
'contractAddress': json['contractAddress'] == null ? undefined : json['contractAddress'],
|
|
63
|
+
'sourceExchange': json['sourceExchange'] == null ? undefined : json['sourceExchange'],
|
|
63
64
|
'yes': json['yes'] == null ? undefined : MarketOutcomeFromJSON(json['yes']),
|
|
64
65
|
'no': json['no'] == null ? undefined : MarketOutcomeFromJSON(json['no']),
|
|
65
66
|
'up': json['up'] == null ? undefined : MarketOutcomeFromJSON(json['up']),
|
|
@@ -92,6 +93,7 @@ export function UnifiedMarketToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
92
93
|
'tickSize': value['tickSize'],
|
|
93
94
|
'status': value['status'],
|
|
94
95
|
'contractAddress': value['contractAddress'],
|
|
96
|
+
'sourceExchange': value['sourceExchange'],
|
|
95
97
|
'yes': MarketOutcomeToJSON(value['yes']),
|
|
96
98
|
'no': MarketOutcomeToJSON(value['no']),
|
|
97
99
|
'up': MarketOutcomeToJSON(value['up']),
|
|
@@ -30,10 +30,10 @@ export * from './FetchEventMatches200Response.js';
|
|
|
30
30
|
export * from './FetchEventMatchesParams.js';
|
|
31
31
|
export * from './FetchEvents200Response.js';
|
|
32
32
|
export * from './FetchMarket200Response.js';
|
|
33
|
+
export * from './FetchMarketMatches200Response.js';
|
|
34
|
+
export * from './FetchMarketMatchesParams.js';
|
|
33
35
|
export * from './FetchMarkets200Response.js';
|
|
34
36
|
export * from './FetchMarketsPaginated200Response.js';
|
|
35
|
-
export * from './FetchMatches200Response.js';
|
|
36
|
-
export * from './FetchMatchesParams.js';
|
|
37
37
|
export * from './FetchMyTrades200Response.js';
|
|
38
38
|
export * from './FetchOHLCV200Response.js';
|
|
39
39
|
export * from './FetchOpenOrders200Response.js';
|
|
@@ -32,10 +32,10 @@ export * from './FetchEventMatches200Response.js';
|
|
|
32
32
|
export * from './FetchEventMatchesParams.js';
|
|
33
33
|
export * from './FetchEvents200Response.js';
|
|
34
34
|
export * from './FetchMarket200Response.js';
|
|
35
|
+
export * from './FetchMarketMatches200Response.js';
|
|
36
|
+
export * from './FetchMarketMatchesParams.js';
|
|
35
37
|
export * from './FetchMarkets200Response.js';
|
|
36
38
|
export * from './FetchMarketsPaginated200Response.js';
|
|
37
|
-
export * from './FetchMatches200Response.js';
|
|
38
|
-
export * from './FetchMatchesParams.js';
|
|
39
39
|
export * from './FetchMyTrades200Response.js';
|
|
40
40
|
export * from './FetchOHLCV200Response.js';
|
|
41
41
|
export * from './FetchOpenOrders200Response.js';
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -18,10 +18,12 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
import { Exchange, Polymarket, Kalshi, KalshiDemo, Limitless, Myriad, Probable, Baozi, Opinion, Metaculus, Smarkets, PolymarketUS } from "./pmxt/client.js";
|
|
21
|
+
import { Router } from "./pmxt/router.js";
|
|
21
22
|
import { ServerManager } from "./pmxt/server-manager.js";
|
|
22
23
|
import * as models from "./pmxt/models.js";
|
|
23
24
|
import * as errors from "./pmxt/errors.js";
|
|
24
25
|
export { Exchange, Polymarket, Kalshi, KalshiDemo, Limitless, Myriad, Probable, Baozi, Opinion, Metaculus, Smarkets, PolymarketUS, PolymarketOptions } from "./pmxt/client.js";
|
|
26
|
+
export { Router } from "./pmxt/router.js";
|
|
25
27
|
export { ServerManager } from "./pmxt/server-manager.js";
|
|
26
28
|
export { MarketList } from "./pmxt/models.js";
|
|
27
29
|
export type * from "./pmxt/models.js";
|
|
@@ -83,6 +85,7 @@ declare const pmxt: {
|
|
|
83
85
|
Metaculus: typeof Metaculus;
|
|
84
86
|
Smarkets: typeof Smarkets;
|
|
85
87
|
PolymarketUS: typeof PolymarketUS;
|
|
88
|
+
Router: typeof Router;
|
|
86
89
|
ServerManager: typeof ServerManager;
|
|
87
90
|
server: {
|
|
88
91
|
readonly status: () => Promise<{
|
package/dist/esm/index.js
CHANGED
|
@@ -18,10 +18,12 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
import { Exchange, Polymarket, Kalshi, KalshiDemo, Limitless, Myriad, Probable, Baozi, Opinion, Metaculus, Smarkets, PolymarketUS } from "./pmxt/client.js";
|
|
21
|
+
import { Router } from "./pmxt/router.js";
|
|
21
22
|
import { ServerManager } from "./pmxt/server-manager.js";
|
|
22
23
|
import * as models from "./pmxt/models.js";
|
|
23
24
|
import * as errors from "./pmxt/errors.js";
|
|
24
25
|
export { Exchange, Polymarket, Kalshi, KalshiDemo, Limitless, Myriad, Probable, Baozi, Opinion, Metaculus, Smarkets, PolymarketUS } from "./pmxt/client.js";
|
|
26
|
+
export { Router } from "./pmxt/router.js";
|
|
25
27
|
export { ServerManager } from "./pmxt/server-manager.js";
|
|
26
28
|
export { MarketList } from "./pmxt/models.js";
|
|
27
29
|
export * from "./pmxt/errors.js";
|
|
@@ -67,6 +69,7 @@ const pmxt = {
|
|
|
67
69
|
Metaculus,
|
|
68
70
|
Smarkets,
|
|
69
71
|
PolymarketUS,
|
|
72
|
+
Router,
|
|
70
73
|
ServerManager,
|
|
71
74
|
server,
|
|
72
75
|
stopServer,
|
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -99,6 +99,7 @@ function convertMarket(raw) {
|
|
|
99
99
|
tickSize: raw.tickSize,
|
|
100
100
|
status: raw.status,
|
|
101
101
|
contractAddress: raw.contractAddress,
|
|
102
|
+
sourceExchange: raw.sourceExchange,
|
|
102
103
|
eventId: raw.eventId,
|
|
103
104
|
yes: convertOutcome(raw.yes),
|
|
104
105
|
no: convertOutcome(raw.no),
|
|
@@ -202,6 +203,7 @@ function convertEvent(raw) {
|
|
|
202
203
|
image: raw.image,
|
|
203
204
|
category: raw.category,
|
|
204
205
|
tags: raw.tags,
|
|
206
|
+
sourceExchange: raw.sourceExchange,
|
|
205
207
|
};
|
|
206
208
|
return event;
|
|
207
209
|
}
|
|
@@ -62,6 +62,8 @@ export interface UnifiedMarket {
|
|
|
62
62
|
status?: string;
|
|
63
63
|
/** On-chain contract / condition identifier where applicable (Polymarket conditionId, etc.). */
|
|
64
64
|
contractAddress?: string;
|
|
65
|
+
/** The exchange/venue this market originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router. */
|
|
66
|
+
sourceExchange?: string;
|
|
65
67
|
/** ID of the parent event this market belongs to */
|
|
66
68
|
eventId?: string;
|
|
67
69
|
/** Convenience access to the Yes outcome for binary markets. */
|
|
@@ -375,6 +377,8 @@ export interface UnifiedEvent {
|
|
|
375
377
|
category?: string;
|
|
376
378
|
/** Event tags */
|
|
377
379
|
tags?: string[];
|
|
380
|
+
/** The exchange/venue this event originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router. */
|
|
381
|
+
sourceExchange?: string;
|
|
378
382
|
}
|
|
379
383
|
/**
|
|
380
384
|
* Advanced criteria for filtering markets.
|
|
@@ -483,3 +487,65 @@ export interface SubscribedAddressSnapshot {
|
|
|
483
487
|
/** Unix timestamp (ms) of this snapshot */
|
|
484
488
|
timestamp: number;
|
|
485
489
|
}
|
|
490
|
+
/** Set-theoretic relation between two markets' resolution conditions. */
|
|
491
|
+
export type MatchRelation = 'identity' | 'subset' | 'superset' | 'overlap' | 'disjoint';
|
|
492
|
+
/** A cross-venue market match with relation classification. */
|
|
493
|
+
export interface MatchResult {
|
|
494
|
+
/** The matched market on another venue. */
|
|
495
|
+
market: UnifiedMarket;
|
|
496
|
+
/** Set-theoretic relation between the source and matched market. */
|
|
497
|
+
relation: MatchRelation;
|
|
498
|
+
/** Confidence score (0.0 to 1.0). */
|
|
499
|
+
confidence: number;
|
|
500
|
+
/** Human-readable explanation of the match. */
|
|
501
|
+
reasoning?: string;
|
|
502
|
+
/** Best bid price on the matched venue (when includePrices=true). */
|
|
503
|
+
bestBid?: number;
|
|
504
|
+
/** Best ask price on the matched venue (when includePrices=true). */
|
|
505
|
+
bestAsk?: number;
|
|
506
|
+
}
|
|
507
|
+
/** A cross-venue event match with constituent market matches. */
|
|
508
|
+
export interface EventMatchResult {
|
|
509
|
+
/** The matched event on another venue. */
|
|
510
|
+
event: UnifiedEvent;
|
|
511
|
+
/** Cross-venue market matches within this event. */
|
|
512
|
+
marketMatches: MatchResult[];
|
|
513
|
+
}
|
|
514
|
+
/** Side-by-side price comparison for a matched market. */
|
|
515
|
+
export interface PriceComparison {
|
|
516
|
+
/** The matched market. */
|
|
517
|
+
market: UnifiedMarket;
|
|
518
|
+
/** Relation type (typically 'identity' for price comparisons). */
|
|
519
|
+
relation: MatchRelation;
|
|
520
|
+
/** Confidence score (0.0 to 1.0). */
|
|
521
|
+
confidence: number;
|
|
522
|
+
/** Human-readable explanation. */
|
|
523
|
+
reasoning?: string;
|
|
524
|
+
/** Best bid price on this venue. */
|
|
525
|
+
bestBid?: number;
|
|
526
|
+
/** Best ask price on this venue. */
|
|
527
|
+
bestAsk?: number;
|
|
528
|
+
/** The venue name (e.g. 'kalshi', 'polymarket'). */
|
|
529
|
+
venue: string;
|
|
530
|
+
}
|
|
531
|
+
/** A cross-venue arbitrage opportunity. */
|
|
532
|
+
export interface ArbitrageOpportunity {
|
|
533
|
+
/** Market on the buy side. */
|
|
534
|
+
marketA: UnifiedMarket;
|
|
535
|
+
/** Market on the sell side. */
|
|
536
|
+
marketB: UnifiedMarket;
|
|
537
|
+
/** Price spread (sellPrice - buyPrice). */
|
|
538
|
+
spread: number;
|
|
539
|
+
/** Venue to buy on. */
|
|
540
|
+
buyVenue: string;
|
|
541
|
+
/** Venue to sell on. */
|
|
542
|
+
sellVenue: string;
|
|
543
|
+
/** Price to buy at. */
|
|
544
|
+
buyPrice: number;
|
|
545
|
+
/** Price to sell at. */
|
|
546
|
+
sellPrice: number;
|
|
547
|
+
/** The set-theoretic relation between the two markets (e.g. identity, subset). */
|
|
548
|
+
relation?: MatchRelation;
|
|
549
|
+
/** Match confidence score (0.0 to 1.0). */
|
|
550
|
+
confidence?: number;
|
|
551
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router — cross-venue intelligence layer.
|
|
3
|
+
*
|
|
4
|
+
* Search, match, compare prices, find hedges, and detect arbitrage across
|
|
5
|
+
* every venue PMXT supports. Only requires a PMXT API key.
|
|
6
|
+
*/
|
|
7
|
+
import { Exchange } from "./client.js";
|
|
8
|
+
import { MatchResult, MatchRelation, EventMatchResult, PriceComparison, ArbitrageOpportunity, UnifiedMarket, UnifiedEvent } from "./models.js";
|
|
9
|
+
/** Options for creating a Router. */
|
|
10
|
+
export interface RouterOptions {
|
|
11
|
+
/** PMXT API key (required for hosted mode). */
|
|
12
|
+
pmxtApiKey?: string;
|
|
13
|
+
/** Override the base URL (defaults to hosted API). */
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
/** Start local sidecar (default: false). */
|
|
16
|
+
autoStartServer?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Cross-venue intelligence layer.
|
|
20
|
+
*
|
|
21
|
+
* Search markets and events across every venue, find semantically
|
|
22
|
+
* equivalent markets on other platforms, compare prices, discover
|
|
23
|
+
* hedges, and scan for arbitrage — all from a single PMXT API key.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import pmxt from "pmxtjs";
|
|
28
|
+
*
|
|
29
|
+
* const router = new pmxt.Router({ pmxtApiKey: "pmxt_live_..." });
|
|
30
|
+
* const markets = await router.fetchMarkets({ query: "election" });
|
|
31
|
+
* const matches = await router.fetchMarketMatches({ market: markets[0] });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class Router extends Exchange {
|
|
35
|
+
constructor(options?: RouterOptions);
|
|
36
|
+
/**
|
|
37
|
+
* Find markets on other venues that correspond to a given market.
|
|
38
|
+
*
|
|
39
|
+
* @param params.market - A UnifiedMarket object (extracts marketId automatically).
|
|
40
|
+
* @param params.marketId - PMXT market ID.
|
|
41
|
+
* @param params.slug - Market slug (alternative to marketId).
|
|
42
|
+
* @param params.url - Market URL on the source venue.
|
|
43
|
+
* @param params.relation - Filter to a specific relation type.
|
|
44
|
+
* @param params.minConfidence - Minimum confidence threshold (0–1).
|
|
45
|
+
* @param params.limit - Maximum number of matches to return.
|
|
46
|
+
* @param params.includePrices - Attach live bestBid/bestAsk to each match.
|
|
47
|
+
*/
|
|
48
|
+
fetchMarketMatches(params?: {
|
|
49
|
+
market?: UnifiedMarket;
|
|
50
|
+
marketId?: string;
|
|
51
|
+
slug?: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
relation?: MatchRelation;
|
|
54
|
+
minConfidence?: number;
|
|
55
|
+
limit?: number;
|
|
56
|
+
includePrices?: boolean;
|
|
57
|
+
}): Promise<MatchResult[]>;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use {@link fetchMarketMatches} instead.
|
|
60
|
+
*/
|
|
61
|
+
fetchMatches(params?: {
|
|
62
|
+
market?: UnifiedMarket;
|
|
63
|
+
marketId?: string;
|
|
64
|
+
slug?: string;
|
|
65
|
+
url?: string;
|
|
66
|
+
relation?: MatchRelation;
|
|
67
|
+
minConfidence?: number;
|
|
68
|
+
limit?: number;
|
|
69
|
+
includePrices?: boolean;
|
|
70
|
+
}): Promise<MatchResult[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Match an entire event across venues.
|
|
73
|
+
*
|
|
74
|
+
* @param params.event - A UnifiedEvent object (extracts id automatically).
|
|
75
|
+
* @param params.eventId - PMXT event ID.
|
|
76
|
+
* @param params.slug - Event slug.
|
|
77
|
+
* @param params.relation - Filter market matches to a specific relation type.
|
|
78
|
+
* @param params.minConfidence - Minimum confidence threshold (0–1).
|
|
79
|
+
* @param params.limit - Maximum number of event matches to return.
|
|
80
|
+
* @param params.includePrices - Attach live prices to each market match.
|
|
81
|
+
*/
|
|
82
|
+
fetchEventMatches(params?: {
|
|
83
|
+
event?: UnifiedEvent;
|
|
84
|
+
eventId?: string;
|
|
85
|
+
slug?: string;
|
|
86
|
+
relation?: MatchRelation;
|
|
87
|
+
minConfidence?: number;
|
|
88
|
+
limit?: number;
|
|
89
|
+
includePrices?: boolean;
|
|
90
|
+
}): Promise<EventMatchResult[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Compare prices for the same market across venues.
|
|
93
|
+
*
|
|
94
|
+
* @param params.market - A UnifiedMarket object (extracts marketId automatically).
|
|
95
|
+
* @param params.marketId - PMXT market ID.
|
|
96
|
+
* @param params.slug - Market slug.
|
|
97
|
+
* @param params.url - Market URL.
|
|
98
|
+
*/
|
|
99
|
+
compareMarketPrices(params?: {
|
|
100
|
+
market?: UnifiedMarket;
|
|
101
|
+
marketId?: string;
|
|
102
|
+
slug?: string;
|
|
103
|
+
url?: string;
|
|
104
|
+
}): Promise<PriceComparison[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Find markets that partially hedge a position.
|
|
107
|
+
*
|
|
108
|
+
* @param params.market - A UnifiedMarket object (extracts marketId automatically).
|
|
109
|
+
* @param params.marketId - PMXT market ID.
|
|
110
|
+
* @param params.slug - Market slug.
|
|
111
|
+
* @param params.url - Market URL.
|
|
112
|
+
*/
|
|
113
|
+
fetchHedges(params?: {
|
|
114
|
+
market?: UnifiedMarket;
|
|
115
|
+
marketId?: string;
|
|
116
|
+
slug?: string;
|
|
117
|
+
url?: string;
|
|
118
|
+
}): Promise<PriceComparison[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Scan for cross-venue arbitrage opportunities.
|
|
121
|
+
*
|
|
122
|
+
* @param params.minSpread - Only return pairs with spread >= this value.
|
|
123
|
+
* @param params.category - Filter source markets by category.
|
|
124
|
+
* @param params.limit - Max source markets to scan (default: 50).
|
|
125
|
+
* @param params.relations - Relation types to include (default: ['identity']).
|
|
126
|
+
*/
|
|
127
|
+
fetchArbitrage(params?: {
|
|
128
|
+
minSpread?: number;
|
|
129
|
+
category?: string;
|
|
130
|
+
limit?: number;
|
|
131
|
+
relations?: MatchRelation[];
|
|
132
|
+
}): Promise<ArbitrageOpportunity[]>;
|
|
133
|
+
}
|