pmxt-core 2.27.2 → 2.27.5
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/BaseExchange.d.ts +71 -0
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/opinion/api.d.ts +1 -1
- package/dist/exchanges/opinion/api.js +1 -1
- package/dist/exchanges/polymarket/api-clob.d.ts +1 -1
- package/dist/exchanges/polymarket/api-clob.js +1 -1
- package/dist/exchanges/polymarket/api-data.d.ts +1 -1
- package/dist/exchanges/polymarket/api-data.js +1 -1
- package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
- package/dist/exchanges/polymarket/api-gamma.js +1 -1
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/server/openapi.yaml +497 -143
- package/dist/types.d.ts +74 -0
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -3,58 +3,98 @@ export interface MarketOutcome {
|
|
|
3
3
|
outcomeId: string;
|
|
4
4
|
/** The market this outcome belongs to (set automatically when outcomes are built) */
|
|
5
5
|
marketId?: string;
|
|
6
|
+
/** Human-readable outcome label (e.g., "Yes", "No", candidate name). */
|
|
6
7
|
label: string;
|
|
8
|
+
/** Probability between 0.0 and 1.0. */
|
|
7
9
|
price: number;
|
|
10
|
+
/** Change in price over the past 24 hours, as an absolute probability delta. */
|
|
8
11
|
priceChange24h?: number;
|
|
12
|
+
/** Exchange-specific metadata (e.g., clobTokenId for Polymarket) */
|
|
9
13
|
metadata?: Record<string, any>;
|
|
10
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A grouped collection of related markets (e.g., "Who will be Fed Chair?" contains multiple candidate markets).
|
|
17
|
+
*/
|
|
11
18
|
export interface UnifiedEvent {
|
|
19
|
+
/** The unique identifier for this event. */
|
|
12
20
|
id: string;
|
|
21
|
+
/** The event title (e.g., "Who will be Fed Chair?"). */
|
|
13
22
|
title: string;
|
|
23
|
+
/** Long-form event description. */
|
|
14
24
|
description: string;
|
|
25
|
+
/** URL-friendly slug for the event. */
|
|
15
26
|
slug: string;
|
|
27
|
+
/** Markets grouped under this event. */
|
|
16
28
|
markets: UnifiedMarket[];
|
|
29
|
+
/** Trading volume over the past 24 hours (USD). */
|
|
17
30
|
volume24h: number;
|
|
18
31
|
volume?: number;
|
|
32
|
+
/** Canonical URL to view the event on the venue. */
|
|
19
33
|
url: string;
|
|
34
|
+
/** Optional image URL for the event. */
|
|
20
35
|
image?: string;
|
|
36
|
+
/** Optional category label (e.g., "Politics", "Sports"). */
|
|
21
37
|
category?: string;
|
|
38
|
+
/** Optional list of tags associated with the event. */
|
|
22
39
|
tags?: string[];
|
|
23
40
|
}
|
|
24
41
|
export interface UnifiedMarket {
|
|
25
42
|
/** The unique identifier for this market */
|
|
26
43
|
marketId: string;
|
|
44
|
+
/** Link to parent event */
|
|
27
45
|
eventId?: string;
|
|
46
|
+
/** The market title (e.g., "Will BTC close above $100k on Dec 31?"). */
|
|
28
47
|
title: string;
|
|
48
|
+
/** Long-form market description or resolution criteria. */
|
|
29
49
|
description: string;
|
|
50
|
+
/** URL-friendly slug for the market. */
|
|
30
51
|
slug?: string;
|
|
52
|
+
/** The possible outcomes for this market. */
|
|
31
53
|
outcomes: MarketOutcome[];
|
|
54
|
+
/** When the market is scheduled to resolve. */
|
|
32
55
|
resolutionDate: Date;
|
|
56
|
+
/** Trading volume over the past 24 hours (USD). */
|
|
33
57
|
volume24h: number;
|
|
34
58
|
volume?: number;
|
|
59
|
+
/** Current market liquidity (USD). */
|
|
35
60
|
liquidity: number;
|
|
61
|
+
/** Total value of outstanding contracts (USD). */
|
|
36
62
|
openInterest?: number;
|
|
63
|
+
/** Canonical URL to view the market on the venue. */
|
|
37
64
|
url: string;
|
|
65
|
+
/** Optional image URL for the market. */
|
|
38
66
|
image?: string;
|
|
67
|
+
/** Optional category label (e.g., "Politics", "Crypto"). */
|
|
39
68
|
category?: string;
|
|
69
|
+
/** Optional list of tags associated with the market. */
|
|
40
70
|
tags?: string[];
|
|
41
71
|
tickSize?: number;
|
|
42
72
|
/** Venue-native lifecycle status (e.g. 'active', 'closed', 'archived'). */
|
|
43
73
|
status?: string;
|
|
44
74
|
/** On-chain contract / condition identifier where applicable (Polymarket conditionId, etc.). */
|
|
45
75
|
contractAddress?: string;
|
|
76
|
+
/** Convenience accessor for the YES outcome on a binary market. */
|
|
46
77
|
yes?: MarketOutcome;
|
|
78
|
+
/** Convenience accessor for the NO outcome on a binary market. */
|
|
47
79
|
no?: MarketOutcome;
|
|
80
|
+
/** Convenience accessor for the UP outcome on a binary market. */
|
|
48
81
|
up?: MarketOutcome;
|
|
82
|
+
/** Convenience accessor for the DOWN outcome on a binary market. */
|
|
49
83
|
down?: MarketOutcome;
|
|
50
84
|
}
|
|
51
85
|
export type CandleInterval = '1m' | '5m' | '15m' | '1h' | '6h' | '1d';
|
|
52
86
|
export interface PriceCandle {
|
|
87
|
+
/** Unix timestamp in milliseconds marking the start of the candle. */
|
|
53
88
|
timestamp: number;
|
|
89
|
+
/** Opening price for the interval (probability between 0.0 and 1.0). */
|
|
54
90
|
open: number;
|
|
91
|
+
/** Highest price during the interval (probability between 0.0 and 1.0). */
|
|
55
92
|
high: number;
|
|
93
|
+
/** Lowest price during the interval (probability between 0.0 and 1.0). */
|
|
56
94
|
low: number;
|
|
95
|
+
/** Closing price for the interval (probability between 0.0 and 1.0). */
|
|
57
96
|
close: number;
|
|
97
|
+
/** Trading volume during the interval. */
|
|
58
98
|
volume?: number;
|
|
59
99
|
}
|
|
60
100
|
export interface OrderLevel {
|
|
@@ -62,60 +102,94 @@ export interface OrderLevel {
|
|
|
62
102
|
size: number;
|
|
63
103
|
}
|
|
64
104
|
export interface OrderBook {
|
|
105
|
+
/** Order book bid levels, sorted by price descending. */
|
|
65
106
|
bids: OrderLevel[];
|
|
107
|
+
/** Order book ask levels, sorted by price ascending. */
|
|
66
108
|
asks: OrderLevel[];
|
|
109
|
+
/** Unix timestamp in milliseconds when the snapshot was taken. */
|
|
67
110
|
timestamp?: number;
|
|
68
111
|
}
|
|
69
112
|
export interface Trade {
|
|
113
|
+
/** The unique identifier for this trade. */
|
|
70
114
|
id: string;
|
|
115
|
+
/** Unix timestamp in milliseconds when the trade executed. */
|
|
71
116
|
timestamp: number;
|
|
117
|
+
/** Probability between 0.0 and 1.0. */
|
|
72
118
|
price: number;
|
|
119
|
+
/** Size of the trade in contracts/shares. */
|
|
73
120
|
amount: number;
|
|
121
|
+
/** Trade side from the taker's perspective. */
|
|
74
122
|
side: 'buy' | 'sell' | 'unknown';
|
|
123
|
+
/** The outcome this trade is for (if known). */
|
|
75
124
|
outcomeId?: string;
|
|
76
125
|
}
|
|
77
126
|
export interface UserTrade extends Trade {
|
|
127
|
+
/** The order that produced this trade, if known. */
|
|
78
128
|
orderId?: string;
|
|
79
129
|
}
|
|
80
130
|
export interface QueuedPromise<T> {
|
|
131
|
+
/** Internal: resolver for a queued promise. */
|
|
81
132
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
133
|
+
/** Internal: rejecter for a queued promise. */
|
|
82
134
|
reject: (reason?: any) => void;
|
|
83
135
|
}
|
|
84
136
|
export interface Order {
|
|
137
|
+
/** The exchange-assigned order identifier. */
|
|
85
138
|
id: string;
|
|
139
|
+
/** The market this order was placed on. */
|
|
86
140
|
marketId: string;
|
|
141
|
+
/** The outcome this order was placed on. */
|
|
87
142
|
outcomeId: string;
|
|
143
|
+
/** Order side: buy or sell. */
|
|
88
144
|
side: 'buy' | 'sell';
|
|
145
|
+
/** Order type: market (execute immediately) or limit (resting at a price). */
|
|
89
146
|
type: 'market' | 'limit';
|
|
90
147
|
price?: number;
|
|
91
148
|
amount: number;
|
|
149
|
+
/** Lifecycle status of the order. */
|
|
92
150
|
status: 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected';
|
|
93
151
|
filled: number;
|
|
94
152
|
remaining: number;
|
|
153
|
+
/** Unix timestamp in milliseconds when the order was created. */
|
|
95
154
|
timestamp: number;
|
|
155
|
+
/** Fee paid for this order, if known. */
|
|
96
156
|
fee?: number;
|
|
97
157
|
}
|
|
98
158
|
export interface Position {
|
|
159
|
+
/** The market this position is held in. */
|
|
99
160
|
marketId: string;
|
|
161
|
+
/** The outcome this position is held in. */
|
|
100
162
|
outcomeId: string;
|
|
163
|
+
/** Human-readable label for the outcome held. */
|
|
101
164
|
outcomeLabel: string;
|
|
102
165
|
size: number;
|
|
166
|
+
/** Average entry price for the position (probability between 0.0 and 1.0). */
|
|
103
167
|
entryPrice: number;
|
|
168
|
+
/** Current mark price for the position (probability between 0.0 and 1.0). */
|
|
104
169
|
currentPrice: number;
|
|
170
|
+
/** Unrealized profit or loss at the current price (USD). */
|
|
105
171
|
unrealizedPnL: number;
|
|
172
|
+
/** Realized profit or loss booked so far (USD). */
|
|
106
173
|
realizedPnL?: number;
|
|
107
174
|
}
|
|
108
175
|
export interface Balance {
|
|
109
176
|
currency: string;
|
|
177
|
+
/** Total balance including funds locked in open orders. */
|
|
110
178
|
total: number;
|
|
179
|
+
/** Balance available to trade (excludes locked funds). */
|
|
111
180
|
available: number;
|
|
112
181
|
locked: number;
|
|
113
182
|
}
|
|
114
183
|
export interface CreateOrderParams {
|
|
184
|
+
/** The market to trade on. */
|
|
115
185
|
marketId: string;
|
|
186
|
+
/** The outcome to trade. */
|
|
116
187
|
outcomeId: string;
|
|
188
|
+
/** Order side: buy or sell. */
|
|
117
189
|
side: 'buy' | 'sell';
|
|
190
|
+
/** Order type: market (execute immediately) or limit (resting at a price). */
|
|
118
191
|
type: 'market' | 'limit';
|
|
192
|
+
/** Size of the order in contracts/shares. */
|
|
119
193
|
amount: number;
|
|
120
194
|
price?: number;
|
|
121
195
|
fee?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.5",
|
|
4
4
|
"description": "pmxt is a unified prediction market data API. The ccxt for prediction markets.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test": "jest -c jest.config.js",
|
|
30
30
|
"server": "tsx watch src/server/index.ts",
|
|
31
31
|
"server:prod": "node dist/server/index.js",
|
|
32
|
-
"generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.27.
|
|
33
|
-
"generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.27.
|
|
32
|
+
"generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.27.5,library=urllib3",
|
|
33
|
+
"generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.27.5,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
|
|
34
34
|
"fetch:openapi": "node scripts/fetch-openapi-specs.js",
|
|
35
35
|
"extract:jsdoc": "node ../scripts/extract-jsdoc.js",
|
|
36
36
|
"generate:docs": "npm run extract:jsdoc && node ../scripts/generate-api-docs.js",
|