@dimes-dot-fi/sdk 2.4.0 → 2.7.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 (44) hide show
  1. package/README.md +16 -0
  2. package/dist/{aliases-Dne14KBa.d.cts → aliases-BI1c3Yt0.d.cts} +981 -787
  3. package/dist/{aliases-Dne14KBa.d.ts → aliases-BI1c3Yt0.d.ts} +981 -787
  4. package/dist/{chunk-KNGEIWFR.cjs → chunk-ERM4WP6D.cjs} +8 -4
  5. package/dist/chunk-ERM4WP6D.cjs.map +1 -0
  6. package/dist/{chunk-LXZAXWLO.mjs → chunk-GA7ZBK6W.mjs} +8 -4
  7. package/dist/chunk-GA7ZBK6W.mjs.map +1 -0
  8. package/dist/{chunk-Q34TMZ5J.mjs → chunk-HJ5EVO5A.mjs} +11 -6
  9. package/dist/chunk-HJ5EVO5A.mjs.map +1 -0
  10. package/dist/{chunk-IZI65LZF.cjs → chunk-L273PAD4.cjs} +14 -9
  11. package/dist/chunk-L273PAD4.cjs.map +1 -0
  12. package/dist/contract/index.cjs +1487 -136
  13. package/dist/contract/index.cjs.map +1 -1
  14. package/dist/contract/index.d.cts +135 -8
  15. package/dist/contract/index.d.ts +135 -8
  16. package/dist/contract/index.mjs +1470 -119
  17. package/dist/contract/index.mjs.map +1 -1
  18. package/dist/{dimes-client-DJ1d_p31.d.ts → dimes-client-C4SsCNrZ.d.cts} +48 -3
  19. package/dist/{dimes-client-D9tohawC.d.cts → dimes-client-Ckn8yRG6.d.ts} +48 -3
  20. package/dist/{dimes-error-E9yPAZb-.d.cts → dimes-error-BRysMNV_.d.cts} +2 -2
  21. package/dist/{dimes-error-hSoOierP.d.ts → dimes-error-Ke7yuX1m.d.ts} +2 -2
  22. package/dist/index.cjs +78 -8
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +10 -9
  25. package/dist/index.d.ts +10 -9
  26. package/dist/index.mjs +74 -4
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/{quote-sWguOcoJ.d.cts → quote-06n723we.d.ts} +7 -2
  29. package/dist/{quote-D4QunMtN.d.ts → quote-CcIqLwKb.d.cts} +7 -2
  30. package/dist/react/index.cjs +34 -33
  31. package/dist/react/index.cjs.map +1 -1
  32. package/dist/react/index.d.cts +12 -8
  33. package/dist/react/index.d.ts +12 -8
  34. package/dist/react/index.mjs +7 -6
  35. package/dist/react/index.mjs.map +1 -1
  36. package/dist/{types-Bvj_WDbX.d.cts → types-B881zrxm.d.cts} +1 -1
  37. package/dist/{types-BHU4Qq7e.d.ts → types-CcoiGMbT.d.ts} +1 -1
  38. package/dist/ws/index.d.cts +3 -3
  39. package/dist/ws/index.d.ts +3 -3
  40. package/package.json +1 -1
  41. package/dist/chunk-IZI65LZF.cjs.map +0 -1
  42. package/dist/chunk-KNGEIWFR.cjs.map +0 -1
  43. package/dist/chunk-LXZAXWLO.mjs.map +0 -1
  44. package/dist/chunk-Q34TMZ5J.mjs.map +0 -1
@@ -43,1222 +43,1292 @@ interface components {
43
43
  */
44
44
  polygon_vault_contract_address: string;
45
45
  };
46
- CustomerOriginationFeeTier: {
46
+ CustomerPositionEntry: {
47
47
  /**
48
- * @description Upper leverage bound (inclusive) in basis points for this tier. The last tier is the catch-all.
49
- * @example 40000
48
+ * @description Entry collateral actually charged, formatted as USD. On a partial fill the vault refunds the unused share at open, and this is net of that refund.
49
+ * @example 2.50
50
50
  */
51
- max_leverage_bps: number;
51
+ collateral_usd: string;
52
52
  /**
53
- * @description Protocol origination fee in basis points applied at or below this tier's leverage bound.
54
- * @example 200
53
+ * @description Entry collateral actually charged, in USD pips (10000 pips = $1). On a partial fill the vault refunds the unused share at open, and this is net of that refund.
54
+ * @example 25000
55
55
  */
56
- fee_bps: number;
57
- };
58
- CustomerFeeRatesMarket: {
56
+ collateral_usd_pips: string;
59
57
  /**
60
- * @description Market ticker
61
- * @example TRUMP-2024-WIN
58
+ * @description Entry leverage in basis points (20000 = 2x)
59
+ * @example 20000
62
60
  */
63
- ticker: string;
61
+ leverage_bps: number;
64
62
  /**
65
- * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
66
- * @example 0
63
+ * @description Risk mode the position was opened in. adaptive: the live risk engine manages leverage. committed: the position follows the planned unwinds fixed at quote time.
64
+ * @example adaptive
65
+ * @enum {string}
67
66
  */
68
- polymarket_trading_fee_bps: number;
67
+ risk_mode: "adaptive" | "committed";
69
68
  /**
70
- * @description Polymarket fee-curve exponent (`feeExponent`). `1` for the standard quadratic curve.
71
- * @example 1
69
+ * @description Extra margin locked in the vault on top of collateral, formatted as USD. Zero on adaptive positions.
70
+ * @example 0.00
72
71
  */
73
- polymarket_fee_exponent: number;
74
- };
75
- CustomerFeeRates: {
76
- /** @description Per-market venue fee fields. Only present when the request includes a `ticker` query parameter. */
77
- market?: components["schemas"]["CustomerFeeRatesMarket"];
78
- /** @description Leverage-tiered protocol origination fee schedule. Resolve a leverage to its fee by picking the first tier whose `maxLeverageBps >= leverageBps` (the last tier is the catch-all). */
79
- origination_fee_tiers: components["schemas"]["CustomerOriginationFeeTier"][];
72
+ locked_margin_usd: string;
80
73
  /**
81
- * @description Maximum combined (protocol + partner) origination fee in basis points enforced on-chain.
82
- * @example 1000
74
+ * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive positions.
75
+ * @example 0
83
76
  */
84
- contract_max_origination_fee_bps: number;
77
+ locked_margin_usdc_units: string;
85
78
  /**
86
- * @description Lifetime fee APR in basis points
87
- * @example 2000
79
+ * @description Entry notional formatted as USD
80
+ * @example 5.00
88
81
  */
89
- lifetime_fee_apr_bps: number;
82
+ notional_usd: string;
90
83
  /**
91
- * @description Liquidation fee in basis points
92
- * @example 250
84
+ * @description Entry notional in USD pips
85
+ * @example 50000
93
86
  */
94
- liquidation_fee_bps: number;
87
+ notional_usd_pips: string;
95
88
  /**
96
- * @description This partner's origination fee component in basis points, added to the protocol tier fee. `0` by default.
97
- * @example 0
89
+ * @description Time in milliseconds from position creation to on-chain open confirmation. Null until the position is fully opened on chain.
90
+ * @example 12500
98
91
  */
99
- partner_origination_fee_bps: number;
92
+ open_latency_ms?: number | null;
100
93
  /**
101
- * @description This partner's Polymarket builder taker fee in basis points (flat percentage of notional). `0` by default.
102
- * @example 0
94
+ * @description ISO 8601 timestamp when position was opened
95
+ * @example 2025-01-15T10:30:00.000Z
103
96
  */
104
- partner_trading_fee_bps: number;
105
- };
106
- FeeReportBody: {
97
+ opened_at?: string;
107
98
  /**
108
- * @description Leverage in basis points (20000 = 2x, 100000 = 10x). Must be divisible by 2500. Maximum 10x.
109
- * @example 50000
99
+ * @description Combined origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
100
+ * @example 100
110
101
  */
111
- leverage_bps: number;
102
+ origination_fee_bps: number;
112
103
  /**
113
- * @description Market ticker
114
- * @example TRUMP-2024-WIN
104
+ * @description Protocol portion of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
105
+ * @example 80
115
106
  */
116
- market_ticker: string;
107
+ protocol_origination_fee_bps: number;
117
108
  /**
118
- * @description Notional amount in USD pips (10,000 pips = $1.00)
119
- * @example 50000
109
+ * @description Partner portion of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
110
+ * @example 20
120
111
  */
121
- notional_amount_usd_pips: string;
112
+ partner_origination_fee_bps: number;
122
113
  /**
123
- * @description Market side (yes or no)
124
- * @enum {string}
114
+ * @description Origination fee actually charged, formatted as USD. On a partial fill the vault refunds the unused share of the reserved fee at open, and this is net of that refund.
115
+ * @example 0.05
125
116
  */
126
- effective_side: "yes" | "no";
117
+ origination_fee_usd: string;
127
118
  /**
128
- * @description Effective-side entry price in USD pips (10000 pips = $1) to compute against. When omitted, the market's current reference price is used. Provide it to compute deterministically against a known price.
129
- * @example 5100
119
+ * @description Origination fee actually charged, in USD pips. On a partial fill this is net of the open-time refund.
120
+ * @example 500
130
121
  */
131
- entry_price_usd_pips?: string;
132
- };
133
- CustomerFeeReport: {
122
+ origination_fee_usd_pips: string;
134
123
  /**
135
- * @description Market ticker
136
- * @example TRUMP-2024-WIN
124
+ * @description Entry price formatted as USD
125
+ * @example 0.50
137
126
  */
138
- market_ticker: string;
127
+ price_usd: string;
139
128
  /**
140
- * @description Market side
141
- * @enum {string}
129
+ * @description Entry price in USD pips
130
+ * @example 5000
142
131
  */
143
- effective_side: "yes" | "no";
132
+ price_usd_pips: string;
144
133
  /**
145
- * @description Leverage in basis points (20000 = 2x)
146
- * @example 20000
134
+ * @description Effective entry price (actual fill price on the prediction market) formatted as USD, computed as the notional actually spent divided by the tokens actually delivered. On a partial fill this reflects the filled portion only, so it never exceeds $1.00. Null until the fill is recorded on chain.
135
+ * @example 0.5025
147
136
  */
148
- leverage_bps: number;
137
+ effective_entry_price_usd?: string | null;
149
138
  /**
150
- * @description Entry price used for the computation, in USD pips
151
- * @example 5100
139
+ * @description Effective entry price in USD pips. Null until the fill is recorded on chain.
140
+ * @example 5025
152
141
  */
153
- entry_price_usd_pips: string;
142
+ effective_entry_price_usd_pips?: string | null;
154
143
  /**
155
- * @description Notional in USD pips (10000 pips = $1)
156
- * @example 500000
144
+ * @description Execution slippage between the offer's indicative entry price and the actual fill price, in basis points. Signed: positive means the fill was worse than the quote, negative means the fill was better. Null until the fill is recorded on chain.
145
+ * @example 50
157
146
  */
158
- notional_amount_usd_pips: string;
147
+ effective_slippage_bps?: number | null;
159
148
  /**
160
- * @description Notional in USDC units (1,000,000 = 1 USDC)
161
- * @example 50000000
149
+ * @description Original position token units delivered when the position opened (1000000 units = 1 token). Unlike `current.positionTokenUnits` (the live, possibly partially-closed survivor), this is the fixed size credited at open and is the basis for the partial-close minimum. Null until the open fill is recorded on chain.
150
+ * @example 10000000
162
151
  */
163
- notional_usdc_units: string;
152
+ position_token_units?: string | null;
164
153
  /**
165
- * @description Collateral in USDC units
166
- * @example 25000000
154
+ * @description How much of the requested size was actually filled when the position opened, in basis points (10000 = 100%). Computed as actual open notional / requested notional and FROZEN at open — it does NOT change when the position is partially closed. Use this for an 'opened at X% of requested' badge. Null until the open fill is recorded on chain.
155
+ * @example 9657
167
156
  */
168
- collateral_usdc_units: string;
157
+ initial_fill_bps?: number | null;
158
+ };
159
+ CustomerPositionFailure: {
169
160
  /**
170
- * @description Combined origination fee in basis points
171
- * @example 200
161
+ * @description Failure reason code
162
+ * @example price_exceeded_tolerance
172
163
  */
173
- origination_fee_bps: number;
164
+ reason: string;
165
+ };
166
+ CustomerPositionUnwind: {
174
167
  /**
175
- * @description Origination fee in USDC units
176
- * @example 1000000
168
+ * @description executed: an unwind that landed on-chain, as recorded by the deleveraging itself. planned: a committed-mode rung that fires if the price reaches triggerPriceUsdPips. triggered: a committed-mode rung whose trigger price was reached, stamped with executedAt. superseded: a committed-mode rung that can no longer fire because a partial close already took the position below its target leverage. Rung rows (planned, triggered, superseded) are the signed ladder and are only returned when the request asks for them; they describe what was promised, while executed rows describe what actually happened.
169
+ * @example executed
170
+ * @enum {string}
177
171
  */
178
- origination_fee_usdc_units: string;
172
+ status: "executed" | "planned" | "superseded" | "triggered";
179
173
  /**
180
- * @description Protocol component of the origination fee in basis points
181
- * @example 200
174
+ * @description The market signal that triggered the risk-model inference behind this unwind (e.g. `spread_blowout`, `depth_decay`, `price_drop_severe`). Null for unwinds not tied to an inference run, such as manually triggered deleveraging.
175
+ * @example spread_blowout
176
+ * @enum {string|null}
182
177
  */
183
- protocol_origination_fee_bps: number;
178
+ reason?: "activity_surge" | "cancel_acceleration" | "crypto_move" | "depth_decay" | "depth_drain" | "depth_entry_drain" | "game_start" | "large_holder" | "last_trade_divergence" | "lead_change" | "post_hard_exit_losing" | "position_exposure" | "price_drop_full_exit" | "price_drop_moderate" | "price_drop_severe" | "price_drop_warning" | "spread_blowout" | "spread_spike" | "spread_warning" | "stale_refresh" | "unknown" | null;
184
179
  /**
185
- * @description Partner component of the origination fee in basis points
186
- * @example 0
180
+ * @description Leverage after unwind in basis points (20000 = 2x)
181
+ * @example 30000
187
182
  */
188
- partner_origination_fee_bps: number;
183
+ after_leverage_bps: number;
189
184
  /**
190
- * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
191
- * @example 0
185
+ * @description Leverage before unwind in basis points (20000 = 2x)
186
+ * @example 60000
192
187
  */
193
- polymarket_trading_fee_bps: number;
188
+ before_leverage_bps: number;
194
189
  /**
195
- * @description Partner Polymarket builder taker fee in basis points (flat percentage of notional).
196
- * @example 0
190
+ * @description ISO 8601 timestamp when the unwind was executed on-chain. Null on planned unwinds, which have not happened yet.
191
+ * @example 2025-06-02T14:30:00.000Z
197
192
  */
198
- partner_trading_fee_bps: number;
193
+ executed_at?: string | null;
199
194
  /**
200
- * @description Expected venue trading fee in USDC units charged to open the position (protocol venue fee + partner builder fee), computed from notional and entry price.
201
- * @example 2204118
195
+ * @description Price at which this planned unwind fires, formatted as USD. Null on executed unwinds.
196
+ * @example 0.42
202
197
  */
203
- expected_open_trading_fee_usdc_units: string;
198
+ trigger_price_usd?: string | null;
204
199
  /**
205
- * @description Total amount the user must provide to open, in USDC units.
206
- * @example 28204118
200
+ * @description Price at which this planned unwind fires, in USD pips (10000 pips = $1). Null on executed unwinds.
201
+ * @example 4200
207
202
  */
208
- total_user_amount_usdc_units: string;
203
+ trigger_price_usd_pips?: string | null;
209
204
  /**
210
- * @description Deterministic at-entry liquidation price ESTIMATE in USD pips (10000 pips = $1): `entry * (L-1)/L * (1 + liquidationFeeBps/10000)`. This is a closed-form estimate; the binding offer uses a TWAP/inference-based price that may differ.
211
- * @example 2629
205
+ * @description Human-readable explanation of `reason` — a customer-facing sentence describing the market condition that triggered this deleverage. Null whenever `reason` is null.
206
+ * @example The bid-ask spread widened sharply beyond its recent baseline, signalling thinning liquidity.
212
207
  */
213
- estimated_liquidation_price_usd_pips: string;
208
+ reason_detail?: string | null;
209
+ };
210
+ CustomerPositionUnwindList: {
211
+ data: components["schemas"]["CustomerPositionUnwind"][];
212
+ has_more: boolean;
213
+ total_count?: number;
214
214
  /**
215
- * @description Gross maximum gain in USDC units: full value on a win (settlement at $1) minus notional, before fees. Profit over principal; may be negative.
216
- * @example 48039215
215
+ * @description Current leverage of the position in basis points (20000 = 2x), null if not yet calculated
216
+ * @example 30000
217
217
  */
218
- gross_max_gain_usdc_units: string;
218
+ current_leverage_bps: number | null;
219
219
  /**
220
- * @description Net maximum gain in USDC units: grossMaxGain minus the open trading fee and the origination fee. Assumes a win via settlement (no exit trading fee) and excludes lifetime fees, so it is an upper bound. May be negative.
221
- * @example 44835097
220
+ * @description ISO 8601 timestamp when the position was opened on-chain (null if not yet opened)
221
+ * @example 2025-06-01T12:00:00.000Z
222
222
  */
223
- net_max_gain_usdc_units: string;
223
+ originated_at: string | null;
224
+ /**
225
+ * @description Leverage at position origination in basis points (20000 = 2x)
226
+ * @example 60000
227
+ */
228
+ origination_leverage_bps: number;
224
229
  };
225
- CustomerLimit: {
230
+ CustomerCloseAttempt: {
226
231
  /**
227
- * @description Total limit formatted as USD
228
- * @example 1000.00
232
+ * @description Outcome of the close attempt. `deferred` means the close could not complete yet and was postponed.
233
+ * @enum {string}
229
234
  */
230
- limit_usd: string;
235
+ outcome: "deferred";
231
236
  /**
232
- * @description Total limit in USD pips (10000 pips = $1)
233
- * @example 10000000
237
+ * @description Why the close was deferred. `awaiting_settlement`: the market resolved before the position could be sold, so the remaining tokens will be redeemed when the market settles rather than sold on the order book.
238
+ * @enum {string}
234
239
  */
235
- limit_usd_pips: string;
240
+ reason: "awaiting_settlement";
236
241
  /**
237
- * @description Remaining available limit formatted as USD
238
- * @example 750.00
242
+ * @description ISO-8601 timestamp of when the close was requested.
243
+ * @example 2026-06-15T17:27:11.736Z
239
244
  */
240
- remaining_usd: string;
245
+ deferred_at: string;
246
+ };
247
+ CustomerPendingOperation: {
241
248
  /**
242
- * @description Remaining available limit in USD pips
243
- * @example 7500000
249
+ * @description The lifecycle operation currently in flight on this position. Present whenever the position is mid-operation (open, close, partial close, unwind, liquidate, or settle); null when the position is at rest. Note `status` stays `open` throughout a `partial_close`, so this is the only signal a slice is in flight after a reload.
250
+ * @enum {string}
244
251
  */
245
- remaining_usd_pips: string;
252
+ type: "open" | "close" | "partial_close" | "unwind" | "liquidate" | "settle";
246
253
  /**
247
- * @description Current usage formatted as USD
248
- * @example 250.00
254
+ * @description Sub-state of the operation: `requested` (submitted, not yet executing), `initiated` (executing on the venue), `pending` (tokens withdrawn, finalizing on chain), `awaiting_settlement` (a close deferred until the market settles). Null when the operation has no distinct phase.
255
+ * @example initiated
256
+ * @enum {string|null}
249
257
  */
250
- usage_usd: string;
258
+ phase?: "requested" | "initiated" | "pending" | "awaiting_settlement" | null;
251
259
  /**
252
- * @description Current usage in USD pips
253
- * @example 2500000
260
+ * @description Token units involved in the in-flight operation (1000000 units = 1 token). For `partial_close` this is the slice being closed; for `close`/`liquidate` the units withdrawn; for the awaiting-settlement close the remaining tokens. Null when the operation carries no specific token amount.
261
+ * @example 5000000
254
262
  */
255
- usage_usd_pips: string;
263
+ token_units?: string | null;
256
264
  };
257
- CustomerOriginationTier: {
265
+ CustomerPositionCurrent: {
258
266
  /**
259
- * @description Origination fee in basis points for this tier
260
- * @example 100
267
+ * @description Current book-value leverage in basis points (20000 = 2x)
268
+ * @example 18000
261
269
  */
262
- fee_bps: number;
270
+ book_leverage_bps: number;
263
271
  /**
264
- * @description Maximum leverage in basis points for this tier
265
- * @example 20000
272
+ * @description Current collateral formatted as USD
273
+ * @example 2.50
266
274
  */
267
- max_leverage_bps: number;
268
- };
269
- CustomerFees: {
275
+ collateral_usd: string;
270
276
  /**
271
- * @description Lifetime fee APR in basis points
272
- * @example 500
277
+ * @description Current collateral in USD pips
278
+ * @example 25000
273
279
  */
274
- lifetime_apr_bps: number;
280
+ collateral_usd_pips: string;
275
281
  /**
276
- * @description Liquidation fee in basis points
277
- * @example 200
282
+ * @description Effective collateral formatted as USD
283
+ * @example 2.45
278
284
  */
279
- liquidation_bps: number;
280
- /** @description Origination fee tiers by leverage */
281
- origination_tiers: components["schemas"]["CustomerOriginationTier"][];
282
- };
283
- CustomerMaxMarketLeveragePerNotional: {
285
+ effective_collateral_usd: string;
284
286
  /**
285
- * @description Maximum market leverage in basis points when the position notional is $100
286
- * @example 100000
287
+ * @description Effective collateral after fees in USD pips
288
+ * @example 24500
287
289
  */
288
- at100_usd_bps: number;
290
+ effective_collateral_usd_pips: string;
289
291
  /**
290
- * @description Maximum market leverage in basis points when the position notional is $500
291
- * @example 80000
292
+ * @deprecated
293
+ * @description Current leverage in basis points
294
+ * @example 18000
292
295
  */
293
- at500_usd_bps: number;
296
+ leverage_bps: number;
294
297
  /**
295
- * @description Maximum market leverage in basis points when the position notional is $1,000
296
- * @example 60000
298
+ * @description Current market-value leverage in basis points, computed from the live oracle price. Null when the position is insolvent (equity <= 0).
299
+ * @example 19500
297
300
  */
298
- at1000_usd_bps: number;
301
+ market_leverage_bps?: number | null;
299
302
  /**
300
- * @description Maximum market leverage in basis points when the position notional is $10,000
301
- * @example 30000
303
+ * @description Current mark price formatted as USD
304
+ * @example 0.55
302
305
  */
303
- at10000_usd_bps: number;
304
- };
305
- CustomerSidedMaxMarketLeveragePerNotional: {
306
- /** @description Per-notional max market leverage for the YES side */
307
- yes: components["schemas"]["CustomerMaxMarketLeveragePerNotional"];
308
- /** @description Per-notional max market leverage for the NO side */
309
- no: components["schemas"]["CustomerMaxMarketLeveragePerNotional"];
310
- };
311
- CustomerLeverage: {
306
+ mark_price_usd: string;
312
307
  /**
313
- * @deprecated
314
- * @description Deprecated: use maxYesBps and maxNoBps. Populated as min(maxYesBps, maxNoBps) for backwards compatibility.
315
- * @example 50000
308
+ * @description Current mark price in USD pips
309
+ * @example 5500
316
310
  */
317
- max_bps: number;
318
- /** @description Max market leverage per side, broken out by position notional. Slippage grows with notional, so larger notionals have lower max leverage. The UI slider should publish the leverage that matches the user's selected notional. */
319
- max_market_leverage_per_notional: components["schemas"]["CustomerSidedMaxMarketLeveragePerNotional"];
311
+ mark_price_usd_pips: string;
320
312
  /**
321
- * @description Maximum leverage in basis points for the NO side
322
- * @example 50000
313
+ * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) as return on equity in basis points
314
+ * @example 1800
323
315
  */
324
- max_no_bps: number;
316
+ net_unrealized_pnl_bps: number;
325
317
  /**
326
- * @description Maximum leverage in basis points for the YES side
327
- * @example 50000
318
+ * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) formatted as USD
319
+ * @example 0.45
328
320
  */
329
- max_yes_bps: number;
321
+ net_unrealized_pnl_usd: string;
330
322
  /**
331
- * @description Minimum leverage in basis points
332
- * @example 10000
323
+ * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) in USD pips (can be negative)
324
+ * @example 4500
333
325
  */
334
- min_bps: number;
326
+ net_unrealized_pnl_usd_pips: string;
335
327
  /**
336
- * @description Leverage step increment in basis points
337
- * @example 1000
328
+ * @description Current notional formatted as USD
329
+ * @example 5.50
338
330
  */
339
- step_bps: number;
340
- };
341
- CustomerMarketPolymarket: {
331
+ notional_usd: string;
342
332
  /**
343
- * @description Polymarket market slug, matching the slug in Polymarket URLs and Gamma API responses.
344
- * @example will-trump-win-the-2024-election
333
+ * @description Current notional in USD pips
334
+ * @example 55000
345
335
  */
346
- slug: string;
336
+ notional_usd_pips: string;
347
337
  /**
348
- * @description Polymarket CTF condition ID for this market. Use it to look the market up on Polymarket's CLOB and Gamma APIs. Null for the small number of markets where Polymarket has not exposed a condition ID.
349
- * @example 0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890
338
+ * @description Smallest partial-close slice the contract will accept right now, in token units (1000000 units = 1 token): `max(5 tokens, 20% of the original opened size)`. Null when the position is not partial-closeable (an operation is already in flight, the open fill isn't recorded yet, or the survivor is below the minimum).
339
+ * @example 5000000
350
340
  */
351
- condition_id?: string | null;
341
+ min_partial_close_token_units?: string | null;
352
342
  /**
353
- * @description Polymarket CLOB token ID for the NO outcome (the ERC1155 position token ID).
354
- * @example 71321045679252212594626385532706912750332728571942532289631379312455583992563
343
+ * @description Largest partial-close slice allowed right now, in token units (1000000 units = 1 token). Two bounds apply and this is the tighter of them: a position may partial-close at most 80% of its original opened size in total over its life (past that only a full close remains), and no single slice may drop the survivor's collateral below the on-chain minimum. Null when the position is not partial-closeable.
344
+ * @example 10000000
355
345
  */
356
- no_token_id: string;
346
+ max_partial_close_token_units?: string | null;
357
347
  /**
358
- * @description Polymarket CLOB token ID for the YES outcome (the ERC1155 position token ID).
359
- * @example 21742633143463906290569050155826241533067272736897614950488156847949938836455
348
+ * @description Position token units held (1000000 units = 1 token)
349
+ * @example 10000000
360
350
  */
361
- yes_token_id: string;
362
- };
363
- CustomerSideEligibility: {
351
+ position_token_units: string;
364
352
  /**
365
- * @description Whether this market is accepting new positions on this side
366
- * @example true
353
+ * @description Fraction of the originally opened size still held, in basis points (10000 = 100%). Computed as current token units / original opened token units. This LEGITIMATELY DECREASES after each partial close (e.g. 7000 = 70% remaining after a 30% close) and is not a fill problem. Null until the open fill is recorded on chain.
354
+ * @example 7000
367
355
  */
368
- accepting_new_positions: boolean;
356
+ remaining_bps?: number | null;
369
357
  /**
370
- * @description Reason code if this side is not accepting new positions; null when accepting
371
- * @example QUOTE_MARKET_NOT_ELIGIBLE
358
+ * @description Total position value formatted as USD
359
+ * @example 3.00
372
360
  */
373
- rejection_reason_code?: string | null;
374
- };
375
- CustomerSidedEligibility: {
376
- /** @description Eligibility for the YES side */
377
- yes: components["schemas"]["CustomerSideEligibility"];
378
- /** @description Eligibility for the NO side */
379
- no: components["schemas"]["CustomerSideEligibility"];
380
- };
381
- CustomerMarketPrices: {
361
+ position_value_usd: string;
382
362
  /**
383
- * @description NO side ask price formatted as USD
384
- * @example 0.51
363
+ * @description Total position value in USD pips
364
+ * @example 30000
385
365
  */
386
- no_ask_price_usd: string;
366
+ position_value_usd_pips: string;
387
367
  /**
388
- * @description NO side ask price in USD pips (10000 pips = $1)
389
- * @example 5100
368
+ * @description Unrealized PnL as return on equity in basis points (1000 = 10%)
369
+ * @example 2000
390
370
  */
391
- no_ask_price_usd_pips: string;
371
+ unrealized_pnl_bps: number;
392
372
  /**
393
- * @description NO side bid price formatted as USD
394
- * @example 0.49
373
+ * @description Unrealized PnL formatted as USD
374
+ * @example 0.50
395
375
  */
396
- no_bid_price_usd: string;
376
+ unrealized_pnl_usd: string;
397
377
  /**
398
- * @description NO side bid price in USD pips (10000 pips = $1)
399
- * @example 4900
378
+ * @description Unrealized PnL in USD pips (can be negative)
379
+ * @example 5000
400
380
  */
401
- no_bid_price_usd_pips: string;
381
+ unrealized_pnl_usd_pips: string;
382
+ };
383
+ CustomerPositionOpenFees: {
402
384
  /**
403
- * @description YES side ask price formatted as USD
404
- * @example 0.51
385
+ * @description Accrued lifetime fee formatted as USD
386
+ * @example 0.01
405
387
  */
406
- yes_ask_price_usd: string;
388
+ accrued_lifetime_fee_usd: string;
407
389
  /**
408
- * @description YES side ask price in USD pips (10000 pips = $1)
409
- * @example 5100
390
+ * @description Accrued lifetime fee in USD pips
391
+ * @example 100
410
392
  */
411
- yes_ask_price_usd_pips: string;
393
+ accrued_lifetime_fee_usd_pips: string;
412
394
  /**
413
- * @description YES side bid price formatted as USD
414
- * @example 0.49
395
+ * @description Venue (Polymarket) trading fees paid so far on this position, summed across open and any force-unwind exchange transactions, formatted as USD.
396
+ * @example 0.02
415
397
  */
416
- yes_bid_price_usd: string;
398
+ accrued_venue_fee_usd: string;
417
399
  /**
418
- * @description YES side bid price in USD pips (10000 pips = $1)
419
- * @example 4900
400
+ * @description Venue trading fees paid so far on this position in USD pips.
401
+ * @example 200
420
402
  */
421
- yes_bid_price_usd_pips: string;
422
- };
423
- CustomerMarket: {
403
+ accrued_venue_fee_usd_pips: string;
424
404
  /**
425
- * @description Market category
426
- * @example politics
405
+ * @description Lifetime fee APR in basis points
406
+ * @example 500
427
407
  */
428
- category: string;
429
- /** @description Fee configuration */
430
- fees: components["schemas"]["CustomerFees"];
408
+ lifetime_apr_bps: number;
431
409
  /**
432
- * @description Market ID
433
- * @example dm_mkt_abc123
410
+ * @description Pending lifetime fee formatted as USD
411
+ * @example 0.005
434
412
  */
435
- id: string;
436
- /** @description Leverage configuration */
437
- leverage: components["schemas"]["CustomerLeverage"];
413
+ pending_lifetime_fee_usd: string;
438
414
  /**
439
- * @description Prediction market provider
440
- * @enum {string}
415
+ * @description Pending lifetime fee in USD pips
416
+ * @example 50
441
417
  */
442
- provider: "polymarket";
418
+ pending_lifetime_fee_usd_pips: string;
443
419
  /**
444
- * @description Current market status
445
- * @enum {string}
420
+ * @description Sum of all fees accrued or owed so far (origination + accrued lifetime + pending lifetime + accrued venue), formatted as USD. Mirrors closed positions' `fees.totalFeesUsd`.
421
+ * @example 0.085
446
422
  */
447
- status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
423
+ total_fees_usd: string;
448
424
  /**
449
- * @description Market tags for filtering
450
- * @example [
451
- * "politics",
452
- * "election"
453
- * ]
425
+ * @description Sum of all fees accrued or owed so far (origination + accrued lifetime + pending lifetime + accrued venue) in USD pips.
426
+ * @example 850
454
427
  */
455
- tags: string[];
456
- /** @description Polymarket identifiers for this market, for mapping our markets onto Polymarket data feeds. Always present (all live markets are Polymarket-sourced). */
457
- polymarket: components["schemas"]["CustomerMarketPolymarket"];
428
+ total_fees_usd_pips: string;
429
+ };
430
+ CustomerPositionRisk: {
458
431
  /**
459
- * @deprecated
460
- * @description Deprecated: use `polymarket.slug`. Market ticker sourced from the upstream trading venue.
461
- * @example will-trump-win-the-2024-election
432
+ * @description Current liquidation price formatted as USD
433
+ * @example 0.35
462
434
  */
463
- ticker: string;
464
- /** @description Market title */
465
- title?: string;
466
- /** @description Latest bid/ask prices for YES and NO sides. Only present when the request includes `expand=prices`. */
467
- prices?: components["schemas"]["CustomerMarketPrices"] | null;
435
+ current_liquidation_price_usd: string;
468
436
  /**
469
- * @description Whether this market is accepting new positions
470
- * @example true
437
+ * @description Current liquidation price in USD pips
438
+ * @example 3500
471
439
  */
472
- accepting_new_positions: boolean;
440
+ current_liquidation_price_usd_pips: string;
473
441
  /**
474
- * @description ISO 8601 timestamp when market closes
475
- * @example 2025-01-20T12:00:00.000Z
442
+ * @description Margin health 0-10000 (10000 at entry, 0 at liquidation)
443
+ * @example 7500
476
444
  */
477
- close_time?: string;
445
+ health_bps: number;
478
446
  /**
479
- * @description ISO 8601 timestamp when this market was first discovered and listed on the platform
480
- * @example 2025-01-10T08:00:00.000Z
447
+ * @description Buffer to liquidation in basis points
448
+ * @example 500
481
449
  */
482
- discovered_at: string;
450
+ liquidation_buffer_bps: number;
483
451
  /**
484
- * @description ISO 8601 timestamp of the latest time a new position can be opened in this market
485
- * @example 2025-01-20T11:30:00.000Z
452
+ * @description Liquidation fee in basis points
453
+ * @example 200
486
454
  */
487
- latest_enter_at?: string;
455
+ liquidation_fee_bps: number;
488
456
  /**
489
- * @description Minimum collateral amount formatted as USD
490
- * @example 0.02
457
+ * @description Dollar distance to liquidation formatted as USD
458
+ * @example 0.50
491
459
  */
492
- min_collateral_usd: string;
460
+ margin_buffer_usd: string;
493
461
  /**
494
- * @description Minimum collateral amount in USD pips (10000 pips = $1)
495
- * @example 200000
462
+ * @description Dollar distance to liquidation in USD pips
463
+ * @example 5000
496
464
  */
497
- min_collateral_usd_pips: string;
465
+ margin_buffer_usd_pips: string;
466
+ };
467
+ CustomerPositionTiming: {
468
+ /** @description Whether settlement is pending (market resolved or voided, settlement not yet executed) */
469
+ is_settlement_pending: boolean;
470
+ /** @description Whether the market was voided (closed with no winner, 50/50 payout at $0.50 per token) */
471
+ is_voided: boolean;
498
472
  /**
499
- * @description Minimum notional amount formatted as USD
500
- * @example 5.00
473
+ * @description ISO 8601 timestamp when market closes
474
+ * @example 2025-01-20T12:00:00.000Z
501
475
  */
502
- min_notional_usd: string;
476
+ market_close_time?: string;
503
477
  /**
504
- * @description Minimum notional amount in USD pips (10000 pips = $1)
505
- * @example 50000
478
+ * @description Market status from the prediction market provider. When 'determined' or 'finalized', mark price reflects the settlement outcome ($1 or $0)
479
+ * @example active
480
+ * @enum {string}
506
481
  */
507
- min_notional_usd_pips: string;
482
+ market_status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
508
483
  /**
509
- * @description Where this market sits on the road to settlement. `none` — still trading, nothing pending. `awaiting_resolution` — the market has closed and the outcome is decided, but the prediction market provider has not yet published the result on chain, so nothing can be redeemed yet. `settling` — the result is published and open positions are being settled. `voided` — the market was voided and every token pays out at $0.50. `unresolved_upstream` — the market disappeared from the provider before publishing a result and may never resolve.
510
- * @example none
484
+ * @description Where this market sits on the road to settlement. `none` — still trading, nothing pending. `awaiting_resolution` — the market has closed and the outcome is decided, but the prediction market provider has not yet published the result on chain, so nothing can be redeemed yet. `settling` — the result is published and we are settling the position. `voided` — the market was voided and every token pays out at $0.50. `unresolved_upstream` — the market disappeared from the provider before publishing a result and may never resolve.
485
+ * @example awaiting_resolution
511
486
  * @enum {string}
512
487
  */
513
488
  settlement_state: "awaiting_resolution" | "none" | "settling" | "unresolved_upstream" | "voided";
514
489
  /**
515
- * @description Capacity-limited maximum notional for NO side formatted as USD
516
- * @example 50.00
517
- */
518
- capacity_max_notional_no_usd?: string | null;
519
- /**
520
- * @description Capacity-limited maximum notional for NO side in USD pips (10000 pips = $1)
521
- * @example 500000000
522
- */
523
- capacity_max_notional_no_usd_pips?: string | null;
524
- /**
525
- * @description Capacity-limited maximum notional for YES side formatted as USD
526
- * @example 50.00
527
- */
528
- capacity_max_notional_yes_usd?: string | null;
529
- /**
530
- * @description Capacity-limited maximum notional for YES side in USD pips (10000 pips = $1)
531
- * @example 500000000
490
+ * @description Minutes until market closes
491
+ * @example 1440
532
492
  */
533
- capacity_max_notional_yes_usd_pips?: string | null;
493
+ time_to_close_minutes?: number;
494
+ };
495
+ CustomerOpenPosition: {
496
+ /** @description Entry details */
497
+ entry: components["schemas"]["CustomerPositionEntry"];
498
+ /** @description Failure details if the position failed */
499
+ failure?: components["schemas"]["CustomerPositionFailure"];
534
500
  /**
535
- * @description Maximum notional available for NO side formatted as USD. Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
536
- * @example 50.00
501
+ * @description Position ID
502
+ * @example dm_pos_abc123
537
503
  */
538
- max_notional_no_usd?: string;
504
+ id: string;
539
505
  /**
540
- * @description Maximum notional available for NO side in USD pips (10000 pips = $1). Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
541
- * @example 500000000
506
+ * @description Name of the partner the position was opened through.
507
+ * @example Acme Markets
542
508
  */
543
- max_notional_no_usd_pips?: string;
509
+ partner: string;
544
510
  /**
545
- * @description Maximum notional available for YES side formatted as USD. Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
546
- * @example 50.00
511
+ * @description Prediction market provider
512
+ * @enum {string}
547
513
  */
548
- max_notional_yes_usd?: string;
514
+ provider: "polymarket";
549
515
  /**
550
- * @description Maximum notional available for YES side in USD pips (10000 pips = $1). Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
551
- * @example 500000000
516
+ * @description Market side
517
+ * @enum {string}
552
518
  */
553
- max_notional_yes_usd_pips?: string;
519
+ side: "yes" | "no";
554
520
  /**
555
- * @description Slippage-limited maximum notional for NO side formatted as USD
556
- * @example 50.00
521
+ * @description Simplified position status. A position that was deleveraged almost entirely and then force-sold for a trivial remainder reports 'settled' once the market resolves against it. The 'status' query parameter still filters on the underlying mechanism, so such a position is returned by status=liquidated.
522
+ * @enum {string}
557
523
  */
558
- slippage_max_notional_no_usd?: string | null;
524
+ status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
525
+ /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
526
+ unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
527
+ /** @description Current position state */
528
+ current: components["schemas"]["CustomerPositionCurrent"];
529
+ /** @description Fee details for open position */
530
+ fees: components["schemas"]["CustomerPositionOpenFees"];
531
+ /** @description Risk metrics */
532
+ risk: components["schemas"]["CustomerPositionRisk"];
533
+ /** @description Timing information */
534
+ timing: components["schemas"]["CustomerPositionTiming"];
559
535
  /**
560
- * @description Slippage-limited maximum notional for NO side in USD pips (10000 pips = $1)
561
- * @example 500000000
536
+ * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
537
+ * @example 84000
562
538
  */
563
- slippage_max_notional_no_usd_pips?: string | null;
539
+ effective_leverage_bps: number;
564
540
  /**
565
- * @description Slippage-limited maximum notional for YES side formatted as USD
566
- * @example 50.00
541
+ * @description Market ticker identifier
542
+ * @example TRUMP-2024-WIN
567
543
  */
568
- slippage_max_notional_yes_usd?: string | null;
544
+ market_ticker: string;
545
+ /** @description Market title */
546
+ market_title?: string;
547
+ /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
548
+ on_chain_position_key: string;
569
549
  /**
570
- * @description Slippage-limited maximum notional for YES side in USD pips (10000 pips = $1)
571
- * @example 500000000
550
+ * @description Wallet address (Solana public key or EVM address)
551
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
572
552
  */
573
- slippage_max_notional_yes_usd_pips?: string | null;
553
+ wallet_address: string;
554
+ /** @description The committed-mode ladder this position was opened on: one row per planned unwind, each with a status of planned, triggered or superseded. Only present when the request includes `expand=planned_unwinds`; omitted otherwise, and empty on adaptive positions. */
555
+ planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
574
556
  /**
575
- * @description Reason code if market is not accepting new positions
576
- * @example QUOTE_MARKET_NOT_ELIGIBLE
557
+ * @deprecated
558
+ * @description Deprecated — use `pendingOperation` (a deferred close now surfaces as `{ type: 'close', phase: 'awaiting_settlement' }`). Details of a close request that could not complete and was deferred. Null unless the customer requested a close that is now waiting on market settlement to redeem the remaining tokens.
577
559
  */
578
- rejection_reason_code?: string;
579
- /** @description Per-side eligibility. A market may accept positions on one side while rejecting the other (e.g. thin opposite-side liquidity, side max-leverage below the floor). */
580
- sided_eligibility: components["schemas"]["CustomerSidedEligibility"];
581
- /** @description Subtitle for the YES outcome */
582
- yes_sub_title?: string;
560
+ close_attempt?: components["schemas"]["CustomerCloseAttempt"] | null;
561
+ /** @description The lifecycle operation currently in flight on this position, or null when the position is at rest. Survives reload (unlike the ephemeral websocket events), so a UI can show that a close / partial close / unwind / settle is in progress after re-fetching REST. */
562
+ pending_operation?: components["schemas"]["CustomerPendingOperation"] | null;
583
563
  };
584
- CustomerPositionEntry: {
585
- /**
586
- * @description Entry collateral formatted as USD
587
- * @example 2.50
588
- */
589
- collateral_usd: string;
590
- /**
591
- * @description Entry collateral in USD pips (10000 pips = $1)
592
- * @example 25000
593
- */
594
- collateral_usd_pips: string;
595
- /**
596
- * @description Entry leverage in basis points (20000 = 2x)
597
- * @example 20000
598
- */
599
- leverage_bps: number;
600
- /**
601
- * @description Entry notional formatted as USD
602
- * @example 5.00
603
- */
604
- notional_usd: string;
605
- /**
606
- * @description Entry notional in USD pips
607
- * @example 50000
608
- */
609
- notional_usd_pips: string;
610
- /**
611
- * @description Time in milliseconds from position creation to on-chain open confirmation. Null until the position is fully opened on chain.
612
- * @example 12500
613
- */
614
- open_latency_ms?: number | null;
564
+ CustomerPositionClosedFees: {
615
565
  /**
616
- * @description ISO 8601 timestamp when position was opened
617
- * @example 2025-01-15T10:30:00.000Z
566
+ * @description Lifetime fee APR in basis points
567
+ * @example 500
618
568
  */
619
- opened_at?: string;
569
+ lifetime_apr_bps: number;
620
570
  /**
621
- * @description Combined origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
571
+ * @deprecated
572
+ * @description Deprecated — use `entry.originationFeeBps`. Same value, kept for backwards compatibility.
622
573
  * @example 100
623
574
  */
624
575
  origination_fee_bps: number;
625
576
  /**
626
- * @description Protocol portion of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
577
+ * @deprecated
578
+ * @description Deprecated — use `entry.protocolOriginationFeeBps`. Same value, kept for backwards compatibility.
627
579
  * @example 80
628
580
  */
629
581
  protocol_origination_fee_bps: number;
630
582
  /**
631
- * @description Partner portion of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
583
+ * @deprecated
584
+ * @description Deprecated — use `entry.partnerOriginationFeeBps`. Same value, kept for backwards compatibility.
632
585
  * @example 20
633
586
  */
634
587
  partner_origination_fee_bps: number;
635
588
  /**
636
- * @description Origination fee formatted as USD
589
+ * @deprecated
590
+ * @description Deprecated — use `entry.originationFeeUsd`. Same value, kept for backwards compatibility.
637
591
  * @example 0.05
638
592
  */
639
593
  origination_fee_usd: string;
640
594
  /**
641
- * @description Origination fee in USD pips
595
+ * @deprecated
596
+ * @description Deprecated — use `entry.originationFeeUsdPips`. Same value, kept for backwards compatibility.
642
597
  * @example 500
643
598
  */
644
599
  origination_fee_usd_pips: string;
645
600
  /**
646
- * @description Entry price formatted as USD
647
- * @example 0.50
648
- */
649
- price_usd: string;
650
- /**
651
- * @description Entry price in USD pips
652
- * @example 5000
601
+ * @description Total blended fees formatted as USD
602
+ * @example 0.085
653
603
  */
654
- price_usd_pips: string;
604
+ total_fees_usd: string;
655
605
  /**
656
- * @description Effective entry price (actual fill price on the prediction market) formatted as USD. Null until the fill is recorded on chain.
657
- * @example 0.5025
606
+ * @description Total blended fees (origination + lifetime + liquidation + venue) in USD pips
607
+ * @example 850
658
608
  */
659
- effective_entry_price_usd?: string | null;
609
+ total_fees_usd_pips: string;
660
610
  /**
661
- * @description Effective entry price in USD pips. Null until the fill is recorded on chain.
662
- * @example 5025
611
+ * @description Total lifetime fee formatted as USD
612
+ * @example 0.015
663
613
  */
664
- effective_entry_price_usd_pips?: string | null;
614
+ total_lifetime_fee_usd: string;
665
615
  /**
666
- * @description Execution slippage between the offer's indicative entry price and the actual fill price, in basis points. Signed: positive means the fill was worse than the quote, negative means the fill was better. Null until the fill is recorded on chain.
667
- * @example 50
616
+ * @description Total lifetime fee collected in USD pips
617
+ * @example 150
668
618
  */
669
- effective_slippage_bps?: number | null;
619
+ total_lifetime_fee_usd_pips: string;
670
620
  /**
671
- * @description Original position token units delivered when the position opened (1000000 units = 1 token). Unlike `current.positionTokenUnits` (the live, possibly partially-closed survivor), this is the fixed size credited at open and is the basis for the partial-close minimum. Null until the open fill is recorded on chain.
672
- * @example 10000000
621
+ * @description Total venue (Polymarket) trading fees collected across the position lifetime (open + close/liquidation/settle + force-unwind), formatted as USD.
622
+ * @example 0.02
673
623
  */
674
- position_token_units?: string | null;
624
+ total_venue_fee_usd: string;
675
625
  /**
676
- * @description How much of the requested size was actually filled when the position opened, in basis points (10000 = 100%). Computed as actual open notional / requested notional and FROZEN at open — it does NOT change when the position is partially closed. Use this for an 'opened at X% of requested' badge. Null until the open fill is recorded on chain.
677
- * @example 9657
626
+ * @description Total venue trading fees collected across the position lifetime in USD pips.
627
+ * @example 200
678
628
  */
679
- initial_fill_bps?: number | null;
629
+ total_venue_fee_usd_pips: string;
680
630
  };
681
- CustomerPositionFailure: {
631
+ CustomerPositionResult: {
682
632
  /**
683
- * @description Failure reason code
684
- * @example price_exceeded_tolerance
633
+ * @description ISO 8601 timestamp when position was closed
634
+ * @example 2025-01-16T14:30:00.000Z
685
635
  */
686
- reason: string;
687
- };
688
- CustomerPositionUnwind: {
636
+ closed_at: string;
689
637
  /**
690
- * @description The market signal that triggered the risk-model inference behind this unwind (e.g. `spread_blowout`, `depth_decay`, `price_drop_severe`). Null for unwinds not tied to an inference run, such as manually triggered deleveraging.
691
- * @example spread_blowout
692
- * @enum {string|null}
638
+ * @description Collected lifetime fee formatted as USD
639
+ * @example 0.015
693
640
  */
694
- reason?: "activity_surge" | "cancel_acceleration" | "crypto_move" | "depth_decay" | "depth_drain" | "depth_entry_drain" | "game_start" | "large_holder" | "last_trade_divergence" | "lead_change" | "post_hard_exit_losing" | "position_exposure" | "price_drop_full_exit" | "price_drop_moderate" | "price_drop_severe" | "price_drop_warning" | "spread_blowout" | "spread_spike" | "spread_warning" | "stale_refresh" | "unknown" | null;
641
+ collected_lifetime_fee_usd: string;
695
642
  /**
696
- * @description Leverage after unwind in basis points (20000 = 2x)
697
- * @example 30000
643
+ * @description Collected lifetime fee in USD pips
644
+ * @example 150
698
645
  */
699
- after_leverage_bps: number;
646
+ collected_lifetime_fee_usd_pips: string;
700
647
  /**
701
- * @description Leverage before unwind in basis points (20000 = 2x)
702
- * @example 60000
648
+ * @description Collected liquidation fee formatted as USD
649
+ * @example 0.00
703
650
  */
704
- before_leverage_bps: number;
651
+ collected_liquidation_fee_usd: string;
705
652
  /**
706
- * @description ISO 8601 timestamp when the unwind was executed on-chain
707
- * @example 2025-06-02T14:30:00.000Z
653
+ * @description Collected liquidation fee in USD pips
654
+ * @example 0
708
655
  */
709
- executed_at: string;
656
+ collected_liquidation_fee_usd_pips: string;
710
657
  /**
711
- * @description Human-readable explanation of `reason` — a customer-facing sentence describing the market condition that triggered this deleverage. Null whenever `reason` is null.
712
- * @example The bid-ask spread widened sharply beyond its recent baseline, signalling thinning liquidity.
658
+ * @description Volume-weighted notional realized across all unwinds and the final close, formatted as USD. Null for reverted or cancelled positions.
659
+ * @example 5.25
713
660
  */
714
- reason_detail?: string | null;
715
- };
716
- CustomerPositionUnwindList: {
717
- data: components["schemas"]["CustomerPositionUnwind"][];
718
- has_more: boolean;
719
- total_count?: number;
661
+ exit_notional_usd?: string | null;
720
662
  /**
721
- * @description Current leverage of the position in basis points (20000 = 2x), null if not yet calculated
722
- * @example 30000
663
+ * @description Exit notional in USD pips. Null for reverted or cancelled positions.
664
+ * @example 52500
723
665
  */
724
- current_leverage_bps: number | null;
666
+ exit_notional_usd_pips?: string | null;
725
667
  /**
726
- * @description ISO 8601 timestamp when the position was opened on-chain (null if not yet opened)
727
- * @example 2025-06-01T12:00:00.000Z
668
+ * @description Whether every amount in this block is settled and will not be restated. False while the closing, liquidating or settling transaction is still in flight, when proceeds have not yet been credited and the PnL figures are provisional. Always true for reverted and cancelled positions, which have no proceeds to credit. Wait for true before booking a result. Absent on responses served by a pod that predates this field, so treat a missing value as not-yet-determined rather than as false.
669
+ * @example true
728
670
  */
729
- originated_at: string | null;
671
+ is_final?: boolean;
730
672
  /**
731
- * @description Leverage at position origination in basis points (20000 = 2x)
732
- * @example 60000
673
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) as return on equity in basis points
674
+ * @example 1700
733
675
  */
734
- origination_leverage_bps: number;
735
- };
736
- CustomerCloseAttempt: {
676
+ net_realized_pnl_bps: number;
737
677
  /**
738
- * @description Outcome of the close attempt. `deferred` means the close could not complete yet and was postponed.
739
- * @enum {string}
678
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) formatted as USD
679
+ * @example 0.435
740
680
  */
741
- outcome: "deferred";
681
+ net_realized_pnl_usd: string;
742
682
  /**
743
- * @description Why the close was deferred. `awaiting_settlement`: the market resolved before the position could be sold, so the remaining tokens will be redeemed when the market settles rather than sold on the order book.
744
- * @enum {string}
683
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) in USD pips (can be negative)
684
+ * @example 4350
745
685
  */
746
- reason: "awaiting_settlement";
686
+ net_realized_pnl_usd_pips: string;
747
687
  /**
748
- * @description ISO-8601 timestamp of when the close was requested.
749
- * @example 2026-06-15T17:27:11.736Z
688
+ * @description Proceeds formatted as USD
689
+ * @example 3.00
750
690
  */
751
- deferred_at: string;
752
- };
753
- CustomerPendingOperation: {
691
+ proceeds_usd: string;
754
692
  /**
755
- * @description The lifecycle operation currently in flight on this position. Present whenever the position is mid-operation (open, close, partial close, unwind, liquidate, or settle); null when the position is at rest. Note `status` stays `open` throughout a `partial_close`, so this is the only signal a slice is in flight after a reload.
756
- * @enum {string}
693
+ * @description Proceeds returned to user in USD pips
694
+ * @example 30000
757
695
  */
758
- type: "open" | "close" | "partial_close" | "unwind" | "liquidate" | "settle";
696
+ proceeds_usd_pips: string;
759
697
  /**
760
- * @description Sub-state of the operation: `requested` (submitted, not yet executing), `initiated` (executing on the venue), `pending` (tokens withdrawn, finalizing on chain), `awaiting_settlement` (a close deferred until the market settles). Null when the operation has no distinct phase.
761
- * @example initiated
762
- * @enum {string|null}
698
+ * @description Realized PnL formatted as USD
699
+ * @example 0.50
763
700
  */
764
- phase?: "requested" | "initiated" | "pending" | "awaiting_settlement" | null;
701
+ realized_pnl_usd: string;
765
702
  /**
766
- * @description Token units involved in the in-flight operation (1000000 units = 1 token). For `partial_close` this is the slice being closed; for `close`/`liquidate` the units withdrawn; for the awaiting-settlement close the remaining tokens. Null when the operation carries no specific token amount.
767
- * @example 5000000
703
+ * @description Realized PnL in USD pips (can be negative)
704
+ * @example 5000
768
705
  */
769
- token_units?: string | null;
706
+ realized_pnl_usd_pips: string;
770
707
  };
771
- CustomerPositionCurrent: {
708
+ CustomerClosedPosition: {
709
+ /** @description Entry details */
710
+ entry: components["schemas"]["CustomerPositionEntry"];
711
+ /** @description Failure details if the position failed */
712
+ failure?: components["schemas"]["CustomerPositionFailure"];
772
713
  /**
773
- * @description Current book-value leverage in basis points (20000 = 2x)
774
- * @example 18000
714
+ * @description Position ID
715
+ * @example dm_pos_abc123
775
716
  */
776
- book_leverage_bps: number;
717
+ id: string;
777
718
  /**
778
- * @description Current collateral formatted as USD
779
- * @example 2.50
719
+ * @description Name of the partner the position was opened through.
720
+ * @example Acme Markets
780
721
  */
781
- collateral_usd: string;
722
+ partner: string;
782
723
  /**
783
- * @description Current collateral in USD pips
784
- * @example 25000
724
+ * @description Prediction market provider
725
+ * @enum {string}
785
726
  */
786
- collateral_usd_pips: string;
727
+ provider: "polymarket";
787
728
  /**
788
- * @description Effective collateral formatted as USD
789
- * @example 2.45
729
+ * @description Market side
730
+ * @enum {string}
790
731
  */
791
- effective_collateral_usd: string;
732
+ side: "yes" | "no";
792
733
  /**
793
- * @description Effective collateral after fees in USD pips
794
- * @example 24500
734
+ * @description Simplified position status. A position that was deleveraged almost entirely and then force-sold for a trivial remainder reports 'settled' once the market resolves against it. The 'status' query parameter still filters on the underlying mechanism, so such a position is returned by status=liquidated.
735
+ * @enum {string}
795
736
  */
796
- effective_collateral_usd_pips: string;
737
+ status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
738
+ /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
739
+ unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
740
+ /** @description Fee details for closed position */
741
+ fees: components["schemas"]["CustomerPositionClosedFees"];
742
+ /** @description Position result/outcome */
743
+ result: components["schemas"]["CustomerPositionResult"];
797
744
  /**
798
- * @deprecated
799
- * @description Current leverage in basis points
800
- * @example 18000
745
+ * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
746
+ * @example 84000
801
747
  */
802
- leverage_bps: number;
748
+ effective_leverage_bps: number;
803
749
  /**
804
- * @description Current market-value leverage in basis points, computed from the live oracle price. Null when the position is insolvent (equity <= 0).
805
- * @example 19500
750
+ * @description Market ticker identifier
751
+ * @example TRUMP-2024-WIN
806
752
  */
807
- market_leverage_bps?: number | null;
753
+ market_ticker: string;
754
+ /** @description Market title */
755
+ market_title?: string;
756
+ /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
757
+ on_chain_position_key: string;
808
758
  /**
809
- * @description Current mark price formatted as USD
810
- * @example 0.55
759
+ * @description Wallet address (Solana public key or EVM address)
760
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
811
761
  */
812
- mark_price_usd: string;
762
+ wallet_address: string;
763
+ /** @description The committed-mode ladder this position was opened on: one row per planned unwind, each with a status of planned, triggered or superseded. Only present when the request includes `expand=planned_unwinds`; omitted otherwise, and empty on adaptive positions. */
764
+ planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
813
765
  /**
814
- * @description Current mark price in USD pips
815
- * @example 5500
766
+ * @description Reason the position was closed. Reports 'settled' for a position that was deleveraged almost entirely and then force-sold for a trivial remainder on a market that resolved against it.
767
+ * @enum {string}
816
768
  */
817
- mark_price_usd_pips: string;
769
+ close_reason: "cancelled" | "closed" | "liquidated" | "reverted" | "settled";
818
770
  /**
819
- * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) as return on equity in basis points
820
- * @example 1800
771
+ * @description Why the position was reverted before it opened. Non-null only when `close_reason` is `reverted`: `exchange_unavailable` (the prediction-market venue was temporarily unavailable — safe to retry), `slippage_exceeded` (price moved beyond tolerance before the order filled), or `unknown`.
772
+ * @enum {string|null}
821
773
  */
822
- net_unrealized_pnl_bps: number;
774
+ revert_reason?: "exchange_unavailable" | "slippage_exceeded" | "unknown" | null;
775
+ };
776
+ CustomerMarketEvent: {
823
777
  /**
824
- * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) formatted as USD
825
- * @example 0.45
778
+ * @description Ticker of the event this market belongs to — the real-world happening the market resolves against, such as one game or one hourly price window. Pass it to GET /events/{event_ticker}/markets to list every market on the same event.
779
+ * @example btc-updown-5m-1786109700
826
780
  */
827
- net_unrealized_pnl_usd: string;
781
+ ticker: string;
828
782
  /**
829
- * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) in USD pips (can be negative)
830
- * @example 4500
783
+ * @description Human-readable event title, or null when the upstream feed did not supply one.
784
+ * @example Bitcoin Up or Down - August 7, 9:35AM-9:40AM ET
831
785
  */
832
- net_unrealized_pnl_usd_pips: string;
786
+ title: string | null;
833
787
  /**
834
- * @description Current notional formatted as USD
835
- * @example 5.50
788
+ * @description Ticker of the series this event belongs to, or null when the event has no series. Pass it to GET /series/{series_ticker}/markets to list every market in the series.
789
+ * @example btc-up-or-down-5m
836
790
  */
837
- notional_usd: string;
791
+ series_ticker: string | null;
792
+ };
793
+ CustomerOriginationTier: {
838
794
  /**
839
- * @description Current notional in USD pips
840
- * @example 55000
795
+ * @description Origination fee in basis points for this tier
796
+ * @example 100
841
797
  */
842
- notional_usd_pips: string;
798
+ fee_bps: number;
843
799
  /**
844
- * @description Smallest partial-close slice the contract will accept right now, in token units (1000000 units = 1 token): `max(5 tokens, 20% of the original opened size)`. Null when the position is not partial-closeable (an operation is already in flight, the open fill isn't recorded yet, or the survivor is below the minimum).
845
- * @example 5000000
800
+ * @description Maximum leverage in basis points for this tier
801
+ * @example 20000
846
802
  */
847
- min_partial_close_token_units?: string | null;
803
+ max_leverage_bps: number;
804
+ };
805
+ CustomerFees: {
848
806
  /**
849
- * @description Largest partial-close slice allowed right now, in token units (1000000 units = 1 token): the full survivor size currently held (`positionTokenUnits`). Null when the position is not partial-closeable.
850
- * @example 10000000
807
+ * @description Lifetime fee APR in basis points
808
+ * @example 500
851
809
  */
852
- max_partial_close_token_units?: string | null;
810
+ lifetime_apr_bps: number;
853
811
  /**
854
- * @description Position token units held (1000000 units = 1 token)
855
- * @example 10000000
812
+ * @description Liquidation fee in basis points
813
+ * @example 200
856
814
  */
857
- position_token_units: string;
815
+ liquidation_bps: number;
816
+ /** @description Origination fee tiers by leverage */
817
+ origination_tiers: components["schemas"]["CustomerOriginationTier"][];
818
+ };
819
+ CustomerMaxMarketLeveragePerNotional: {
858
820
  /**
859
- * @description Fraction of the originally opened size still held, in basis points (10000 = 100%). Computed as current token units / original opened token units. This LEGITIMATELY DECREASES after each partial close (e.g. 7000 = 70% remaining after a 30% close) and is not a fill problem. Null until the open fill is recorded on chain.
860
- * @example 7000
821
+ * @description Maximum market leverage in basis points when the position notional is $100
822
+ * @example 100000
861
823
  */
862
- remaining_bps?: number | null;
824
+ at100_usd_bps: number;
863
825
  /**
864
- * @description Total position value formatted as USD
865
- * @example 3.00
826
+ * @description Maximum market leverage in basis points when the position notional is $500
827
+ * @example 80000
866
828
  */
867
- position_value_usd: string;
829
+ at500_usd_bps: number;
868
830
  /**
869
- * @description Total position value in USD pips
870
- * @example 30000
831
+ * @description Maximum market leverage in basis points when the position notional is $1,000
832
+ * @example 60000
871
833
  */
872
- position_value_usd_pips: string;
834
+ at1000_usd_bps: number;
873
835
  /**
874
- * @description Unrealized PnL as return on equity in basis points (1000 = 10%)
875
- * @example 2000
836
+ * @description Maximum market leverage in basis points when the position notional is $10,000
837
+ * @example 30000
876
838
  */
877
- unrealized_pnl_bps: number;
839
+ at10000_usd_bps: number;
840
+ };
841
+ CustomerSidedMaxMarketLeveragePerNotional: {
842
+ /** @description Per-notional max market leverage for the YES side */
843
+ yes: components["schemas"]["CustomerMaxMarketLeveragePerNotional"];
844
+ /** @description Per-notional max market leverage for the NO side */
845
+ no: components["schemas"]["CustomerMaxMarketLeveragePerNotional"];
846
+ };
847
+ CustomerLeverage: {
878
848
  /**
879
- * @description Unrealized PnL formatted as USD
880
- * @example 0.50
849
+ * @deprecated
850
+ * @description Deprecated: use maxYesBps and maxNoBps. Populated as min(maxYesBps, maxNoBps) for backwards compatibility.
851
+ * @example 50000
881
852
  */
882
- unrealized_pnl_usd: string;
853
+ max_bps: number;
854
+ /** @description Max market leverage per side, broken out by position notional. Slippage grows with notional, so larger notionals have lower max leverage. The UI slider should publish the leverage that matches the user's selected notional. */
855
+ max_market_leverage_per_notional: components["schemas"]["CustomerSidedMaxMarketLeveragePerNotional"];
883
856
  /**
884
- * @description Unrealized PnL in USD pips (can be negative)
885
- * @example 5000
857
+ * @description Maximum leverage in basis points for the NO side
858
+ * @example 50000
886
859
  */
887
- unrealized_pnl_usd_pips: string;
888
- };
889
- CustomerPositionOpenFees: {
860
+ max_no_bps: number;
890
861
  /**
891
- * @description Accrued lifetime fee formatted as USD
892
- * @example 0.01
862
+ * @description Maximum leverage in basis points for the YES side
863
+ * @example 50000
893
864
  */
894
- accrued_lifetime_fee_usd: string;
865
+ max_yes_bps: number;
895
866
  /**
896
- * @description Accrued lifetime fee in USD pips
897
- * @example 100
867
+ * @description Minimum leverage in basis points
868
+ * @example 10000
898
869
  */
899
- accrued_lifetime_fee_usd_pips: string;
870
+ min_bps: number;
900
871
  /**
901
- * @description Venue (Polymarket) trading fees paid so far on this position, summed across open and any force-unwind exchange transactions, formatted as USD.
902
- * @example 0.02
872
+ * @description Leverage step increment in basis points
873
+ * @example 1000
903
874
  */
904
- accrued_venue_fee_usd: string;
875
+ step_bps: number;
876
+ };
877
+ CustomerMarketPolymarket: {
905
878
  /**
906
- * @description Venue trading fees paid so far on this position in USD pips.
907
- * @example 200
879
+ * @description Polymarket market slug, matching the slug in Polymarket URLs and Gamma API responses.
880
+ * @example will-trump-win-the-2024-election
908
881
  */
909
- accrued_venue_fee_usd_pips: string;
882
+ slug: string;
910
883
  /**
911
- * @description Lifetime fee APR in basis points
912
- * @example 500
884
+ * @description Polymarket CTF condition ID for this market. Use it to look the market up on Polymarket's CLOB and Gamma APIs. Null for the small number of markets where Polymarket has not exposed a condition ID.
885
+ * @example 0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890
913
886
  */
914
- lifetime_apr_bps: number;
887
+ condition_id?: string | null;
915
888
  /**
916
- * @description Pending lifetime fee formatted as USD
917
- * @example 0.005
889
+ * @description Polymarket CLOB token ID for the NO outcome (the ERC1155 position token ID).
890
+ * @example 71321045679252212594626385532706912750332728571942532289631379312455583992563
918
891
  */
919
- pending_lifetime_fee_usd: string;
892
+ no_token_id: string;
920
893
  /**
921
- * @description Pending lifetime fee in USD pips
922
- * @example 50
894
+ * @description Polymarket CLOB token ID for the YES outcome (the ERC1155 position token ID).
895
+ * @example 21742633143463906290569050155826241533067272736897614950488156847949938836455
923
896
  */
924
- pending_lifetime_fee_usd_pips: string;
897
+ yes_token_id: string;
898
+ };
899
+ CustomerSideEligibility: {
925
900
  /**
926
- * @description Sum of all fees accrued or owed so far (origination + accrued lifetime + pending lifetime + accrued venue), formatted as USD. Mirrors closed positions' `fees.totalFeesUsd`.
927
- * @example 0.085
901
+ * @description Whether this market is accepting new positions on this side
902
+ * @example true
928
903
  */
929
- total_fees_usd: string;
904
+ accepting_new_positions: boolean;
930
905
  /**
931
- * @description Sum of all fees accrued or owed so far (origination + accrued lifetime + pending lifetime + accrued venue) in USD pips.
932
- * @example 850
906
+ * @description Reason code if this side is not accepting new positions; null when accepting
907
+ * @example QUOTE_MARKET_NOT_ELIGIBLE
933
908
  */
934
- total_fees_usd_pips: string;
909
+ rejection_reason_code?: string | null;
935
910
  };
936
- CustomerPositionRisk: {
911
+ CustomerSidedEligibility: {
912
+ /** @description Eligibility for the YES side */
913
+ yes: components["schemas"]["CustomerSideEligibility"];
914
+ /** @description Eligibility for the NO side */
915
+ no: components["schemas"]["CustomerSideEligibility"];
916
+ };
917
+ CustomerMarketPrices: {
937
918
  /**
938
- * @description Current liquidation price formatted as USD
939
- * @example 0.35
919
+ * @description NO side ask price formatted as USD
920
+ * @example 0.51
940
921
  */
941
- current_liquidation_price_usd: string;
922
+ no_ask_price_usd: string;
942
923
  /**
943
- * @description Current liquidation price in USD pips
944
- * @example 3500
924
+ * @description NO side ask price in USD pips (10000 pips = $1)
925
+ * @example 5100
945
926
  */
946
- current_liquidation_price_usd_pips: string;
927
+ no_ask_price_usd_pips: string;
947
928
  /**
948
- * @description Margin health 0-10000 (10000 at entry, 0 at liquidation)
949
- * @example 7500
929
+ * @description NO side bid price formatted as USD
930
+ * @example 0.49
950
931
  */
951
- health_bps: number;
932
+ no_bid_price_usd: string;
952
933
  /**
953
- * @description Buffer to liquidation in basis points
954
- * @example 500
934
+ * @description NO side bid price in USD pips (10000 pips = $1)
935
+ * @example 4900
955
936
  */
956
- liquidation_buffer_bps: number;
937
+ no_bid_price_usd_pips: string;
957
938
  /**
958
- * @description Liquidation fee in basis points
959
- * @example 200
939
+ * @description YES side ask price formatted as USD
940
+ * @example 0.51
960
941
  */
961
- liquidation_fee_bps: number;
942
+ yes_ask_price_usd: string;
962
943
  /**
963
- * @description Dollar distance to liquidation formatted as USD
964
- * @example 0.50
944
+ * @description YES side ask price in USD pips (10000 pips = $1)
945
+ * @example 5100
965
946
  */
966
- margin_buffer_usd: string;
947
+ yes_ask_price_usd_pips: string;
967
948
  /**
968
- * @description Dollar distance to liquidation in USD pips
969
- * @example 5000
949
+ * @description YES side bid price formatted as USD
950
+ * @example 0.49
970
951
  */
971
- margin_buffer_usd_pips: string;
952
+ yes_bid_price_usd: string;
953
+ /**
954
+ * @description YES side bid price in USD pips (10000 pips = $1)
955
+ * @example 4900
956
+ */
957
+ yes_bid_price_usd_pips: string;
972
958
  };
973
- CustomerPositionTiming: {
974
- /** @description Whether settlement is pending (market resolved or voided, settlement not yet executed) */
975
- is_settlement_pending: boolean;
976
- /** @description Whether the market was voided (closed with no winner, 50/50 payout at $0.50 per token) */
977
- is_voided: boolean;
959
+ CustomerMarket: {
960
+ /**
961
+ * @description Market category
962
+ * @example politics
963
+ */
964
+ category: string;
965
+ /** @description The event this market belongs to. Use its tickers to fetch sibling markets or your own positions scoped to the same event or series. */
966
+ event: components["schemas"]["CustomerMarketEvent"];
967
+ /** @description Fee configuration */
968
+ fees: components["schemas"]["CustomerFees"];
969
+ /**
970
+ * @description Market ID
971
+ * @example dm_mkt_abc123
972
+ */
973
+ id: string;
974
+ /** @description Leverage configuration */
975
+ leverage: components["schemas"]["CustomerLeverage"];
976
+ /**
977
+ * @description Prediction market provider
978
+ * @enum {string}
979
+ */
980
+ provider: "polymarket";
981
+ /**
982
+ * @description Current market status
983
+ * @enum {string}
984
+ */
985
+ status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
986
+ /**
987
+ * @description Market tags for filtering
988
+ * @example [
989
+ * "politics",
990
+ * "election"
991
+ * ]
992
+ */
993
+ tags: string[];
994
+ /** @description Polymarket identifiers for this market, for mapping our markets onto Polymarket data feeds. Always present (all live markets are Polymarket-sourced). */
995
+ polymarket: components["schemas"]["CustomerMarketPolymarket"];
996
+ /**
997
+ * @deprecated
998
+ * @description Deprecated: use `polymarket.slug`. Market ticker sourced from the upstream trading venue.
999
+ * @example will-trump-win-the-2024-election
1000
+ */
1001
+ ticker: string;
1002
+ /** @description Market title */
1003
+ title?: string;
1004
+ /** @description Latest bid/ask prices for YES and NO sides. Only present when the request includes `expand=prices`. */
1005
+ prices?: components["schemas"]["CustomerMarketPrices"] | null;
1006
+ /**
1007
+ * @description Whether this market is accepting new positions
1008
+ * @example true
1009
+ */
1010
+ accepting_new_positions: boolean;
978
1011
  /**
979
1012
  * @description ISO 8601 timestamp when market closes
980
1013
  * @example 2025-01-20T12:00:00.000Z
981
1014
  */
982
- market_close_time?: string;
1015
+ close_time?: string;
983
1016
  /**
984
- * @description Market status from the prediction market provider. When 'determined' or 'finalized', mark price reflects the settlement outcome ($1 or $0)
985
- * @example active
986
- * @enum {string}
1017
+ * @description ISO 8601 timestamp when this market was first discovered and listed on the platform
1018
+ * @example 2025-01-10T08:00:00.000Z
987
1019
  */
988
- market_status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
1020
+ discovered_at: string;
989
1021
  /**
990
- * @description Where this market sits on the road to settlement. `none` — still trading, nothing pending. `awaiting_resolution` — the market has closed and the outcome is decided, but the prediction market provider has not yet published the result on chain, so nothing can be redeemed yet. `settling` — the result is published and we are settling the position. `voided` — the market was voided and every token pays out at $0.50. `unresolved_upstream` — the market disappeared from the provider before publishing a result and may never resolve.
991
- * @example awaiting_resolution
1022
+ * @description ISO 8601 timestamp of the latest time a new position can be opened in this market
1023
+ * @example 2025-01-20T11:30:00.000Z
1024
+ */
1025
+ latest_enter_at?: string;
1026
+ /**
1027
+ * @description Minimum collateral amount formatted as USD
1028
+ * @example 0.02
1029
+ */
1030
+ min_collateral_usd: string;
1031
+ /**
1032
+ * @description Minimum collateral amount in USD pips (10000 pips = $1)
1033
+ * @example 200000
1034
+ */
1035
+ min_collateral_usd_pips: string;
1036
+ /**
1037
+ * @description Minimum notional amount formatted as USD
1038
+ * @example 5.00
1039
+ */
1040
+ min_notional_usd: string;
1041
+ /**
1042
+ * @description Minimum notional amount in USD pips (10000 pips = $1)
1043
+ * @example 50000
1044
+ */
1045
+ min_notional_usd_pips: string;
1046
+ /**
1047
+ * @description Where this market sits on the road to settlement. `none` — still trading, nothing pending. `awaiting_resolution` — the market has closed and the outcome is decided, but the prediction market provider has not yet published the result on chain, so nothing can be redeemed yet. `settling` — the result is published and open positions are being settled. `voided` — the market was voided and every token pays out at $0.50. `unresolved_upstream` — the market disappeared from the provider before publishing a result and may never resolve.
1048
+ * @example none
992
1049
  * @enum {string}
993
1050
  */
994
1051
  settlement_state: "awaiting_resolution" | "none" | "settling" | "unresolved_upstream" | "voided";
995
1052
  /**
996
- * @description Minutes until market closes
997
- * @example 1440
1053
+ * @description Capacity-limited maximum notional for NO side formatted as USD
1054
+ * @example 50.00
998
1055
  */
999
- time_to_close_minutes?: number;
1000
- };
1001
- CustomerOpenPosition: {
1002
- /** @description Entry details */
1003
- entry: components["schemas"]["CustomerPositionEntry"];
1004
- /** @description Failure details if the position failed */
1005
- failure?: components["schemas"]["CustomerPositionFailure"];
1056
+ capacity_max_notional_no_usd?: string | null;
1006
1057
  /**
1007
- * @description Position ID
1008
- * @example dm_pos_abc123
1058
+ * @description Capacity-limited maximum notional for NO side in USD pips (10000 pips = $1)
1059
+ * @example 500000000
1009
1060
  */
1010
- id: string;
1061
+ capacity_max_notional_no_usd_pips?: string | null;
1011
1062
  /**
1012
- * @description Prediction market provider
1013
- * @enum {string}
1063
+ * @description Capacity-limited maximum notional for YES side formatted as USD
1064
+ * @example 50.00
1014
1065
  */
1015
- provider: "polymarket";
1066
+ capacity_max_notional_yes_usd?: string | null;
1016
1067
  /**
1017
- * @description Market side
1018
- * @enum {string}
1068
+ * @description Capacity-limited maximum notional for YES side in USD pips (10000 pips = $1)
1069
+ * @example 500000000
1019
1070
  */
1020
- side: "yes" | "no";
1071
+ capacity_max_notional_yes_usd_pips?: string | null;
1021
1072
  /**
1022
- * @description Simplified position status
1023
- * @enum {string}
1073
+ * @description Maximum notional available for NO side formatted as USD. Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
1074
+ * @example 50.00
1024
1075
  */
1025
- status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
1026
- /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
1027
- unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1028
- /** @description Current position state */
1029
- current: components["schemas"]["CustomerPositionCurrent"];
1030
- /** @description Fee details for open position */
1031
- fees: components["schemas"]["CustomerPositionOpenFees"];
1032
- /** @description Risk metrics */
1033
- risk: components["schemas"]["CustomerPositionRisk"];
1034
- /** @description Timing information */
1035
- timing: components["schemas"]["CustomerPositionTiming"];
1076
+ max_notional_no_usd?: string;
1036
1077
  /**
1037
- * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
1038
- * @example 84000
1078
+ * @description Maximum notional available for NO side in USD pips (10000 pips = $1). Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
1079
+ * @example 500000000
1039
1080
  */
1040
- effective_leverage_bps: number;
1081
+ max_notional_no_usd_pips?: string;
1041
1082
  /**
1042
- * @description Market ticker identifier
1043
- * @example TRUMP-2024-WIN
1083
+ * @description Maximum notional available for YES side formatted as USD. Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
1084
+ * @example 50.00
1044
1085
  */
1045
- market_ticker: string;
1046
- /** @description Market title */
1047
- market_title?: string;
1048
- /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
1049
- on_chain_position_key: string;
1086
+ max_notional_yes_usd?: string;
1050
1087
  /**
1051
- * @description Wallet address (Solana public key or EVM address)
1052
- * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1088
+ * @description Maximum notional available for YES side in USD pips (10000 pips = $1). Bounded by slippage, capacity, the partner's remaining position limit, and the per-user position limit (assuming a user with no open positions).
1089
+ * @example 500000000
1053
1090
  */
1054
- wallet_address: string;
1091
+ max_notional_yes_usd_pips?: string;
1055
1092
  /**
1056
- * @deprecated
1057
- * @description Deprecated — use `pendingOperation` (a deferred close now surfaces as `{ type: 'close', phase: 'awaiting_settlement' }`). Details of a close request that could not complete and was deferred. Null unless the customer requested a close that is now waiting on market settlement to redeem the remaining tokens.
1093
+ * @description Slippage-limited maximum notional for NO side formatted as USD
1094
+ * @example 50.00
1058
1095
  */
1059
- close_attempt?: components["schemas"]["CustomerCloseAttempt"] | null;
1060
- /** @description The lifecycle operation currently in flight on this position, or null when the position is at rest. Survives reload (unlike the ephemeral websocket events), so a UI can show that a close / partial close / unwind / settle is in progress after re-fetching REST. */
1061
- pending_operation?: components["schemas"]["CustomerPendingOperation"] | null;
1096
+ slippage_max_notional_no_usd?: string | null;
1097
+ /**
1098
+ * @description Slippage-limited maximum notional for NO side in USD pips (10000 pips = $1)
1099
+ * @example 500000000
1100
+ */
1101
+ slippage_max_notional_no_usd_pips?: string | null;
1102
+ /**
1103
+ * @description Slippage-limited maximum notional for YES side formatted as USD
1104
+ * @example 50.00
1105
+ */
1106
+ slippage_max_notional_yes_usd?: string | null;
1107
+ /**
1108
+ * @description Slippage-limited maximum notional for YES side in USD pips (10000 pips = $1)
1109
+ * @example 500000000
1110
+ */
1111
+ slippage_max_notional_yes_usd_pips?: string | null;
1112
+ /**
1113
+ * @description Reason code if market is not accepting new positions
1114
+ * @example QUOTE_MARKET_NOT_ELIGIBLE
1115
+ */
1116
+ rejection_reason_code?: string;
1117
+ /** @description Per-side eligibility. A market may accept positions on one side while rejecting the other (e.g. thin opposite-side liquidity, side max-leverage below the floor). */
1118
+ sided_eligibility: components["schemas"]["CustomerSidedEligibility"];
1119
+ /** @description Subtitle for the YES outcome */
1120
+ yes_sub_title?: string;
1062
1121
  };
1063
- CustomerPositionClosedFees: {
1122
+ CustomerOriginationFeeTier: {
1064
1123
  /**
1065
- * @description Lifetime fee APR in basis points
1066
- * @example 500
1124
+ * @description Upper leverage bound (inclusive) in basis points for this tier. The last tier is the catch-all.
1125
+ * @example 40000
1067
1126
  */
1068
- lifetime_apr_bps: number;
1127
+ max_leverage_bps: number;
1069
1128
  /**
1070
- * @deprecated
1071
- * @description Deprecated — use `entry.originationFeeBps`. Same value, kept for backwards compatibility.
1072
- * @example 100
1129
+ * @description Protocol origination fee in basis points applied at or below this tier's leverage bound.
1130
+ * @example 200
1073
1131
  */
1074
- origination_fee_bps: number;
1132
+ fee_bps: number;
1133
+ };
1134
+ CustomerFeeRatesMarket: {
1075
1135
  /**
1076
- * @deprecated
1077
- * @description Deprecated — use `entry.protocolOriginationFeeBps`. Same value, kept for backwards compatibility.
1078
- * @example 80
1136
+ * @description Market ticker
1137
+ * @example TRUMP-2024-WIN
1079
1138
  */
1080
- protocol_origination_fee_bps: number;
1139
+ ticker: string;
1081
1140
  /**
1082
- * @deprecated
1083
- * @description Deprecated — use `entry.partnerOriginationFeeBps`. Same value, kept for backwards compatibility.
1084
- * @example 20
1141
+ * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
1142
+ * @example 0
1085
1143
  */
1086
- partner_origination_fee_bps: number;
1144
+ polymarket_trading_fee_bps: number;
1145
+ /**
1146
+ * @description Polymarket fee-curve exponent (`feeExponent`). `1` for the standard quadratic curve.
1147
+ * @example 1
1148
+ */
1149
+ polymarket_fee_exponent: number;
1150
+ };
1151
+ CustomerFeeRates: {
1152
+ /** @description Per-market venue fee fields. Only present when the request includes a `ticker` query parameter. */
1153
+ market?: components["schemas"]["CustomerFeeRatesMarket"];
1154
+ /** @description Leverage-tiered protocol origination fee schedule. Resolve a leverage to its fee by picking the first tier whose `maxLeverageBps >= leverageBps` (the last tier is the catch-all). */
1155
+ origination_fee_tiers: components["schemas"]["CustomerOriginationFeeTier"][];
1156
+ /**
1157
+ * @description Maximum combined (protocol + partner) origination fee in basis points enforced on-chain.
1158
+ * @example 1000
1159
+ */
1160
+ contract_max_origination_fee_bps: number;
1161
+ /**
1162
+ * @description Lifetime fee APR in basis points
1163
+ * @example 2000
1164
+ */
1165
+ lifetime_fee_apr_bps: number;
1087
1166
  /**
1088
- * @deprecated
1089
- * @description Deprecated — use `entry.originationFeeUsd`. Same value, kept for backwards compatibility.
1090
- * @example 0.05
1167
+ * @description Liquidation fee in basis points
1168
+ * @example 250
1091
1169
  */
1092
- origination_fee_usd: string;
1170
+ liquidation_fee_bps: number;
1093
1171
  /**
1094
- * @deprecated
1095
- * @description Deprecated — use `entry.originationFeeUsdPips`. Same value, kept for backwards compatibility.
1096
- * @example 500
1172
+ * @description This partner's origination fee component in basis points, added to the protocol tier fee. `0` by default.
1173
+ * @example 0
1097
1174
  */
1098
- origination_fee_usd_pips: string;
1175
+ partner_origination_fee_bps: number;
1099
1176
  /**
1100
- * @description Total blended fees formatted as USD
1101
- * @example 0.085
1177
+ * @description This partner's Polymarket builder taker fee in basis points (flat percentage of notional). `0` by default.
1178
+ * @example 0
1102
1179
  */
1103
- total_fees_usd: string;
1180
+ partner_trading_fee_bps: number;
1181
+ };
1182
+ FeeReportBody: {
1104
1183
  /**
1105
- * @description Total blended fees (origination + lifetime + liquidation + venue) in USD pips
1106
- * @example 850
1184
+ * @description Leverage in basis points (20000 = 2x, 100000 = 10x). Must be divisible by 2500. Maximum 10x.
1185
+ * @example 50000
1107
1186
  */
1108
- total_fees_usd_pips: string;
1187
+ leverage_bps: number;
1109
1188
  /**
1110
- * @description Total lifetime fee formatted as USD
1111
- * @example 0.015
1189
+ * @description Market ticker
1190
+ * @example TRUMP-2024-WIN
1112
1191
  */
1113
- total_lifetime_fee_usd: string;
1192
+ market_ticker: string;
1114
1193
  /**
1115
- * @description Total lifetime fee collected in USD pips
1116
- * @example 150
1194
+ * @description Notional amount in USD pips (10,000 pips = $1.00)
1195
+ * @example 50000
1117
1196
  */
1118
- total_lifetime_fee_usd_pips: string;
1197
+ notional_amount_usd_pips: string;
1119
1198
  /**
1120
- * @description Total venue (Polymarket) trading fees collected across the position lifetime (open + close/liquidation/settle + force-unwind), formatted as USD.
1121
- * @example 0.02
1199
+ * @description Market side (yes or no)
1200
+ * @enum {string}
1122
1201
  */
1123
- total_venue_fee_usd: string;
1202
+ effective_side: "yes" | "no";
1124
1203
  /**
1125
- * @description Total venue trading fees collected across the position lifetime in USD pips.
1126
- * @example 200
1204
+ * @description Effective-side entry price in USD pips (10000 pips = $1) to compute against. When omitted, the market's current reference price is used. Provide it to compute deterministically against a known price.
1205
+ * @example 5100
1127
1206
  */
1128
- total_venue_fee_usd_pips: string;
1207
+ entry_price_usd_pips?: string;
1129
1208
  };
1130
- CustomerPositionResult: {
1209
+ CustomerFeeReport: {
1131
1210
  /**
1132
- * @description ISO 8601 timestamp when position was closed
1133
- * @example 2025-01-16T14:30:00.000Z
1211
+ * @description Market ticker
1212
+ * @example TRUMP-2024-WIN
1134
1213
  */
1135
- closed_at: string;
1214
+ market_ticker: string;
1136
1215
  /**
1137
- * @description Collected lifetime fee formatted as USD
1138
- * @example 0.015
1216
+ * @description Market side
1217
+ * @enum {string}
1139
1218
  */
1140
- collected_lifetime_fee_usd: string;
1219
+ effective_side: "yes" | "no";
1141
1220
  /**
1142
- * @description Collected lifetime fee in USD pips
1143
- * @example 150
1221
+ * @description Leverage in basis points (20000 = 2x)
1222
+ * @example 20000
1144
1223
  */
1145
- collected_lifetime_fee_usd_pips: string;
1224
+ leverage_bps: number;
1146
1225
  /**
1147
- * @description Collected liquidation fee formatted as USD
1148
- * @example 0.00
1226
+ * @description Entry price used for the computation, in USD pips
1227
+ * @example 5100
1149
1228
  */
1150
- collected_liquidation_fee_usd: string;
1229
+ entry_price_usd_pips: string;
1151
1230
  /**
1152
- * @description Collected liquidation fee in USD pips
1153
- * @example 0
1231
+ * @description Notional in USD pips (10000 pips = $1)
1232
+ * @example 500000
1154
1233
  */
1155
- collected_liquidation_fee_usd_pips: string;
1234
+ notional_amount_usd_pips: string;
1156
1235
  /**
1157
- * @description Volume-weighted notional realized across all unwinds and the final close, formatted as USD. Null for reverted or cancelled positions.
1158
- * @example 5.25
1236
+ * @description Notional in USDC units (1,000,000 = 1 USDC)
1237
+ * @example 50000000
1159
1238
  */
1160
- exit_notional_usd?: string | null;
1239
+ notional_usdc_units: string;
1161
1240
  /**
1162
- * @description Exit notional in USD pips. Null for reverted or cancelled positions.
1163
- * @example 52500
1241
+ * @description Collateral in USDC units
1242
+ * @example 25000000
1164
1243
  */
1165
- exit_notional_usd_pips?: string | null;
1244
+ collateral_usdc_units: string;
1166
1245
  /**
1167
- * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) as return on equity in basis points
1168
- * @example 1700
1246
+ * @description Combined origination fee in basis points
1247
+ * @example 200
1169
1248
  */
1170
- net_realized_pnl_bps: number;
1249
+ origination_fee_bps: number;
1171
1250
  /**
1172
- * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) formatted as USD
1173
- * @example 0.435
1251
+ * @description Origination fee in USDC units
1252
+ * @example 1000000
1174
1253
  */
1175
- net_realized_pnl_usd: string;
1254
+ origination_fee_usdc_units: string;
1176
1255
  /**
1177
- * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) in USD pips (can be negative)
1178
- * @example 4350
1256
+ * @description Protocol component of the origination fee in basis points
1257
+ * @example 200
1179
1258
  */
1180
- net_realized_pnl_usd_pips: string;
1259
+ protocol_origination_fee_bps: number;
1181
1260
  /**
1182
- * @description Proceeds formatted as USD
1183
- * @example 3.00
1261
+ * @description Partner component of the origination fee in basis points
1262
+ * @example 0
1184
1263
  */
1185
- proceeds_usd: string;
1264
+ partner_origination_fee_bps: number;
1186
1265
  /**
1187
- * @description Proceeds returned to user in USD pips
1188
- * @example 30000
1266
+ * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
1267
+ * @example 0
1189
1268
  */
1190
- proceeds_usd_pips: string;
1269
+ polymarket_trading_fee_bps: number;
1191
1270
  /**
1192
- * @description Realized PnL formatted as USD
1193
- * @example 0.50
1271
+ * @description Partner Polymarket builder taker fee in basis points (flat percentage of notional).
1272
+ * @example 0
1194
1273
  */
1195
- realized_pnl_usd: string;
1274
+ partner_trading_fee_bps: number;
1196
1275
  /**
1197
- * @description Realized PnL in USD pips (can be negative)
1198
- * @example 5000
1276
+ * @description Expected venue trading fee in USDC units charged to open the position (protocol venue fee + partner builder fee), computed from notional and entry price.
1277
+ * @example 2204118
1199
1278
  */
1200
- realized_pnl_usd_pips: string;
1201
- };
1202
- CustomerClosedPosition: {
1203
- /** @description Entry details */
1204
- entry: components["schemas"]["CustomerPositionEntry"];
1205
- /** @description Failure details if the position failed */
1206
- failure?: components["schemas"]["CustomerPositionFailure"];
1279
+ expected_open_trading_fee_usdc_units: string;
1207
1280
  /**
1208
- * @description Position ID
1209
- * @example dm_pos_abc123
1281
+ * @description Total amount the user must provide to open, in USDC units.
1282
+ * @example 28204118
1210
1283
  */
1211
- id: string;
1284
+ total_user_amount_usdc_units: string;
1212
1285
  /**
1213
- * @description Prediction market provider
1214
- * @enum {string}
1286
+ * @description Deterministic at-entry liquidation price ESTIMATE in USD pips (10000 pips = $1): `entry * (L-1)/L * (1 + liquidationFeeBps/10000)`. This is a closed-form estimate; the binding offer uses a TWAP/inference-based price that may differ.
1287
+ * @example 2629
1215
1288
  */
1216
- provider: "polymarket";
1289
+ estimated_liquidation_price_usd_pips: string;
1217
1290
  /**
1218
- * @description Market side
1219
- * @enum {string}
1291
+ * @description Gross maximum gain in USDC units: full value on a win (settlement at $1) minus notional, before fees. Profit over principal; may be negative.
1292
+ * @example 48039215
1220
1293
  */
1221
- side: "yes" | "no";
1294
+ gross_max_gain_usdc_units: string;
1222
1295
  /**
1223
- * @description Simplified position status
1224
- * @enum {string}
1296
+ * @description Net maximum gain in USDC units: grossMaxGain minus the open trading fee and the origination fee. Assumes a win via settlement (no exit trading fee) and excludes lifetime fees, so it is an upper bound. May be negative.
1297
+ * @example 44835097
1225
1298
  */
1226
- status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
1227
- /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
1228
- unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1229
- /** @description Fee details for closed position */
1230
- fees: components["schemas"]["CustomerPositionClosedFees"];
1231
- /** @description Position result/outcome */
1232
- result: components["schemas"]["CustomerPositionResult"];
1299
+ net_max_gain_usdc_units: string;
1300
+ };
1301
+ CustomerLimit: {
1233
1302
  /**
1234
- * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
1235
- * @example 84000
1303
+ * @description Total limit formatted as USD
1304
+ * @example 1000.00
1236
1305
  */
1237
- effective_leverage_bps: number;
1306
+ limit_usd: string;
1238
1307
  /**
1239
- * @description Market ticker identifier
1240
- * @example TRUMP-2024-WIN
1308
+ * @description Total limit in USD pips (10000 pips = $1)
1309
+ * @example 10000000
1241
1310
  */
1242
- market_ticker: string;
1243
- /** @description Market title */
1244
- market_title?: string;
1245
- /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
1246
- on_chain_position_key: string;
1311
+ limit_usd_pips: string;
1247
1312
  /**
1248
- * @description Wallet address (Solana public key or EVM address)
1249
- * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1313
+ * @description Remaining available limit formatted as USD
1314
+ * @example 750.00
1250
1315
  */
1251
- wallet_address: string;
1316
+ remaining_usd: string;
1252
1317
  /**
1253
- * @description Reason the position was closed
1254
- * @enum {string}
1318
+ * @description Remaining available limit in USD pips
1319
+ * @example 7500000
1255
1320
  */
1256
- close_reason: "closed" | "liquidated" | "reverted" | "settled";
1321
+ remaining_usd_pips: string;
1257
1322
  /**
1258
- * @description Why the position was reverted before it opened. Non-null only when `close_reason` is `reverted`: `exchange_unavailable` (the prediction-market venue was temporarily unavailable — safe to retry), `slippage_exceeded` (price moved beyond tolerance before the order filled), or `unknown`.
1259
- * @enum {string|null}
1323
+ * @description Current usage formatted as USD
1324
+ * @example 250.00
1260
1325
  */
1261
- revert_reason?: "exchange_unavailable" | "slippage_exceeded" | "unknown" | null;
1326
+ usage_usd: string;
1327
+ /**
1328
+ * @description Current usage in USD pips
1329
+ * @example 2500000
1330
+ */
1331
+ usage_usd_pips: string;
1262
1332
  };
1263
1333
  CustomerPartialClose: {
1264
1334
  /**
@@ -1417,10 +1487,75 @@ interface components {
1417
1487
  */
1418
1488
  allow_partial_fill: boolean;
1419
1489
  /**
1420
- * @description Minimum fill the user will accept, in basis points. Only valid when allowPartialFill=true (rejected otherwise). Must be in [2000, 5000] and divisible by 500 (5% steps). Capped from below by max(2000, ceil(MIN_COLLATERAL × 10000 / requestedCollateral)).
1490
+ * @description Minimum fill the user will accept, in basis points. Only valid when allowPartialFill=true (rejected otherwise). Must be in [2000, 7000] and divisible by 500 (5% steps). Capped from below by max(2000, ceil(MIN_COLLATERAL × 10000 / requestedCollateral)).
1421
1491
  * @example 5000
1422
1492
  */
1423
1493
  min_fill_bps?: number;
1494
+ /**
1495
+ * @description Risk mode for the resulting position. adaptive: the live risk engine manages leverage. committed: the quote carries a fixed set of price-triggered unwinds and the user posts extra margin. A committed request is answered in committed mode or not at all — when the market, price or leverage rules the mode out, the quote is rejected with QUOTE_COMMITTED_RISK_MODE_UNAVAILABLE carrying the reason. Take a draft quote first to see whether the mode is on offer.
1496
+ * @default adaptive
1497
+ * @example committed
1498
+ * @enum {string}
1499
+ */
1500
+ risk_mode: "adaptive" | "committed";
1501
+ };
1502
+ PlannedUnwind: {
1503
+ /**
1504
+ * @description Order in which this unwind fires, starting at 0
1505
+ * @example 0
1506
+ */
1507
+ sequence: number;
1508
+ /**
1509
+ * @description Price at which this unwind fires, formatted as USD
1510
+ * @example 0.42
1511
+ */
1512
+ trigger_price_usd: string;
1513
+ /**
1514
+ * @description Price at which this unwind fires, in USD pips (10000 pips = $1)
1515
+ * @example 4200
1516
+ */
1517
+ trigger_price_usd_pips: string;
1518
+ /**
1519
+ * @description Book leverage the position is unwound to when this fires, in basis points (10000 = 1x)
1520
+ * @example 15000
1521
+ */
1522
+ target_leverage_bps: number;
1523
+ /**
1524
+ * @description Estimated whole tokens sold to reach the target. An estimate only — the executed amount depends on the fill.
1525
+ * @example 30
1526
+ */
1527
+ estimated_sell_tokens: string;
1528
+ /**
1529
+ * @description Estimated token units sold to reach the target (1000000 units = 1 token). An estimate only — the executed amount depends on the fill.
1530
+ * @example 30000000
1531
+ */
1532
+ estimated_sell_token_units: string;
1533
+ };
1534
+ CommittedUnwinds: {
1535
+ /** @description Whether committed mode can be offered for this quote */
1536
+ available: boolean;
1537
+ /**
1538
+ * @description Extra margin the user must post on top of collateral, formatted as USD
1539
+ * @example 67.00
1540
+ */
1541
+ margin_required_usd?: string | null;
1542
+ /**
1543
+ * @description Extra margin the user must post on top of collateral, in USDC units (1000000 units = 1 USDC)
1544
+ * @example 67000000
1545
+ */
1546
+ margin_required_usdc_units?: string | null;
1547
+ /**
1548
+ * @description Price at which selling the remaining tokens repays the loan in full, formatted as USD
1549
+ * @example 0.27
1550
+ */
1551
+ debt_clear_price_usd?: string | null;
1552
+ /**
1553
+ * @description Price at which selling the remaining tokens repays the loan in full, in USD pips
1554
+ * @example 2700
1555
+ */
1556
+ debt_clear_price_usd_pips?: string | null;
1557
+ /** @description The pre-committed unwinds, in the order they fire. Null when committed mode is unavailable. */
1558
+ planned_unwinds?: components["schemas"]["PlannedUnwind"][] | null;
1424
1559
  };
1425
1560
  CustomerOfferMaxGain: {
1426
1561
  /**
@@ -1505,6 +1640,12 @@ interface components {
1505
1640
  * @example 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890
1506
1641
  */
1507
1642
  polymarket_market_id: string;
1643
+ /**
1644
+ * @description Which Polymarket share ledger the market uses, numbered as the vault numbers it: 1 = Conditional Tokens (CTF), 2 = Polymarket Protocol V2 (PositionManager). Pass it as `protocolVersion` to the vault. A version 2 quote is signed for `createPositionWithVersion` / `createPositionWithMarginAndVersion` (or their push-funded twins) and is rejected by the create functions without a version.
1645
+ * @example 1
1646
+ * @enum {number}
1647
+ */
1648
+ polymarket_protocol_version: 1 | 2;
1508
1649
  /** @description EIP-191 signature for contract create position */
1509
1650
  contract_signature: string;
1510
1651
  /**
@@ -1517,6 +1658,24 @@ interface components {
1517
1658
  * @example 0x1234567890123456789012345678901234567890
1518
1659
  */
1519
1660
  polygon_vault_contract_address: string;
1661
+ /**
1662
+ * @description Risk mode this quote was issued in. A committed request is answered in committed mode or rejected, so this only reports adaptive when adaptive was asked for.
1663
+ * @example adaptive
1664
+ * @enum {string}
1665
+ */
1666
+ risk_mode: "adaptive" | "committed";
1667
+ /** @description Committed-unwind mode for this quote: the pre-committed unwinds and the extra margin they require, or whether the mode can be offered at all. */
1668
+ committed_unwinds?: components["schemas"]["CommittedUnwinds"];
1669
+ /**
1670
+ * @description Extra margin locked in the vault on top of collateral, formatted as USD. Zero on adaptive quotes.
1671
+ * @example 0.00
1672
+ */
1673
+ margin_usd: string;
1674
+ /**
1675
+ * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive quotes. Included in totalUserAmountUsdcUnits.
1676
+ * @example 0
1677
+ */
1678
+ margin_usdc_units: string;
1520
1679
  /**
1521
1680
  * @description Expected trading fee formatted as USD
1522
1681
  * @example 0.02
@@ -1714,11 +1873,20 @@ interface components {
1714
1873
  */
1715
1874
  total_user_amount_usd_pips: string;
1716
1875
  /**
1717
- * @description Total amount user must transfer at createPosition in USDC units (1,000,000 units = 1 USDC). Contract-ready value. On Polymarket = collateral + originationFee.
1876
+ * @description Total amount user must transfer at position creation in USDC units (1,000,000 units = 1 USDC). Contract-ready value = collateral + originationFee + expected open trading fee + committed-mode margin.
1718
1877
  * @example 2730000
1719
1878
  */
1720
1879
  total_user_amount_usdc_units: string;
1721
1880
  };
1881
+ PromoteOfferBody: {
1882
+ /**
1883
+ * @description Risk mode for the promoted offer. The draft carries the committed unwinds it was quoted with; this chooses whether the promoted offer opens on them. Omitted means adaptive.
1884
+ * @default adaptive
1885
+ * @example committed
1886
+ * @enum {string}
1887
+ */
1888
+ risk_mode: "adaptive" | "committed";
1889
+ };
1722
1890
  };
1723
1891
  responses: never;
1724
1892
  parameters: never;
@@ -1728,7 +1896,23 @@ interface components {
1728
1896
  }
1729
1897
 
1730
1898
  type Raw = components["schemas"];
1731
- type Market = CamelizeKeys<Raw["CustomerMarket"]>;
1899
+ /**
1900
+ * The event a market belongs to — the real-world happening it resolves against (one game, one
1901
+ * hourly price window). `seriesTicker` names the recurring template the event came from, and is
1902
+ * null for events with no series.
1903
+ *
1904
+ * Hand-written rather than derived from `Raw` because `generated.ts` is currently pinned to an API
1905
+ * version that predates this block. Delete this and let `CustomerMarket` supply `event` the next
1906
+ * time the types are regenerated against a spec that has it.
1907
+ */
1908
+ interface MarketEvent {
1909
+ seriesTicker: string | null;
1910
+ ticker: string;
1911
+ title: string | null;
1912
+ }
1913
+ type Market = CamelizeKeys<Raw["CustomerMarket"]> & {
1914
+ event: MarketEvent;
1915
+ };
1732
1916
  type MarketLeverage = CamelizeKeys<Raw["CustomerLeverage"]>;
1733
1917
  type MarketMaxLeveragePerNotional = CamelizeKeys<Raw["CustomerMaxMarketLeveragePerNotional"]>;
1734
1918
  type MarketSidedMaxLeveragePerNotional = CamelizeKeys<Raw["CustomerSidedMaxMarketLeveragePerNotional"]>;
@@ -1770,6 +1954,7 @@ type FeeRatesOriginationTier = CamelizeKeys<Raw["CustomerOriginationFeeTier"]>;
1770
1954
  type FeeRatesMarket = CamelizeKeys<Raw["CustomerFeeRatesMarket"]>;
1771
1955
  type FeeRates = CamelizeKeys<Raw["CustomerFeeRates"]>;
1772
1956
  type FeeReport = CamelizeKeys<Raw["CustomerFeeReport"]>;
1957
+ type RiskMode = "adaptive" | "committed";
1773
1958
  interface CreateQuoteParams {
1774
1959
  marketTicker: string;
1775
1960
  effectiveSide: "yes" | "no";
@@ -1779,6 +1964,15 @@ interface CreateQuoteParams {
1779
1964
  pmProvider?: "polymarket" | "kalshi";
1780
1965
  allowPartialFill?: boolean;
1781
1966
  minFillBps?: number;
1967
+ /**
1968
+ * Ask for a committed deleverage plan (a fixed ladder of trigger prices, backed by a refundable
1969
+ * margin deposit) instead of the adaptive risk engine. Defaults to `adaptive`.
1970
+ *
1971
+ * A committed request is answered in committed mode or rejected with
1972
+ * `quote_committed_risk_mode_unavailable` — you never get an adaptive quote back from it. Take a
1973
+ * draft first and read `committedUnwinds.available` to know whether the mode is on offer.
1974
+ */
1975
+ riskMode?: RiskMode;
1782
1976
  }
1783
1977
  /** @deprecated Renamed to {@link CreateQuoteParams}. Kept as an alias for backward compatibility. */
1784
1978
  type CreateOfferParams = CreateQuoteParams;
@@ -1793,4 +1987,4 @@ declare function isOpenPosition(p: Position): p is OpenPosition;
1793
1987
  declare function isClosedPosition(p: Position): p is ClosedPosition;
1794
1988
  declare function leverageMaxBps(lev: MarketLeverage, side: "yes" | "no"): number;
1795
1989
 
1796
- export { type PositionFailure as A, type PositionOpenFees as B, type CreateQuoteParams as C, type PositionPartialClose as D, type PositionResult as E, type FeeRates as F, type PositionRisk as G, type PositionTiming as H, type PositionUnwind as I, type PositionUnwindList as J, isClosedPosition as K, isOpenPosition as L, type Market as M, leverageMaxBps as N, type Offer as O, type Position as P, type Quote as Q, type MarketPolymarket as a, type MarketLeverage as b, type PositionTransactions as c, type PositionPartialCloseList as d, type ContractInfo as e, type CustomerLimit as f, type FeeReportParams as g, type FeeReport as h, type CamelizeKeys as i, type CloseAttempt as j, type ClosedPosition as k, type CreateOfferParams as l, type CreateTokenResult as m, type FeeRatesMarket as n, type FeeRatesOriginationTier as o, type MarketFees as p, type MarketMaxLeveragePerNotional as q, type MarketPrices as r, type MarketSidedEligibility as s, type MarketSidedMaxLeveragePerNotional as t, type OpenPosition as u, type OriginationTier as v, type PendingOperation as w, type PositionClosedFees as x, type PositionCurrent as y, type PositionEntry as z };
1990
+ export { type PositionCurrent as A, type PositionEntry as B, type CreateQuoteParams as C, type PositionFailure as D, type PositionOpenFees as E, type FeeRates as F, type PositionPartialClose as G, type PositionResult as H, type PositionRisk as I, type PositionTiming as J, type PositionUnwind as K, isClosedPosition as L, type Market as M, isOpenPosition as N, type Offer as O, type Position as P, type Quote as Q, type RiskMode as R, leverageMaxBps as S, type MarketPolymarket as a, type MarketLeverage as b, type PositionTransactions as c, type PositionUnwindList as d, type PositionPartialCloseList as e, type ContractInfo as f, type CustomerLimit as g, type FeeReportParams as h, type FeeReport as i, type CamelizeKeys as j, type CloseAttempt as k, type ClosedPosition as l, type CreateOfferParams as m, type CreateTokenResult as n, type FeeRatesMarket as o, type FeeRatesOriginationTier as p, type MarketEvent as q, type MarketFees as r, type MarketMaxLeveragePerNotional as s, type MarketPrices as t, type MarketSidedEligibility as u, type MarketSidedMaxLeveragePerNotional as v, type OpenPosition as w, type OriginationTier as x, type PendingOperation as y, type PositionClosedFees as z };