pmxt-core 2.27.6 → 2.27.8
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 +0 -331
- package/dist/BaseExchange.js +0 -331
- 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/limitless/index.d.ts +0 -30
- package/dist/exchanges/limitless/index.js +0 -30
- 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/polymarket/auth.js +10 -0
- package/dist/exchanges/polymarket/index.d.ts +0 -12
- package/dist/exchanges/polymarket/index.js +0 -12
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/index.d.ts +0 -24
- package/dist/exchanges/probable/index.js +0 -24
- package/dist/server/openapi.yaml +195 -0
- package/package.json +3 -3
package/dist/BaseExchange.d.ts
CHANGED
|
@@ -282,18 +282,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
282
282
|
*
|
|
283
283
|
* @param reload - Force a fresh fetch from the API even if markets are already loaded
|
|
284
284
|
* @returns Dictionary of markets indexed by marketId
|
|
285
|
-
*
|
|
286
|
-
* @example-ts Stable pagination
|
|
287
|
-
* await exchange.loadMarkets();
|
|
288
|
-
* const all = Object.values(exchange.markets);
|
|
289
|
-
* const page1 = all.slice(0, 100);
|
|
290
|
-
* const page2 = all.slice(100, 200);
|
|
291
|
-
*
|
|
292
|
-
* @example-python Stable pagination
|
|
293
|
-
* exchange.load_markets()
|
|
294
|
-
* all = list(exchange.markets.values())
|
|
295
|
-
* page1 = all[:100]
|
|
296
|
-
* page2 = all[100:200]
|
|
297
285
|
*/
|
|
298
286
|
loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
|
|
299
287
|
/**
|
|
@@ -314,20 +302,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
314
302
|
* across pages, use `loadMarkets()` and paginate over `Object.values(exchange.markets)`.
|
|
315
303
|
*
|
|
316
304
|
* @note Some exchanges (like Limitless) may only support status 'active' for search results.
|
|
317
|
-
*
|
|
318
|
-
* @example-ts Fetch markets
|
|
319
|
-
* const markets = await exchange.fetchMarkets({ query: 'Trump', limit: 10000 });
|
|
320
|
-
* console.log(markets[0].title);
|
|
321
|
-
*
|
|
322
|
-
* @example-ts Get market by slug
|
|
323
|
-
* const markets = await exchange.fetchMarkets({ slug: 'will-trump-win' });
|
|
324
|
-
*
|
|
325
|
-
* @example-python Fetch markets
|
|
326
|
-
* markets = exchange.fetch_markets(query='Trump', limit=10000)
|
|
327
|
-
* print(markets[0].title)
|
|
328
|
-
*
|
|
329
|
-
* @example-python Get market by slug
|
|
330
|
-
* markets = exchange.fetch_markets(slug='will-trump-win')
|
|
331
305
|
*/
|
|
332
306
|
fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
|
|
333
307
|
/**
|
|
@@ -361,16 +335,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
361
335
|
* @returns Array of unified events
|
|
362
336
|
*
|
|
363
337
|
* @note Some exchanges (like Limitless) may only support status 'active' for search results.
|
|
364
|
-
*
|
|
365
|
-
* @example-ts Search events
|
|
366
|
-
* const events = await exchange.fetchEvents({ query: 'Fed Chair' });
|
|
367
|
-
* const fedEvent = events[0];
|
|
368
|
-
* console.log(fedEvent.title, fedEvent.markets.length, 'markets');
|
|
369
|
-
*
|
|
370
|
-
* @example-python Search events
|
|
371
|
-
* events = exchange.fetch_events(query='Fed Chair')
|
|
372
|
-
* fed_event = events[0]
|
|
373
|
-
* print(fed_event.title, len(fed_event.markets), 'markets')
|
|
374
338
|
*/
|
|
375
339
|
fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
376
340
|
/**
|
|
@@ -380,15 +344,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
380
344
|
* @param params - Lookup parameters (marketId, outcomeId, slug, etc.)
|
|
381
345
|
* @returns A single unified market
|
|
382
346
|
* @throws MarketNotFound if no market matches the parameters
|
|
383
|
-
*
|
|
384
|
-
* @example-ts Fetch by market ID
|
|
385
|
-
* const market = await exchange.fetchMarket({ marketId: '663583' });
|
|
386
|
-
*
|
|
387
|
-
* @example-ts Fetch by outcome ID
|
|
388
|
-
* const market = await exchange.fetchMarket({ outcomeId: '10991849...' });
|
|
389
|
-
*
|
|
390
|
-
* @example-python Fetch by market ID
|
|
391
|
-
* market = exchange.fetch_market(market_id='663583')
|
|
392
347
|
*/
|
|
393
348
|
fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
|
|
394
349
|
/**
|
|
@@ -398,12 +353,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
398
353
|
* @param params - Lookup parameters (eventId, slug, query)
|
|
399
354
|
* @returns A single unified event
|
|
400
355
|
* @throws EventNotFound if no event matches the parameters
|
|
401
|
-
*
|
|
402
|
-
* @example-ts Fetch by event ID
|
|
403
|
-
* const event = await exchange.fetchEvent({ eventId: 'TRUMP25DEC' });
|
|
404
|
-
*
|
|
405
|
-
* @example-python Fetch by event ID
|
|
406
|
-
* event = exchange.fetch_event(event_id='TRUMP25DEC')
|
|
407
356
|
*/
|
|
408
357
|
fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
|
|
409
358
|
/**
|
|
@@ -413,21 +362,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
413
362
|
* @param params - OHLCV parameters including resolution (required)
|
|
414
363
|
* @returns Array of price candles
|
|
415
364
|
*
|
|
416
|
-
* @example-ts Fetch hourly candles
|
|
417
|
-
* const markets = await exchange.fetchMarkets({ query: 'Trump' });
|
|
418
|
-
* const outcomeId = markets[0].yes.outcomeId;
|
|
419
|
-
* const candles = await exchange.fetchOHLCV(outcomeId, {
|
|
420
|
-
* resolution: '1h',
|
|
421
|
-
* limit: 100
|
|
422
|
-
* });
|
|
423
|
-
* console.log(`Latest close: ${candles[candles.length - 1].close}`);
|
|
424
|
-
*
|
|
425
|
-
* @example-python Fetch hourly candles
|
|
426
|
-
* markets = exchange.fetch_markets(query='Trump')
|
|
427
|
-
* outcome_id = markets[0].yes.outcome_id
|
|
428
|
-
* candles = exchange.fetch_ohlcv(outcome_id, resolution='1h', limit=100)
|
|
429
|
-
* print(f"Latest close: {candles[-1].close}")
|
|
430
|
-
*
|
|
431
365
|
* @notes **CRITICAL**: Use `outcome.outcomeId` (TS) / `outcome.outcome_id` (Python), not the market ID.
|
|
432
366
|
* @notes Polymarket: outcomeId is the CLOB Token ID. Kalshi: outcomeId is the Market Ticker.
|
|
433
367
|
* @notes Resolution options: '1m' | '5m' | '15m' | '1h' | '6h' | '1d'
|
|
@@ -439,18 +373,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
439
373
|
*
|
|
440
374
|
* @param id - The Outcome ID (outcomeId)
|
|
441
375
|
* @returns Current order book with bids and asks
|
|
442
|
-
*
|
|
443
|
-
* @example-ts Fetch order book
|
|
444
|
-
* const book = await exchange.fetchOrderBook(outcome.outcomeId);
|
|
445
|
-
* console.log(`Best bid: ${book.bids[0].price}`);
|
|
446
|
-
* console.log(`Best ask: ${book.asks[0].price}`);
|
|
447
|
-
* console.log(`Spread: ${(book.asks[0].price - book.bids[0].price) * 100}%`);
|
|
448
|
-
*
|
|
449
|
-
* @example-python Fetch order book
|
|
450
|
-
* book = exchange.fetch_order_book(outcome.outcome_id)
|
|
451
|
-
* print(f"Best bid: {book.bids[0].price}")
|
|
452
|
-
* print(f"Best ask: {book.asks[0].price}")
|
|
453
|
-
* print(f"Spread: {(book.asks[0].price - book.bids[0].price) * 100:.2f}%")
|
|
454
376
|
*/
|
|
455
377
|
fetchOrderBook(id: string): Promise<OrderBook>;
|
|
456
378
|
/**
|
|
@@ -460,17 +382,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
460
382
|
* @param params - Trade filter parameters
|
|
461
383
|
* @returns Array of recent trades
|
|
462
384
|
*
|
|
463
|
-
* @example-ts Fetch recent trades
|
|
464
|
-
* const trades = await exchange.fetchTrades(outcome.outcomeId, { limit: 100 });
|
|
465
|
-
* for (const trade of trades) {
|
|
466
|
-
* console.log(`${trade.side} ${trade.amount} @ ${trade.price}`);
|
|
467
|
-
* }
|
|
468
|
-
*
|
|
469
|
-
* @example-python Fetch recent trades
|
|
470
|
-
* trades = exchange.fetch_trades(outcome.outcome_id, limit=100)
|
|
471
|
-
* for trade in trades:
|
|
472
|
-
* print(f"{trade.side} {trade.amount} @ {trade.price}")
|
|
473
|
-
*
|
|
474
385
|
* @notes Polymarket requires an API key for trade history. Use fetchOHLCV for public historical data.
|
|
475
386
|
*/
|
|
476
387
|
fetchTrades(id: string, params: TradesParams | HistoryFilterParams): Promise<Trade[]>;
|
|
@@ -479,46 +390,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
479
390
|
*
|
|
480
391
|
* @param params - Order parameters
|
|
481
392
|
* @returns The created order
|
|
482
|
-
*
|
|
483
|
-
* @example-ts Place a limit order
|
|
484
|
-
* const order = await exchange.createOrder({
|
|
485
|
-
* marketId: market.marketId,
|
|
486
|
-
* outcomeId: market.yes.outcomeId,
|
|
487
|
-
* side: 'buy',
|
|
488
|
-
* type: 'limit',
|
|
489
|
-
* amount: 10,
|
|
490
|
-
* price: 0.55
|
|
491
|
-
* });
|
|
492
|
-
* console.log(`Order ${order.id}: ${order.status}`);
|
|
493
|
-
*
|
|
494
|
-
* @example-ts Place a market order
|
|
495
|
-
* const order = await exchange.createOrder({
|
|
496
|
-
* marketId: market.marketId,
|
|
497
|
-
* outcomeId: market.yes.outcomeId,
|
|
498
|
-
* side: 'buy',
|
|
499
|
-
* type: 'market',
|
|
500
|
-
* amount: 5
|
|
501
|
-
* });
|
|
502
|
-
*
|
|
503
|
-
* @example-python Place a limit order
|
|
504
|
-
* order = exchange.create_order(
|
|
505
|
-
* market_id=market.market_id,
|
|
506
|
-
* outcome_id=market.yes.outcome_id,
|
|
507
|
-
* side='buy',
|
|
508
|
-
* type='limit',
|
|
509
|
-
* amount=10,
|
|
510
|
-
* price=0.55
|
|
511
|
-
* )
|
|
512
|
-
* print(f"Order {order.id}: {order.status}")
|
|
513
|
-
*
|
|
514
|
-
* @example-python Place a market order
|
|
515
|
-
* order = exchange.create_order(
|
|
516
|
-
* market_id=market.market_id,
|
|
517
|
-
* outcome_id=market.yes.outcome_id,
|
|
518
|
-
* side='buy',
|
|
519
|
-
* type='market',
|
|
520
|
-
* amount=5
|
|
521
|
-
* )
|
|
522
393
|
*/
|
|
523
394
|
createOrder(params: CreateOrderParams): Promise<Order>;
|
|
524
395
|
/**
|
|
@@ -528,30 +399,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
528
399
|
*
|
|
529
400
|
* @param params - Order parameters (same as createOrder)
|
|
530
401
|
* @returns A BuiltOrder containing the exchange-native payload
|
|
531
|
-
*
|
|
532
|
-
* @example-ts Build then inspect a Polymarket order
|
|
533
|
-
* const built = await exchange.buildOrder({
|
|
534
|
-
* marketId: market.marketId,
|
|
535
|
-
* outcomeId: market.yes.outcomeId,
|
|
536
|
-
* side: 'buy',
|
|
537
|
-
* type: 'limit',
|
|
538
|
-
* amount: 10,
|
|
539
|
-
* price: 0.55
|
|
540
|
-
* });
|
|
541
|
-
* console.log(built.signedOrder); // EIP-712 signed order struct
|
|
542
|
-
* const order = await exchange.submitOrder(built);
|
|
543
|
-
*
|
|
544
|
-
* @example-python Build then submit a Polymarket order
|
|
545
|
-
* built = exchange.build_order(
|
|
546
|
-
* market_id=market.market_id,
|
|
547
|
-
* outcome_id=market.yes.outcome_id,
|
|
548
|
-
* side='buy',
|
|
549
|
-
* type='limit',
|
|
550
|
-
* amount=10,
|
|
551
|
-
* price=0.55
|
|
552
|
-
* )
|
|
553
|
-
* print(built.signed_order)
|
|
554
|
-
* order = exchange.submit_order(built)
|
|
555
402
|
*/
|
|
556
403
|
buildOrder(params: CreateOrderParams): Promise<BuiltOrder>;
|
|
557
404
|
/**
|
|
@@ -559,16 +406,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
559
406
|
*
|
|
560
407
|
* @param built - A BuiltOrder from buildOrder()
|
|
561
408
|
* @returns The submitted order
|
|
562
|
-
*
|
|
563
|
-
* @example-ts Submit a pre-built order
|
|
564
|
-
* const built = await exchange.buildOrder(params);
|
|
565
|
-
* const order = await exchange.submitOrder(built);
|
|
566
|
-
* console.log(`Order ${order.id}: ${order.status}`);
|
|
567
|
-
*
|
|
568
|
-
* @example-python Submit a pre-built order
|
|
569
|
-
* built = exchange.build_order(params)
|
|
570
|
-
* order = exchange.submit_order(built)
|
|
571
|
-
* print(f"Order {order.id}: {order.status}")
|
|
572
409
|
*/
|
|
573
410
|
submitOrder(built: BuiltOrder): Promise<Order>;
|
|
574
411
|
/**
|
|
@@ -576,14 +413,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
576
413
|
*
|
|
577
414
|
* @param orderId - The order ID to cancel
|
|
578
415
|
* @returns The cancelled order
|
|
579
|
-
*
|
|
580
|
-
* @example-ts Cancel an order
|
|
581
|
-
* const cancelled = await exchange.cancelOrder('order-123');
|
|
582
|
-
* console.log(cancelled.status); // 'cancelled'
|
|
583
|
-
*
|
|
584
|
-
* @example-python Cancel an order
|
|
585
|
-
* cancelled = exchange.cancel_order('order-123')
|
|
586
|
-
* print(cancelled.status) # 'cancelled'
|
|
587
416
|
*/
|
|
588
417
|
cancelOrder(orderId: string): Promise<Order>;
|
|
589
418
|
/**
|
|
@@ -591,14 +420,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
591
420
|
*
|
|
592
421
|
* @param orderId - The order ID to look up
|
|
593
422
|
* @returns The order details
|
|
594
|
-
*
|
|
595
|
-
* @example-ts Fetch order status
|
|
596
|
-
* const order = await exchange.fetchOrder('order-456');
|
|
597
|
-
* console.log(`Filled: ${order.filled}/${order.amount}`);
|
|
598
|
-
*
|
|
599
|
-
* @example-python Fetch order status
|
|
600
|
-
* order = exchange.fetch_order('order-456')
|
|
601
|
-
* print(f"Filled: {order.filled}/{order.amount}")
|
|
602
423
|
*/
|
|
603
424
|
fetchOrder(orderId: string): Promise<Order>;
|
|
604
425
|
/**
|
|
@@ -606,23 +427,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
606
427
|
*
|
|
607
428
|
* @param marketId - Optional market ID to filter by
|
|
608
429
|
* @returns Array of open orders
|
|
609
|
-
*
|
|
610
|
-
* @example-ts Fetch all open orders
|
|
611
|
-
* const orders = await exchange.fetchOpenOrders();
|
|
612
|
-
* for (const order of orders) {
|
|
613
|
-
* console.log(`${order.side} ${order.amount} @ ${order.price}`);
|
|
614
|
-
* }
|
|
615
|
-
*
|
|
616
|
-
* @example-ts Fetch orders for a specific market
|
|
617
|
-
* const orders = await exchange.fetchOpenOrders('FED-25JAN');
|
|
618
|
-
*
|
|
619
|
-
* @example-python Fetch all open orders
|
|
620
|
-
* orders = exchange.fetch_open_orders()
|
|
621
|
-
* for order in orders:
|
|
622
|
-
* print(f"{order.side} {order.amount} @ {order.price}")
|
|
623
|
-
*
|
|
624
|
-
* @example-python Fetch orders for a specific market
|
|
625
|
-
* orders = exchange.fetch_open_orders('FED-25JAN')
|
|
626
430
|
*/
|
|
627
431
|
fetchOpenOrders(marketId?: string): Promise<Order[]>;
|
|
628
432
|
fetchMyTrades(params?: MyTradesParams): Promise<UserTrade[]>;
|
|
@@ -633,19 +437,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
633
437
|
*
|
|
634
438
|
* @param address - Optional public wallet address
|
|
635
439
|
* @returns Array of user positions
|
|
636
|
-
*
|
|
637
|
-
* @example-ts Fetch positions
|
|
638
|
-
* const positions = await exchange.fetchPositions();
|
|
639
|
-
* for (const pos of positions) {
|
|
640
|
-
* console.log(`${pos.outcomeLabel}: ${pos.size} @ $${pos.entryPrice}`);
|
|
641
|
-
* console.log(`Unrealized P&L: $${pos.unrealizedPnL.toFixed(2)}`);
|
|
642
|
-
* }
|
|
643
|
-
*
|
|
644
|
-
* @example-python Fetch positions
|
|
645
|
-
* positions = exchange.fetch_positions()
|
|
646
|
-
* for pos in positions:
|
|
647
|
-
* print(f"{pos.outcome_label}: {pos.size} @ ${pos.entry_price}")
|
|
648
|
-
* print(f"Unrealized P&L: ${pos.unrealized_pnl:.2f}")
|
|
649
440
|
*/
|
|
650
441
|
fetchPositions(address?: string): Promise<Position[]>;
|
|
651
442
|
/**
|
|
@@ -653,14 +444,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
653
444
|
*
|
|
654
445
|
* @param address - Optional public wallet address
|
|
655
446
|
* @returns Array of account balances
|
|
656
|
-
*
|
|
657
|
-
* @example-ts Fetch balance
|
|
658
|
-
* const balances = await exchange.fetchBalance();
|
|
659
|
-
* console.log(`Available: $${balances[0].available}`);
|
|
660
|
-
*
|
|
661
|
-
* @example-python Fetch balance
|
|
662
|
-
* balances = exchange.fetch_balance()
|
|
663
|
-
* print(f"Available: ${balances[0].available}")
|
|
664
447
|
*/
|
|
665
448
|
fetchBalance(address?: string): Promise<Balance[]>;
|
|
666
449
|
/**
|
|
@@ -671,16 +454,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
671
454
|
* @param side - 'buy' or 'sell'
|
|
672
455
|
* @param amount - Number of contracts to simulate
|
|
673
456
|
* @returns Average execution price, or 0 if insufficient liquidity
|
|
674
|
-
*
|
|
675
|
-
* @example-ts Get execution price
|
|
676
|
-
* const book = await exchange.fetchOrderBook(outcome.outcomeId);
|
|
677
|
-
* const price = exchange.getExecutionPrice(book, 'buy', 100);
|
|
678
|
-
* console.log(`Avg price for 100 contracts: ${price}`);
|
|
679
|
-
*
|
|
680
|
-
* @example-python Get execution price
|
|
681
|
-
* book = exchange.fetch_order_book(outcome.outcome_id)
|
|
682
|
-
* price = exchange.get_execution_price(book, 'buy', 100)
|
|
683
|
-
* print(f"Avg price for 100 contracts: {price}")
|
|
684
457
|
*/
|
|
685
458
|
getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): number;
|
|
686
459
|
/**
|
|
@@ -690,20 +463,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
690
463
|
* @param side - 'buy' or 'sell'
|
|
691
464
|
* @param amount - Number of contracts to simulate
|
|
692
465
|
* @returns Detailed execution result with price, filled amount, and fill status
|
|
693
|
-
*
|
|
694
|
-
* @example-ts Get detailed execution price
|
|
695
|
-
* const book = await exchange.fetchOrderBook(outcome.outcomeId);
|
|
696
|
-
* const result = exchange.getExecutionPriceDetailed(book, 'buy', 100);
|
|
697
|
-
* console.log(`Price: ${result.price}`);
|
|
698
|
-
* console.log(`Filled: ${result.filledAmount}/${100}`);
|
|
699
|
-
* console.log(`Fully filled: ${result.fullyFilled}`);
|
|
700
|
-
*
|
|
701
|
-
* @example-python Get detailed execution price
|
|
702
|
-
* book = exchange.fetch_order_book(outcome.outcome_id)
|
|
703
|
-
* result = exchange.get_execution_price_detailed(book, 'buy', 100)
|
|
704
|
-
* print(f"Price: {result.price}")
|
|
705
|
-
* print(f"Filled: {result.filled_amount}/100")
|
|
706
|
-
* print(f"Fully filled: {result.fully_filled}")
|
|
707
466
|
*/
|
|
708
467
|
getExecutionPriceDetailed(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): ExecutionPriceResult;
|
|
709
468
|
/**
|
|
@@ -713,36 +472,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
713
472
|
* @param markets - Array of markets to filter
|
|
714
473
|
* @param criteria - Filter criteria: string (text search), object (structured), or function (predicate)
|
|
715
474
|
* @returns Filtered array of markets
|
|
716
|
-
*
|
|
717
|
-
* @example-ts Simple text search
|
|
718
|
-
* const filtered = exchange.filterMarkets(markets, 'Trump');
|
|
719
|
-
*
|
|
720
|
-
* @example-ts Advanced criteria
|
|
721
|
-
* const undervalued = exchange.filterMarkets(markets, {
|
|
722
|
-
* text: 'Election',
|
|
723
|
-
* volume24h: { min: 10000 },
|
|
724
|
-
* price: { outcome: 'yes', max: 0.4 }
|
|
725
|
-
* });
|
|
726
|
-
*
|
|
727
|
-
* @example-ts Custom predicate
|
|
728
|
-
* const volatile = exchange.filterMarkets(markets,
|
|
729
|
-
* m => m.yes?.priceChange24h < -0.1
|
|
730
|
-
* );
|
|
731
|
-
*
|
|
732
|
-
* @example-python Simple text search
|
|
733
|
-
* filtered = exchange.filter_markets(markets, 'Trump')
|
|
734
|
-
*
|
|
735
|
-
* @example-python Advanced criteria
|
|
736
|
-
* undervalued = exchange.filter_markets(markets, {
|
|
737
|
-
* 'text': 'Election',
|
|
738
|
-
* 'volume_24h': {'min': 10000},
|
|
739
|
-
* 'price': {'outcome': 'yes', 'max': 0.4}
|
|
740
|
-
* })
|
|
741
|
-
*
|
|
742
|
-
* @example-python Custom predicate
|
|
743
|
-
* volatile = exchange.filter_markets(markets,
|
|
744
|
-
* lambda m: m.yes and m.yes.price_change_24h < -0.1
|
|
745
|
-
* )
|
|
746
475
|
*/
|
|
747
476
|
filterMarkets(markets: UnifiedMarket[], criteria: string | MarketFilterCriteria | MarketFilterFunction): UnifiedMarket[];
|
|
748
477
|
/**
|
|
@@ -752,18 +481,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
752
481
|
* @param events - Array of events to filter
|
|
753
482
|
* @param criteria - Filter criteria: string (text search), object (structured), or function (predicate)
|
|
754
483
|
* @returns Filtered array of events
|
|
755
|
-
*
|
|
756
|
-
* @example-ts Filter by category
|
|
757
|
-
* const filtered = exchange.filterEvents(events, {
|
|
758
|
-
* category: 'Politics',
|
|
759
|
-
* marketCount: { min: 5 }
|
|
760
|
-
* });
|
|
761
|
-
*
|
|
762
|
-
* @example-python Filter by category
|
|
763
|
-
* filtered = exchange.filter_events(events, {
|
|
764
|
-
* 'category': 'Politics',
|
|
765
|
-
* 'market_count': {'min': 5}
|
|
766
|
-
* })
|
|
767
484
|
*/
|
|
768
485
|
filterEvents(events: UnifiedEvent[], criteria: string | EventFilterCriteria | EventFilterFunction): UnifiedEvent[];
|
|
769
486
|
/**
|
|
@@ -773,17 +490,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
773
490
|
* @param id - The Outcome ID to watch
|
|
774
491
|
* @param limit - Optional limit for orderbook depth
|
|
775
492
|
* @returns Promise that resolves with the current orderbook state
|
|
776
|
-
*
|
|
777
|
-
* @example-ts Stream order book
|
|
778
|
-
* while (true) {
|
|
779
|
-
* const book = await exchange.watchOrderBook(outcome.outcomeId);
|
|
780
|
-
* console.log(`Bid: ${book.bids[0]?.price} Ask: ${book.asks[0]?.price}`);
|
|
781
|
-
* }
|
|
782
|
-
*
|
|
783
|
-
* @example-python Stream order book
|
|
784
|
-
* while True:
|
|
785
|
-
* book = exchange.watch_order_book(outcome.outcome_id)
|
|
786
|
-
* print(f"Bid: {book.bids[0].price} Ask: {book.asks[0].price}")
|
|
787
493
|
*/
|
|
788
494
|
watchOrderBook(id: string, limit?: number): Promise<OrderBook>;
|
|
789
495
|
/**
|
|
@@ -795,20 +501,6 @@ export declare abstract class PredictionMarketExchange {
|
|
|
795
501
|
* @param since - Optional timestamp to filter trades from
|
|
796
502
|
* @param limit - Optional limit for number of trades
|
|
797
503
|
* @returns Promise that resolves with recent trades
|
|
798
|
-
*
|
|
799
|
-
* @example-ts Stream trades
|
|
800
|
-
* while (true) {
|
|
801
|
-
* const trades = await exchange.watchTrades(outcome.outcomeId);
|
|
802
|
-
* for (const trade of trades) {
|
|
803
|
-
* console.log(`${trade.side} ${trade.amount} @ ${trade.price}`);
|
|
804
|
-
* }
|
|
805
|
-
* }
|
|
806
|
-
*
|
|
807
|
-
* @example-python Stream trades
|
|
808
|
-
* while True:
|
|
809
|
-
* trades = exchange.watch_trades(outcome.outcome_id)
|
|
810
|
-
* for trade in trades:
|
|
811
|
-
* print(f"{trade.side} {trade.amount} @ {trade.price}")
|
|
812
504
|
*/
|
|
813
505
|
watchTrades(id: string, address?: string, since?: number, limit?: number): Promise<Trade[]>;
|
|
814
506
|
/**
|
|
@@ -819,40 +511,17 @@ export declare abstract class PredictionMarketExchange {
|
|
|
819
511
|
* @param address - Public wallet address to watch
|
|
820
512
|
* @param types - Subset of activity to watch (default: all types)
|
|
821
513
|
* @returns Promise that resolves with the latest SubscribedAddressSnapshot snapshot
|
|
822
|
-
*
|
|
823
|
-
* @example-ts Stream wallet activity
|
|
824
|
-
* while (true) {
|
|
825
|
-
* const activity = await exchange.watchAddress('0xabc...', ['trades', 'positions']);
|
|
826
|
-
* console.log(activity.trades, activity.positions);
|
|
827
|
-
* }
|
|
828
|
-
*
|
|
829
|
-
* @example-python Stream wallet activity
|
|
830
|
-
* while True:
|
|
831
|
-
* activity = exchange.watch_address('0xabc...', ['trades', 'positions'])
|
|
832
|
-
* print(activity.trades, activity.positions)
|
|
833
514
|
*/
|
|
834
515
|
watchAddress(address: string, types?: SubscriptionOption[]): Promise<SubscribedAddressSnapshot>;
|
|
835
516
|
/**
|
|
836
517
|
* Stop watching a previously registered wallet address and release its resource updates.
|
|
837
518
|
*
|
|
838
519
|
* @param address - Public wallet address to stop watching
|
|
839
|
-
*
|
|
840
|
-
* @example-ts Stop watching
|
|
841
|
-
* await exchange.unwatchAddress('0xabc...');
|
|
842
|
-
*
|
|
843
|
-
* @example-python Stop watching
|
|
844
|
-
* exchange.unwatch_address('0xabc...')
|
|
845
520
|
*/
|
|
846
521
|
unwatchAddress(address: string): Promise<void>;
|
|
847
522
|
/**
|
|
848
523
|
* Close all WebSocket connections and clean up resources.
|
|
849
524
|
* Call this when you're done streaming to properly release connections.
|
|
850
|
-
*
|
|
851
|
-
* @example-ts Close connections
|
|
852
|
-
* await exchange.close();
|
|
853
|
-
*
|
|
854
|
-
* @example-python Close connections
|
|
855
|
-
* exchange.close()
|
|
856
525
|
*/
|
|
857
526
|
close(): Promise<void>;
|
|
858
527
|
/**
|