pmxt 1.2.0__py3-none-any.whl → 1.3.2__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
@@ -33,7 +33,7 @@ from .models import (
33
33
  CreateOrderParams,
34
34
  )
35
35
 
36
- __version__ = "1.2.0"
36
+ __version__ = "1.3.2"
37
37
  __all__ = [
38
38
  # Exchanges
39
39
  "Polymarket",
@@ -24369,6 +24369,15 @@ var require_BaseExchange = __commonJS({
24369
24369
  constructor(credentials) {
24370
24370
  this.credentials = credentials;
24371
24371
  }
24372
+ /**
24373
+ * Search for events matching a keyword query.
24374
+ * Returns grouped events, each containing related markets.
24375
+ * @param query - Search term
24376
+ * @param params - Optional filter parameters
24377
+ */
24378
+ async searchEvents(query, params) {
24379
+ throw new Error("Method searchEvents not implemented.");
24380
+ }
24372
24381
  /**
24373
24382
  * Fetch historical price data for a specific market outcome.
24374
24383
  * @param id - The Outcome ID (MarketOutcome.id). This should be the ID of the specific tradeable asset.
@@ -38020,6 +38029,44 @@ var require_axios = __commonJS({
38020
38029
  }
38021
38030
  });
38022
38031
 
38032
+ // dist/utils/market-utils.js
38033
+ var require_market_utils = __commonJS({
38034
+ "dist/utils/market-utils.js"(exports2) {
38035
+ "use strict";
38036
+ Object.defineProperty(exports2, "__esModule", { value: true });
38037
+ exports2.addBinaryOutcomes = addBinaryOutcomes;
38038
+ function addBinaryOutcomes(market) {
38039
+ const outcomes = market.outcomes;
38040
+ if (outcomes.length !== 2)
38041
+ return;
38042
+ const o1 = outcomes[0];
38043
+ const o2 = outcomes[1];
38044
+ const l1 = o1.label.toLowerCase();
38045
+ const l2 = o2.label.toLowerCase();
38046
+ const isYes = (l) => l === "yes" || l === "up" || l === "over";
38047
+ const isNo = (l) => l === "no" || l === "down" || l === "under";
38048
+ if (isYes(l1) || isNo(l2)) {
38049
+ market.yes = o1;
38050
+ market.no = o2;
38051
+ } else if (isYes(l2) || isNo(l1)) {
38052
+ market.yes = o2;
38053
+ market.no = o1;
38054
+ } else if (l2.startsWith("not ")) {
38055
+ market.yes = o1;
38056
+ market.no = o2;
38057
+ } else if (l1.startsWith("not ")) {
38058
+ market.yes = o2;
38059
+ market.no = o1;
38060
+ } else {
38061
+ market.yes = o1;
38062
+ market.no = o2;
38063
+ }
38064
+ market.up = market.yes;
38065
+ market.down = market.no;
38066
+ }
38067
+ }
38068
+ });
38069
+
38023
38070
  // dist/exchanges/polymarket/utils.js
38024
38071
  var require_utils4 = __commonJS({
38025
38072
  "dist/exchanges/polymarket/utils.js"(exports2) {
@@ -38028,6 +38075,7 @@ var require_utils4 = __commonJS({
38028
38075
  exports2.CLOB_API_URL = exports2.GAMMA_API_URL = void 0;
38029
38076
  exports2.mapMarketToUnified = mapMarketToUnified;
38030
38077
  exports2.mapIntervalToFidelity = mapIntervalToFidelity;
38078
+ var market_utils_1 = require_market_utils();
38031
38079
  exports2.GAMMA_API_URL = "https://gamma-api.polymarket.com/events";
38032
38080
  exports2.CLOB_API_URL = "https://clob.polymarket.com";
38033
38081
  function mapMarketToUnified(event, market, options = {}) {
@@ -38079,7 +38127,7 @@ var require_utils4 = __commonJS({
38079
38127
  });
38080
38128
  });
38081
38129
  }
38082
- return {
38130
+ const um = {
38083
38131
  id: market.id,
38084
38132
  title: market.question ? `${event.title} - ${market.question}` : event.title,
38085
38133
  description: market.description || event.description,
@@ -38094,6 +38142,8 @@ var require_utils4 = __commonJS({
38094
38142
  category: event.category || event.tags?.[0]?.label,
38095
38143
  tags: event.tags?.map((t) => t.label) || []
38096
38144
  };
38145
+ (0, market_utils_1.addBinaryOutcomes)(um);
38146
+ return um;
38097
38147
  }
38098
38148
  function mapIntervalToFidelity(interval) {
38099
38149
  const mapping = {
@@ -38206,6 +38256,76 @@ var require_searchMarkets = __commonJS({
38206
38256
  }
38207
38257
  });
38208
38258
 
38259
+ // dist/exchanges/polymarket/searchEvents.js
38260
+ var require_searchEvents = __commonJS({
38261
+ "dist/exchanges/polymarket/searchEvents.js"(exports2) {
38262
+ "use strict";
38263
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
38264
+ return mod && mod.__esModule ? mod : { "default": mod };
38265
+ };
38266
+ Object.defineProperty(exports2, "__esModule", { value: true });
38267
+ exports2.searchEvents = searchEvents;
38268
+ var axios_1 = __importDefault(require_axios());
38269
+ var utils_1 = require_utils4();
38270
+ async function searchEvents(query, params) {
38271
+ const searchLimit = 1e5;
38272
+ try {
38273
+ const response = await axios_1.default.get(utils_1.GAMMA_API_URL, {
38274
+ params: {
38275
+ active: "true",
38276
+ closed: "false",
38277
+ limit: searchLimit
38278
+ }
38279
+ });
38280
+ const events = response.data || [];
38281
+ const lowerQuery = query.toLowerCase();
38282
+ const searchIn = params?.searchIn || "title";
38283
+ const filtered = events.filter((event) => {
38284
+ const titleMatch = (event.title || "").toLowerCase().includes(lowerQuery);
38285
+ const descMatch = (event.description || "").toLowerCase().includes(lowerQuery);
38286
+ if (searchIn === "title")
38287
+ return titleMatch;
38288
+ if (searchIn === "description")
38289
+ return descMatch;
38290
+ return titleMatch || descMatch;
38291
+ });
38292
+ const unifiedEvents = filtered.map((event) => {
38293
+ const markets = [];
38294
+ if (event.markets) {
38295
+ for (const market of event.markets) {
38296
+ const unifiedMarket = (0, utils_1.mapMarketToUnified)(event, market, { useQuestionAsCandidateFallback: true });
38297
+ if (unifiedMarket) {
38298
+ markets.push(unifiedMarket);
38299
+ }
38300
+ }
38301
+ }
38302
+ const unifiedEvent = {
38303
+ id: event.id || event.slug,
38304
+ title: event.title,
38305
+ description: event.description || "",
38306
+ slug: event.slug,
38307
+ markets,
38308
+ url: `https://polymarket.com/event/${event.slug}`,
38309
+ image: event.image || `https://polymarket.com/api/og?slug=${event.slug}`,
38310
+ category: event.category || event.tags?.[0]?.label,
38311
+ tags: event.tags?.map((t) => t.label) || [],
38312
+ searchMarkets: function(marketQuery) {
38313
+ const lowerMarketQuery = marketQuery.toLowerCase();
38314
+ return this.markets.filter((m) => m.title.toLowerCase().includes(lowerMarketQuery) || m.description.toLowerCase().includes(lowerMarketQuery) || m.outcomes.some((o) => o.label.toLowerCase().includes(lowerMarketQuery)));
38315
+ }
38316
+ };
38317
+ return unifiedEvent;
38318
+ });
38319
+ const limit = params?.limit || 20;
38320
+ return unifiedEvents.slice(0, limit);
38321
+ } catch (error) {
38322
+ console.error("Error searching Polymarket events:", error);
38323
+ return [];
38324
+ }
38325
+ }
38326
+ }
38327
+ });
38328
+
38209
38329
  // dist/exchanges/polymarket/getMarketsBySlug.js
38210
38330
  var require_getMarketsBySlug = __commonJS({
38211
38331
  "dist/exchanges/polymarket/getMarketsBySlug.js"(exports2) {
@@ -38263,9 +38383,20 @@ var require_fetchOHLCV = __commonJS({
38263
38383
  try {
38264
38384
  const fidelity = (0, utils_1.mapIntervalToFidelity)(params.resolution);
38265
38385
  const nowTs = Math.floor(Date.now() / 1e3);
38266
- let startTs = params.start ? Math.floor(params.start.getTime() / 1e3) : 0;
38267
- let endTs = params.end ? Math.floor(params.end.getTime() / 1e3) : nowTs;
38268
- if (!params.start) {
38386
+ const ensureDate = (d) => {
38387
+ if (typeof d === "string") {
38388
+ if (!d.endsWith("Z") && !d.match(/[+-]\d{2}:\d{2}$/)) {
38389
+ return /* @__PURE__ */ new Date(d + "Z");
38390
+ }
38391
+ return new Date(d);
38392
+ }
38393
+ return d;
38394
+ };
38395
+ const pStart = params.start ? ensureDate(params.start) : void 0;
38396
+ const pEnd = params.end ? ensureDate(params.end) : void 0;
38397
+ let startTs = pStart ? Math.floor(pStart.getTime() / 1e3) : 0;
38398
+ let endTs = pEnd ? Math.floor(pEnd.getTime() / 1e3) : nowTs;
38399
+ if (!pStart) {
38269
38400
  const count = params.limit || 100;
38270
38401
  const durationSeconds = count * fidelity * 60;
38271
38402
  startTs = endTs - durationSeconds;
@@ -38281,19 +38412,30 @@ var require_fetchOHLCV = __commonJS({
38281
38412
  });
38282
38413
  const history = response.data.history || [];
38283
38414
  const resolutionMs = fidelity * 60 * 1e3;
38284
- const candles = history.map((item) => {
38415
+ const buckets = /* @__PURE__ */ new Map();
38416
+ history.forEach((item) => {
38285
38417
  const rawMs = item.t * 1e3;
38286
38418
  const snappedMs = Math.floor(rawMs / resolutionMs) * resolutionMs;
38287
- return {
38288
- timestamp: snappedMs,
38289
- // Aligned timestamp
38290
- open: item.p,
38291
- high: item.p,
38292
- low: item.p,
38293
- close: item.p,
38294
- volume: void 0
38295
- };
38419
+ const price = Number(item.p);
38420
+ const volume = Number(item.s || item.v || 0);
38421
+ if (!buckets.has(snappedMs)) {
38422
+ buckets.set(snappedMs, {
38423
+ timestamp: snappedMs,
38424
+ open: price,
38425
+ high: price,
38426
+ low: price,
38427
+ close: price,
38428
+ volume
38429
+ });
38430
+ } else {
38431
+ const candle = buckets.get(snappedMs);
38432
+ candle.high = Math.max(candle.high, price);
38433
+ candle.low = Math.min(candle.low, price);
38434
+ candle.close = price;
38435
+ candle.volume = (candle.volume || 0) + volume;
38436
+ }
38296
38437
  });
38438
+ const candles = Array.from(buckets.values()).sort((a, b) => a.timestamp - b.timestamp);
38297
38439
  if (params.limit && candles.length > params.limit) {
38298
38440
  return candles.slice(-params.limit);
38299
38441
  }
@@ -104573,6 +104715,7 @@ var require_polymarket = __commonJS({
104573
104715
  var BaseExchange_1 = require_BaseExchange();
104574
104716
  var fetchMarkets_1 = require_fetchMarkets();
104575
104717
  var searchMarkets_1 = require_searchMarkets();
104718
+ var searchEvents_1 = require_searchEvents();
104576
104719
  var getMarketsBySlug_1 = require_getMarketsBySlug();
104577
104720
  var fetchOHLCV_1 = require_fetchOHLCV();
104578
104721
  var fetchOrderBook_1 = require_fetchOrderBook();
@@ -104606,6 +104749,9 @@ var require_polymarket = __commonJS({
104606
104749
  async searchMarkets(query, params) {
104607
104750
  return (0, searchMarkets_1.searchMarkets)(query, params);
104608
104751
  }
104752
+ async searchEvents(query, params) {
104753
+ return (0, searchEvents_1.searchEvents)(query, params);
104754
+ }
104609
104755
  async getMarketsBySlug(slug) {
104610
104756
  return (0, getMarketsBySlug_1.getMarketsBySlug)(slug);
104611
104757
  }
@@ -104805,6 +104951,7 @@ var require_utils10 = __commonJS({
104805
104951
  exports2.KALSHI_SERIES_URL = exports2.KALSHI_API_URL = void 0;
104806
104952
  exports2.mapMarketToUnified = mapMarketToUnified;
104807
104953
  exports2.mapIntervalToKalshi = mapIntervalToKalshi;
104954
+ var market_utils_1 = require_market_utils();
104808
104955
  exports2.KALSHI_API_URL = "https://api.elections.kalshi.com/trade-api/v2/events";
104809
104956
  exports2.KALSHI_SERIES_URL = "https://api.elections.kalshi.com/trade-api/v2/series";
104810
104957
  function mapMarketToUnified(event, market) {
@@ -104854,7 +105001,7 @@ var require_utils10 = __commonJS({
104854
105001
  }
104855
105002
  }
104856
105003
  }
104857
- return {
105004
+ const um = {
104858
105005
  id: market.ticker,
104859
105006
  title: event.title,
104860
105007
  description: market.rules_primary || market.rules_secondary || "",
@@ -104869,6 +105016,8 @@ var require_utils10 = __commonJS({
104869
105016
  category: event.category,
104870
105017
  tags: unifiedTags
104871
105018
  };
105019
+ (0, market_utils_1.addBinaryOutcomes)(um);
105020
+ return um;
104872
105021
  }
104873
105022
  function mapIntervalToKalshi(interval) {
104874
105023
  const mapping = {
@@ -105046,6 +105195,68 @@ var require_searchMarkets2 = __commonJS({
105046
105195
  }
105047
105196
  });
105048
105197
 
105198
+ // dist/exchanges/kalshi/searchEvents.js
105199
+ var require_searchEvents2 = __commonJS({
105200
+ "dist/exchanges/kalshi/searchEvents.js"(exports2) {
105201
+ "use strict";
105202
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
105203
+ return mod && mod.__esModule ? mod : { "default": mod };
105204
+ };
105205
+ Object.defineProperty(exports2, "__esModule", { value: true });
105206
+ exports2.searchEvents = searchEvents;
105207
+ var axios_1 = __importDefault(require_axios());
105208
+ var utils_1 = require_utils10();
105209
+ async function searchEvents(query, params) {
105210
+ try {
105211
+ const queryParams = {
105212
+ limit: 200,
105213
+ // Reasonable batch for search
105214
+ with_nested_markets: true,
105215
+ status: "open"
105216
+ };
105217
+ const response = await axios_1.default.get(utils_1.KALSHI_API_URL, { params: queryParams });
105218
+ const events = response.data.events || [];
105219
+ const lowerQuery = query.toLowerCase();
105220
+ const filtered = events.filter((event) => {
105221
+ return (event.title || "").toLowerCase().includes(lowerQuery);
105222
+ });
105223
+ const unifiedEvents = filtered.map((event) => {
105224
+ const markets = [];
105225
+ if (event.markets) {
105226
+ for (const market of event.markets) {
105227
+ const unifiedMarket = (0, utils_1.mapMarketToUnified)(event, market);
105228
+ if (unifiedMarket) {
105229
+ markets.push(unifiedMarket);
105230
+ }
105231
+ }
105232
+ }
105233
+ const unifiedEvent = {
105234
+ id: event.event_ticker,
105235
+ title: event.title,
105236
+ description: event.mututals_description || "",
105237
+ slug: event.event_ticker,
105238
+ markets,
105239
+ url: `https://kalshi.com/events/${event.event_ticker}`,
105240
+ image: event.image_url,
105241
+ category: event.category,
105242
+ tags: event.tags || [],
105243
+ searchMarkets: function(marketQuery) {
105244
+ const lowerMarketQuery = marketQuery.toLowerCase();
105245
+ return this.markets.filter((m) => m.title.toLowerCase().includes(lowerMarketQuery) || m.outcomes.some((o) => o.label.toLowerCase().includes(lowerMarketQuery)));
105246
+ }
105247
+ };
105248
+ return unifiedEvent;
105249
+ });
105250
+ const limit = params?.limit || 20;
105251
+ return unifiedEvents.slice(0, limit);
105252
+ } catch (error) {
105253
+ console.error("Error searching Kalshi events:", error);
105254
+ return [];
105255
+ }
105256
+ }
105257
+ }
105258
+ });
105259
+
105049
105260
  // dist/exchanges/kalshi/getMarketsBySlug.js
105050
105261
  var require_getMarketsBySlug2 = __commonJS({
105051
105262
  "dist/exchanges/kalshi/getMarketsBySlug.js"(exports2) {
@@ -105130,12 +105341,23 @@ var require_fetchOHLCV2 = __commonJS({
105130
105341
  const now = Math.floor(Date.now() / 1e3);
105131
105342
  let startTs = now - 24 * 60 * 60;
105132
105343
  let endTs = now;
105133
- if (params.start) {
105134
- startTs = Math.floor(params.start.getTime() / 1e3);
105344
+ const ensureDate = (d) => {
105345
+ if (typeof d === "string") {
105346
+ if (!d.endsWith("Z") && !d.match(/[+-]\d{2}:\d{2}$/)) {
105347
+ return /* @__PURE__ */ new Date(d + "Z");
105348
+ }
105349
+ return new Date(d);
105350
+ }
105351
+ return d;
105352
+ };
105353
+ const pStart = params.start ? ensureDate(params.start) : void 0;
105354
+ const pEnd = params.end ? ensureDate(params.end) : void 0;
105355
+ if (pStart) {
105356
+ startTs = Math.floor(pStart.getTime() / 1e3);
105135
105357
  }
105136
- if (params.end) {
105137
- endTs = Math.floor(params.end.getTime() / 1e3);
105138
- if (!params.start) {
105358
+ if (pEnd) {
105359
+ endTs = Math.floor(pEnd.getTime() / 1e3);
105360
+ if (!pStart) {
105139
105361
  startTs = endTs - 24 * 60 * 60;
105140
105362
  }
105141
105363
  }
@@ -105664,6 +105886,7 @@ var require_kalshi = __commonJS({
105664
105886
  var BaseExchange_1 = require_BaseExchange();
105665
105887
  var fetchMarkets_1 = require_fetchMarkets2();
105666
105888
  var searchMarkets_1 = require_searchMarkets2();
105889
+ var searchEvents_1 = require_searchEvents2();
105667
105890
  var getMarketsBySlug_1 = require_getMarketsBySlug2();
105668
105891
  var fetchOHLCV_1 = require_fetchOHLCV2();
105669
105892
  var fetchOrderBook_1 = require_fetchOrderBook2();
@@ -105707,6 +105930,9 @@ var require_kalshi = __commonJS({
105707
105930
  async searchMarkets(query, params) {
105708
105931
  return (0, searchMarkets_1.searchMarkets)(query, params);
105709
105932
  }
105933
+ async searchEvents(query, params) {
105934
+ return (0, searchEvents_1.searchEvents)(query, params);
105935
+ }
105710
105936
  async getMarketsBySlug(slug) {
105711
105937
  return (0, getMarketsBySlug_1.getMarketsBySlug)(slug);
105712
105938
  }
@@ -106203,14 +106429,28 @@ var crypto_2 = require("crypto");
106203
106429
  var fs_1 = require("fs");
106204
106430
  var path_1 = require("path");
106205
106431
  function getServerVersion() {
106206
- let baseVersion = "1.0.0";
106432
+ let baseVersion = "1.0.0-b4";
106207
106433
  let packageJson;
106208
106434
  try {
106209
- const packageCtx = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, "../../package.json"), "utf-8");
106210
- packageJson = JSON.parse(packageCtx);
106211
- baseVersion = packageJson.version;
106435
+ const possiblePaths = [
106436
+ (0, path_1.join)(__dirname, "../../package.json"),
106437
+ // From dist/server/
106438
+ (0, path_1.join)(__dirname, "../../../package.json"),
106439
+ // From dist/server/bundled
106440
+ (0, path_1.join)(__dirname, "package.json")
106441
+ // Same directory (unlikely)
106442
+ ];
106443
+ for (const pkgPath of possiblePaths) {
106444
+ try {
106445
+ const packageCtx = (0, fs_1.readFileSync)(pkgPath, "utf-8");
106446
+ packageJson = JSON.parse(packageCtx);
106447
+ baseVersion = packageJson.version;
106448
+ break;
106449
+ } catch {
106450
+ continue;
106451
+ }
106452
+ }
106212
106453
  } catch (e) {
106213
- baseVersion = "1.0.0";
106214
106454
  }
106215
106455
  const isDev = process.env.NODE_ENV === "development" || process.env.PMXT_ALWAYS_RESTART === "1" || __dirname.includes("/core/src/") && !!packageJson || __dirname.includes("/core/dist/") && !!packageJson;
106216
106456
  if (!isDev) {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pmxt
3
- Version: 1.2.0
3
+ Version: 1.3.2
4
4
  Summary: Unified prediction market data API - The ccxt for prediction markets
5
5
  Author: PMXT Contributors
6
6
  License: MIT
@@ -1,20 +1,20 @@
1
- pmxt/__init__.py,sha256=j56wDMQ7UDMKuCfCG21_Yyu5sRfQZYAJr_O5KgazqAs,1150
1
+ pmxt/__init__.py,sha256=60Edb9QkU4g2o9-42-vm3Rw3Md1QocdXIultWAK8jfs,1150
2
2
  pmxt/client.py,sha256=pTU7MYP_k0lj-0eJifbHVcpGQVn5U7MTTDisKbv3fVI,27755
3
3
  pmxt/models.py,sha256=ZqRu__L8jnhZOYjE_Zy20dpft177Jb4lOZIkvBwuorg,6438
4
4
  pmxt/server_manager.py,sha256=-G97dYEdKl7F3HK9bAOKYl-SGWP6HsvzZIx2QxiZm24,11494
5
5
  pmxt/_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  pmxt/_server/bin/pmxt-ensure-server,sha256=kXIond0UbxS52FAVQD7kHmSBaL_s6cbIyapLRr4KZJw,4544
7
- pmxt/_server/server/bundled.js,sha256=bgJSNnbYAsY2opHDoF-EfnJZgD03Ws2FmKpWGGKcGYg,4187137
8
- pmxt_internal/__init__.py,sha256=5scd_3UsIdcgcasF_lMtLRrmio0gNi-AqDefszhlCuE,6400
9
- pmxt_internal/api_client.py,sha256=t5ZZ-asj3thoDVhqc0XqzS6XsVqtjYrCBnIBb_zMERw,27889
7
+ pmxt/_server/server/bundled.js,sha256=KxMsOJdiw5D2ynSJGFUCeojDlA-w7Eu6ldlgDoeApp4,4196247
8
+ pmxt_internal/__init__.py,sha256=TWRGUrnPnE5eJ05s9XyoeK6NaRsuv-KgfXAIRLSH438,6762
9
+ pmxt_internal/api_client.py,sha256=hMQILzoVpEZAYaD01o0bVxE3pIcb0thRCW4ZWS-hLI8,27889
10
10
  pmxt_internal/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
11
- pmxt_internal/configuration.py,sha256=mxljZIa_w0ecXcUnhWUSvlfp9ItsSAy7G2Srhmc4Ohg,18320
11
+ pmxt_internal/configuration.py,sha256=4oqyzwcK-xUvZo4SJx59CadQLQcgs8-jgAFiPG7IGlI,18320
12
12
  pmxt_internal/exceptions.py,sha256=txF8A7vlan57JS69kFPs-IZF-Qhp7IZobBTJVa4fOaM,6644
13
13
  pmxt_internal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  pmxt_internal/rest.py,sha256=FMj4yaV6XLr842u_ScWHSzQsTFdk0jaUeuWLJoRbogQ,9760
15
15
  pmxt_internal/api/__init__.py,sha256=ppJSCipQ5IAk2z6UZkFaGSsEmnoAnSSHb8sjb_DYUkY,101
16
- pmxt_internal/api/default_api.py,sha256=h1vGidUmbkXhBHAE1THOWsGjiJc0RnIQTy1fRVSye7M,171451
17
- pmxt_internal/models/__init__.py,sha256=vjHF9UaS2iEhSGavMQL9PtS5NFaFUMTEKKzg-qJwKeE,3449
16
+ pmxt_internal/api/default_api.py,sha256=4ySNtjkT9zJBfaHzX4fmXN5IgE-zIsr-uJs6WMO_N28,183099
17
+ pmxt_internal/models/__init__.py,sha256=VPMpFsTZYckNs5JLcdO_8UwcZn4xEK3xQ58LUO0rxv4,3667
18
18
  pmxt_internal/models/balance.py,sha256=Dj5kFiLrsXOZyyXTC18bPjWrgw7qdWnTgTSCmk_l6xk,2962
19
19
  pmxt_internal/models/base_request.py,sha256=ZNipF7ycXFkQJ6j3QmB1TzA0UO3fB54AMPlAgIA3KOA,2987
20
20
  pmxt_internal/models/base_response.py,sha256=g-NG4Swxl3cg4-YOCPl65dUeHzOnA9S7ubTj8HOYZs0,2975
@@ -49,14 +49,17 @@ pmxt_internal/models/order_book.py,sha256=FZQ5g81szBtpCun3vFFTDZb_xZkwUMVyEIF1ZZ
49
49
  pmxt_internal/models/order_level.py,sha256=dMeuXlhBqe1kA-R1ysFjt77qJxx6ukrZHwO1y3hZ6EM,2735
50
50
  pmxt_internal/models/position.py,sha256=a2v8JudGks66xtSU_BILwnEhxqfTu1o01g-ShWHpkeA,3740
51
51
  pmxt_internal/models/price_candle.py,sha256=AebmNrnVl_JI0Vqy_IRoRh08qX9ZUdzzazKmnVTuyio,3151
52
+ pmxt_internal/models/search_events200_response.py,sha256=70Nope-KWr4MBAFSMyjNugkOPgQZ1bZZym7HPdYR9vE,3560
53
+ pmxt_internal/models/search_events_request.py,sha256=F9Y8fUARgIKUmMKkIZn3SviCVn-3CF8jJzUz9byWOB8,3710
52
54
  pmxt_internal/models/search_markets_request.py,sha256=BARoy2GXgV7RQNIGck6UaOyQqf0NIJkyGGbFf2cfZKc,3714
53
55
  pmxt_internal/models/search_markets_request_args_inner.py,sha256=PkusFd_OxhUsItsBpluPJA11zg0sXXjbOK-lPmemvLs,5561
54
56
  pmxt_internal/models/trade.py,sha256=U6Fc18rbwILs9FmX8CSDYYL8dF6763l8QzeMQNRxQdo,3328
57
+ pmxt_internal/models/unified_event.py,sha256=zJVokyA3_Ny9cFxI_kZaJShB_V-KMqr5rY-i6oMDXCU,3896
55
58
  pmxt_internal/models/unified_market.py,sha256=DoYhiH4HycYGlq858PEeB-CIA7haT6rxmJeYZJuulMA,5646
56
59
  pmxt_internal/models/watch_order_book_request.py,sha256=kavGUI-SLz2-Kam_jcJ_h0GDe0-9UkxqCmVsAi6Uios,3726
57
60
  pmxt_internal/models/watch_order_book_request_args_inner.py,sha256=ZHrjmFDGxRG5MXbuz4mUp9KFfo3XS7zuXWTyMNgi4xI,5464
58
61
  pmxt_internal/models/watch_trades_request.py,sha256=brrg8JbEe-aeg7mIe_Y2HzRPogp-IfRhkXChrxzqoLU,3722
59
- pmxt-1.2.0.dist-info/METADATA,sha256=r9aUUGW_AalVxZIHnLRDdyt40XIqBYl5XrYv1nE7oLA,6288
60
- pmxt-1.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
61
- pmxt-1.2.0.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
62
- pmxt-1.2.0.dist-info/RECORD,,
62
+ pmxt-1.3.2.dist-info/METADATA,sha256=6PvfHTMQafjJLsKC8v3ykslGwgJ6432t6_FVwV84O9w,6288
63
+ pmxt-1.3.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
64
+ pmxt-1.3.2.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
65
+ pmxt-1.3.2.dist-info/RECORD,,
pmxt_internal/__init__.py CHANGED
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "1.2.0"
17
+ __version__ = "1.3.2"
18
18
 
19
19
  # Define package exports
20
20
  __all__ = [
@@ -62,9 +62,12 @@ __all__ = [
62
62
  "OrderLevel",
63
63
  "Position",
64
64
  "PriceCandle",
65
+ "SearchEvents200Response",
66
+ "SearchEventsRequest",
65
67
  "SearchMarketsRequest",
66
68
  "SearchMarketsRequestArgsInner",
67
69
  "Trade",
70
+ "UnifiedEvent",
68
71
  "UnifiedMarket",
69
72
  "WatchOrderBookRequest",
70
73
  "WatchOrderBookRequestArgsInner",
@@ -120,9 +123,12 @@ from pmxt_internal.models.order_book import OrderBook as OrderBook
120
123
  from pmxt_internal.models.order_level import OrderLevel as OrderLevel
121
124
  from pmxt_internal.models.position import Position as Position
122
125
  from pmxt_internal.models.price_candle import PriceCandle as PriceCandle
126
+ from pmxt_internal.models.search_events200_response import SearchEvents200Response as SearchEvents200Response
127
+ from pmxt_internal.models.search_events_request import SearchEventsRequest as SearchEventsRequest
123
128
  from pmxt_internal.models.search_markets_request import SearchMarketsRequest as SearchMarketsRequest
124
129
  from pmxt_internal.models.search_markets_request_args_inner import SearchMarketsRequestArgsInner as SearchMarketsRequestArgsInner
125
130
  from pmxt_internal.models.trade import Trade as Trade
131
+ from pmxt_internal.models.unified_event import UnifiedEvent as UnifiedEvent
126
132
  from pmxt_internal.models.unified_market import UnifiedMarket as UnifiedMarket
127
133
  from pmxt_internal.models.watch_order_book_request import WatchOrderBookRequest as WatchOrderBookRequest
128
134
  from pmxt_internal.models.watch_order_book_request_args_inner import WatchOrderBookRequestArgsInner as WatchOrderBookRequestArgsInner
@@ -37,6 +37,8 @@ from pmxt_internal.models.fetch_trades200_response import FetchTrades200Response
37
37
  from pmxt_internal.models.fetch_trades_request import FetchTradesRequest
38
38
  from pmxt_internal.models.get_markets_by_slug_request import GetMarketsBySlugRequest
39
39
  from pmxt_internal.models.health_check200_response import HealthCheck200Response
40
+ from pmxt_internal.models.search_events200_response import SearchEvents200Response
41
+ from pmxt_internal.models.search_events_request import SearchEventsRequest
40
42
  from pmxt_internal.models.search_markets_request import SearchMarketsRequest
41
43
  from pmxt_internal.models.watch_order_book_request import WatchOrderBookRequest
42
44
  from pmxt_internal.models.watch_trades_request import WatchTradesRequest
@@ -3436,6 +3438,294 @@ class DefaultApi:
3436
3438
 
3437
3439
 
3438
3440
 
3441
+ @validate_call
3442
+ def search_events(
3443
+ self,
3444
+ exchange: Annotated[StrictStr, Field(description="The prediction market exchange to target.")],
3445
+ search_events_request: Optional[SearchEventsRequest] = None,
3446
+ _request_timeout: Union[
3447
+ None,
3448
+ Annotated[StrictFloat, Field(gt=0)],
3449
+ Tuple[
3450
+ Annotated[StrictFloat, Field(gt=0)],
3451
+ Annotated[StrictFloat, Field(gt=0)]
3452
+ ]
3453
+ ] = None,
3454
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3455
+ _content_type: Optional[StrictStr] = None,
3456
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3457
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3458
+ ) -> SearchEvents200Response:
3459
+ """Search Events
3460
+
3461
+ Search for events (groups of related markets) by title or description.
3462
+
3463
+ :param exchange: The prediction market exchange to target. (required)
3464
+ :type exchange: str
3465
+ :param search_events_request:
3466
+ :type search_events_request: SearchEventsRequest
3467
+ :param _request_timeout: timeout setting for this request. If one
3468
+ number provided, it will be total request
3469
+ timeout. It can also be a pair (tuple) of
3470
+ (connection, read) timeouts.
3471
+ :type _request_timeout: int, tuple(int, int), optional
3472
+ :param _request_auth: set to override the auth_settings for an a single
3473
+ request; this effectively ignores the
3474
+ authentication in the spec for a single request.
3475
+ :type _request_auth: dict, optional
3476
+ :param _content_type: force content-type for the request.
3477
+ :type _content_type: str, Optional
3478
+ :param _headers: set to override the headers for a single
3479
+ request; this effectively ignores the headers
3480
+ in the spec for a single request.
3481
+ :type _headers: dict, optional
3482
+ :param _host_index: set to override the host_index for a single
3483
+ request; this effectively ignores the host_index
3484
+ in the spec for a single request.
3485
+ :type _host_index: int, optional
3486
+ :return: Returns the result object.
3487
+ """ # noqa: E501
3488
+
3489
+ _param = self._search_events_serialize(
3490
+ exchange=exchange,
3491
+ search_events_request=search_events_request,
3492
+ _request_auth=_request_auth,
3493
+ _content_type=_content_type,
3494
+ _headers=_headers,
3495
+ _host_index=_host_index
3496
+ )
3497
+
3498
+ _response_types_map: Dict[str, Optional[str]] = {
3499
+ '200': "SearchEvents200Response",
3500
+ }
3501
+ response_data = self.api_client.call_api(
3502
+ *_param,
3503
+ _request_timeout=_request_timeout
3504
+ )
3505
+ response_data.read()
3506
+ return self.api_client.response_deserialize(
3507
+ response_data=response_data,
3508
+ response_types_map=_response_types_map,
3509
+ ).data
3510
+
3511
+
3512
+ @validate_call
3513
+ def search_events_with_http_info(
3514
+ self,
3515
+ exchange: Annotated[StrictStr, Field(description="The prediction market exchange to target.")],
3516
+ search_events_request: Optional[SearchEventsRequest] = None,
3517
+ _request_timeout: Union[
3518
+ None,
3519
+ Annotated[StrictFloat, Field(gt=0)],
3520
+ Tuple[
3521
+ Annotated[StrictFloat, Field(gt=0)],
3522
+ Annotated[StrictFloat, Field(gt=0)]
3523
+ ]
3524
+ ] = None,
3525
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3526
+ _content_type: Optional[StrictStr] = None,
3527
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3528
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3529
+ ) -> ApiResponse[SearchEvents200Response]:
3530
+ """Search Events
3531
+
3532
+ Search for events (groups of related markets) by title or description.
3533
+
3534
+ :param exchange: The prediction market exchange to target. (required)
3535
+ :type exchange: str
3536
+ :param search_events_request:
3537
+ :type search_events_request: SearchEventsRequest
3538
+ :param _request_timeout: timeout setting for this request. If one
3539
+ number provided, it will be total request
3540
+ timeout. It can also be a pair (tuple) of
3541
+ (connection, read) timeouts.
3542
+ :type _request_timeout: int, tuple(int, int), optional
3543
+ :param _request_auth: set to override the auth_settings for an a single
3544
+ request; this effectively ignores the
3545
+ authentication in the spec for a single request.
3546
+ :type _request_auth: dict, optional
3547
+ :param _content_type: force content-type for the request.
3548
+ :type _content_type: str, Optional
3549
+ :param _headers: set to override the headers for a single
3550
+ request; this effectively ignores the headers
3551
+ in the spec for a single request.
3552
+ :type _headers: dict, optional
3553
+ :param _host_index: set to override the host_index for a single
3554
+ request; this effectively ignores the host_index
3555
+ in the spec for a single request.
3556
+ :type _host_index: int, optional
3557
+ :return: Returns the result object.
3558
+ """ # noqa: E501
3559
+
3560
+ _param = self._search_events_serialize(
3561
+ exchange=exchange,
3562
+ search_events_request=search_events_request,
3563
+ _request_auth=_request_auth,
3564
+ _content_type=_content_type,
3565
+ _headers=_headers,
3566
+ _host_index=_host_index
3567
+ )
3568
+
3569
+ _response_types_map: Dict[str, Optional[str]] = {
3570
+ '200': "SearchEvents200Response",
3571
+ }
3572
+ response_data = self.api_client.call_api(
3573
+ *_param,
3574
+ _request_timeout=_request_timeout
3575
+ )
3576
+ response_data.read()
3577
+ return self.api_client.response_deserialize(
3578
+ response_data=response_data,
3579
+ response_types_map=_response_types_map,
3580
+ )
3581
+
3582
+
3583
+ @validate_call
3584
+ def search_events_without_preload_content(
3585
+ self,
3586
+ exchange: Annotated[StrictStr, Field(description="The prediction market exchange to target.")],
3587
+ search_events_request: Optional[SearchEventsRequest] = None,
3588
+ _request_timeout: Union[
3589
+ None,
3590
+ Annotated[StrictFloat, Field(gt=0)],
3591
+ Tuple[
3592
+ Annotated[StrictFloat, Field(gt=0)],
3593
+ Annotated[StrictFloat, Field(gt=0)]
3594
+ ]
3595
+ ] = None,
3596
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3597
+ _content_type: Optional[StrictStr] = None,
3598
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3599
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3600
+ ) -> RESTResponseType:
3601
+ """Search Events
3602
+
3603
+ Search for events (groups of related markets) by title or description.
3604
+
3605
+ :param exchange: The prediction market exchange to target. (required)
3606
+ :type exchange: str
3607
+ :param search_events_request:
3608
+ :type search_events_request: SearchEventsRequest
3609
+ :param _request_timeout: timeout setting for this request. If one
3610
+ number provided, it will be total request
3611
+ timeout. It can also be a pair (tuple) of
3612
+ (connection, read) timeouts.
3613
+ :type _request_timeout: int, tuple(int, int), optional
3614
+ :param _request_auth: set to override the auth_settings for an a single
3615
+ request; this effectively ignores the
3616
+ authentication in the spec for a single request.
3617
+ :type _request_auth: dict, optional
3618
+ :param _content_type: force content-type for the request.
3619
+ :type _content_type: str, Optional
3620
+ :param _headers: set to override the headers for a single
3621
+ request; this effectively ignores the headers
3622
+ in the spec for a single request.
3623
+ :type _headers: dict, optional
3624
+ :param _host_index: set to override the host_index for a single
3625
+ request; this effectively ignores the host_index
3626
+ in the spec for a single request.
3627
+ :type _host_index: int, optional
3628
+ :return: Returns the result object.
3629
+ """ # noqa: E501
3630
+
3631
+ _param = self._search_events_serialize(
3632
+ exchange=exchange,
3633
+ search_events_request=search_events_request,
3634
+ _request_auth=_request_auth,
3635
+ _content_type=_content_type,
3636
+ _headers=_headers,
3637
+ _host_index=_host_index
3638
+ )
3639
+
3640
+ _response_types_map: Dict[str, Optional[str]] = {
3641
+ '200': "SearchEvents200Response",
3642
+ }
3643
+ response_data = self.api_client.call_api(
3644
+ *_param,
3645
+ _request_timeout=_request_timeout
3646
+ )
3647
+ return response_data.response
3648
+
3649
+
3650
+ def _search_events_serialize(
3651
+ self,
3652
+ exchange,
3653
+ search_events_request,
3654
+ _request_auth,
3655
+ _content_type,
3656
+ _headers,
3657
+ _host_index,
3658
+ ) -> RequestSerialized:
3659
+
3660
+ _host = None
3661
+
3662
+ _collection_formats: Dict[str, str] = {
3663
+ }
3664
+
3665
+ _path_params: Dict[str, str] = {}
3666
+ _query_params: List[Tuple[str, str]] = []
3667
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3668
+ _form_params: List[Tuple[str, str]] = []
3669
+ _files: Dict[
3670
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3671
+ ] = {}
3672
+ _body_params: Optional[bytes] = None
3673
+
3674
+ # process the path parameters
3675
+ if exchange is not None:
3676
+ _path_params['exchange'] = exchange
3677
+ # process the query parameters
3678
+ # process the header parameters
3679
+ # process the form parameters
3680
+ # process the body parameter
3681
+ if search_events_request is not None:
3682
+ _body_params = search_events_request
3683
+
3684
+
3685
+ # set the HTTP header `Accept`
3686
+ if 'Accept' not in _header_params:
3687
+ _header_params['Accept'] = self.api_client.select_header_accept(
3688
+ [
3689
+ 'application/json'
3690
+ ]
3691
+ )
3692
+
3693
+ # set the HTTP header `Content-Type`
3694
+ if _content_type:
3695
+ _header_params['Content-Type'] = _content_type
3696
+ else:
3697
+ _default_content_type = (
3698
+ self.api_client.select_header_content_type(
3699
+ [
3700
+ 'application/json'
3701
+ ]
3702
+ )
3703
+ )
3704
+ if _default_content_type is not None:
3705
+ _header_params['Content-Type'] = _default_content_type
3706
+
3707
+ # authentication setting
3708
+ _auth_settings: List[str] = [
3709
+ ]
3710
+
3711
+ return self.api_client.param_serialize(
3712
+ method='POST',
3713
+ resource_path='/api/{exchange}/searchEvents',
3714
+ path_params=_path_params,
3715
+ query_params=_query_params,
3716
+ header_params=_header_params,
3717
+ body=_body_params,
3718
+ post_params=_form_params,
3719
+ files=_files,
3720
+ auth_settings=_auth_settings,
3721
+ collection_formats=_collection_formats,
3722
+ _host=_host,
3723
+ _request_auth=_request_auth
3724
+ )
3725
+
3726
+
3727
+
3728
+
3439
3729
  @validate_call
3440
3730
  def search_markets(
3441
3731
  self,
@@ -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.2.0/python'
94
+ self.user_agent = 'OpenAPI-Generator/1.3.2/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.2.0".\
509
+ "SDK Package Version: 1.3.2".\
510
510
  format(env=sys.platform, pyversion=sys.version)
511
511
 
512
512
  def get_host_settings(self) -> List[HostSetting]:
@@ -47,9 +47,12 @@ from pmxt_internal.models.order_book import OrderBook
47
47
  from pmxt_internal.models.order_level import OrderLevel
48
48
  from pmxt_internal.models.position import Position
49
49
  from pmxt_internal.models.price_candle import PriceCandle
50
+ from pmxt_internal.models.search_events200_response import SearchEvents200Response
51
+ from pmxt_internal.models.search_events_request import SearchEventsRequest
50
52
  from pmxt_internal.models.search_markets_request import SearchMarketsRequest
51
53
  from pmxt_internal.models.search_markets_request_args_inner import SearchMarketsRequestArgsInner
52
54
  from pmxt_internal.models.trade import Trade
55
+ from pmxt_internal.models.unified_event import UnifiedEvent
53
56
  from pmxt_internal.models.unified_market import UnifiedMarket
54
57
  from pmxt_internal.models.watch_order_book_request import WatchOrderBookRequest
55
58
  from pmxt_internal.models.watch_order_book_request_args_inner import WatchOrderBookRequestArgsInner
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ PMXT Sidecar API
5
+
6
+ A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
7
+
8
+ The version of the OpenAPI document: 0.4.4
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictBool
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from pmxt_internal.models.error_detail import ErrorDetail
23
+ from pmxt_internal.models.unified_event import UnifiedEvent
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SearchEvents200Response(BaseModel):
28
+ """
29
+ SearchEvents200Response
30
+ """ # noqa: E501
31
+ success: Optional[StrictBool] = None
32
+ error: Optional[ErrorDetail] = None
33
+ data: Optional[List[UnifiedEvent]] = None
34
+ __properties: ClassVar[List[str]] = ["success", "error", "data"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of SearchEvents200Response from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of error
76
+ if self.error:
77
+ _dict['error'] = self.error.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of each item in data (list)
79
+ _items = []
80
+ if self.data:
81
+ for _item_data in self.data:
82
+ if _item_data:
83
+ _items.append(_item_data.to_dict())
84
+ _dict['data'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of SearchEvents200Response from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "success": obj.get("success"),
98
+ "error": ErrorDetail.from_dict(obj["error"]) if obj.get("error") is not None else None,
99
+ "data": [UnifiedEvent.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None
100
+ })
101
+ return _obj
102
+
103
+
@@ -0,0 +1,102 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ PMXT Sidecar API
5
+
6
+ A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
7
+
8
+ The version of the OpenAPI document: 0.4.4
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
24
+ from pmxt_internal.models.search_markets_request_args_inner import SearchMarketsRequestArgsInner
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class SearchEventsRequest(BaseModel):
29
+ """
30
+ SearchEventsRequest
31
+ """ # noqa: E501
32
+ args: Annotated[List[SearchMarketsRequestArgsInner], Field(min_length=1, max_length=2)] = Field(description="[query, params?]")
33
+ credentials: Optional[ExchangeCredentials] = None
34
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of SearchEventsRequest from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in args (list)
76
+ _items = []
77
+ if self.args:
78
+ for _item_args in self.args:
79
+ if _item_args:
80
+ _items.append(_item_args.to_dict())
81
+ _dict['args'] = _items
82
+ # override the default output from pydantic by calling `to_dict()` of credentials
83
+ if self.credentials:
84
+ _dict['credentials'] = self.credentials.to_dict()
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of SearchEventsRequest from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "args": [SearchMarketsRequestArgsInner.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None,
98
+ "credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
99
+ })
100
+ return _obj
101
+
102
+
@@ -0,0 +1,111 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ PMXT Sidecar API
5
+
6
+ A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
7
+
8
+ The version of the OpenAPI document: 0.4.4
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from pmxt_internal.models.unified_market import UnifiedMarket
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class UnifiedEvent(BaseModel):
27
+ """
28
+ A grouped collection of related markets (e.g., \"Who will be Fed Chair?\" contains multiple candidate markets)
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr] = None
31
+ title: Optional[StrictStr] = None
32
+ description: Optional[StrictStr] = None
33
+ slug: Optional[StrictStr] = None
34
+ markets: Optional[List[UnifiedMarket]] = None
35
+ url: Optional[StrictStr] = None
36
+ image: Optional[StrictStr] = None
37
+ category: Optional[StrictStr] = None
38
+ tags: Optional[List[StrictStr]] = None
39
+ __properties: ClassVar[List[str]] = ["id", "title", "description", "slug", "markets", "url", "image", "category", "tags"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of UnifiedEvent from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of each item in markets (list)
81
+ _items = []
82
+ if self.markets:
83
+ for _item_markets in self.markets:
84
+ if _item_markets:
85
+ _items.append(_item_markets.to_dict())
86
+ _dict['markets'] = _items
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of UnifiedEvent from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "id": obj.get("id"),
100
+ "title": obj.get("title"),
101
+ "description": obj.get("description"),
102
+ "slug": obj.get("slug"),
103
+ "markets": [UnifiedMarket.from_dict(_item) for _item in obj["markets"]] if obj.get("markets") is not None else None,
104
+ "url": obj.get("url"),
105
+ "image": obj.get("image"),
106
+ "category": obj.get("category"),
107
+ "tags": obj.get("tags")
108
+ })
109
+ return _obj
110
+
111
+
File without changes