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