pmxt 1.6.0__py3-none-any.whl → 1.7.0__py3-none-any.whl

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.
pmxt/__init__.py CHANGED
@@ -49,7 +49,7 @@ def restart_server():
49
49
  """
50
50
  _default_manager.restart()
51
51
 
52
- __version__ = "1.6.0"
52
+ __version__ = "1.7.0"
53
53
  __all__ = [
54
54
  # Exchanges
55
55
  "Polymarket",
@@ -24419,13 +24419,118 @@ var require_BaseExchange = __commonJS({
24419
24419
  this.credentials = credentials;
24420
24420
  }
24421
24421
  /**
24422
+ * Fetch markets with optional filtering, search, or slug lookup.
24423
+ * This is the primary method for retrieving markets in CCXT-style.
24424
+ *
24425
+ * @param params - Optional parameters for filtering and search
24426
+ * @param params.query - Search keyword to filter markets
24427
+ * @param params.slug - Market slug/ticker for direct lookup
24428
+ * @param params.limit - Maximum number of results
24429
+ * @param params.offset - Pagination offset
24430
+ * @param params.sort - Sort order
24431
+ * @param params.searchIn - Where to search (title, description, or both)
24432
+ * @returns Array of unified markets
24433
+ *
24434
+ * @example Fetch all markets
24435
+ * await exchange.fetchMarkets()
24436
+ *
24437
+ * @example Search markets
24438
+ * await exchange.fetchMarkets({ query: 'Trump' })
24439
+ *
24440
+ * @example Get market by slug
24441
+ * await exchange.fetchMarkets({ slug: 'will-trump-win' })
24442
+ */
24443
+ async fetchMarkets(params) {
24444
+ if (params?.slug) {
24445
+ return this.fetchMarketsBySlugImpl(params.slug);
24446
+ }
24447
+ if (params?.query) {
24448
+ return this.searchMarketsImpl(params.query, params);
24449
+ }
24450
+ return this.fetchMarketsImpl(params);
24451
+ }
24452
+ /**
24453
+ * Fetch events with optional keyword search.
24454
+ * Events group related markets together.
24455
+ *
24456
+ * @param params - Optional parameters for search and filtering
24457
+ * @param params.query - Search keyword to filter events
24458
+ * @param params.limit - Maximum number of results
24459
+ * @param params.offset - Pagination offset
24460
+ * @param params.searchIn - Where to search (title, description, or both)
24461
+ * @returns Array of unified events
24462
+ *
24463
+ * @example Search events
24464
+ * await exchange.fetchEvents({ query: 'Election' })
24465
+ */
24466
+ async fetchEvents(params) {
24467
+ if (params?.query) {
24468
+ return this.searchEventsImpl(params.query, params);
24469
+ }
24470
+ throw new Error("fetchEvents() requires a query parameter");
24471
+ }
24472
+ // ----------------------------------------------------------------------------
24473
+ // Implementation methods (to be overridden by exchanges)
24474
+ // ----------------------------------------------------------------------------
24475
+ /**
24476
+ * @internal
24477
+ * Implementation for fetching all markets.
24478
+ */
24479
+ async fetchMarketsImpl(params) {
24480
+ throw new Error("Method fetchMarketsImpl not implemented.");
24481
+ }
24482
+ /**
24483
+ * @internal
24484
+ * Implementation for searching markets by keyword.
24485
+ */
24486
+ async searchMarketsImpl(query, params) {
24487
+ throw new Error("Method searchMarketsImpl not implemented.");
24488
+ }
24489
+ /**
24490
+ * @internal
24491
+ * Implementation for fetching markets by slug/ticker.
24492
+ */
24493
+ async fetchMarketsBySlugImpl(slug) {
24494
+ throw new Error("Method fetchMarketsBySlugImpl not implemented.");
24495
+ }
24496
+ /**
24497
+ * @internal
24498
+ * Implementation for searching events by keyword.
24499
+ */
24500
+ async searchEventsImpl(query, params) {
24501
+ throw new Error("Method searchEventsImpl not implemented.");
24502
+ }
24503
+ // ----------------------------------------------------------------------------
24504
+ // Deprecated methods (kept for backward compatibility)
24505
+ // ----------------------------------------------------------------------------
24506
+ /**
24507
+ * @deprecated Use fetchMarkets({ query: '...' }) instead. Will be removed in v2.0
24508
+ * Search for markets matching a keyword query.
24509
+ * By default, searches only in market titles. Use params.searchIn to search descriptions or both.
24510
+ */
24511
+ async searchMarkets(query, params) {
24512
+ console.warn('\u26A0\uFE0F searchMarkets() is deprecated. Use fetchMarkets({ query: "..." }) instead.');
24513
+ return this.fetchMarkets({ ...params, query });
24514
+ }
24515
+ /**
24516
+ * @deprecated Use fetchMarkets({ slug: '...' }) instead. Will be removed in v2.0
24517
+ * Fetch markets by URL slug (Polymarket) or ticker (Kalshi).
24518
+ * @param slug - Market slug or ticker
24519
+ */
24520
+ async getMarketsBySlug(slug) {
24521
+ console.warn('\u26A0\uFE0F getMarketsBySlug() is deprecated. Use fetchMarkets({ slug: "..." }) instead.');
24522
+ return this.fetchMarkets({ slug });
24523
+ }
24524
+ /**
24525
+ * @deprecated Use fetchEvents({ query: '...' }) instead. Will be removed in v2.0
24422
24526
  * Search for events matching a keyword query.
24423
24527
  * Returns grouped events, each containing related markets.
24424
24528
  * @param query - Search term
24425
24529
  * @param params - Optional filter parameters
24426
24530
  */
24427
24531
  async searchEvents(query, params) {
24428
- throw new Error("Method searchEvents not implemented.");
24532
+ console.warn('\u26A0\uFE0F searchEvents() is deprecated. Use fetchEvents({ query: "..." }) instead.');
24533
+ return this.fetchEvents({ ...params, query });
24429
24534
  }
24430
24535
  /**
24431
24536
  * Fetch historical price data for a specific market outcome.
@@ -105150,18 +105255,21 @@ var require_polymarket = __commonJS({
105150
105255
  get name() {
105151
105256
  return "Polymarket";
105152
105257
  }
105153
- async fetchMarkets(params) {
105258
+ // ----------------------------------------------------------------------------
105259
+ // Implementation methods for CCXT-style API
105260
+ // ----------------------------------------------------------------------------
105261
+ async fetchMarketsImpl(params) {
105154
105262
  return (0, fetchMarkets_1.fetchMarkets)(params);
105155
105263
  }
105156
- async searchMarkets(query, params) {
105264
+ async searchMarketsImpl(query, params) {
105157
105265
  return (0, searchMarkets_1.searchMarkets)(query, params);
105158
105266
  }
105159
- async searchEvents(query, params) {
105160
- return (0, searchEvents_1.searchEvents)(query, params);
105161
- }
105162
- async getMarketsBySlug(slug) {
105267
+ async fetchMarketsBySlugImpl(slug) {
105163
105268
  return (0, getMarketsBySlug_1.getMarketsBySlug)(slug);
105164
105269
  }
105270
+ async searchEventsImpl(query, params) {
105271
+ return (0, searchEvents_1.searchEvents)(query, params);
105272
+ }
105165
105273
  async fetchOHLCV(id, params) {
105166
105274
  return (0, fetchOHLCV_1.fetchOHLCV)(id, params);
105167
105275
  }
@@ -106135,18 +106243,21 @@ var require_limitless = __commonJS({
106135
106243
  get name() {
106136
106244
  return "Limitless";
106137
106245
  }
106138
- async fetchMarkets(params) {
106246
+ // ----------------------------------------------------------------------------
106247
+ // Implementation methods for CCXT-style API
106248
+ // ----------------------------------------------------------------------------
106249
+ async fetchMarketsImpl(params) {
106139
106250
  return (0, fetchMarkets_1.fetchMarkets)(params);
106140
106251
  }
106141
- async searchMarkets(query, params) {
106252
+ async searchMarketsImpl(query, params) {
106142
106253
  return (0, searchMarkets_1.searchMarkets)(query, params);
106143
106254
  }
106144
- async searchEvents(query, params) {
106145
- return (0, searchEvents_1.searchEvents)(query, params);
106146
- }
106147
- async getMarketsBySlug(slug) {
106255
+ async fetchMarketsBySlugImpl(slug) {
106148
106256
  return (0, getMarketsBySlug_1.getMarketsBySlug)(slug);
106149
106257
  }
106258
+ async searchEventsImpl(query, params) {
106259
+ return (0, searchEvents_1.searchEvents)(query, params);
106260
+ }
106150
106261
  async fetchOHLCV(id, params) {
106151
106262
  return (0, fetchOHLCV_1.fetchOHLCV)(id, params);
106152
106263
  }
@@ -107347,20 +107458,20 @@ var require_kalshi = __commonJS({
107347
107458
  return this.auth;
107348
107459
  }
107349
107460
  // ----------------------------------------------------------------------------
107350
- // Market Data Methods
107461
+ // Market Data Methods - Implementation for CCXT-style API
107351
107462
  // ----------------------------------------------------------------------------
107352
- async fetchMarkets(params) {
107463
+ async fetchMarketsImpl(params) {
107353
107464
  return (0, fetchMarkets_1.fetchMarkets)(params);
107354
107465
  }
107355
- async searchMarkets(query, params) {
107466
+ async searchMarketsImpl(query, params) {
107356
107467
  return (0, searchMarkets_1.searchMarkets)(query, params);
107357
107468
  }
107358
- async searchEvents(query, params) {
107359
- return (0, searchEvents_1.searchEvents)(query, params);
107360
- }
107361
- async getMarketsBySlug(slug) {
107469
+ async fetchMarketsBySlugImpl(slug) {
107362
107470
  return (0, getMarketsBySlug_1.getMarketsBySlug)(slug);
107363
107471
  }
107472
+ async searchEventsImpl(query, params) {
107473
+ return (0, searchEvents_1.searchEvents)(query, params);
107474
+ }
107364
107475
  async fetchOHLCV(id, params) {
107365
107476
  return (0, fetchOHLCV_1.fetchOHLCV)(id, params);
107366
107477
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pmxt
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Unified prediction market data API - The ccxt for prediction markets
5
5
  Author: PMXT Contributors
6
6
  License: MIT
@@ -69,14 +69,14 @@ print(markets[0].title)
69
69
  outcome = markets[0].outcomes[0]
70
70
  print(f"{outcome.label}: {outcome.price * 100:.1f}%")
71
71
 
72
- # Fetch historical data (use outcome.id!)
72
+ # Fetch historical data (use outcome.outcome_id!)
73
73
  candles = poly.fetch_ohlcv(
74
- outcome.id,
74
+ outcome.outcome_id,
75
75
  pmxt.HistoryFilterParams(resolution="1d", limit=30)
76
76
  )
77
77
 
78
78
  # Get current order book
79
- order_book = poly.fetch_order_book(outcome.id)
79
+ order_book = poly.fetch_order_book(outcome.outcome_id)
80
80
  spread = order_book.asks[0].price - order_book.bids[0].price
81
81
  print(f"Spread: {spread * 100:.2f}%")
82
82
  ```
@@ -182,7 +182,7 @@ All methods return clean Python dataclasses:
182
182
  ```python
183
183
  @dataclass
184
184
  class UnifiedMarket:
185
- id: str
185
+ market_id: str # Use this for create_order
186
186
  title: str
187
187
  outcomes: List[MarketOutcome]
188
188
  volume_24h: float
@@ -192,7 +192,7 @@ class UnifiedMarket:
192
192
 
193
193
  @dataclass
194
194
  class MarketOutcome:
195
- id: str # Use this for fetch_ohlcv/fetch_order_book
195
+ outcome_id: str # Use this for fetch_ohlcv/fetch_order_book/fetch_trades
196
196
  label: str # "Trump", "Yes", etc.
197
197
  price: float # 0.0 to 1.0 (probability)
198
198
  # ... more fields
@@ -202,16 +202,16 @@ See the [full API reference](../../API_REFERENCE.md) for complete documentation.
202
202
 
203
203
  ## Important Notes
204
204
 
205
- ### Use `outcome.id`, not `market.id`
205
+ ### Use `outcome.outcome_id`, not `market.market_id`
206
206
 
207
207
  For deep-dive methods like `fetch_ohlcv()`, `fetch_order_book()`, and `fetch_trades()`, you must use the **outcome ID**, not the market ID:
208
208
 
209
209
  ```python
210
210
  markets = poly.search_markets("Trump")
211
- outcome_id = markets[0].outcomes[0].id # Correct
211
+ outcome_id = markets[0].outcomes[0].outcome_id # Correct
212
212
 
213
213
  candles = poly.fetch_ohlcv(outcome_id, ...) # Works
214
- candles = poly.fetch_ohlcv(markets[0].id, ...) # Wrong!
214
+ candles = poly.fetch_ohlcv(markets[0].market_id, ...) # Wrong!
215
215
  ```
216
216
 
217
217
  ### Prices are 0.0 to 1.0
@@ -1,15 +1,15 @@
1
- pmxt/__init__.py,sha256=kbtmNd7bfDO-SNmmsJ0D11RuTWmX1gYBrJiVyTTRdgo,1520
1
+ pmxt/__init__.py,sha256=mALOMPFV9BEkIwUqZ4_SAytlq9Lh3WVjSuAlTzLFFaY,1520
2
2
  pmxt/client.py,sha256=lpDT0zDw1OXal_hbjcV69DidlgyyzKMmPMqvm4waNGg,43488
3
3
  pmxt/models.py,sha256=LYfbd_SEtvqI9gYnVz6wAqlijJkSODrodE7v0owbyok,10291
4
4
  pmxt/server_manager.py,sha256=kkbvQOgCBBDUbe0X4KGLZsWpuHxz3Yvb9ECDhjQxMOE,12050
5
5
  pmxt/_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  pmxt/_server/bin/pmxt-ensure-server,sha256=kXIond0UbxS52FAVQD7kHmSBaL_s6cbIyapLRr4KZJw,4544
7
7
  pmxt/_server/bin/pmxt-ensure-server.js,sha256=kXIond0UbxS52FAVQD7kHmSBaL_s6cbIyapLRr4KZJw,4544
8
- pmxt/_server/server/bundled.js,sha256=ZfMpYAXX5UZECbkYlvCB5mGPvhorSrkw-h4m0ZeRdEk,4251928
9
- pmxt_internal/__init__.py,sha256=CEpTnAT2C0rjNGAaRZbClTn4UvDWuHTe3AeC5n7AuBE,7756
10
- pmxt_internal/api_client.py,sha256=nNG9x5sU703c-iI5McO1R21TNLikw9sHxn5osmiSmkk,27889
8
+ pmxt/_server/server/bundled.js,sha256=PoH6oBCeXSAFINx7AAPeVY89xbAoxjlWt3WWwbrZaLI,4256943
9
+ pmxt_internal/__init__.py,sha256=kB1112bowIVIz803gTxnoVVXdPoBOkZ7Hr3uUb4JTss,7756
10
+ pmxt_internal/api_client.py,sha256=Z4IcjvppvcZGKSah_BCFI8WZIyUX_rP05XLtSNIYklI,27889
11
11
  pmxt_internal/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
12
- pmxt_internal/configuration.py,sha256=QzLqWzVIo7r9XwfJKlfaHgWg7cbgNmERylbCO6Ja4b8,18320
12
+ pmxt_internal/configuration.py,sha256=UxpBcHmAuuTBdl-1wAY8GVGyebJursuyndZjrFeCQk4,18320
13
13
  pmxt_internal/exceptions.py,sha256=txF8A7vlan57JS69kFPs-IZF-Qhp7IZobBTJVa4fOaM,6644
14
14
  pmxt_internal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  pmxt_internal/rest.py,sha256=FMj4yaV6XLr842u_ScWHSzQsTFdk0jaUeuWLJoRbogQ,9760
@@ -66,7 +66,7 @@ pmxt_internal/models/unified_market.py,sha256=0y917aPCUNtlToDhfJWwVh3lGT-1VRFh_p
66
66
  pmxt_internal/models/watch_order_book_request.py,sha256=kavGUI-SLz2-Kam_jcJ_h0GDe0-9UkxqCmVsAi6Uios,3726
67
67
  pmxt_internal/models/watch_order_book_request_args_inner.py,sha256=ZHrjmFDGxRG5MXbuz4mUp9KFfo3XS7zuXWTyMNgi4xI,5464
68
68
  pmxt_internal/models/watch_trades_request.py,sha256=brrg8JbEe-aeg7mIe_Y2HzRPogp-IfRhkXChrxzqoLU,3722
69
- pmxt-1.6.0.dist-info/METADATA,sha256=aglrK1EbEVfA2fdanlMDKDCmRdHd8ONF8mcUOuvf9h8,6449
70
- pmxt-1.6.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
71
- pmxt-1.6.0.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
72
- pmxt-1.6.0.dist-info/RECORD,,
69
+ pmxt-1.7.0.dist-info/METADATA,sha256=Q3N8stoYU3EiOESPB60W8cfG2D3TsRg0FKYLE1p6P38,6557
70
+ pmxt-1.7.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
71
+ pmxt-1.7.0.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
72
+ pmxt-1.7.0.dist-info/RECORD,,
pmxt_internal/__init__.py CHANGED
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "1.6.0"
17
+ __version__ = "1.7.0"
18
18
 
19
19
  # Define package exports
20
20
  __all__ = [
@@ -91,7 +91,7 @@ class ApiClient:
91
91
  self.default_headers[header_name] = header_value
92
92
  self.cookie = cookie
93
93
  # Set default User-Agent.
94
- self.user_agent = 'OpenAPI-Generator/1.6.0/python'
94
+ self.user_agent = 'OpenAPI-Generator/1.7.0/python'
95
95
  self.client_side_validation = configuration.client_side_validation
96
96
 
97
97
  def __enter__(self):
@@ -506,7 +506,7 @@ class Configuration:
506
506
  "OS: {env}\n"\
507
507
  "Python Version: {pyversion}\n"\
508
508
  "Version of the API: 0.4.4\n"\
509
- "SDK Package Version: 1.6.0".\
509
+ "SDK Package Version: 1.7.0".\
510
510
  format(env=sys.platform, pyversion=sys.version)
511
511
 
512
512
  def get_host_settings(self) -> List[HostSetting]:
File without changes