pmxt-core 2.49.0 → 2.49.1

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
3
- * Generated at: 2026-06-08T19:06:11.820Z
3
+ * Generated at: 2026-06-08T20:14:31.062Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const kalshiApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.kalshiApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
6
- * Generated at: 2026-06-08T19:06:11.820Z
6
+ * Generated at: 2026-06-08T20:14:31.062Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.kalshiApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
3
- * Generated at: 2026-06-08T19:06:11.859Z
3
+ * Generated at: 2026-06-08T20:14:31.111Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const limitlessApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.limitlessApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
6
- * Generated at: 2026-06-08T19:06:11.859Z
6
+ * Generated at: 2026-06-08T20:14:31.111Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.limitlessApiSpec = {
@@ -411,7 +411,11 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
411
411
  const market = markets.find(m => m.marketId === params.marketId);
412
412
  const outcome = market?.outcomes.find(o => o.outcomeId === params.outcomeId);
413
413
  if (existing) {
414
- const epx = existing.entryPrice * existing.size;
414
+ // entryPrice became nullable in v2.49 for hosted-mode positions,
415
+ // but the mock exchange always populates it on first fill — fall
416
+ // back to the new fill price if a prior fill somehow left it unset.
417
+ const prevEntry = existing.entryPrice ?? price;
418
+ const epx = prevEntry * existing.size;
415
419
  const npx = price * sizeDelta;
416
420
  const newEntry = (epx + npx) / newSize;
417
421
  const ep = round(newEntry, 4);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
3
- * Generated at: 2026-06-08T19:06:11.872Z
3
+ * Generated at: 2026-06-08T20:14:31.126Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const myriadApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.myriadApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
6
- * Generated at: 2026-06-08T19:06:11.872Z
6
+ * Generated at: 2026-06-08T20:14:31.126Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.myriadApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
3
- * Generated at: 2026-06-08T19:06:11.875Z
3
+ * Generated at: 2026-06-08T20:14:31.131Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const opinionApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.opinionApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
6
- * Generated at: 2026-06-08T19:06:11.875Z
6
+ * Generated at: 2026-06-08T20:14:31.131Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.opinionApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
3
- * Generated at: 2026-06-08T19:06:11.828Z
3
+ * Generated at: 2026-06-08T20:14:31.070Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketClobSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketClobSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
6
- * Generated at: 2026-06-08T19:06:11.828Z
6
+ * Generated at: 2026-06-08T20:14:31.070Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketClobSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
3
- * Generated at: 2026-06-08T19:06:11.840Z
3
+ * Generated at: 2026-06-08T20:14:31.086Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketDataSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketDataSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
6
- * Generated at: 2026-06-08T19:06:11.840Z
6
+ * Generated at: 2026-06-08T20:14:31.086Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketDataSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
3
- * Generated at: 2026-06-08T19:06:11.836Z
3
+ * Generated at: 2026-06-08T20:14:31.084Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketGammaSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketGammaSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
6
- * Generated at: 2026-06-08T19:06:11.836Z
6
+ * Generated at: 2026-06-08T20:14:31.084Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
3
- * Generated at: 2026-06-08T19:06:11.866Z
3
+ * Generated at: 2026-06-08T20:14:31.118Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const probableApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.probableApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
6
- * Generated at: 2026-06-08T19:06:11.866Z
6
+ * Generated at: 2026-06-08T20:14:31.118Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
@@ -2612,9 +2612,108 @@ components:
2612
2612
  $ref: '#/components/schemas/ErrorDetail'
2613
2613
  ErrorDetail:
2614
2614
  type: object
2615
+ description: >-
2616
+ Structured error envelope returned inside `BaseResponse.error` and `ErrorResponse.error`. Hosted-mode endpoints
2617
+ populate `code`, `retryable`, and optionally `exchange` / `detail`; legacy local-mode endpoints may still return
2618
+ only `message`.
2615
2619
  properties:
2616
2620
  message:
2617
2621
  type: string
2622
+ description: Human-readable error message.
2623
+ code:
2624
+ type: string
2625
+ description: >-
2626
+ Stable machine-readable error code. Hosted-mode errors use the `HostedTradingError` family (e.g.
2627
+ `INSUFFICIENT_ESCROW_BALANCE`, `BUILT_ORDER_EXPIRED`); pre-hosted local errors use the legacy family (e.g.
2628
+ `BAD_REQUEST`, `NOT_FOUND`).
2629
+ enum:
2630
+ - HOSTED_TRADING_ERROR
2631
+ - INSUFFICIENT_ESCROW_BALANCE
2632
+ - ORDER_SIZE_TOO_SMALL
2633
+ - INVALID_API_KEY
2634
+ - OUTCOME_NOT_FOUND
2635
+ - CATALOG_UNAVAILABLE
2636
+ - BUILT_ORDER_EXPIRED
2637
+ - INVALID_SIGNATURE
2638
+ - NO_LIQUIDITY
2639
+ - MISSING_WALLET_ADDRESS
2640
+ - BAD_REQUEST
2641
+ - AUTHENTICATION_ERROR
2642
+ - PERMISSION_DENIED
2643
+ - NOT_FOUND
2644
+ - ORDER_NOT_FOUND
2645
+ - MARKET_NOT_FOUND
2646
+ - EVENT_NOT_FOUND
2647
+ - RATE_LIMIT_EXCEEDED
2648
+ - INVALID_ORDER
2649
+ - INSUFFICIENT_FUNDS
2650
+ - VALIDATION_ERROR
2651
+ - NETWORK_ERROR
2652
+ - EXCHANGE_NOT_AVAILABLE
2653
+ - NOT_SUPPORTED
2654
+ retryable:
2655
+ type: boolean
2656
+ description: >-
2657
+ Hint for clients: when `true`, the same request may succeed on retry (e.g. transient network or rate-limit
2658
+ conditions); when `false`, the caller should not retry without modifying the request.
2659
+ exchange:
2660
+ type: string
2661
+ nullable: true
2662
+ description: 'Venue the error originated from, when known (e.g. ''polymarket'', ''kalshi'').'
2663
+ detail:
2664
+ type: object
2665
+ additionalProperties: {}
2666
+ nullable: true
2667
+ description: >-
2668
+ Free-form hosted-mode detail blob. Shape depends on `code` — e.g. for `INSUFFICIENT_ESCROW_BALANCE` it may
2669
+ include `{ requested, available }`; for `ORDER_SIZE_TOO_SMALL` it may include `{ min }`; for
2670
+ `BUILT_ORDER_EXPIRED` it may include `{ expiry }`.
2671
+ ExchangeOptions:
2672
+ type: object
2673
+ description: |-
2674
+ Constructor-level options for venue clients (Polymarket, Kalshi, Opinion, etc.).
2675
+ Hosted mode is the default when pmxtApiKey is set; otherwise the SDK runs against
2676
+ a local sidecar with venue credentials.
2677
+ properties:
2678
+ pmxtApiKey:
2679
+ type: string
2680
+ description: >-
2681
+ PMXT customer API key. When set, the SDK routes to api.pmxt.dev (catalog) and trade.pmxt.dev (trading). Get
2682
+ one at pmxt.dev/dashboard.
2683
+ walletAddress:
2684
+ type: string
2685
+ nullable: true
2686
+ description: >-
2687
+ EVM wallet address for hosted reads/writes. Required for endpoints that operate on a wallet (balances,
2688
+ positions, trades, open orders).
2689
+ signer:
2690
+ type: object
2691
+ nullable: true
2692
+ description: >-
2693
+ Optional pre-built signer for hosted writes. If absent and privateKey is set, the SDK auto-wraps privateKey
2694
+ into a signer.
2695
+ privateKey:
2696
+ type: string
2697
+ nullable: true
2698
+ description: >-
2699
+ Private key. In hosted mode, used to derive an EIP-712 signer for writes (wraps into
2700
+ EthAccountSigner/EthersSigner). In self-hosted mode, used as the venue credential directly.
2701
+ baseUrl:
2702
+ type: string
2703
+ nullable: true
2704
+ description: >-
2705
+ Explicit base URL override. When unset, the SDK uses api.pmxt.dev when pmxtApiKey is set, or the local
2706
+ sidecar otherwise.
2707
+ apiKey:
2708
+ type: string
2709
+ nullable: true
2710
+ description: Venue-side API key (e.g. Polymarket CLOB key). Only relevant for self-hosted mode.
2711
+ autoStartServer:
2712
+ type: boolean
2713
+ nullable: true
2714
+ description: >-
2715
+ Auto-start the local sidecar when running self-hosted. Defaults to true when no pmxtApiKey is set, false
2716
+ when hosted.
2618
2717
  BaseRequest:
2619
2718
  type: object
2620
2719
  description: Base request structure with optional credentials
@@ -2847,14 +2946,12 @@ components:
2847
2946
  type: string
2848
2947
  description: 'Human-readable series title (e.g. "ATP Match Winner", "WTA").'
2849
2948
  description:
2850
- oneOf:
2851
- - type: string
2852
- - {}
2949
+ type: string
2950
+ nullable: true
2853
2951
  description: Long-form series description.
2854
2952
  recurrence:
2855
- oneOf:
2856
- - type: string
2857
- - {}
2953
+ type: string
2954
+ nullable: true
2858
2955
  description: 'Recurrence cadence the venue reports (''daily'', ''weekly'', ''annual'', ...).'
2859
2956
  events:
2860
2957
  type: array
@@ -2862,14 +2959,12 @@ components:
2862
2959
  $ref: '#/components/schemas/UnifiedEvent'
2863
2960
  description: Child events. Populated when fetched by id; the list form usually omits this to keep payloads small.
2864
2961
  url:
2865
- oneOf:
2866
- - type: string
2867
- - {}
2962
+ type: string
2963
+ nullable: true
2868
2964
  description: Canonical venue URL for the series.
2869
2965
  image:
2870
- oneOf:
2871
- - type: string
2872
- - {}
2966
+ type: string
2967
+ nullable: true
2873
2968
  description: Venue-hosted image.
2874
2969
  sourceExchange:
2875
2970
  type: string
@@ -3003,6 +3098,18 @@ components:
3003
3098
  orderId:
3004
3099
  type: string
3005
3100
  description: 'The order that produced this trade, if known.'
3101
+ txHash:
3102
+ type: string
3103
+ nullable: true
3104
+ description: Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
3105
+ chain:
3106
+ type: string
3107
+ nullable: true
3108
+ description: Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
3109
+ blockNumber:
3110
+ type: number
3111
+ nullable: true
3112
+ description: Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
3006
3113
  required:
3007
3114
  - id
3008
3115
  - timestamp
@@ -3066,6 +3173,18 @@ components:
3066
3173
  feeRateBps:
3067
3174
  type: number
3068
3175
  description: Fee rate in basis points applied to this order (e.g. 100 = 1%).
3176
+ txHash:
3177
+ type: string
3178
+ nullable: true
3179
+ description: Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
3180
+ chain:
3181
+ type: string
3182
+ nullable: true
3183
+ description: Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
3184
+ blockNumber:
3185
+ type: number
3186
+ nullable: true
3187
+ description: Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
3069
3188
  required:
3070
3189
  - id
3071
3190
  - marketId
@@ -3079,6 +3198,10 @@ components:
3079
3198
  - timestamp
3080
3199
  Position:
3081
3200
  type: object
3201
+ description: >-
3202
+ A current position in a market. In hosted mode, `outcomeLabel`, `entryPrice`, `currentPrice` and `unrealizedPnL`
3203
+ may be null when the server cannot derive them (e.g. `with_mtm=false` or no fill history). Venue-direct callers
3204
+ continue to populate every field.
3082
3205
  properties:
3083
3206
  marketId:
3084
3207
  type: string
@@ -3088,30 +3211,58 @@ components:
3088
3211
  description: The outcome this position is held in.
3089
3212
  outcomeLabel:
3090
3213
  type: string
3091
- description: Human-readable label for the outcome held.
3214
+ nullable: true
3215
+ description: Human-readable label for the outcome held. Optional in hosted mode.
3092
3216
  size:
3093
3217
  type: number
3094
3218
  description: 'Positive for long, negative for short'
3095
3219
  entryPrice:
3096
3220
  type: number
3097
- description: Average entry price for the position (probability between 0.0 and 1.0).
3221
+ nullable: true
3222
+ description: >-
3223
+ Average entry price for the position (probability between 0.0 and 1.0). Optional in hosted mode when no fill
3224
+ history is available.
3098
3225
  currentPrice:
3099
3226
  type: number
3100
- description: Current mark price for the position (probability between 0.0 and 1.0).
3227
+ nullable: true
3228
+ description: >-
3229
+ Current mark price for the position (probability between 0.0 and 1.0). Optional in hosted mode when
3230
+ mark-to-market data is unavailable.
3231
+ currentValue:
3232
+ type: number
3233
+ nullable: true
3234
+ description: Current market value of the position (size * currentPrice). Null when currentPrice is unavailable.
3101
3235
  unrealizedPnL:
3102
3236
  type: number
3103
- description: Unrealized profit or loss at the current price (USD).
3237
+ nullable: true
3238
+ description: >-
3239
+ Unrealized profit or loss at the current price (USD). Optional in hosted mode when mark-to-market data is
3240
+ unavailable.
3104
3241
  realizedPnL:
3105
3242
  type: number
3106
3243
  description: Realized profit or loss booked so far (USD).
3244
+ txHash:
3245
+ type: string
3246
+ nullable: true
3247
+ description: >-
3248
+ Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for
3249
+ non-on-chain venues.
3250
+ chain:
3251
+ type: string
3252
+ nullable: true
3253
+ description: >-
3254
+ Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for
3255
+ non-on-chain venues.
3256
+ blockNumber:
3257
+ type: number
3258
+ nullable: true
3259
+ description: >-
3260
+ Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for
3261
+ non-on-chain venues.
3107
3262
  required:
3108
3263
  - marketId
3109
3264
  - outcomeId
3110
- - outcomeLabel
3111
3265
  - size
3112
- - entryPrice
3113
- - currentPrice
3114
- - unrealizedPnL
3115
3266
  Balance:
3116
3267
  type: object
3117
3268
  properties:
@@ -3127,6 +3278,12 @@ components:
3127
3278
  locked:
3128
3279
  type: number
3129
3280
  description: In open orders
3281
+ venue:
3282
+ type: string
3283
+ nullable: true
3284
+ description: >-
3285
+ Hosted-mode: which venue this balance belongs to in a multi-venue response. Null when the balance is
3286
+ venue-agnostic.
3130
3287
  required:
3131
3288
  - currency
3132
3289
  - total
@@ -3457,6 +3614,12 @@ components:
3457
3614
  populates this.
3458
3615
  raw:
3459
3616
  description: 'The raw, exchange-native payload. Always present.'
3617
+ expiry:
3618
+ type: number
3619
+ nullable: true
3620
+ description: >-
3621
+ Unix epoch (ms) when this built order expires server-side. Submitting after expiry returns
3622
+ BUILT_ORDER_EXPIRED.
3460
3623
  required:
3461
3624
  - exchange
3462
3625
  - params
@@ -3766,17 +3929,14 @@ components:
3766
3929
  confidence:
3767
3930
  type: number
3768
3931
  reasoning:
3769
- oneOf:
3770
- - type: string
3771
- - {}
3932
+ type: string
3933
+ nullable: true
3772
3934
  bestBid:
3773
- oneOf:
3774
- - type: number
3775
- - {}
3935
+ type: number
3936
+ nullable: true
3776
3937
  bestAsk:
3777
- oneOf:
3778
- - type: number
3779
- - {}
3938
+ type: number
3939
+ nullable: true
3780
3940
  required:
3781
3941
  - market
3782
3942
  - relation
@@ -3813,17 +3973,14 @@ components:
3813
3973
  confidence:
3814
3974
  type: number
3815
3975
  reasoning:
3816
- oneOf:
3817
- - type: string
3818
- - {}
3976
+ type: string
3977
+ nullable: true
3819
3978
  bestBid:
3820
- oneOf:
3821
- - type: number
3822
- - {}
3979
+ type: number
3980
+ nullable: true
3823
3981
  bestAsk:
3824
- oneOf:
3825
- - type: number
3826
- - {}
3982
+ type: number
3983
+ nullable: true
3827
3984
  venue:
3828
3985
  type: string
3829
3986
  required:
@@ -3924,9 +4081,8 @@ components:
3924
4081
  type: number
3925
4082
  description: Match confidence score (0.0 to 1.0).
3926
4083
  reasoning:
3927
- oneOf:
3928
- - type: string
3929
- - {}
4084
+ type: string
4085
+ nullable: true
3930
4086
  description: Why the two markets were matched.
3931
4087
  required:
3932
4088
  - marketA
package/dist/types.d.ts CHANGED
@@ -177,6 +177,12 @@ export interface Trade {
177
177
  export interface UserTrade extends Trade {
178
178
  /** The order that produced this trade, if known. */
179
179
  orderId?: string;
180
+ /** Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues. */
181
+ txHash?: string | null;
182
+ /** Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues. */
183
+ chain?: string | null;
184
+ /** Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues. */
185
+ blockNumber?: number | null;
180
186
  }
181
187
  export interface QueuedPromise<T> {
182
188
  /** Internal: resolver for a queued promise. */
@@ -209,23 +215,45 @@ export interface Order {
209
215
  fee?: number;
210
216
  /** Fee rate in basis points applied to this order (e.g. 100 = 1%). */
211
217
  feeRateBps?: number;
218
+ /** Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues. */
219
+ txHash?: string | null;
220
+ /** Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues. */
221
+ chain?: string | null;
222
+ /** Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues. */
223
+ blockNumber?: number | null;
212
224
  }
225
+ /**
226
+ * A current position in a market.
227
+ *
228
+ * In hosted mode, `outcomeLabel`, `entryPrice`, `currentPrice` and
229
+ * `unrealizedPnL` may be null when the server cannot derive them
230
+ * (e.g. `with_mtm=false` or no fill history). Venue-direct callers
231
+ * continue to populate every field.
232
+ */
213
233
  export interface Position {
214
234
  /** The market this position is held in. */
215
235
  marketId: string;
216
236
  /** The outcome this position is held in. */
217
237
  outcomeId: string;
218
- /** Human-readable label for the outcome held. */
219
- outcomeLabel: string;
238
+ /** Human-readable label for the outcome held. Optional in hosted mode. */
239
+ outcomeLabel?: string | null;
220
240
  size: number;
221
- /** Average entry price for the position (probability between 0.0 and 1.0). */
222
- entryPrice: number;
223
- /** Current mark price for the position (probability between 0.0 and 1.0). */
224
- currentPrice: number;
225
- /** Unrealized profit or loss at the current price (USD). */
226
- unrealizedPnL: number;
241
+ /** Average entry price for the position (probability between 0.0 and 1.0). Optional in hosted mode when no fill history is available. */
242
+ entryPrice?: number | null;
243
+ /** Current mark price for the position (probability between 0.0 and 1.0). Optional in hosted mode when mark-to-market data is unavailable. */
244
+ currentPrice?: number | null;
245
+ /** Current market value of the position (size * currentPrice). Null when currentPrice is unavailable. */
246
+ currentValue?: number | null;
247
+ /** Unrealized profit or loss at the current price (USD). Optional in hosted mode when mark-to-market data is unavailable. */
248
+ unrealizedPnL?: number | null;
227
249
  /** Realized profit or loss booked so far (USD). */
228
250
  realizedPnL?: number;
251
+ /** Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for non-on-chain venues. */
252
+ txHash?: string | null;
253
+ /** Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for non-on-chain venues. */
254
+ chain?: string | null;
255
+ /** Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for non-on-chain venues. */
256
+ blockNumber?: number | null;
229
257
  }
230
258
  export interface Balance {
231
259
  currency: string;
@@ -234,6 +262,8 @@ export interface Balance {
234
262
  /** Balance available to trade (excludes locked funds). */
235
263
  available: number;
236
264
  locked: number;
265
+ /** Hosted-mode: which venue this balance belongs to in a multi-venue response. Null when the balance is venue-agnostic. */
266
+ venue?: string | null;
237
267
  }
238
268
  export interface CreateOrderParams {
239
269
  /** The market to trade on. */
@@ -274,4 +304,9 @@ export interface BuiltOrder {
274
304
  };
275
305
  /** The raw, exchange-native payload. Always present. */
276
306
  raw: unknown;
307
+ /**
308
+ * Unix epoch (ms) when this built order expires server-side.
309
+ * Submitting after expiry returns BUILT_ORDER_EXPIRED.
310
+ */
311
+ expiry?: number | null;
277
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.49.0",
3
+ "version": "2.49.1",
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.49.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.49.0,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.49.1,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.49.1,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",