pmxt-core 2.48.6 → 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.
- package/dist/exchanges/gemini-titan/normalizer.js +9 -3
- package/dist/exchanges/gemini-titan/websocket.js +17 -5
- package/dist/exchanges/hyperliquid/normalizer.js +2 -0
- package/dist/exchanges/interfaces.d.ts +2 -2
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +2 -2
- package/dist/exchanges/kalshi/config.d.ts +6 -6
- package/dist/exchanges/kalshi/config.js +8 -8
- package/dist/exchanges/kalshi/fetcher.d.ts +2 -0
- package/dist/exchanges/kalshi/fetcher.js +6 -7
- package/dist/exchanges/kalshi/normalizer.js +6 -1
- package/dist/exchanges/kalshi/websocket.js +21 -9
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/client.js +2 -2
- package/dist/exchanges/limitless/config.d.ts +2 -0
- package/dist/exchanges/limitless/config.js +3 -1
- package/dist/exchanges/limitless/fetcher.d.ts +10 -0
- package/dist/exchanges/limitless/fetcher.js +2 -1
- package/dist/exchanges/limitless/index.js +1 -1
- package/dist/exchanges/limitless/utils.js +3 -3
- package/dist/exchanges/limitless/websocket.js +8 -11
- package/dist/exchanges/metaculus/utils.js +0 -1
- package/dist/exchanges/mock/index.js +5 -1
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +17 -2
- package/dist/exchanges/myriad/normalizer.js +10 -5
- package/dist/exchanges/myriad/utils.js +2 -0
- package/dist/exchanges/opinion/api.d.ts +16 -1
- package/dist/exchanges/opinion/api.js +20 -1
- package/dist/exchanges/opinion/websocket.js +21 -14
- package/dist/exchanges/polymarket/api-clob.d.ts +13 -1
- package/dist/exchanges/polymarket/api-clob.js +26 -1
- package/dist/exchanges/polymarket/api-data.d.ts +1 -1
- package/dist/exchanges/polymarket/api-data.js +1 -1
- package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
- package/dist/exchanges/polymarket/api-gamma.js +1 -1
- package/dist/exchanges/polymarket/auth.js +3 -3
- package/dist/exchanges/polymarket/config.d.ts +1 -0
- package/dist/exchanges/polymarket/config.js +4 -0
- package/dist/exchanges/polymarket/index.js +2 -1
- package/dist/exchanges/polymarket_us/websocket.js +3 -2
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/auth.js +5 -4
- package/dist/exchanges/probable/config.d.ts +2 -0
- package/dist/exchanges/probable/config.js +5 -0
- package/dist/exchanges/probable/websocket.js +2 -1
- package/dist/exchanges/suibets/api.d.ts +1 -1
- package/dist/exchanges/suibets/api.js +1 -1
- package/dist/exchanges/suibets/config.d.ts +1 -1
- package/dist/exchanges/suibets/config.js +2 -2
- package/dist/exchanges/suibets/errors.js +9 -0
- package/dist/exchanges/suibets/fetcher.d.ts +22 -2
- package/dist/exchanges/suibets/fetcher.js +23 -5
- package/dist/exchanges/suibets/index.d.ts +1 -1
- package/dist/exchanges/suibets/index.js +1 -1
- package/dist/exchanges/suibets/normalizer.js +2 -22
- package/dist/feeds/binance/binance-feed.js +6 -3
- package/dist/feeds/chainlink/chainlink-feed.js +5 -2
- package/dist/server/openapi.yaml +199 -41
- package/dist/types.d.ts +44 -8
- package/dist/utils/throttler.js +3 -5
- package/package.json +4 -4
|
@@ -139,7 +139,7 @@ class ChainlinkFeed extends base_feed_1.BaseDataFeed {
|
|
|
139
139
|
// -- CCXT: watchTicker --
|
|
140
140
|
watchTickerImpl(symbol, callback) {
|
|
141
141
|
const sub = { symbol: symbol.toUpperCase(), callback };
|
|
142
|
-
this.subscriptions
|
|
142
|
+
this.subscriptions.push(sub);
|
|
143
143
|
this.ensureConnected().catch((err) => {
|
|
144
144
|
logger_1.logger.error('[ChainlinkFeed] initial connect failed in watchTickerImpl', { error: err instanceof Error ? err.message : String(err) });
|
|
145
145
|
});
|
|
@@ -281,7 +281,10 @@ class ChainlinkFeed extends base_feed_1.BaseDataFeed {
|
|
|
281
281
|
try {
|
|
282
282
|
msg = JSON.parse(text);
|
|
283
283
|
}
|
|
284
|
-
catch {
|
|
284
|
+
catch (error) {
|
|
285
|
+
logger_1.logger.debug('[ChainlinkFeed] failed to parse relay message', {
|
|
286
|
+
error: error instanceof Error ? error.message : String(error),
|
|
287
|
+
});
|
|
285
288
|
return;
|
|
286
289
|
}
|
|
287
290
|
if (msg.op !== 'event')
|
package/dist/server/openapi.yaml
CHANGED
|
@@ -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
|
-
|
|
2851
|
-
|
|
2852
|
-
- {}
|
|
2949
|
+
type: string
|
|
2950
|
+
nullable: true
|
|
2853
2951
|
description: Long-form series description.
|
|
2854
2952
|
recurrence:
|
|
2855
|
-
|
|
2856
|
-
|
|
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
|
-
|
|
2866
|
-
|
|
2867
|
-
- {}
|
|
2962
|
+
type: string
|
|
2963
|
+
nullable: true
|
|
2868
2964
|
description: Canonical venue URL for the series.
|
|
2869
2965
|
image:
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
- {}
|
|
2966
|
+
type: string
|
|
2967
|
+
nullable: true
|
|
2873
2968
|
description: Venue-hosted image.
|
|
2874
2969
|
sourceExchange:
|
|
2875
2970
|
type: string
|
|
@@ -2939,6 +3034,8 @@ components:
|
|
|
2939
3034
|
size:
|
|
2940
3035
|
type: number
|
|
2941
3036
|
description: contracts/shares
|
|
3037
|
+
orderCount:
|
|
3038
|
+
type: number
|
|
2942
3039
|
required:
|
|
2943
3040
|
- price
|
|
2944
3041
|
- size
|
|
@@ -3001,6 +3098,18 @@ components:
|
|
|
3001
3098
|
orderId:
|
|
3002
3099
|
type: string
|
|
3003
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.
|
|
3004
3113
|
required:
|
|
3005
3114
|
- id
|
|
3006
3115
|
- timestamp
|
|
@@ -3064,6 +3173,18 @@ components:
|
|
|
3064
3173
|
feeRateBps:
|
|
3065
3174
|
type: number
|
|
3066
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.
|
|
3067
3188
|
required:
|
|
3068
3189
|
- id
|
|
3069
3190
|
- marketId
|
|
@@ -3077,6 +3198,10 @@ components:
|
|
|
3077
3198
|
- timestamp
|
|
3078
3199
|
Position:
|
|
3079
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.
|
|
3080
3205
|
properties:
|
|
3081
3206
|
marketId:
|
|
3082
3207
|
type: string
|
|
@@ -3086,30 +3211,58 @@ components:
|
|
|
3086
3211
|
description: The outcome this position is held in.
|
|
3087
3212
|
outcomeLabel:
|
|
3088
3213
|
type: string
|
|
3089
|
-
|
|
3214
|
+
nullable: true
|
|
3215
|
+
description: Human-readable label for the outcome held. Optional in hosted mode.
|
|
3090
3216
|
size:
|
|
3091
3217
|
type: number
|
|
3092
3218
|
description: 'Positive for long, negative for short'
|
|
3093
3219
|
entryPrice:
|
|
3094
3220
|
type: number
|
|
3095
|
-
|
|
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.
|
|
3096
3225
|
currentPrice:
|
|
3097
3226
|
type: number
|
|
3098
|
-
|
|
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.
|
|
3099
3235
|
unrealizedPnL:
|
|
3100
3236
|
type: number
|
|
3101
|
-
|
|
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.
|
|
3102
3241
|
realizedPnL:
|
|
3103
3242
|
type: number
|
|
3104
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.
|
|
3105
3262
|
required:
|
|
3106
3263
|
- marketId
|
|
3107
3264
|
- outcomeId
|
|
3108
|
-
- outcomeLabel
|
|
3109
3265
|
- size
|
|
3110
|
-
- entryPrice
|
|
3111
|
-
- currentPrice
|
|
3112
|
-
- unrealizedPnL
|
|
3113
3266
|
Balance:
|
|
3114
3267
|
type: object
|
|
3115
3268
|
properties:
|
|
@@ -3125,6 +3278,12 @@ components:
|
|
|
3125
3278
|
locked:
|
|
3126
3279
|
type: number
|
|
3127
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.
|
|
3128
3287
|
required:
|
|
3129
3288
|
- currency
|
|
3130
3289
|
- total
|
|
@@ -3455,6 +3614,12 @@ components:
|
|
|
3455
3614
|
populates this.
|
|
3456
3615
|
raw:
|
|
3457
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.
|
|
3458
3623
|
required:
|
|
3459
3624
|
- exchange
|
|
3460
3625
|
- params
|
|
@@ -3764,17 +3929,14 @@ components:
|
|
|
3764
3929
|
confidence:
|
|
3765
3930
|
type: number
|
|
3766
3931
|
reasoning:
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
- {}
|
|
3932
|
+
type: string
|
|
3933
|
+
nullable: true
|
|
3770
3934
|
bestBid:
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
- {}
|
|
3935
|
+
type: number
|
|
3936
|
+
nullable: true
|
|
3774
3937
|
bestAsk:
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
- {}
|
|
3938
|
+
type: number
|
|
3939
|
+
nullable: true
|
|
3778
3940
|
required:
|
|
3779
3941
|
- market
|
|
3780
3942
|
- relation
|
|
@@ -3811,17 +3973,14 @@ components:
|
|
|
3811
3973
|
confidence:
|
|
3812
3974
|
type: number
|
|
3813
3975
|
reasoning:
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
- {}
|
|
3976
|
+
type: string
|
|
3977
|
+
nullable: true
|
|
3817
3978
|
bestBid:
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
- {}
|
|
3979
|
+
type: number
|
|
3980
|
+
nullable: true
|
|
3821
3981
|
bestAsk:
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
- {}
|
|
3982
|
+
type: number
|
|
3983
|
+
nullable: true
|
|
3825
3984
|
venue:
|
|
3826
3985
|
type: string
|
|
3827
3986
|
required:
|
|
@@ -3922,9 +4081,8 @@ components:
|
|
|
3922
4081
|
type: number
|
|
3923
4082
|
description: Match confidence score (0.0 to 1.0).
|
|
3924
4083
|
reasoning:
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
- {}
|
|
4084
|
+
type: string
|
|
4085
|
+
nullable: true
|
|
3928
4086
|
description: Why the two markets were matched.
|
|
3929
4087
|
required:
|
|
3930
4088
|
- marketA
|
package/dist/types.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ export interface PriceCandle {
|
|
|
148
148
|
export interface OrderLevel {
|
|
149
149
|
price: number;
|
|
150
150
|
size: number;
|
|
151
|
+
orderCount?: number;
|
|
151
152
|
}
|
|
152
153
|
export interface OrderBook {
|
|
153
154
|
/** Order book bid levels, sorted by price descending. */
|
|
@@ -176,6 +177,12 @@ export interface Trade {
|
|
|
176
177
|
export interface UserTrade extends Trade {
|
|
177
178
|
/** The order that produced this trade, if known. */
|
|
178
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;
|
|
179
186
|
}
|
|
180
187
|
export interface QueuedPromise<T> {
|
|
181
188
|
/** Internal: resolver for a queued promise. */
|
|
@@ -208,23 +215,45 @@ export interface Order {
|
|
|
208
215
|
fee?: number;
|
|
209
216
|
/** Fee rate in basis points applied to this order (e.g. 100 = 1%). */
|
|
210
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;
|
|
211
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
|
+
*/
|
|
212
233
|
export interface Position {
|
|
213
234
|
/** The market this position is held in. */
|
|
214
235
|
marketId: string;
|
|
215
236
|
/** The outcome this position is held in. */
|
|
216
237
|
outcomeId: string;
|
|
217
|
-
/** Human-readable label for the outcome held. */
|
|
218
|
-
outcomeLabel
|
|
238
|
+
/** Human-readable label for the outcome held. Optional in hosted mode. */
|
|
239
|
+
outcomeLabel?: string | null;
|
|
219
240
|
size: number;
|
|
220
|
-
/** Average entry price for the position (probability between 0.0 and 1.0). */
|
|
221
|
-
entryPrice
|
|
222
|
-
/** Current mark price for the position (probability between 0.0 and 1.0). */
|
|
223
|
-
currentPrice
|
|
224
|
-
/**
|
|
225
|
-
|
|
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;
|
|
226
249
|
/** Realized profit or loss booked so far (USD). */
|
|
227
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;
|
|
228
257
|
}
|
|
229
258
|
export interface Balance {
|
|
230
259
|
currency: string;
|
|
@@ -233,6 +262,8 @@ export interface Balance {
|
|
|
233
262
|
/** Balance available to trade (excludes locked funds). */
|
|
234
263
|
available: number;
|
|
235
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;
|
|
236
267
|
}
|
|
237
268
|
export interface CreateOrderParams {
|
|
238
269
|
/** The market to trade on. */
|
|
@@ -273,4 +304,9 @@ export interface BuiltOrder {
|
|
|
273
304
|
};
|
|
274
305
|
/** The raw, exchange-native payload. Always present. */
|
|
275
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;
|
|
276
312
|
}
|
package/dist/utils/throttler.js
CHANGED
|
@@ -17,12 +17,10 @@ class Throttler {
|
|
|
17
17
|
this.maxQueueDepth = config.maxQueueDepth ?? 1000;
|
|
18
18
|
}
|
|
19
19
|
async throttle(cost = 1) {
|
|
20
|
-
return new Promise((resolve) => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
21
|
if (this.queue.length >= this.maxQueueDepth) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
dropped.resolve();
|
|
25
|
-
}
|
|
22
|
+
reject(new Error(`Throttler queue full (max depth ${this.maxQueueDepth})`));
|
|
23
|
+
return;
|
|
26
24
|
}
|
|
27
25
|
this.queue.push({ resolve, cost });
|
|
28
26
|
if (!this.running) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.
|
|
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.
|
|
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.
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@polymarket/clob-client-v2": "^1.0.5",
|
|
51
51
|
"@prob/clob": "0.5.0",
|
|
52
52
|
"@solana/web3.js": "^1.98.4",
|
|
53
|
-
"axios": "^1.
|
|
53
|
+
"axios": "^1.17.0",
|
|
54
54
|
"bs58": "^6.0.0",
|
|
55
55
|
"cors": "^2.8.5",
|
|
56
56
|
"dotenv": "^17.2.3",
|