pmxt-core 2.46.14 → 2.48.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.
Files changed (82) hide show
  1. package/dist/BaseExchange.d.ts +42 -1
  2. package/dist/BaseExchange.js +29 -2
  3. package/dist/exchanges/baozi/index.d.ts +1 -0
  4. package/dist/exchanges/baozi/index.js +5 -0
  5. package/dist/exchanges/baozi/normalizer.js +2 -0
  6. package/dist/exchanges/baozi/utils.js +28 -0
  7. package/dist/exchanges/gemini-titan/index.d.ts +6 -2
  8. package/dist/exchanges/gemini-titan/index.js +81 -1
  9. package/dist/exchanges/gemini-titan/normalizer.d.ts +7 -1
  10. package/dist/exchanges/gemini-titan/normalizer.js +54 -0
  11. package/dist/exchanges/hyperliquid/index.d.ts +3 -0
  12. package/dist/exchanges/hyperliquid/index.js +7 -0
  13. package/dist/exchanges/hyperliquid/normalizer.js +20 -0
  14. package/dist/exchanges/kalshi/api.d.ts +1 -1
  15. package/dist/exchanges/kalshi/api.js +1 -1
  16. package/dist/exchanges/kalshi/fetcher.d.ts +10 -0
  17. package/dist/exchanges/kalshi/fetcher.js +36 -0
  18. package/dist/exchanges/kalshi/index.d.ts +3 -2
  19. package/dist/exchanges/kalshi/index.js +33 -0
  20. package/dist/exchanges/kalshi/normalizer.d.ts +3 -2
  21. package/dist/exchanges/kalshi/normalizer.js +35 -0
  22. package/dist/exchanges/limitless/api.d.ts +1 -1
  23. package/dist/exchanges/limitless/api.js +1 -1
  24. package/dist/exchanges/limitless/index.d.ts +1 -0
  25. package/dist/exchanges/limitless/index.js +5 -0
  26. package/dist/exchanges/limitless/normalizer.js +10 -0
  27. package/dist/exchanges/limitless/utils.js +17 -0
  28. package/dist/exchanges/metaculus/fetchEvents.js +6 -0
  29. package/dist/exchanges/metaculus/index.d.ts +3 -0
  30. package/dist/exchanges/metaculus/index.js +3 -0
  31. package/dist/exchanges/metaculus/utils.d.ts +2 -1
  32. package/dist/exchanges/metaculus/utils.js +32 -3
  33. package/dist/exchanges/myriad/api.d.ts +1 -1
  34. package/dist/exchanges/myriad/api.js +1 -1
  35. package/dist/exchanges/myriad/index.d.ts +1 -0
  36. package/dist/exchanges/myriad/index.js +5 -0
  37. package/dist/exchanges/myriad/normalizer.js +14 -0
  38. package/dist/exchanges/myriad/utils.js +14 -0
  39. package/dist/exchanges/opinion/api.d.ts +1 -1
  40. package/dist/exchanges/opinion/api.js +1 -1
  41. package/dist/exchanges/opinion/index.d.ts +6 -2
  42. package/dist/exchanges/opinion/index.js +54 -1
  43. package/dist/exchanges/opinion/normalizer.d.ts +8 -2
  44. package/dist/exchanges/opinion/normalizer.js +42 -0
  45. package/dist/exchanges/polymarket/api-clob.d.ts +1 -1
  46. package/dist/exchanges/polymarket/api-clob.js +1 -1
  47. package/dist/exchanges/polymarket/api-data.d.ts +1 -1
  48. package/dist/exchanges/polymarket/api-data.js +1 -1
  49. package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
  50. package/dist/exchanges/polymarket/api-gamma.js +1 -1
  51. package/dist/exchanges/polymarket/index.d.ts +13 -2
  52. package/dist/exchanges/polymarket/index.js +49 -0
  53. package/dist/exchanges/polymarket/normalizer.d.ts +2 -1
  54. package/dist/exchanges/polymarket/normalizer.js +48 -0
  55. package/dist/exchanges/polymarket/utils.js +28 -0
  56. package/dist/exchanges/polymarket_us/index.d.ts +3 -2
  57. package/dist/exchanges/polymarket_us/index.js +57 -0
  58. package/dist/exchanges/polymarket_us/normalizer.d.ts +9 -2
  59. package/dist/exchanges/polymarket_us/normalizer.js +42 -0
  60. package/dist/exchanges/probable/api.d.ts +1 -1
  61. package/dist/exchanges/probable/api.js +1 -1
  62. package/dist/exchanges/probable/index.d.ts +3 -0
  63. package/dist/exchanges/probable/index.js +7 -0
  64. package/dist/exchanges/probable/utils.js +17 -0
  65. package/dist/exchanges/smarkets/index.d.ts +1 -0
  66. package/dist/exchanges/smarkets/index.js +5 -0
  67. package/dist/exchanges/smarkets/normalizer.js +20 -0
  68. package/dist/exchanges/suibets/index.d.ts +1 -0
  69. package/dist/exchanges/suibets/index.js +5 -0
  70. package/dist/exchanges/suibets/normalizer.js +20 -0
  71. package/dist/router/Router.d.ts +29 -2
  72. package/dist/router/Router.js +145 -0
  73. package/dist/router/index.d.ts +1 -0
  74. package/dist/router/index.js +1 -0
  75. package/dist/router/series-map.d.ts +32 -0
  76. package/dist/router/series-map.js +146 -0
  77. package/dist/server/method-verbs.json +10 -0
  78. package/dist/server/openapi.yaml +132 -0
  79. package/dist/types.d.ts +35 -0
  80. package/dist/utils/metadata.d.ts +14 -0
  81. package/dist/utils/metadata.js +33 -0
  82. package/package.json +3 -3
@@ -326,6 +326,15 @@ paths:
326
326
  schema:
327
327
  type: string
328
328
  description: Lookup by event slug
329
+ - in: query
330
+ name: series
331
+ required: false
332
+ schema:
333
+ type: string
334
+ description: >-
335
+ Filter events by their parent series. Accepts the venue-native series id / ticker / slug (e.g. Kalshi
336
+ `"KXATPMATCH"`, Polymarket `"wta"`). Passed through to the vendor where supported, otherwise applied to
337
+ `sourceMetadata` after fetch.
329
338
  - in: query
330
339
  name: filter
331
340
  required: false
@@ -369,6 +378,43 @@ paths:
369
378
  description: >-
370
379
  Fetch events with optional keyword search. Events group related markets together (e.g., "Who will be Fed Chair?"
371
380
  contains multiple candidate markets).
381
+ '/api/{exchange}/fetchSeries':
382
+ get:
383
+ summary: Fetch Series
384
+ operationId: fetchSeries
385
+ parameters:
386
+ - in: path
387
+ name: exchange
388
+ schema:
389
+ type: string
390
+ enum:
391
+ - polymarket
392
+ - kalshi
393
+ - kalshi-demo
394
+ - opinion
395
+ - polymarket_us
396
+ - router
397
+ required: true
398
+ description: The prediction market exchange to target.
399
+ responses:
400
+ '200':
401
+ description: Fetch Series response
402
+ content:
403
+ application/json:
404
+ schema:
405
+ allOf:
406
+ - $ref: '#/components/schemas/BaseResponse'
407
+ - type: object
408
+ properties:
409
+ data:
410
+ type: array
411
+ items:
412
+ $ref: '#/components/schemas/UnifiedSeries'
413
+ description: >-
414
+ Fetch the recurring series (fourth tier above Event -> Market -> Outcome) that this venue exposes. Returns an
415
+ empty array on venues without a series concept (Limitless, Smarkets, Probable, Metaculus, Baozi, Hyperliquid,
416
+ SuiBets, Polymarket US). - `params.id` -> a single matching series with its events populated where supported. -
417
+ no params -> the full list, typically without nested events for payload size.
372
418
  '/api/{exchange}/fetchMarket':
373
419
  get:
374
420
  summary: Fetch Market
@@ -548,6 +594,15 @@ paths:
548
594
  schema:
549
595
  type: string
550
596
  description: Lookup by event slug
597
+ - in: query
598
+ name: series
599
+ required: false
600
+ schema:
601
+ type: string
602
+ description: >-
603
+ Filter events by their parent series. Accepts the venue-native series id / ticker / slug (e.g. Kalshi
604
+ `"KXATPMATCH"`, Polymarket `"wta"`). Passed through to the vendor where supported, otherwise applied to
605
+ `sourceMetadata` after fetch.
551
606
  - in: query
552
607
  name: filter
553
608
  required: false
@@ -2654,6 +2709,13 @@ components:
2654
2709
  contractAddress:
2655
2710
  type: string
2656
2711
  description: 'On-chain contract / condition identifier where applicable (Polymarket conditionId, etc.).'
2712
+ sourceMetadata:
2713
+ type: object
2714
+ additionalProperties: {}
2715
+ description: >-
2716
+ Raw venue-specific metadata not captured by first-class fields (e.g. Kalshi series_ticker / series_title
2717
+ from the parent event, Polymarket series). Passed through verbatim so downstream consumers can recover
2718
+ anything the unified shape omits. Each venue populates what it has.
2657
2719
  sourceExchange:
2658
2720
  type: string
2659
2721
  description: 'The exchange/venue this market originates from (e.g. ''polymarket'', ''kalshi''). Populated by the Router.'
@@ -2755,6 +2817,13 @@ components:
2755
2817
  Optional list of tags. More granular than category — e.g. ["Sports", "FIFA World Cup", "2026 FIFA World
2756
2818
  Cup"] or ["Politics", "Geopolitics", "Middle East"]. Tags vary by venue: Polymarket markets carry several,
2757
2819
  Kalshi typically one.
2820
+ sourceMetadata:
2821
+ type: object
2822
+ additionalProperties: {}
2823
+ description: >-
2824
+ Raw venue-specific metadata not captured by first-class fields (e.g. Kalshi series_ticker / series_title,
2825
+ Polymarket series). Passed through verbatim so downstream consumers can recover anything the unified shape
2826
+ omits. Each venue populates what it has.
2758
2827
  sourceExchange:
2759
2828
  type: string
2760
2829
  description: 'The exchange/venue this event originates from (e.g. ''polymarket'', ''kalshi''). Populated by the Router.'
@@ -2766,6 +2835,63 @@ components:
2766
2835
  - markets
2767
2836
  - volume24h
2768
2837
  - url
2838
+ UnifiedSeries:
2839
+ type: object
2840
+ description: >-
2841
+ A recurring grouping of events on a venue — the fourth tier above Event -> Market -> Outcome. Examples: Kalshi
2842
+ `KXATPMATCH` (every ATP tennis match), Polymarket `wta` (every WTA match), Opinion's daily `collection`. Series
2843
+ only exists where the venue exposes a recurring-event concept; venues without one return an empty array from
2844
+ `fetchSeries`.
2845
+ properties:
2846
+ id:
2847
+ type: string
2848
+ description: >-
2849
+ Stable venue-native series identifier (e.g. "KXATPMATCH" on Kalshi, "atp" on Polymarket Gamma, numeric Gamma
2850
+ id).
2851
+ ticker:
2852
+ type: string
2853
+ description: 'Venue-native ticker, when distinct from `id`.'
2854
+ slug:
2855
+ type: string
2856
+ description: Venue-native slug.
2857
+ title:
2858
+ type: string
2859
+ description: 'Human-readable series title (e.g. "ATP Match Winner", "WTA").'
2860
+ description:
2861
+ oneOf:
2862
+ - type: string
2863
+ - {}
2864
+ description: Long-form series description.
2865
+ recurrence:
2866
+ oneOf:
2867
+ - type: string
2868
+ - {}
2869
+ description: 'Recurrence cadence the venue reports (''daily'', ''weekly'', ''annual'', ...).'
2870
+ events:
2871
+ type: array
2872
+ items:
2873
+ $ref: '#/components/schemas/UnifiedEvent'
2874
+ description: Child events. Populated when fetched by id; the list form usually omits this to keep payloads small.
2875
+ url:
2876
+ oneOf:
2877
+ - type: string
2878
+ - {}
2879
+ description: Canonical venue URL for the series.
2880
+ image:
2881
+ oneOf:
2882
+ - type: string
2883
+ - {}
2884
+ description: Venue-hosted image.
2885
+ sourceExchange:
2886
+ type: string
2887
+ description: The exchange this series originates from. Populated by the Router.
2888
+ sourceMetadata:
2889
+ type: object
2890
+ additionalProperties: {}
2891
+ description: Raw venue-specific fields not promoted to first-class columns.
2892
+ required:
2893
+ - id
2894
+ - title
2769
2895
  PriceCandle:
2770
2896
  type: object
2771
2897
  properties:
@@ -3159,6 +3285,12 @@ components:
3159
3285
  slug:
3160
3286
  type: string
3161
3287
  description: Lookup by event slug
3288
+ series:
3289
+ type: string
3290
+ description: >-
3291
+ Filter events by their parent series. Accepts the venue-native series id / ticker / slug (e.g. Kalshi
3292
+ `"KXATPMATCH"`, Polymarket `"wta"`). Passed through to the vendor where supported, otherwise applied to
3293
+ `sourceMetadata` after fetch.
3162
3294
  filter:
3163
3295
  allOf:
3164
3296
  - $ref: '#/components/schemas/EventFilterCriteria'
package/dist/types.d.ts CHANGED
@@ -37,6 +37,8 @@ export interface UnifiedEvent {
37
37
  category?: string;
38
38
  /** Optional list of tags. More granular than category — e.g. ["Sports", "FIFA World Cup", "2026 FIFA World Cup"] or ["Politics", "Geopolitics", "Middle East"]. Tags vary by venue: Polymarket markets carry several, Kalshi typically one. */
39
39
  tags?: string[];
40
+ /** Raw venue-specific metadata not captured by first-class fields (e.g. Kalshi series_ticker / series_title, Polymarket series). Passed through verbatim so downstream consumers can recover anything the unified shape omits. Each venue populates what it has. */
41
+ sourceMetadata?: Record<string, unknown>;
40
42
  /** The exchange/venue this event originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router. */
41
43
  sourceExchange?: string;
42
44
  }
@@ -75,6 +77,8 @@ export interface UnifiedMarket {
75
77
  status?: string;
76
78
  /** On-chain contract / condition identifier where applicable (Polymarket conditionId, etc.). */
77
79
  contractAddress?: string;
80
+ /** Raw venue-specific metadata not captured by first-class fields (e.g. Kalshi series_ticker / series_title from the parent event, Polymarket series). Passed through verbatim so downstream consumers can recover anything the unified shape omits. Each venue populates what it has. */
81
+ sourceMetadata?: Record<string, unknown>;
78
82
  /** The exchange/venue this market originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router. */
79
83
  sourceExchange?: string;
80
84
  /** Convenience accessor for the YES outcome on a binary market. */
@@ -86,6 +90,37 @@ export interface UnifiedMarket {
86
90
  /** Convenience accessor for the DOWN outcome on a binary market. */
87
91
  down?: MarketOutcome;
88
92
  }
93
+ /**
94
+ * A recurring grouping of events on a venue — the fourth tier above
95
+ * Event -> Market -> Outcome. Examples: Kalshi `KXATPMATCH` (every ATP
96
+ * tennis match), Polymarket `wta` (every WTA match), Opinion's daily
97
+ * `collection`. Series only exists where the venue exposes a recurring-event
98
+ * concept; venues without one return an empty array from `fetchSeries`.
99
+ */
100
+ export interface UnifiedSeries {
101
+ /** Stable venue-native series identifier (e.g. "KXATPMATCH" on Kalshi, "atp" on Polymarket Gamma, numeric Gamma id). */
102
+ id: string;
103
+ /** Venue-native ticker, when distinct from `id`. */
104
+ ticker?: string;
105
+ /** Venue-native slug. */
106
+ slug?: string;
107
+ /** Human-readable series title (e.g. "ATP Match Winner", "WTA"). */
108
+ title: string;
109
+ /** Long-form series description. */
110
+ description?: string | null;
111
+ /** Recurrence cadence the venue reports ('daily', 'weekly', 'annual', ...). */
112
+ recurrence?: string | null;
113
+ /** Child events. Populated when fetched by id; the list form usually omits this to keep payloads small. */
114
+ events?: UnifiedEvent[];
115
+ /** Canonical venue URL for the series. */
116
+ url?: string | null;
117
+ /** Venue-hosted image. */
118
+ image?: string | null;
119
+ /** The exchange this series originates from. Populated by the Router. */
120
+ sourceExchange?: string;
121
+ /** Raw venue-specific fields not promoted to first-class columns. */
122
+ sourceMetadata?: Record<string, unknown>;
123
+ }
89
124
  /**
90
125
  * Candle interval for OHLCV data.
91
126
  *
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Build a `sourceMetadata` object from a raw venue payload, capturing only the
3
+ * venue-specific data that the unified shape would otherwise drop.
4
+ *
5
+ * Keys listed in `promotedKeys` are omitted because they are already
6
+ * represented by first-class Unified / DB columns (price, volume, status, ...),
7
+ * so keeping them here would duplicate data. Everything else on the raw payload
8
+ * is preserved verbatim. `extra` adds non-promoted fields that live on a
9
+ * different raw object (e.g. a parent event's series identifiers attached to a
10
+ * market); `undefined` extras are skipped so we never store empty keys.
11
+ *
12
+ * Returns a new object — the inputs are never mutated.
13
+ */
14
+ export declare function buildSourceMetadata(raw: Record<string, unknown> | null | undefined, promotedKeys: readonly string[], extra?: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildSourceMetadata = buildSourceMetadata;
4
+ /**
5
+ * Build a `sourceMetadata` object from a raw venue payload, capturing only the
6
+ * venue-specific data that the unified shape would otherwise drop.
7
+ *
8
+ * Keys listed in `promotedKeys` are omitted because they are already
9
+ * represented by first-class Unified / DB columns (price, volume, status, ...),
10
+ * so keeping them here would duplicate data. Everything else on the raw payload
11
+ * is preserved verbatim. `extra` adds non-promoted fields that live on a
12
+ * different raw object (e.g. a parent event's series identifiers attached to a
13
+ * market); `undefined` extras are skipped so we never store empty keys.
14
+ *
15
+ * Returns a new object — the inputs are never mutated.
16
+ */
17
+ function buildSourceMetadata(raw, promotedKeys, extra) {
18
+ const promoted = new Set(promotedKeys);
19
+ const out = {};
20
+ if (raw && typeof raw === 'object') {
21
+ for (const [key, value] of Object.entries(raw)) {
22
+ if (!promoted.has(key))
23
+ out[key] = value;
24
+ }
25
+ }
26
+ if (extra) {
27
+ for (const [key, value] of Object.entries(extra)) {
28
+ if (value !== undefined)
29
+ out[key] = value;
30
+ }
31
+ }
32
+ return out;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.46.14",
3
+ "version": "2.48.0",
4
4
  "description": "pmxt is a unified prediction market data API. The ccxt for prediction markets.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "test": "jest -c jest.config.js",
30
30
  "server": "tsx watch src/server/index.ts",
31
31
  "server:prod": "node dist/server/index.js",
32
- "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.46.14,library=urllib3",
33
- "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.46.14,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
32
+ "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.48.0,library=urllib3",
33
+ "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.48.0,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
34
34
  "fetch:openapi": "node scripts/fetch-openapi-specs.js",
35
35
  "extract:jsdoc": "node ../scripts/extract-jsdoc.js",
36
36
  "generate:docs": "npm run extract:jsdoc && node ../scripts/generate-api-docs.js",