pmxtjs 2.42.7 → 2.43.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 +120 -4
- package/dist/esm/generated/src/apis/DefaultApi.js +136 -5
- package/dist/esm/generated/src/models/FetchOrderBooks200Response.d.ts +48 -0
- package/dist/esm/generated/src/models/FetchOrderBooks200Response.js +48 -0
- package/dist/esm/generated/src/models/FetchOrderBooksRequest.d.ts +39 -0
- package/dist/esm/generated/src/models/FetchOrderBooksRequest.js +46 -0
- package/dist/esm/generated/src/models/OrderBook.d.ts +6 -0
- package/dist/esm/generated/src/models/OrderBook.js +2 -0
- package/dist/esm/generated/src/models/index.d.ts +2 -0
- package/dist/esm/generated/src/models/index.js +2 -0
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/pmxt/client.d.ts +45 -3
- package/dist/esm/pmxt/client.js +97 -5
- package/dist/esm/pmxt/models.d.ts +3 -1
- package/dist/generated/src/apis/DefaultApi.d.ts +120 -4
- package/dist/generated/src/apis/DefaultApi.js +137 -6
- package/dist/generated/src/models/FetchOrderBooks200Response.d.ts +48 -0
- package/dist/generated/src/models/FetchOrderBooks200Response.js +55 -0
- package/dist/generated/src/models/FetchOrderBooksRequest.d.ts +39 -0
- package/dist/generated/src/models/FetchOrderBooksRequest.js +53 -0
- package/dist/generated/src/models/OrderBook.d.ts +6 -0
- package/dist/generated/src/models/OrderBook.js +2 -0
- package/dist/generated/src/models/index.d.ts +2 -0
- package/dist/generated/src/models/index.js +2 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -1
- package/dist/pmxt/client.d.ts +45 -3
- package/dist/pmxt/client.js +101 -6
- package/dist/pmxt/models.d.ts +3 -1
- package/generated/.openapi-generator/FILES +4 -0
- package/generated/docs/DefaultApi.md +130 -59
- package/generated/docs/FetchOrderBooks200Response.md +38 -0
- package/generated/docs/FetchOrderBooksRequest.md +36 -0
- package/generated/docs/GetExecutionPriceRequestArgsInner.md +2 -0
- package/generated/docs/OrderBook.md +2 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +160 -5
- package/generated/src/models/FetchOrderBooks200Response.ts +96 -0
- package/generated/src/models/FetchOrderBooksRequest.ts +82 -0
- package/generated/src/models/OrderBook.ts +8 -0
- package/generated/src/models/index.ts +2 -0
- package/index.ts +5 -2
- package/package.json +2 -2
- package/pmxt/client.ts +105 -11
- package/pmxt/models.ts +4 -1
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -156,7 +156,8 @@ export declare abstract class Exchange {
|
|
|
156
156
|
fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
157
157
|
fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
|
|
158
158
|
fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
|
|
159
|
-
fetchOrderBook(outcomeId: string | MarketOutcome,
|
|
159
|
+
fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook>;
|
|
160
|
+
fetchOrderBooks(outcomeIds: (string | MarketOutcome)[]): Promise<Record<string, OrderBook>>;
|
|
160
161
|
submitOrder(built: BuiltOrder): Promise<Order>;
|
|
161
162
|
cancelOrder(orderId: string): Promise<Order>;
|
|
162
163
|
fetchOrder(orderId: string): Promise<Order>;
|
|
@@ -215,6 +216,7 @@ export declare abstract class Exchange {
|
|
|
215
216
|
*
|
|
216
217
|
* @param outcomeId - Outcome ID to watch
|
|
217
218
|
* @param limit - Optional depth limit for order book
|
|
219
|
+
* @param params - Optional exchange-specific parameters
|
|
218
220
|
* @returns Next order book update
|
|
219
221
|
*
|
|
220
222
|
* @example
|
|
@@ -227,7 +229,7 @@ export declare abstract class Exchange {
|
|
|
227
229
|
* }
|
|
228
230
|
* ```
|
|
229
231
|
*/
|
|
230
|
-
watchOrderBook(outcomeId: string | MarketOutcome, limit?: number): Promise<OrderBook>;
|
|
232
|
+
watchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook>;
|
|
231
233
|
/**
|
|
232
234
|
* Watch real-time order book updates for multiple outcomes at once.
|
|
233
235
|
*
|
|
@@ -240,6 +242,7 @@ export declare abstract class Exchange {
|
|
|
240
242
|
*
|
|
241
243
|
* @param outcomeIds - Array of outcome IDs (or MarketOutcome objects)
|
|
242
244
|
* @param limit - Optional depth limit for each order book
|
|
245
|
+
* @param params - Optional exchange-specific parameters
|
|
243
246
|
* @returns Record mapping ticker to OrderBook
|
|
244
247
|
*
|
|
245
248
|
* @example
|
|
@@ -253,7 +256,7 @@ export declare abstract class Exchange {
|
|
|
253
256
|
* }
|
|
254
257
|
* ```
|
|
255
258
|
*/
|
|
256
|
-
watchOrderBooks(outcomeIds: (string | MarketOutcome)[], limit?: number): Promise<Record<string, OrderBook>>;
|
|
259
|
+
watchOrderBooks(outcomeIds: (string | MarketOutcome)[], limit?: number, params?: Record<string, any>): Promise<Record<string, OrderBook>>;
|
|
257
260
|
/**
|
|
258
261
|
* Stream all orderbook updates across venues via the hosted WebSocket API.
|
|
259
262
|
*
|
|
@@ -661,3 +664,42 @@ export declare class Smarkets extends Exchange {
|
|
|
661
664
|
export declare class PolymarketUS extends Exchange {
|
|
662
665
|
constructor(options?: ExchangeOptions);
|
|
663
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* Gemini Titan exchange client.
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* ```typescript
|
|
672
|
+
* const titan = new GeminiTitan();
|
|
673
|
+
* const markets = await titan.fetchMarkets();
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
export declare class GeminiTitan extends Exchange {
|
|
677
|
+
constructor(options?: ExchangeOptions);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Hyperliquid exchange client.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* const hl = new Hyperliquid();
|
|
685
|
+
* const markets = await hl.fetchMarkets();
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
export declare class Hyperliquid extends Exchange {
|
|
689
|
+
constructor(options?: ExchangeOptions);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Mock exchange client.
|
|
693
|
+
*
|
|
694
|
+
* Offline deterministic exchange for testing and development.
|
|
695
|
+
* No credentials required.
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* ```typescript
|
|
699
|
+
* const mock = new Mock();
|
|
700
|
+
* const markets = await mock.fetchMarkets();
|
|
701
|
+
* ```
|
|
702
|
+
*/
|
|
703
|
+
export declare class Mock extends Exchange {
|
|
704
|
+
constructor(options?: ExchangeOptions);
|
|
705
|
+
}
|
package/dist/pmxt/client.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* OpenAPI client, matching the Python API exactly.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.PolymarketUS = exports.Smarkets = exports.Metaculus = exports.Opinion = exports.Baozi = exports.Probable = exports.Myriad = exports.KalshiDemo = exports.Limitless = exports.Kalshi = exports.Polymarket = exports.Exchange = void 0;
|
|
9
|
+
exports.Mock = exports.Hyperliquid = exports.GeminiTitan = exports.PolymarketUS = exports.Smarkets = exports.Metaculus = exports.Opinion = exports.Baozi = exports.Probable = exports.Myriad = exports.KalshiDemo = exports.Limitless = exports.Kalshi = exports.Polymarket = exports.Exchange = void 0;
|
|
10
10
|
const index_js_1 = require("../generated/src/index.js");
|
|
11
11
|
const models_js_1 = require("./models.js");
|
|
12
12
|
const server_manager_js_1 = require("./server-manager.js");
|
|
@@ -633,13 +633,15 @@ class Exchange {
|
|
|
633
633
|
throw new errors_js_1.PmxtError(`Failed to fetchEvent: ${error}`);
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
async fetchOrderBook(outcomeId,
|
|
636
|
+
async fetchOrderBook(outcomeId, limit, params) {
|
|
637
637
|
await this.initPromise;
|
|
638
638
|
try {
|
|
639
639
|
const args = [];
|
|
640
640
|
args.push(resolveOutcomeId(outcomeId));
|
|
641
|
-
if (
|
|
642
|
-
args.push(
|
|
641
|
+
if (limit !== undefined)
|
|
642
|
+
args.push(limit);
|
|
643
|
+
if (params !== undefined)
|
|
644
|
+
args.push(params);
|
|
643
645
|
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchOrderBook`, {
|
|
644
646
|
method: 'POST',
|
|
645
647
|
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
@@ -662,6 +664,37 @@ class Exchange {
|
|
|
662
664
|
throw new errors_js_1.PmxtError(`Failed to fetchOrderBook: ${error}`);
|
|
663
665
|
}
|
|
664
666
|
}
|
|
667
|
+
async fetchOrderBooks(outcomeIds) {
|
|
668
|
+
await this.initPromise;
|
|
669
|
+
try {
|
|
670
|
+
const args = [];
|
|
671
|
+
args.push(outcomeIds.map(resolveOutcomeId));
|
|
672
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchOrderBooks`, {
|
|
673
|
+
method: 'POST',
|
|
674
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
675
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
676
|
+
});
|
|
677
|
+
if (!response.ok) {
|
|
678
|
+
const body = await response.json().catch(() => ({}));
|
|
679
|
+
if (body.error && typeof body.error === "object") {
|
|
680
|
+
throw (0, errors_js_1.fromServerError)(body.error);
|
|
681
|
+
}
|
|
682
|
+
throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
|
|
683
|
+
}
|
|
684
|
+
const json = await response.json();
|
|
685
|
+
const data = this.handleResponse(json);
|
|
686
|
+
const result = {};
|
|
687
|
+
for (const [key, value] of Object.entries(data)) {
|
|
688
|
+
result[key] = convertOrderBook(value);
|
|
689
|
+
}
|
|
690
|
+
return result;
|
|
691
|
+
}
|
|
692
|
+
catch (error) {
|
|
693
|
+
if (error instanceof errors_js_1.PmxtError)
|
|
694
|
+
throw error;
|
|
695
|
+
throw new errors_js_1.PmxtError(`Failed to fetchOrderBooks: ${error}`);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
665
698
|
async submitOrder(built) {
|
|
666
699
|
await this.initPromise;
|
|
667
700
|
try {
|
|
@@ -1345,6 +1378,7 @@ class Exchange {
|
|
|
1345
1378
|
*
|
|
1346
1379
|
* @param outcomeId - Outcome ID to watch
|
|
1347
1380
|
* @param limit - Optional depth limit for order book
|
|
1381
|
+
* @param params - Optional exchange-specific parameters
|
|
1348
1382
|
* @returns Next order book update
|
|
1349
1383
|
*
|
|
1350
1384
|
* @example
|
|
@@ -1357,13 +1391,19 @@ class Exchange {
|
|
|
1357
1391
|
* }
|
|
1358
1392
|
* ```
|
|
1359
1393
|
*/
|
|
1360
|
-
async watchOrderBook(outcomeId, limit) {
|
|
1394
|
+
async watchOrderBook(outcomeId, limit, params = {}) {
|
|
1361
1395
|
await this.initPromise;
|
|
1362
1396
|
const resolvedOutcomeId = resolveOutcomeId(outcomeId);
|
|
1363
1397
|
const args = [resolvedOutcomeId];
|
|
1364
1398
|
if (limit !== undefined) {
|
|
1365
1399
|
args.push(limit);
|
|
1366
1400
|
}
|
|
1401
|
+
if (Object.keys(params).length > 0) {
|
|
1402
|
+
if (limit === undefined) {
|
|
1403
|
+
args.push(undefined);
|
|
1404
|
+
}
|
|
1405
|
+
args.push(params);
|
|
1406
|
+
}
|
|
1367
1407
|
// Try WebSocket transport first
|
|
1368
1408
|
const wsData = await this.watchViaWs("watchOrderBook", args);
|
|
1369
1409
|
if (wsData !== null) {
|
|
@@ -1405,6 +1445,7 @@ class Exchange {
|
|
|
1405
1445
|
*
|
|
1406
1446
|
* @param outcomeIds - Array of outcome IDs (or MarketOutcome objects)
|
|
1407
1447
|
* @param limit - Optional depth limit for each order book
|
|
1448
|
+
* @param params - Optional exchange-specific parameters
|
|
1408
1449
|
* @returns Record mapping ticker to OrderBook
|
|
1409
1450
|
*
|
|
1410
1451
|
* @example
|
|
@@ -1418,13 +1459,19 @@ class Exchange {
|
|
|
1418
1459
|
* }
|
|
1419
1460
|
* ```
|
|
1420
1461
|
*/
|
|
1421
|
-
async watchOrderBooks(outcomeIds, limit) {
|
|
1462
|
+
async watchOrderBooks(outcomeIds, limit, params = {}) {
|
|
1422
1463
|
await this.initPromise;
|
|
1423
1464
|
const resolvedIds = outcomeIds.map(resolveOutcomeId);
|
|
1424
1465
|
const args = [resolvedIds];
|
|
1425
1466
|
if (limit !== undefined) {
|
|
1426
1467
|
args.push(limit);
|
|
1427
1468
|
}
|
|
1469
|
+
if (Object.keys(params).length > 0) {
|
|
1470
|
+
if (limit === undefined) {
|
|
1471
|
+
args.push(undefined);
|
|
1472
|
+
}
|
|
1473
|
+
args.push(params);
|
|
1474
|
+
}
|
|
1428
1475
|
// Try WebSocket transport first
|
|
1429
1476
|
const ws = await this.getOrCreateWs();
|
|
1430
1477
|
if (ws) {
|
|
@@ -2395,3 +2442,51 @@ class PolymarketUS extends Exchange {
|
|
|
2395
2442
|
}
|
|
2396
2443
|
}
|
|
2397
2444
|
exports.PolymarketUS = PolymarketUS;
|
|
2445
|
+
/**
|
|
2446
|
+
* Gemini Titan exchange client.
|
|
2447
|
+
*
|
|
2448
|
+
* @example
|
|
2449
|
+
* ```typescript
|
|
2450
|
+
* const titan = new GeminiTitan();
|
|
2451
|
+
* const markets = await titan.fetchMarkets();
|
|
2452
|
+
* ```
|
|
2453
|
+
*/
|
|
2454
|
+
class GeminiTitan extends Exchange {
|
|
2455
|
+
constructor(options = {}) {
|
|
2456
|
+
super("gemini-titan", options);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
exports.GeminiTitan = GeminiTitan;
|
|
2460
|
+
/**
|
|
2461
|
+
* Hyperliquid exchange client.
|
|
2462
|
+
*
|
|
2463
|
+
* @example
|
|
2464
|
+
* ```typescript
|
|
2465
|
+
* const hl = new Hyperliquid();
|
|
2466
|
+
* const markets = await hl.fetchMarkets();
|
|
2467
|
+
* ```
|
|
2468
|
+
*/
|
|
2469
|
+
class Hyperliquid extends Exchange {
|
|
2470
|
+
constructor(options = {}) {
|
|
2471
|
+
super("hyperliquid", options);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
exports.Hyperliquid = Hyperliquid;
|
|
2475
|
+
/**
|
|
2476
|
+
* Mock exchange client.
|
|
2477
|
+
*
|
|
2478
|
+
* Offline deterministic exchange for testing and development.
|
|
2479
|
+
* No credentials required.
|
|
2480
|
+
*
|
|
2481
|
+
* @example
|
|
2482
|
+
* ```typescript
|
|
2483
|
+
* const mock = new Mock();
|
|
2484
|
+
* const markets = await mock.fetchMarkets();
|
|
2485
|
+
* ```
|
|
2486
|
+
*/
|
|
2487
|
+
class Mock extends Exchange {
|
|
2488
|
+
constructor(options = {}) {
|
|
2489
|
+
super("mock", options);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
exports.Mock = Mock;
|
package/dist/pmxt/models.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export interface OrderLevel {
|
|
|
102
102
|
size: number;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Order book for an outcome.
|
|
106
106
|
*/
|
|
107
107
|
export interface OrderBook {
|
|
108
108
|
/** Bid orders (sorted high to low) */
|
|
@@ -111,6 +111,8 @@ export interface OrderBook {
|
|
|
111
111
|
asks: OrderLevel[];
|
|
112
112
|
/** Unix timestamp (milliseconds) */
|
|
113
113
|
timestamp?: number;
|
|
114
|
+
/** ISO 8601 datetime string of the snapshot (CCXT-compatible) */
|
|
115
|
+
datetime?: string;
|
|
114
116
|
}
|
|
115
117
|
/**
|
|
116
118
|
* A single event from the firehose stream.
|
|
@@ -60,6 +60,8 @@ docs/FetchMyTrades200Response.md
|
|
|
60
60
|
docs/FetchOHLCV200Response.md
|
|
61
61
|
docs/FetchOpenOrders200Response.md
|
|
62
62
|
docs/FetchOrderBook200Response.md
|
|
63
|
+
docs/FetchOrderBooks200Response.md
|
|
64
|
+
docs/FetchOrderBooksRequest.md
|
|
63
65
|
docs/FetchPositions200Response.md
|
|
64
66
|
docs/FetchTrades200Response.md
|
|
65
67
|
docs/FilterEventsRequest.md
|
|
@@ -166,6 +168,8 @@ src/models/FetchMyTrades200Response.ts
|
|
|
166
168
|
src/models/FetchOHLCV200Response.ts
|
|
167
169
|
src/models/FetchOpenOrders200Response.ts
|
|
168
170
|
src/models/FetchOrderBook200Response.ts
|
|
171
|
+
src/models/FetchOrderBooks200Response.ts
|
|
172
|
+
src/models/FetchOrderBooksRequest.ts
|
|
169
173
|
src/models/FetchPositions200Response.ts
|
|
170
174
|
src/models/FetchTrades200Response.ts
|
|
171
175
|
src/models/FilterEventsRequest.ts
|