@dimes-dot-fi/sdk 2.5.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.
@@ -43,1248 +43,1292 @@ interface components {
43
43
  */
44
44
  polygon_vault_contract_address: string;
45
45
  };
46
- CustomerOriginationFeeTier: {
47
- /**
48
- * @description Upper leverage bound (inclusive) in basis points for this tier. The last tier is the catch-all.
49
- * @example 40000
50
- */
51
- max_leverage_bps: number;
52
- /**
53
- * @description Protocol origination fee in basis points applied at or below this tier's leverage bound.
54
- * @example 200
55
- */
56
- fee_bps: number;
57
- };
58
- CustomerFeeRatesMarket: {
59
- /**
60
- * @description Market ticker
61
- * @example TRUMP-2024-WIN
62
- */
63
- ticker: string;
46
+ CustomerPositionEntry: {
64
47
  /**
65
- * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
66
- * @example 0
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
67
50
  */
68
- polymarket_trading_fee_bps: number;
51
+ collateral_usd: string;
69
52
  /**
70
- * @description Polymarket fee-curve exponent (`feeExponent`). `1` for the standard quadratic curve.
71
- * @example 1
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
72
55
  */
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"][];
56
+ collateral_usd_pips: string;
80
57
  /**
81
- * @description Maximum combined (protocol + partner) origination fee in basis points enforced on-chain.
82
- * @example 1000
58
+ * @description Entry leverage in basis points (20000 = 2x)
59
+ * @example 20000
83
60
  */
84
- contract_max_origination_fee_bps: number;
61
+ leverage_bps: number;
85
62
  /**
86
- * @description Lifetime fee APR in basis points
87
- * @example 2000
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}
88
66
  */
89
- lifetime_fee_apr_bps: number;
67
+ risk_mode: "adaptive" | "committed";
90
68
  /**
91
- * @description Liquidation fee in basis points
92
- * @example 250
69
+ * @description Extra margin locked in the vault on top of collateral, formatted as USD. Zero on adaptive positions.
70
+ * @example 0.00
93
71
  */
94
- liquidation_fee_bps: number;
72
+ locked_margin_usd: string;
95
73
  /**
96
- * @description This partner's origination fee component in basis points, added to the protocol tier fee. `0` by default.
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.
97
75
  * @example 0
98
76
  */
99
- partner_origination_fee_bps: number;
77
+ locked_margin_usdc_units: string;
100
78
  /**
101
- * @description This partner's Polymarket builder taker fee in basis points (flat percentage of notional). `0` by default.
102
- * @example 0
79
+ * @description Entry notional formatted as USD
80
+ * @example 5.00
103
81
  */
104
- partner_trading_fee_bps: number;
105
- };
106
- FeeReportBody: {
82
+ notional_usd: string;
107
83
  /**
108
- * @description Leverage in basis points (20000 = 2x, 100000 = 10x). Must be divisible by 2500. Maximum 10x.
84
+ * @description Entry notional in USD pips
109
85
  * @example 50000
110
86
  */
111
- leverage_bps: number;
87
+ notional_usd_pips: string;
112
88
  /**
113
- * @description Market ticker
114
- * @example TRUMP-2024-WIN
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
115
91
  */
116
- market_ticker: string;
92
+ open_latency_ms?: number | null;
117
93
  /**
118
- * @description Notional amount in USD pips (10,000 pips = $1.00)
119
- * @example 50000
94
+ * @description ISO 8601 timestamp when position was opened
95
+ * @example 2025-01-15T10:30:00.000Z
120
96
  */
121
- notional_amount_usd_pips: string;
97
+ opened_at?: string;
122
98
  /**
123
- * @description Market side (yes or no)
124
- * @enum {string}
99
+ * @description Combined origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
100
+ * @example 100
125
101
  */
126
- effective_side: "yes" | "no";
102
+ origination_fee_bps: number;
127
103
  /**
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
104
+ * @description Protocol portion of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
105
+ * @example 80
130
106
  */
131
- entry_price_usd_pips?: string;
132
- };
133
- CustomerFeeReport: {
107
+ protocol_origination_fee_bps: number;
134
108
  /**
135
- * @description Market ticker
136
- * @example TRUMP-2024-WIN
109
+ * @description Partner portion of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
110
+ * @example 20
137
111
  */
138
- market_ticker: string;
112
+ partner_origination_fee_bps: number;
139
113
  /**
140
- * @description Market side
141
- * @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
142
116
  */
143
- effective_side: "yes" | "no";
117
+ origination_fee_usd: string;
144
118
  /**
145
- * @description Leverage in basis points (20000 = 2x)
146
- * @example 20000
119
+ * @description Origination fee actually charged, in USD pips. On a partial fill this is net of the open-time refund.
120
+ * @example 500
147
121
  */
148
- leverage_bps: number;
122
+ origination_fee_usd_pips: string;
149
123
  /**
150
- * @description Entry price used for the computation, in USD pips
151
- * @example 5100
124
+ * @description Entry price formatted as USD
125
+ * @example 0.50
152
126
  */
153
- entry_price_usd_pips: string;
127
+ price_usd: string;
154
128
  /**
155
- * @description Notional in USD pips (10000 pips = $1)
156
- * @example 500000
129
+ * @description Entry price in USD pips
130
+ * @example 5000
157
131
  */
158
- notional_amount_usd_pips: string;
132
+ price_usd_pips: string;
159
133
  /**
160
- * @description Notional in USDC units (1,000,000 = 1 USDC)
161
- * @example 50000000
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
162
136
  */
163
- notional_usdc_units: string;
137
+ effective_entry_price_usd?: string | null;
164
138
  /**
165
- * @description Collateral in USDC units
166
- * @example 25000000
139
+ * @description Effective entry price in USD pips. Null until the fill is recorded on chain.
140
+ * @example 5025
167
141
  */
168
- collateral_usdc_units: string;
142
+ effective_entry_price_usd_pips?: string | null;
169
143
  /**
170
- * @description Combined origination fee in basis points
171
- * @example 200
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
172
146
  */
173
- origination_fee_bps: number;
147
+ effective_slippage_bps?: number | null;
174
148
  /**
175
- * @description Origination fee in USDC units
176
- * @example 1000000
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
177
151
  */
178
- origination_fee_usdc_units: string;
152
+ position_token_units?: string | null;
179
153
  /**
180
- * @description Protocol component of the origination fee in basis points
181
- * @example 200
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
182
156
  */
183
- protocol_origination_fee_bps: number;
157
+ initial_fill_bps?: number | null;
158
+ };
159
+ CustomerPositionFailure: {
184
160
  /**
185
- * @description Partner component of the origination fee in basis points
186
- * @example 0
161
+ * @description Failure reason code
162
+ * @example price_exceeded_tolerance
187
163
  */
188
- partner_origination_fee_bps: number;
164
+ reason: string;
165
+ };
166
+ CustomerPositionUnwind: {
189
167
  /**
190
- * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
191
- * @example 0
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}
192
171
  */
193
- polymarket_trading_fee_bps: number;
172
+ status: "executed" | "planned" | "superseded" | "triggered";
194
173
  /**
195
- * @description Partner Polymarket builder taker fee in basis points (flat percentage of notional).
196
- * @example 0
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}
197
177
  */
198
- partner_trading_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;
199
179
  /**
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
180
+ * @description Leverage after unwind in basis points (20000 = 2x)
181
+ * @example 30000
202
182
  */
203
- expected_open_trading_fee_usdc_units: string;
183
+ after_leverage_bps: number;
204
184
  /**
205
- * @description Total amount the user must provide to open, in USDC units.
206
- * @example 28204118
185
+ * @description Leverage before unwind in basis points (20000 = 2x)
186
+ * @example 60000
207
187
  */
208
- total_user_amount_usdc_units: string;
188
+ before_leverage_bps: number;
209
189
  /**
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
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
212
192
  */
213
- estimated_liquidation_price_usd_pips: string;
193
+ executed_at?: string | null;
214
194
  /**
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
195
+ * @description Price at which this planned unwind fires, formatted as USD. Null on executed unwinds.
196
+ * @example 0.42
217
197
  */
218
- gross_max_gain_usdc_units: string;
198
+ trigger_price_usd?: string | null;
219
199
  /**
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
200
+ * @description Price at which this planned unwind fires, in USD pips (10000 pips = $1). Null on executed unwinds.
201
+ * @example 4200
222
202
  */
223
- net_max_gain_usdc_units: string;
203
+ trigger_price_usd_pips?: string | null;
204
+ /**
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.
207
+ */
208
+ reason_detail?: string | null;
224
209
  };
225
- CustomerLimit: {
210
+ CustomerPositionUnwindList: {
211
+ data: components["schemas"]["CustomerPositionUnwind"][];
212
+ has_more: boolean;
213
+ total_count?: number;
226
214
  /**
227
- * @description Total limit formatted as USD
228
- * @example 1000.00
215
+ * @description Current leverage of the position in basis points (20000 = 2x), null if not yet calculated
216
+ * @example 30000
229
217
  */
230
- limit_usd: string;
218
+ current_leverage_bps: number | null;
231
219
  /**
232
- * @description Total limit in USD pips (10000 pips = $1)
233
- * @example 10000000
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
234
222
  */
235
- limit_usd_pips: string;
223
+ originated_at: string | null;
236
224
  /**
237
- * @description Remaining available limit formatted as USD
238
- * @example 750.00
225
+ * @description Leverage at position origination in basis points (20000 = 2x)
226
+ * @example 60000
239
227
  */
240
- remaining_usd: string;
228
+ origination_leverage_bps: number;
229
+ };
230
+ CustomerCloseAttempt: {
241
231
  /**
242
- * @description Remaining available limit in USD pips
243
- * @example 7500000
232
+ * @description Outcome of the close attempt. `deferred` means the close could not complete yet and was postponed.
233
+ * @enum {string}
244
234
  */
245
- remaining_usd_pips: string;
235
+ outcome: "deferred";
246
236
  /**
247
- * @description Current usage formatted as USD
248
- * @example 250.00
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}
249
239
  */
250
- usage_usd: string;
240
+ reason: "awaiting_settlement";
251
241
  /**
252
- * @description Current usage in USD pips
253
- * @example 2500000
242
+ * @description ISO-8601 timestamp of when the close was requested.
243
+ * @example 2026-06-15T17:27:11.736Z
254
244
  */
255
- usage_usd_pips: string;
245
+ deferred_at: string;
256
246
  };
257
- CustomerOriginationTier: {
247
+ CustomerPendingOperation: {
258
248
  /**
259
- * @description Origination fee in basis points for this tier
260
- * @example 100
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}
261
251
  */
262
- fee_bps: number;
263
- /**
264
- * @description Maximum leverage in basis points for this tier
265
- * @example 20000
266
- */
267
- max_leverage_bps: number;
268
- };
269
- CustomerFees: {
252
+ type: "open" | "close" | "partial_close" | "unwind" | "liquidate" | "settle";
270
253
  /**
271
- * @description Lifetime fee APR in basis points
272
- * @example 500
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}
273
257
  */
274
- lifetime_apr_bps: number;
258
+ phase?: "requested" | "initiated" | "pending" | "awaiting_settlement" | null;
275
259
  /**
276
- * @description Liquidation fee in basis points
277
- * @example 200
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
278
262
  */
279
- liquidation_bps: number;
280
- /** @description Origination fee tiers by leverage */
281
- origination_tiers: components["schemas"]["CustomerOriginationTier"][];
263
+ token_units?: string | null;
282
264
  };
283
- CustomerMaxMarketLeveragePerNotional: {
265
+ CustomerPositionCurrent: {
284
266
  /**
285
- * @description Maximum market leverage in basis points when the position notional is $100
286
- * @example 100000
267
+ * @description Current book-value leverage in basis points (20000 = 2x)
268
+ * @example 18000
287
269
  */
288
- at100_usd_bps: number;
270
+ book_leverage_bps: number;
289
271
  /**
290
- * @description Maximum market leverage in basis points when the position notional is $500
291
- * @example 80000
272
+ * @description Current collateral formatted as USD
273
+ * @example 2.50
292
274
  */
293
- at500_usd_bps: number;
275
+ collateral_usd: string;
294
276
  /**
295
- * @description Maximum market leverage in basis points when the position notional is $1,000
296
- * @example 60000
277
+ * @description Current collateral in USD pips
278
+ * @example 25000
297
279
  */
298
- at1000_usd_bps: number;
280
+ collateral_usd_pips: string;
299
281
  /**
300
- * @description Maximum market leverage in basis points when the position notional is $10,000
301
- * @example 30000
282
+ * @description Effective collateral formatted as USD
283
+ * @example 2.45
302
284
  */
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: {
285
+ effective_collateral_usd: string;
312
286
  /**
313
- * @deprecated
314
- * @description Deprecated: use maxYesBps and maxNoBps. Populated as min(maxYesBps, maxNoBps) for backwards compatibility.
315
- * @example 50000
287
+ * @description Effective collateral after fees in USD pips
288
+ * @example 24500
316
289
  */
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"];
290
+ effective_collateral_usd_pips: string;
320
291
  /**
321
- * @description Maximum leverage in basis points for the NO side
322
- * @example 50000
292
+ * @deprecated
293
+ * @description Current leverage in basis points
294
+ * @example 18000
323
295
  */
324
- max_no_bps: number;
296
+ leverage_bps: number;
325
297
  /**
326
- * @description Maximum leverage in basis points for the YES side
327
- * @example 50000
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
328
300
  */
329
- max_yes_bps: number;
301
+ market_leverage_bps?: number | null;
330
302
  /**
331
- * @description Minimum leverage in basis points
332
- * @example 10000
303
+ * @description Current mark price formatted as USD
304
+ * @example 0.55
333
305
  */
334
- min_bps: number;
306
+ mark_price_usd: string;
335
307
  /**
336
- * @description Leverage step increment in basis points
337
- * @example 1000
308
+ * @description Current mark price in USD pips
309
+ * @example 5500
338
310
  */
339
- step_bps: number;
340
- };
341
- CustomerMarketPolymarket: {
311
+ mark_price_usd_pips: string;
342
312
  /**
343
- * @description Polymarket market slug, matching the slug in Polymarket URLs and Gamma API responses.
344
- * @example will-trump-win-the-2024-election
313
+ * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) as return on equity in basis points
314
+ * @example 1800
345
315
  */
346
- slug: string;
316
+ net_unrealized_pnl_bps: number;
347
317
  /**
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
318
+ * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) formatted as USD
319
+ * @example 0.45
350
320
  */
351
- condition_id?: string | null;
321
+ net_unrealized_pnl_usd: string;
352
322
  /**
353
- * @description Polymarket CLOB token ID for the NO outcome (the ERC1155 position token ID).
354
- * @example 71321045679252212594626385532706912750332728571942532289631379312455583992563
323
+ * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) in USD pips (can be negative)
324
+ * @example 4500
355
325
  */
356
- no_token_id: string;
326
+ net_unrealized_pnl_usd_pips: string;
357
327
  /**
358
- * @description Polymarket CLOB token ID for the YES outcome (the ERC1155 position token ID).
359
- * @example 21742633143463906290569050155826241533067272736897614950488156847949938836455
328
+ * @description Current notional formatted as USD
329
+ * @example 5.50
360
330
  */
361
- yes_token_id: string;
362
- };
363
- CustomerSideEligibility: {
331
+ notional_usd: string;
364
332
  /**
365
- * @description Whether this market is accepting new positions on this side
366
- * @example true
333
+ * @description Current notional in USD pips
334
+ * @example 55000
367
335
  */
368
- accepting_new_positions: boolean;
336
+ notional_usd_pips: string;
369
337
  /**
370
- * @description Reason code if this side is not accepting new positions; null when accepting
371
- * @example QUOTE_MARKET_NOT_ELIGIBLE
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
372
340
  */
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: {
341
+ min_partial_close_token_units?: string | null;
382
342
  /**
383
- * @description NO side ask price formatted as USD
384
- * @example 0.51
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
385
345
  */
386
- no_ask_price_usd: string;
346
+ max_partial_close_token_units?: string | null;
387
347
  /**
388
- * @description NO side ask price in USD pips (10000 pips = $1)
389
- * @example 5100
348
+ * @description Position token units held (1000000 units = 1 token)
349
+ * @example 10000000
390
350
  */
391
- no_ask_price_usd_pips: string;
351
+ position_token_units: string;
392
352
  /**
393
- * @description NO side bid price formatted as USD
394
- * @example 0.49
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
395
355
  */
396
- no_bid_price_usd: string;
356
+ remaining_bps?: number | null;
397
357
  /**
398
- * @description NO side bid price in USD pips (10000 pips = $1)
399
- * @example 4900
358
+ * @description Total position value formatted as USD
359
+ * @example 3.00
400
360
  */
401
- no_bid_price_usd_pips: string;
361
+ position_value_usd: string;
402
362
  /**
403
- * @description YES side ask price formatted as USD
404
- * @example 0.51
363
+ * @description Total position value in USD pips
364
+ * @example 30000
405
365
  */
406
- yes_ask_price_usd: string;
366
+ position_value_usd_pips: string;
407
367
  /**
408
- * @description YES side ask price in USD pips (10000 pips = $1)
409
- * @example 5100
368
+ * @description Unrealized PnL as return on equity in basis points (1000 = 10%)
369
+ * @example 2000
410
370
  */
411
- yes_ask_price_usd_pips: string;
371
+ unrealized_pnl_bps: number;
412
372
  /**
413
- * @description YES side bid price formatted as USD
414
- * @example 0.49
373
+ * @description Unrealized PnL formatted as USD
374
+ * @example 0.50
415
375
  */
416
- yes_bid_price_usd: string;
376
+ unrealized_pnl_usd: string;
417
377
  /**
418
- * @description YES side bid price in USD pips (10000 pips = $1)
419
- * @example 4900
378
+ * @description Unrealized PnL in USD pips (can be negative)
379
+ * @example 5000
420
380
  */
421
- yes_bid_price_usd_pips: string;
381
+ unrealized_pnl_usd_pips: string;
422
382
  };
423
- CustomerMarket: {
383
+ CustomerPositionOpenFees: {
424
384
  /**
425
- * @description Market category
426
- * @example politics
385
+ * @description Accrued lifetime fee formatted as USD
386
+ * @example 0.01
427
387
  */
428
- category: string;
429
- /** @description Fee configuration */
430
- fees: components["schemas"]["CustomerFees"];
388
+ accrued_lifetime_fee_usd: string;
431
389
  /**
432
- * @description Market ID
433
- * @example dm_mkt_abc123
390
+ * @description Accrued lifetime fee in USD pips
391
+ * @example 100
434
392
  */
435
- id: string;
436
- /** @description Leverage configuration */
437
- leverage: components["schemas"]["CustomerLeverage"];
393
+ accrued_lifetime_fee_usd_pips: string;
438
394
  /**
439
- * @description Prediction market provider
440
- * @enum {string}
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
441
397
  */
442
- provider: "polymarket";
398
+ accrued_venue_fee_usd: string;
443
399
  /**
444
- * @description Current market status
445
- * @enum {string}
400
+ * @description Venue trading fees paid so far on this position in USD pips.
401
+ * @example 200
446
402
  */
447
- status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
403
+ accrued_venue_fee_usd_pips: string;
448
404
  /**
449
- * @description Market tags for filtering
450
- * @example [
451
- * "politics",
452
- * "election"
453
- * ]
405
+ * @description Lifetime fee APR in basis points
406
+ * @example 500
454
407
  */
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"];
408
+ lifetime_apr_bps: number;
458
409
  /**
459
- * @deprecated
460
- * @description Deprecated: use `polymarket.slug`. Market ticker sourced from the upstream trading venue.
461
- * @example will-trump-win-the-2024-election
410
+ * @description Pending lifetime fee formatted as USD
411
+ * @example 0.005
462
412
  */
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;
413
+ pending_lifetime_fee_usd: string;
468
414
  /**
469
- * @description Whether this market is accepting new positions
470
- * @example true
415
+ * @description Pending lifetime fee in USD pips
416
+ * @example 50
471
417
  */
472
- accepting_new_positions: boolean;
418
+ pending_lifetime_fee_usd_pips: string;
473
419
  /**
474
- * @description ISO 8601 timestamp when market closes
475
- * @example 2025-01-20T12:00:00.000Z
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
476
422
  */
477
- close_time?: string;
423
+ total_fees_usd: string;
478
424
  /**
479
- * @description ISO 8601 timestamp when this market was first discovered and listed on the platform
480
- * @example 2025-01-10T08:00:00.000Z
425
+ * @description Sum of all fees accrued or owed so far (origination + accrued lifetime + pending lifetime + accrued venue) in USD pips.
426
+ * @example 850
481
427
  */
482
- discovered_at: string;
483
- /**
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
486
- */
487
- latest_enter_at?: string;
488
- /**
489
- * @description Minimum collateral amount formatted as USD
490
- * @example 0.02
491
- */
492
- min_collateral_usd: string;
493
- /**
494
- * @description Minimum collateral amount in USD pips (10000 pips = $1)
495
- * @example 200000
496
- */
497
- min_collateral_usd_pips: string;
498
- /**
499
- * @description Minimum notional amount formatted as USD
500
- * @example 5.00
501
- */
502
- min_notional_usd: string;
503
- /**
504
- * @description Minimum notional amount in USD pips (10000 pips = $1)
505
- * @example 50000
506
- */
507
- min_notional_usd_pips: string;
508
- /**
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
511
- * @enum {string}
512
- */
513
- settlement_state: "awaiting_resolution" | "none" | "settling" | "unresolved_upstream" | "voided";
514
- /**
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;
428
+ total_fees_usd_pips: string;
429
+ };
430
+ CustomerPositionRisk: {
519
431
  /**
520
- * @description Capacity-limited maximum notional for NO side in USD pips (10000 pips = $1)
521
- * @example 500000000
432
+ * @description Current liquidation price formatted as USD
433
+ * @example 0.35
522
434
  */
523
- capacity_max_notional_no_usd_pips?: string | null;
435
+ current_liquidation_price_usd: string;
524
436
  /**
525
- * @description Capacity-limited maximum notional for YES side formatted as USD
526
- * @example 50.00
437
+ * @description Current liquidation price in USD pips
438
+ * @example 3500
527
439
  */
528
- capacity_max_notional_yes_usd?: string | null;
440
+ current_liquidation_price_usd_pips: string;
529
441
  /**
530
- * @description Capacity-limited maximum notional for YES side in USD pips (10000 pips = $1)
531
- * @example 500000000
442
+ * @description Margin health 0-10000 (10000 at entry, 0 at liquidation)
443
+ * @example 7500
532
444
  */
533
- capacity_max_notional_yes_usd_pips?: string | null;
445
+ health_bps: number;
534
446
  /**
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
447
+ * @description Buffer to liquidation in basis points
448
+ * @example 500
537
449
  */
538
- max_notional_no_usd?: string;
450
+ liquidation_buffer_bps: number;
539
451
  /**
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
452
+ * @description Liquidation fee in basis points
453
+ * @example 200
542
454
  */
543
- max_notional_no_usd_pips?: string;
455
+ liquidation_fee_bps: number;
544
456
  /**
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
457
+ * @description Dollar distance to liquidation formatted as USD
458
+ * @example 0.50
547
459
  */
548
- max_notional_yes_usd?: string;
460
+ margin_buffer_usd: string;
549
461
  /**
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
462
+ * @description Dollar distance to liquidation in USD pips
463
+ * @example 5000
552
464
  */
553
- max_notional_yes_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;
554
472
  /**
555
- * @description Slippage-limited maximum notional for NO side formatted as USD
556
- * @example 50.00
473
+ * @description ISO 8601 timestamp when market closes
474
+ * @example 2025-01-20T12:00:00.000Z
557
475
  */
558
- slippage_max_notional_no_usd?: string | null;
476
+ market_close_time?: string;
559
477
  /**
560
- * @description Slippage-limited maximum notional for NO side in USD pips (10000 pips = $1)
561
- * @example 500000000
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}
562
481
  */
563
- slippage_max_notional_no_usd_pips?: string | null;
482
+ market_status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
564
483
  /**
565
- * @description Slippage-limited maximum notional for YES side formatted as USD
566
- * @example 50.00
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
486
+ * @enum {string}
567
487
  */
568
- slippage_max_notional_yes_usd?: string | null;
488
+ settlement_state: "awaiting_resolution" | "none" | "settling" | "unresolved_upstream" | "voided";
569
489
  /**
570
- * @description Slippage-limited maximum notional for YES side in USD pips (10000 pips = $1)
571
- * @example 500000000
490
+ * @description Minutes until market closes
491
+ * @example 1440
572
492
  */
573
- slippage_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"];
574
500
  /**
575
- * @description Reason code if market is not accepting new positions
576
- * @example QUOTE_MARKET_NOT_ELIGIBLE
501
+ * @description Position ID
502
+ * @example dm_pos_abc123
577
503
  */
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;
583
- };
584
- CustomerPositionEntry: {
504
+ id: string;
585
505
  /**
586
- * @description Entry collateral formatted as USD
587
- * @example 2.50
506
+ * @description Name of the partner the position was opened through.
507
+ * @example Acme Markets
588
508
  */
589
- collateral_usd: string;
509
+ partner: string;
590
510
  /**
591
- * @description Entry collateral in USD pips (10000 pips = $1)
592
- * @example 25000
511
+ * @description Prediction market provider
512
+ * @enum {string}
593
513
  */
594
- collateral_usd_pips: string;
514
+ provider: "polymarket";
595
515
  /**
596
- * @description Entry leverage in basis points (20000 = 2x)
597
- * @example 20000
516
+ * @description Market side
517
+ * @enum {string}
598
518
  */
599
- leverage_bps: number;
519
+ side: "yes" | "no";
600
520
  /**
601
- * @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.
602
- * @example adaptive
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.
603
522
  * @enum {string}
604
523
  */
605
- risk_mode: "adaptive" | "committed";
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"];
606
535
  /**
607
- * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive positions.
608
- * @example 0
536
+ * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
537
+ * @example 84000
609
538
  */
610
- locked_margin_usdc_units: string;
539
+ effective_leverage_bps: number;
611
540
  /**
612
- * @description Entry notional formatted as USD
613
- * @example 5.00
541
+ * @description Market ticker identifier
542
+ * @example TRUMP-2024-WIN
614
543
  */
615
- notional_usd: string;
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;
616
549
  /**
617
- * @description Entry notional in USD pips
618
- * @example 50000
550
+ * @description Wallet address (Solana public key or EVM address)
551
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
619
552
  */
620
- notional_usd_pips: string;
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;
621
556
  /**
622
- * @description Time in milliseconds from position creation to on-chain open confirmation. Null until the position is fully opened on chain.
623
- * @example 12500
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.
624
559
  */
625
- open_latency_ms?: number | null;
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;
563
+ };
564
+ CustomerPositionClosedFees: {
626
565
  /**
627
- * @description ISO 8601 timestamp when position was opened
628
- * @example 2025-01-15T10:30:00.000Z
566
+ * @description Lifetime fee APR in basis points
567
+ * @example 500
629
568
  */
630
- opened_at?: string;
569
+ lifetime_apr_bps: number;
631
570
  /**
632
- * @description Combined origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
571
+ * @deprecated
572
+ * @description Deprecated — use `entry.originationFeeBps`. Same value, kept for backwards compatibility.
633
573
  * @example 100
634
574
  */
635
575
  origination_fee_bps: number;
636
576
  /**
637
- * @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.
638
579
  * @example 80
639
580
  */
640
581
  protocol_origination_fee_bps: number;
641
582
  /**
642
- * @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.
643
585
  * @example 20
644
586
  */
645
587
  partner_origination_fee_bps: number;
646
588
  /**
647
- * @description Origination fee formatted as USD
589
+ * @deprecated
590
+ * @description Deprecated — use `entry.originationFeeUsd`. Same value, kept for backwards compatibility.
648
591
  * @example 0.05
649
592
  */
650
593
  origination_fee_usd: string;
651
594
  /**
652
- * @description Origination fee in USD pips
595
+ * @deprecated
596
+ * @description Deprecated — use `entry.originationFeeUsdPips`. Same value, kept for backwards compatibility.
653
597
  * @example 500
654
598
  */
655
599
  origination_fee_usd_pips: string;
656
600
  /**
657
- * @description Entry price formatted as USD
658
- * @example 0.50
659
- */
660
- price_usd: string;
661
- /**
662
- * @description Entry price in USD pips
663
- * @example 5000
601
+ * @description Total blended fees formatted as USD
602
+ * @example 0.085
664
603
  */
665
- price_usd_pips: string;
604
+ total_fees_usd: string;
666
605
  /**
667
- * @description Effective entry price (actual fill price on the prediction market) formatted as USD. Null until the fill is recorded on chain.
668
- * @example 0.5025
606
+ * @description Total blended fees (origination + lifetime + liquidation + venue) in USD pips
607
+ * @example 850
669
608
  */
670
- effective_entry_price_usd?: string | null;
609
+ total_fees_usd_pips: string;
671
610
  /**
672
- * @description Effective entry price in USD pips. Null until the fill is recorded on chain.
673
- * @example 5025
611
+ * @description Total lifetime fee formatted as USD
612
+ * @example 0.015
674
613
  */
675
- effective_entry_price_usd_pips?: string | null;
614
+ total_lifetime_fee_usd: string;
676
615
  /**
677
- * @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.
678
- * @example 50
616
+ * @description Total lifetime fee collected in USD pips
617
+ * @example 150
679
618
  */
680
- effective_slippage_bps?: number | null;
619
+ total_lifetime_fee_usd_pips: string;
681
620
  /**
682
- * @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.
683
- * @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
684
623
  */
685
- position_token_units?: string | null;
624
+ total_venue_fee_usd: string;
686
625
  /**
687
- * @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.
688
- * @example 9657
626
+ * @description Total venue trading fees collected across the position lifetime in USD pips.
627
+ * @example 200
689
628
  */
690
- initial_fill_bps?: number | null;
629
+ total_venue_fee_usd_pips: string;
691
630
  };
692
- CustomerPositionFailure: {
631
+ CustomerPositionResult: {
693
632
  /**
694
- * @description Failure reason code
695
- * @example price_exceeded_tolerance
696
- */
697
- reason: string;
698
- };
699
- CustomerPositionUnwind: {
700
- /**
701
- * @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.
702
- * @example executed
703
- * @enum {string}
704
- */
705
- status: "executed" | "planned" | "superseded" | "triggered";
706
- /**
707
- * @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.
708
- * @example spread_blowout
709
- * @enum {string|null}
633
+ * @description ISO 8601 timestamp when position was closed
634
+ * @example 2025-01-16T14:30:00.000Z
710
635
  */
711
- 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;
636
+ closed_at: string;
712
637
  /**
713
- * @description Leverage after unwind in basis points (20000 = 2x)
714
- * @example 30000
638
+ * @description Collected lifetime fee formatted as USD
639
+ * @example 0.015
715
640
  */
716
- after_leverage_bps: number;
641
+ collected_lifetime_fee_usd: string;
717
642
  /**
718
- * @description Leverage before unwind in basis points (20000 = 2x)
719
- * @example 60000
643
+ * @description Collected lifetime fee in USD pips
644
+ * @example 150
720
645
  */
721
- before_leverage_bps: number;
646
+ collected_lifetime_fee_usd_pips: string;
722
647
  /**
723
- * @description ISO 8601 timestamp when the unwind was executed on-chain. Null on planned unwinds, which have not happened yet.
724
- * @example 2025-06-02T14:30:00.000Z
648
+ * @description Collected liquidation fee formatted as USD
649
+ * @example 0.00
725
650
  */
726
- executed_at?: string | null;
651
+ collected_liquidation_fee_usd: string;
727
652
  /**
728
- * @description Price at which this planned unwind fires, in USD pips (10000 pips = $1). Null on executed unwinds.
729
- * @example 4200
653
+ * @description Collected liquidation fee in USD pips
654
+ * @example 0
730
655
  */
731
- trigger_price_usd_pips?: string | null;
656
+ collected_liquidation_fee_usd_pips: string;
732
657
  /**
733
- * @description Human-readable explanation of `reason` — a customer-facing sentence describing the market condition that triggered this deleverage. Null whenever `reason` is null.
734
- * @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
735
660
  */
736
- reason_detail?: string | null;
737
- };
738
- CustomerPositionUnwindList: {
739
- data: components["schemas"]["CustomerPositionUnwind"][];
740
- has_more: boolean;
741
- total_count?: number;
661
+ exit_notional_usd?: string | null;
742
662
  /**
743
- * @description Current leverage of the position in basis points (20000 = 2x), null if not yet calculated
744
- * @example 30000
663
+ * @description Exit notional in USD pips. Null for reverted or cancelled positions.
664
+ * @example 52500
745
665
  */
746
- current_leverage_bps: number | null;
666
+ exit_notional_usd_pips?: string | null;
747
667
  /**
748
- * @description ISO 8601 timestamp when the position was opened on-chain (null if not yet opened)
749
- * @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
750
670
  */
751
- originated_at: string | null;
671
+ is_final?: boolean;
752
672
  /**
753
- * @description Leverage at position origination in basis points (20000 = 2x)
754
- * @example 60000
673
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) as return on equity in basis points
674
+ * @example 1700
755
675
  */
756
- origination_leverage_bps: number;
757
- };
758
- CustomerCloseAttempt: {
676
+ net_realized_pnl_bps: number;
759
677
  /**
760
- * @description Outcome of the close attempt. `deferred` means the close could not complete yet and was postponed.
761
- * @enum {string}
678
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) formatted as USD
679
+ * @example 0.435
762
680
  */
763
- outcome: "deferred";
681
+ net_realized_pnl_usd: string;
764
682
  /**
765
- * @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.
766
- * @enum {string}
683
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) in USD pips (can be negative)
684
+ * @example 4350
767
685
  */
768
- reason: "awaiting_settlement";
686
+ net_realized_pnl_usd_pips: string;
769
687
  /**
770
- * @description ISO-8601 timestamp of when the close was requested.
771
- * @example 2026-06-15T17:27:11.736Z
688
+ * @description Proceeds formatted as USD
689
+ * @example 3.00
772
690
  */
773
- deferred_at: string;
774
- };
775
- CustomerPendingOperation: {
691
+ proceeds_usd: string;
776
692
  /**
777
- * @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.
778
- * @enum {string}
693
+ * @description Proceeds returned to user in USD pips
694
+ * @example 30000
779
695
  */
780
- type: "open" | "close" | "partial_close" | "unwind" | "liquidate" | "settle";
696
+ proceeds_usd_pips: string;
781
697
  /**
782
- * @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.
783
- * @example initiated
784
- * @enum {string|null}
698
+ * @description Realized PnL formatted as USD
699
+ * @example 0.50
785
700
  */
786
- phase?: "requested" | "initiated" | "pending" | "awaiting_settlement" | null;
701
+ realized_pnl_usd: string;
787
702
  /**
788
- * @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.
789
- * @example 5000000
703
+ * @description Realized PnL in USD pips (can be negative)
704
+ * @example 5000
790
705
  */
791
- token_units?: string | null;
706
+ realized_pnl_usd_pips: string;
792
707
  };
793
- 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"];
794
713
  /**
795
- * @description Current book-value leverage in basis points (20000 = 2x)
796
- * @example 18000
714
+ * @description Position ID
715
+ * @example dm_pos_abc123
797
716
  */
798
- book_leverage_bps: number;
717
+ id: string;
799
718
  /**
800
- * @description Current collateral formatted as USD
801
- * @example 2.50
719
+ * @description Name of the partner the position was opened through.
720
+ * @example Acme Markets
802
721
  */
803
- collateral_usd: string;
722
+ partner: string;
804
723
  /**
805
- * @description Current collateral in USD pips
806
- * @example 25000
724
+ * @description Prediction market provider
725
+ * @enum {string}
807
726
  */
808
- collateral_usd_pips: string;
727
+ provider: "polymarket";
809
728
  /**
810
- * @description Effective collateral formatted as USD
811
- * @example 2.45
729
+ * @description Market side
730
+ * @enum {string}
812
731
  */
813
- effective_collateral_usd: string;
732
+ side: "yes" | "no";
814
733
  /**
815
- * @description Effective collateral after fees in USD pips
816
- * @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}
817
736
  */
818
- 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"];
819
744
  /**
820
- * @deprecated
821
- * @description Current leverage in basis points
822
- * @example 18000
745
+ * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
746
+ * @example 84000
823
747
  */
824
- leverage_bps: number;
748
+ effective_leverage_bps: number;
825
749
  /**
826
- * @description Current market-value leverage in basis points, computed from the live oracle price. Null when the position is insolvent (equity <= 0).
827
- * @example 19500
750
+ * @description Market ticker identifier
751
+ * @example TRUMP-2024-WIN
828
752
  */
829
- 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;
830
758
  /**
831
- * @description Current mark price formatted as USD
832
- * @example 0.55
759
+ * @description Wallet address (Solana public key or EVM address)
760
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
833
761
  */
834
- 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;
835
765
  /**
836
- * @description Current mark price in USD pips
837
- * @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}
838
768
  */
839
- mark_price_usd_pips: string;
769
+ close_reason: "cancelled" | "closed" | "liquidated" | "reverted" | "settled";
840
770
  /**
841
- * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) as return on equity in basis points
842
- * @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}
843
773
  */
844
- net_unrealized_pnl_bps: number;
774
+ revert_reason?: "exchange_unavailable" | "slippage_exceeded" | "unknown" | null;
775
+ };
776
+ CustomerMarketEvent: {
845
777
  /**
846
- * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) formatted as USD
847
- * @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
848
780
  */
849
- net_unrealized_pnl_usd: string;
781
+ ticker: string;
850
782
  /**
851
- * @description Unrealized PnL net of all fees (origination + pending lifetime + accrued venue) in USD pips (can be negative)
852
- * @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
853
785
  */
854
- net_unrealized_pnl_usd_pips: string;
786
+ title: string | null;
855
787
  /**
856
- * @description Current notional formatted as USD
857
- * @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
858
790
  */
859
- notional_usd: string;
791
+ series_ticker: string | null;
792
+ };
793
+ CustomerOriginationTier: {
860
794
  /**
861
- * @description Current notional in USD pips
862
- * @example 55000
795
+ * @description Origination fee in basis points for this tier
796
+ * @example 100
863
797
  */
864
- notional_usd_pips: string;
798
+ fee_bps: number;
865
799
  /**
866
- * @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).
867
- * @example 5000000
800
+ * @description Maximum leverage in basis points for this tier
801
+ * @example 20000
868
802
  */
869
- min_partial_close_token_units?: string | null;
803
+ max_leverage_bps: number;
804
+ };
805
+ CustomerFees: {
870
806
  /**
871
- * @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.
872
- * @example 10000000
807
+ * @description Lifetime fee APR in basis points
808
+ * @example 500
873
809
  */
874
- max_partial_close_token_units?: string | null;
810
+ lifetime_apr_bps: number;
875
811
  /**
876
- * @description Position token units held (1000000 units = 1 token)
877
- * @example 10000000
812
+ * @description Liquidation fee in basis points
813
+ * @example 200
878
814
  */
879
- position_token_units: string;
815
+ liquidation_bps: number;
816
+ /** @description Origination fee tiers by leverage */
817
+ origination_tiers: components["schemas"]["CustomerOriginationTier"][];
818
+ };
819
+ CustomerMaxMarketLeveragePerNotional: {
880
820
  /**
881
- * @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.
882
- * @example 7000
821
+ * @description Maximum market leverage in basis points when the position notional is $100
822
+ * @example 100000
883
823
  */
884
- remaining_bps?: number | null;
824
+ at100_usd_bps: number;
885
825
  /**
886
- * @description Total position value formatted as USD
887
- * @example 3.00
826
+ * @description Maximum market leverage in basis points when the position notional is $500
827
+ * @example 80000
888
828
  */
889
- position_value_usd: string;
829
+ at500_usd_bps: number;
890
830
  /**
891
- * @description Total position value in USD pips
892
- * @example 30000
831
+ * @description Maximum market leverage in basis points when the position notional is $1,000
832
+ * @example 60000
893
833
  */
894
- position_value_usd_pips: string;
834
+ at1000_usd_bps: number;
895
835
  /**
896
- * @description Unrealized PnL as return on equity in basis points (1000 = 10%)
897
- * @example 2000
836
+ * @description Maximum market leverage in basis points when the position notional is $10,000
837
+ * @example 30000
898
838
  */
899
- unrealized_pnl_bps: number;
900
- /**
901
- * @description Unrealized PnL formatted as USD
902
- * @example 0.50
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: {
848
+ /**
849
+ * @deprecated
850
+ * @description Deprecated: use maxYesBps and maxNoBps. Populated as min(maxYesBps, maxNoBps) for backwards compatibility.
851
+ * @example 50000
903
852
  */
904
- 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"];
905
856
  /**
906
- * @description Unrealized PnL in USD pips (can be negative)
907
- * @example 5000
857
+ * @description Maximum leverage in basis points for the NO side
858
+ * @example 50000
908
859
  */
909
- unrealized_pnl_usd_pips: string;
910
- };
911
- CustomerPositionOpenFees: {
860
+ max_no_bps: number;
912
861
  /**
913
- * @description Accrued lifetime fee formatted as USD
914
- * @example 0.01
862
+ * @description Maximum leverage in basis points for the YES side
863
+ * @example 50000
915
864
  */
916
- accrued_lifetime_fee_usd: string;
865
+ max_yes_bps: number;
917
866
  /**
918
- * @description Accrued lifetime fee in USD pips
919
- * @example 100
867
+ * @description Minimum leverage in basis points
868
+ * @example 10000
920
869
  */
921
- accrued_lifetime_fee_usd_pips: string;
870
+ min_bps: number;
922
871
  /**
923
- * @description Venue (Polymarket) trading fees paid so far on this position, summed across open and any force-unwind exchange transactions, formatted as USD.
924
- * @example 0.02
872
+ * @description Leverage step increment in basis points
873
+ * @example 1000
925
874
  */
926
- accrued_venue_fee_usd: string;
875
+ step_bps: number;
876
+ };
877
+ CustomerMarketPolymarket: {
927
878
  /**
928
- * @description Venue trading fees paid so far on this position in USD pips.
929
- * @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
930
881
  */
931
- accrued_venue_fee_usd_pips: string;
882
+ slug: string;
932
883
  /**
933
- * @description Lifetime fee APR in basis points
934
- * @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
935
886
  */
936
- lifetime_apr_bps: number;
887
+ condition_id?: string | null;
937
888
  /**
938
- * @description Pending lifetime fee formatted as USD
939
- * @example 0.005
889
+ * @description Polymarket CLOB token ID for the NO outcome (the ERC1155 position token ID).
890
+ * @example 71321045679252212594626385532706912750332728571942532289631379312455583992563
940
891
  */
941
- pending_lifetime_fee_usd: string;
892
+ no_token_id: string;
942
893
  /**
943
- * @description Pending lifetime fee in USD pips
944
- * @example 50
894
+ * @description Polymarket CLOB token ID for the YES outcome (the ERC1155 position token ID).
895
+ * @example 21742633143463906290569050155826241533067272736897614950488156847949938836455
945
896
  */
946
- pending_lifetime_fee_usd_pips: string;
897
+ yes_token_id: string;
898
+ };
899
+ CustomerSideEligibility: {
947
900
  /**
948
- * @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`.
949
- * @example 0.085
901
+ * @description Whether this market is accepting new positions on this side
902
+ * @example true
950
903
  */
951
- total_fees_usd: string;
904
+ accepting_new_positions: boolean;
952
905
  /**
953
- * @description Sum of all fees accrued or owed so far (origination + accrued lifetime + pending lifetime + accrued venue) in USD pips.
954
- * @example 850
906
+ * @description Reason code if this side is not accepting new positions; null when accepting
907
+ * @example QUOTE_MARKET_NOT_ELIGIBLE
955
908
  */
956
- total_fees_usd_pips: string;
909
+ rejection_reason_code?: string | null;
957
910
  };
958
- 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: {
959
918
  /**
960
- * @description Current liquidation price formatted as USD
961
- * @example 0.35
919
+ * @description NO side ask price formatted as USD
920
+ * @example 0.51
962
921
  */
963
- current_liquidation_price_usd: string;
922
+ no_ask_price_usd: string;
964
923
  /**
965
- * @description Current liquidation price in USD pips
966
- * @example 3500
924
+ * @description NO side ask price in USD pips (10000 pips = $1)
925
+ * @example 5100
967
926
  */
968
- current_liquidation_price_usd_pips: string;
927
+ no_ask_price_usd_pips: string;
969
928
  /**
970
- * @description Margin health 0-10000 (10000 at entry, 0 at liquidation)
971
- * @example 7500
929
+ * @description NO side bid price formatted as USD
930
+ * @example 0.49
972
931
  */
973
- health_bps: number;
932
+ no_bid_price_usd: string;
974
933
  /**
975
- * @description Buffer to liquidation in basis points
976
- * @example 500
934
+ * @description NO side bid price in USD pips (10000 pips = $1)
935
+ * @example 4900
977
936
  */
978
- liquidation_buffer_bps: number;
937
+ no_bid_price_usd_pips: string;
979
938
  /**
980
- * @description Liquidation fee in basis points
981
- * @example 200
939
+ * @description YES side ask price formatted as USD
940
+ * @example 0.51
982
941
  */
983
- liquidation_fee_bps: number;
942
+ yes_ask_price_usd: string;
984
943
  /**
985
- * @description Dollar distance to liquidation formatted as USD
986
- * @example 0.50
944
+ * @description YES side ask price in USD pips (10000 pips = $1)
945
+ * @example 5100
987
946
  */
988
- margin_buffer_usd: string;
947
+ yes_ask_price_usd_pips: string;
989
948
  /**
990
- * @description Dollar distance to liquidation in USD pips
991
- * @example 5000
949
+ * @description YES side bid price formatted as USD
950
+ * @example 0.49
992
951
  */
993
- 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;
994
958
  };
995
- CustomerPositionTiming: {
996
- /** @description Whether settlement is pending (market resolved or voided, settlement not yet executed) */
997
- is_settlement_pending: boolean;
998
- /** @description Whether the market was voided (closed with no winner, 50/50 payout at $0.50 per token) */
999
- 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;
1000
1011
  /**
1001
1012
  * @description ISO 8601 timestamp when market closes
1002
1013
  * @example 2025-01-20T12:00:00.000Z
1003
1014
  */
1004
- market_close_time?: string;
1015
+ close_time?: string;
1005
1016
  /**
1006
- * @description Market status from the prediction market provider. When 'determined' or 'finalized', mark price reflects the settlement outcome ($1 or $0)
1007
- * @example active
1008
- * @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
1009
1019
  */
1010
- market_status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
1020
+ discovered_at: string;
1011
1021
  /**
1012
- * @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.
1013
- * @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
1014
1049
  * @enum {string}
1015
1050
  */
1016
1051
  settlement_state: "awaiting_resolution" | "none" | "settling" | "unresolved_upstream" | "voided";
1017
1052
  /**
1018
- * @description Minutes until market closes
1019
- * @example 1440
1053
+ * @description Capacity-limited maximum notional for NO side formatted as USD
1054
+ * @example 50.00
1020
1055
  */
1021
- time_to_close_minutes?: number;
1022
- };
1023
- CustomerOpenPosition: {
1024
- /** @description Entry details */
1025
- entry: components["schemas"]["CustomerPositionEntry"];
1026
- /** @description Failure details if the position failed */
1027
- failure?: components["schemas"]["CustomerPositionFailure"];
1056
+ capacity_max_notional_no_usd?: string | null;
1028
1057
  /**
1029
- * @description Position ID
1030
- * @example dm_pos_abc123
1058
+ * @description Capacity-limited maximum notional for NO side in USD pips (10000 pips = $1)
1059
+ * @example 500000000
1031
1060
  */
1032
- id: string;
1061
+ capacity_max_notional_no_usd_pips?: string | null;
1033
1062
  /**
1034
- * @description Prediction market provider
1035
- * @enum {string}
1063
+ * @description Capacity-limited maximum notional for YES side formatted as USD
1064
+ * @example 50.00
1036
1065
  */
1037
- provider: "polymarket";
1066
+ capacity_max_notional_yes_usd?: string | null;
1038
1067
  /**
1039
- * @description Market side
1040
- * @enum {string}
1068
+ * @description Capacity-limited maximum notional for YES side in USD pips (10000 pips = $1)
1069
+ * @example 500000000
1041
1070
  */
1042
- side: "yes" | "no";
1071
+ capacity_max_notional_yes_usd_pips?: string | null;
1043
1072
  /**
1044
- * @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.
1045
- * @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
1046
1075
  */
1047
- status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
1048
- /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
1049
- unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1050
- /** @description Current position state */
1051
- current: components["schemas"]["CustomerPositionCurrent"];
1052
- /** @description Fee details for open position */
1053
- fees: components["schemas"]["CustomerPositionOpenFees"];
1054
- /** @description Risk metrics */
1055
- risk: components["schemas"]["CustomerPositionRisk"];
1056
- /** @description Timing information */
1057
- timing: components["schemas"]["CustomerPositionTiming"];
1076
+ max_notional_no_usd?: string;
1058
1077
  /**
1059
- * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
1060
- * @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
1061
1080
  */
1062
- effective_leverage_bps: number;
1081
+ max_notional_no_usd_pips?: string;
1063
1082
  /**
1064
- * @description Market ticker identifier
1065
- * @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
1066
1085
  */
1067
- market_ticker: string;
1068
- /** @description Market title */
1069
- market_title?: string;
1070
- /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
1071
- on_chain_position_key: string;
1086
+ max_notional_yes_usd?: string;
1072
1087
  /**
1073
- * @description Wallet address (Solana public key or EVM address)
1074
- * @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
1075
1090
  */
1076
- wallet_address: string;
1077
- /** @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. */
1078
- planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1091
+ max_notional_yes_usd_pips?: string;
1079
1092
  /**
1080
- * @deprecated
1081
- * @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
1082
1095
  */
1083
- close_attempt?: components["schemas"]["CustomerCloseAttempt"] | null;
1084
- /** @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. */
1085
- 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;
1086
1121
  };
1087
- CustomerPositionClosedFees: {
1122
+ CustomerOriginationFeeTier: {
1088
1123
  /**
1089
- * @description Lifetime fee APR in basis points
1090
- * @example 500
1124
+ * @description Upper leverage bound (inclusive) in basis points for this tier. The last tier is the catch-all.
1125
+ * @example 40000
1091
1126
  */
1092
- lifetime_apr_bps: number;
1127
+ max_leverage_bps: number;
1128
+ /**
1129
+ * @description Protocol origination fee in basis points applied at or below this tier's leverage bound.
1130
+ * @example 200
1131
+ */
1132
+ fee_bps: number;
1133
+ };
1134
+ CustomerFeeRatesMarket: {
1135
+ /**
1136
+ * @description Market ticker
1137
+ * @example TRUMP-2024-WIN
1138
+ */
1139
+ ticker: string;
1140
+ /**
1141
+ * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
1142
+ * @example 0
1143
+ */
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"][];
1093
1156
  /**
1094
- * @deprecated
1095
- * @description Deprecated — use `entry.originationFeeBps`. Same value, kept for backwards compatibility.
1096
- * @example 100
1157
+ * @description Maximum combined (protocol + partner) origination fee in basis points enforced on-chain.
1158
+ * @example 1000
1097
1159
  */
1098
- origination_fee_bps: number;
1160
+ contract_max_origination_fee_bps: number;
1099
1161
  /**
1100
- * @deprecated
1101
- * @description Deprecated — use `entry.protocolOriginationFeeBps`. Same value, kept for backwards compatibility.
1102
- * @example 80
1162
+ * @description Lifetime fee APR in basis points
1163
+ * @example 2000
1103
1164
  */
1104
- protocol_origination_fee_bps: number;
1165
+ lifetime_fee_apr_bps: number;
1105
1166
  /**
1106
- * @deprecated
1107
- * @description Deprecated — use `entry.partnerOriginationFeeBps`. Same value, kept for backwards compatibility.
1108
- * @example 20
1167
+ * @description Liquidation fee in basis points
1168
+ * @example 250
1109
1169
  */
1110
- partner_origination_fee_bps: number;
1170
+ liquidation_fee_bps: number;
1111
1171
  /**
1112
- * @deprecated
1113
- * @description Deprecated — use `entry.originationFeeUsd`. Same value, kept for backwards compatibility.
1114
- * @example 0.05
1172
+ * @description This partner's origination fee component in basis points, added to the protocol tier fee. `0` by default.
1173
+ * @example 0
1115
1174
  */
1116
- origination_fee_usd: string;
1175
+ partner_origination_fee_bps: number;
1117
1176
  /**
1118
- * @deprecated
1119
- * @description Deprecated — use `entry.originationFeeUsdPips`. Same value, kept for backwards compatibility.
1120
- * @example 500
1177
+ * @description This partner's Polymarket builder taker fee in basis points (flat percentage of notional). `0` by default.
1178
+ * @example 0
1121
1179
  */
1122
- origination_fee_usd_pips: string;
1180
+ partner_trading_fee_bps: number;
1181
+ };
1182
+ FeeReportBody: {
1123
1183
  /**
1124
- * @description Total blended fees formatted as USD
1125
- * @example 0.085
1184
+ * @description Leverage in basis points (20000 = 2x, 100000 = 10x). Must be divisible by 2500. Maximum 10x.
1185
+ * @example 50000
1126
1186
  */
1127
- total_fees_usd: string;
1187
+ leverage_bps: number;
1128
1188
  /**
1129
- * @description Total blended fees (origination + lifetime + liquidation + venue) in USD pips
1130
- * @example 850
1189
+ * @description Market ticker
1190
+ * @example TRUMP-2024-WIN
1131
1191
  */
1132
- total_fees_usd_pips: string;
1192
+ market_ticker: string;
1133
1193
  /**
1134
- * @description Total lifetime fee formatted as USD
1135
- * @example 0.015
1194
+ * @description Notional amount in USD pips (10,000 pips = $1.00)
1195
+ * @example 50000
1136
1196
  */
1137
- total_lifetime_fee_usd: string;
1197
+ notional_amount_usd_pips: string;
1138
1198
  /**
1139
- * @description Total lifetime fee collected in USD pips
1140
- * @example 150
1199
+ * @description Market side (yes or no)
1200
+ * @enum {string}
1141
1201
  */
1142
- total_lifetime_fee_usd_pips: string;
1202
+ effective_side: "yes" | "no";
1143
1203
  /**
1144
- * @description Total venue (Polymarket) trading fees collected across the position lifetime (open + close/liquidation/settle + force-unwind), formatted as USD.
1145
- * @example 0.02
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
1146
1206
  */
1147
- total_venue_fee_usd: string;
1207
+ entry_price_usd_pips?: string;
1208
+ };
1209
+ CustomerFeeReport: {
1148
1210
  /**
1149
- * @description Total venue trading fees collected across the position lifetime in USD pips.
1150
- * @example 200
1211
+ * @description Market ticker
1212
+ * @example TRUMP-2024-WIN
1151
1213
  */
1152
- total_venue_fee_usd_pips: string;
1153
- };
1154
- CustomerPositionResult: {
1214
+ market_ticker: string;
1155
1215
  /**
1156
- * @description ISO 8601 timestamp when position was closed
1157
- * @example 2025-01-16T14:30:00.000Z
1216
+ * @description Market side
1217
+ * @enum {string}
1158
1218
  */
1159
- closed_at: string;
1219
+ effective_side: "yes" | "no";
1160
1220
  /**
1161
- * @description Collected lifetime fee formatted as USD
1162
- * @example 0.015
1221
+ * @description Leverage in basis points (20000 = 2x)
1222
+ * @example 20000
1163
1223
  */
1164
- collected_lifetime_fee_usd: string;
1224
+ leverage_bps: number;
1165
1225
  /**
1166
- * @description Collected lifetime fee in USD pips
1167
- * @example 150
1226
+ * @description Entry price used for the computation, in USD pips
1227
+ * @example 5100
1168
1228
  */
1169
- collected_lifetime_fee_usd_pips: string;
1229
+ entry_price_usd_pips: string;
1170
1230
  /**
1171
- * @description Collected liquidation fee formatted as USD
1172
- * @example 0.00
1231
+ * @description Notional in USD pips (10000 pips = $1)
1232
+ * @example 500000
1173
1233
  */
1174
- collected_liquidation_fee_usd: string;
1234
+ notional_amount_usd_pips: string;
1175
1235
  /**
1176
- * @description Collected liquidation fee in USD pips
1177
- * @example 0
1236
+ * @description Notional in USDC units (1,000,000 = 1 USDC)
1237
+ * @example 50000000
1178
1238
  */
1179
- collected_liquidation_fee_usd_pips: string;
1239
+ notional_usdc_units: string;
1180
1240
  /**
1181
- * @description Volume-weighted notional realized across all unwinds and the final close, formatted as USD. Null for reverted or cancelled positions.
1182
- * @example 5.25
1241
+ * @description Collateral in USDC units
1242
+ * @example 25000000
1183
1243
  */
1184
- exit_notional_usd?: string | null;
1244
+ collateral_usdc_units: string;
1185
1245
  /**
1186
- * @description Exit notional in USD pips. Null for reverted or cancelled positions.
1187
- * @example 52500
1246
+ * @description Combined origination fee in basis points
1247
+ * @example 200
1188
1248
  */
1189
- exit_notional_usd_pips?: string | null;
1249
+ origination_fee_bps: number;
1190
1250
  /**
1191
- * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) as return on equity in basis points
1192
- * @example 1700
1251
+ * @description Origination fee in USDC units
1252
+ * @example 1000000
1193
1253
  */
1194
- net_realized_pnl_bps: number;
1254
+ origination_fee_usdc_units: string;
1195
1255
  /**
1196
- * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) formatted as USD
1197
- * @example 0.435
1256
+ * @description Protocol component of the origination fee in basis points
1257
+ * @example 200
1198
1258
  */
1199
- net_realized_pnl_usd: string;
1259
+ protocol_origination_fee_bps: number;
1200
1260
  /**
1201
- * @description Realized PnL net of all fees (origination + lifetime + liquidation + venue) in USD pips (can be negative)
1202
- * @example 4350
1261
+ * @description Partner component of the origination fee in basis points
1262
+ * @example 0
1203
1263
  */
1204
- net_realized_pnl_usd_pips: string;
1264
+ partner_origination_fee_bps: number;
1205
1265
  /**
1206
- * @description Proceeds formatted as USD
1207
- * @example 3.00
1266
+ * @description Polymarket venue trading fee rate in basis points (`feeRateBps`).
1267
+ * @example 0
1208
1268
  */
1209
- proceeds_usd: string;
1269
+ polymarket_trading_fee_bps: number;
1210
1270
  /**
1211
- * @description Proceeds returned to user in USD pips
1212
- * @example 30000
1271
+ * @description Partner Polymarket builder taker fee in basis points (flat percentage of notional).
1272
+ * @example 0
1213
1273
  */
1214
- proceeds_usd_pips: string;
1274
+ partner_trading_fee_bps: number;
1215
1275
  /**
1216
- * @description Realized PnL formatted as USD
1217
- * @example 0.50
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
1218
1278
  */
1219
- realized_pnl_usd: string;
1279
+ expected_open_trading_fee_usdc_units: string;
1220
1280
  /**
1221
- * @description Realized PnL in USD pips (can be negative)
1222
- * @example 5000
1281
+ * @description Total amount the user must provide to open, in USDC units.
1282
+ * @example 28204118
1223
1283
  */
1224
- realized_pnl_usd_pips: string;
1225
- };
1226
- CustomerClosedPosition: {
1227
- /** @description Entry details */
1228
- entry: components["schemas"]["CustomerPositionEntry"];
1229
- /** @description Failure details if the position failed */
1230
- failure?: components["schemas"]["CustomerPositionFailure"];
1284
+ total_user_amount_usdc_units: string;
1231
1285
  /**
1232
- * @description Position ID
1233
- * @example dm_pos_abc123
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
1234
1288
  */
1235
- id: string;
1289
+ estimated_liquidation_price_usd_pips: string;
1236
1290
  /**
1237
- * @description Prediction market provider
1238
- * @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
1239
1293
  */
1240
- provider: "polymarket";
1294
+ gross_max_gain_usdc_units: string;
1241
1295
  /**
1242
- * @description Market side
1243
- * @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
1244
1298
  */
1245
- side: "yes" | "no";
1299
+ net_max_gain_usdc_units: string;
1300
+ };
1301
+ CustomerLimit: {
1246
1302
  /**
1247
- * @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.
1248
- * @enum {string}
1303
+ * @description Total limit formatted as USD
1304
+ * @example 1000.00
1249
1305
  */
1250
- status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
1251
- /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
1252
- unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1253
- /** @description Fee details for closed position */
1254
- fees: components["schemas"]["CustomerPositionClosedFees"];
1255
- /** @description Position result/outcome */
1256
- result: components["schemas"]["CustomerPositionResult"];
1306
+ limit_usd: string;
1257
1307
  /**
1258
- * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
1259
- * @example 84000
1308
+ * @description Total limit in USD pips (10000 pips = $1)
1309
+ * @example 10000000
1260
1310
  */
1261
- effective_leverage_bps: number;
1311
+ limit_usd_pips: string;
1262
1312
  /**
1263
- * @description Market ticker identifier
1264
- * @example TRUMP-2024-WIN
1313
+ * @description Remaining available limit formatted as USD
1314
+ * @example 750.00
1265
1315
  */
1266
- market_ticker: string;
1267
- /** @description Market title */
1268
- market_title?: string;
1269
- /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
1270
- on_chain_position_key: string;
1316
+ remaining_usd: string;
1271
1317
  /**
1272
- * @description Wallet address (Solana public key or EVM address)
1273
- * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1318
+ * @description Remaining available limit in USD pips
1319
+ * @example 7500000
1274
1320
  */
1275
- wallet_address: string;
1276
- /** @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. */
1277
- planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1321
+ remaining_usd_pips: string;
1278
1322
  /**
1279
- * @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.
1280
- * @enum {string}
1323
+ * @description Current usage formatted as USD
1324
+ * @example 250.00
1281
1325
  */
1282
- close_reason: "cancelled" | "closed" | "liquidated" | "reverted" | "settled";
1326
+ usage_usd: string;
1283
1327
  /**
1284
- * @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`.
1285
- * @enum {string|null}
1328
+ * @description Current usage in USD pips
1329
+ * @example 2500000
1286
1330
  */
1287
- revert_reason?: "exchange_unavailable" | "slippage_exceeded" | "unknown" | null;
1331
+ usage_usd_pips: string;
1288
1332
  };
1289
1333
  CustomerPartialClose: {
1290
1334
  /**
@@ -1455,22 +1499,17 @@ interface components {
1455
1499
  */
1456
1500
  risk_mode: "adaptive" | "committed";
1457
1501
  };
1458
- CommittedUnwindUnavailableReason: {
1459
- /**
1460
- * @description Machine-readable reason committed mode cannot be offered for this quote
1461
- * @example cryptoMarket
1462
- * @enum {string}
1463
- */
1464
- code: "cryptoMarket" | "illegibleMarginTooLarge" | "illegibleTooManyUnwinds" | "invertedRiskBands" | "lateGameSoccer" | "notOfferedOnDeskQuotes";
1465
- /** @description Human-readable explanation of the same reason */
1466
- message: string;
1467
- };
1468
1502
  PlannedUnwind: {
1469
1503
  /**
1470
1504
  * @description Order in which this unwind fires, starting at 0
1471
1505
  * @example 0
1472
1506
  */
1473
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;
1474
1513
  /**
1475
1514
  * @description Price at which this unwind fires, in USD pips (10000 pips = $1)
1476
1515
  * @example 4200
@@ -1481,28 +1520,41 @@ interface components {
1481
1520
  * @example 15000
1482
1521
  */
1483
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;
1484
1528
  /**
1485
1529
  * @description Estimated token units sold to reach the target (1000000 units = 1 token). An estimate only — the executed amount depends on the fill.
1486
1530
  * @example 30000000
1487
1531
  */
1488
- token_units_to_sell_estimate: string;
1532
+ estimated_sell_token_units: string;
1489
1533
  };
1490
1534
  CommittedUnwinds: {
1491
1535
  /** @description Whether committed mode can be offered for this quote */
1492
1536
  available: boolean;
1493
- /** @description Why committed mode is unavailable. Null when it is available. */
1494
- unavailable_reason?: components["schemas"]["CommittedUnwindUnavailableReason"] | null;
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;
1495
1542
  /**
1496
1543
  * @description Extra margin the user must post on top of collateral, in USDC units (1000000 units = 1 USDC)
1497
1544
  * @example 67000000
1498
1545
  */
1499
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;
1500
1552
  /**
1501
1553
  * @description Price at which selling the remaining tokens repays the loan in full, in USD pips
1502
1554
  * @example 2700
1503
1555
  */
1504
1556
  debt_clear_price_usd_pips?: string | null;
1505
- /** @description The pre-committed unwinds, in the order they fire. Empty when committed mode is unavailable. */
1557
+ /** @description The pre-committed unwinds, in the order they fire. Null when committed mode is unavailable. */
1506
1558
  planned_unwinds?: components["schemas"]["PlannedUnwind"][] | null;
1507
1559
  };
1508
1560
  CustomerOfferMaxGain: {
@@ -1588,6 +1640,12 @@ interface components {
1588
1640
  * @example 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890
1589
1641
  */
1590
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;
1591
1649
  /** @description EIP-191 signature for contract create position */
1592
1650
  contract_signature: string;
1593
1651
  /**
@@ -1600,20 +1658,19 @@ interface components {
1600
1658
  * @example 0x1234567890123456789012345678901234567890
1601
1659
  */
1602
1660
  polygon_vault_contract_address: string;
1603
- /**
1604
- * @description Vault function this quote's signature authorizes. createPositionWithMargin for committed quotes, createPosition otherwise. A signature for one will not authorize the other.
1605
- * @example createPosition
1606
- * @enum {string}
1607
- */
1608
- polygon_vault_function_name: "createPosition" | "createPositionWithMargin";
1609
1661
  /**
1610
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.
1611
1663
  * @example adaptive
1612
1664
  * @enum {string}
1613
1665
  */
1614
1666
  risk_mode: "adaptive" | "committed";
1615
- /** @description Committed-unwind mode for this quote: the pre-committed unwinds and the extra margin they require, or the reason the mode cannot be offered. */
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. */
1616
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;
1617
1674
  /**
1618
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.
1619
1676
  * @example 0