{"format":"opendoc-document","version":1,"url":"https://docs.upscale.trade/es/developers/operations/changemargin","title":"Cambiar el margen de la posición","description":"PATCH /positions/{positionId}/margin: Mueve el saldo de cotización dentro o fuera del margen de una posición abierta, lo que desplaza con ello su apalancamiento y su precio de…","kind":"api-operation","locale":"es","inLanguage":"es","translation":{"sourceLanguage":"en","targetLanguage":"es","status":"complete","translatedUnits":50,"totalUnits":50},"lastModified":"2026-09-28T20:05:09.350Z","revision":"3c2fd254d25c5fe88817d5c939afd24407f25862bdfb7b9dc8ab5105728c7abe","section":{"title":"Developers","url":"https://docs.upscale.trade/es/developers"},"representations":{"html":"https://docs.upscale.trade/es/developers/operations/changemargin","markdown":"https://docs.upscale.trade/es/developers/operations/changemargin.md","json":"https://docs.upscale.trade/es/developers/operations/changemargin.json"},"translations":{"en":"https://docs.upscale.trade/developers/operations/changemargin","ru":"https://docs.upscale.trade/ru/developers/operations/changemargin","es":"https://docs.upscale.trade/es/developers/operations/changemargin"},"operation":{"id":"changeMargin","method":"PATCH","path":"/positions/{positionId}/margin","summary":"Cambiar el margen de la posición","description":"Mueve el saldo de cotización dentro o fuera del margen de una posición abierta, lo que desplaza con ello su apalancamiento y su precio de liquidación.\n\n- La posición debe seguir abierta, y su cuenta debe pertenecer a quien llama y estar `active` — una cuenta bloqueada por el límite de capital gestionado se rechaza aquí.\n- El mercado debe estar abierto y no en modo de solo cierre.\n- `marginChange: \"0\"` se acepta y devuelve la posición sin cambios.\n- Añadir más de lo que cubre el saldo libre falla con `insufficient_balance`; retirar más de lo que la posición puede ceder falla con `non_positive_margin`.","tags":["Trading"],"tagLabels":{"Accounts":"Cuentas","Config":"Configuración","Trading":"Trading"},"deprecated":false,"parameters":[{"name":"positionId","location":"path","schema":{"type":"string · uuid","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"uuid"},"properties":[],"variants":[]},"type":"string · uuid","required":true,"description":"Identificador de posición. Su cuenta debe pertenecer al llamador.","example":"00000000-0000-4000-8000-000000000000"}],"bodies":[{"mediaType":"application/json","required":true,"properties":[{"name":"marginChange","type":"string · int32","required":true,"description":"Signed quote amount to move in or out of the position margin, fp9 raw. Positive adds margin and requires that much free balance, negative withdraws it and must keep the remaining margin positive. `0` is accepted and changes nothing.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Signed quote amount to move in or out of the position margin, fp9 raw. Positive adds margin and requires that much free balance, negative withdraws it and must keep the remaining margin positive. `0` is accepted and changes nothing.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}}],"schema":{"type":"object","types":["object"],"reference":"#/components/schemas/MarginChangeRequest","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"marginChange","type":"string · int32","required":true,"description":"Importe de cotización con signo para mover dentro o fuera del margen de la posición, fp9 en bruto. Positivo añade margen y requiere esa cantidad de saldo libre; negativo lo retira y debe mantener positivo el margen restante. `0` se acepta y no cambia nada.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Importe de cotización con signo para mover dentro o fuera del margen de la posición, fp9 en bruto. Positivo añade margen y requiere esa cantidad de saldo libre; negativo lo retira y debe mantener positivo el margen restante. `0` se acepta y no cambia nada.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}}],"variants":[]},"example":"{\n  \"marginChange\": \"1000000000\"\n}"}],"responses":[{"status":"401","description":"No autorizado","properties":[],"headers":[]},{"status":"403","description":"La cuenta pertenece a otro usuario (`account_access_denied`), o la solicitud se autentica con una clave de API mientras `api_trading` está deshabilitado en la cuenta (`api_trading_not_enabled`). La cuenta no está en un estado activo. El mercado está en pausa (`market_paused`) o solo acepta órdenes de cierre (`market_close_only`).","properties":[],"headers":[]},{"status":"404","description":"No existe ninguna posición con este identificador.","properties":[],"headers":[]},{"status":"429","description":"Se superó el límite de velocidad de la clave de API (`api_key_rate_limit_exceeded`). `Retry-After` indica cuándo volver; el cuerpo incluye el bucket (`read` / `write`), la ventana que se activó, su límite y `retryAt`.","properties":[],"headers":[]},{"status":"default","description":"Respuesta","mediaType":"application/json","properties":[{"name":"idx","type":"string[]","required":true,"description":"Position identifier. Same value as `txId`.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Position identifier. Same value as `txId`.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}},{"name":"txId","type":"string[]","required":true,"description":"Position identifier. Kept for backward compatibility, always equal to `idx`.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Position identifier. Kept for backward compatibility, always equal to `idx`.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}},{"name":"version","type":"number","required":true,"description":"Revision of the position: incremented by every event applied to it.","example":"0","schema":{"type":"number","types":["number"],"description":"Revision of the position: incremented by every event applied to it.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"openedAt","type":"string · date-time","required":true,"description":"When the position was opened.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time","types":["string"],"description":"When the position was opened.","example":"2026-05-01T12:30:00.000Z","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"lastUpdatedAt","type":"string · date-time","required":true,"description":"When the last event was applied to the position.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time","types":["string"],"description":"When the last event was applied to the position.","example":"2026-05-01T12:30:00.000Z","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"closedAt","type":"string · date-time · nullable","required":true,"description":"When the position was closed; null while it is still open.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time · nullable","types":["string"],"description":"When the position was closed; null while it is still open.","example":"2026-05-01T12:30:00.000Z","nullable":true,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"type","type":"string · enum","required":true,"description":"Direction of the position. Same value as `direction`.","example":"long","schema":{"type":"string · enum","types":["string"],"description":"Direction of the position. Same value as `direction`.","enum":["long","short"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"status","type":"string · enum","required":true,"description":"Whether the position is still open, closed by the trader, or liquidated.","example":"opened","schema":{"type":"string · enum","types":["string"],"description":"Whether the position is still open, closed by the trader, or liquidated.","enum":["opened","closed","liquidated"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"market","type":"string · uuid","required":true,"description":"Market the position is held on.","example":"00000000-0000-4000-8000-000000000000","schema":{"type":"string · uuid","types":["string"],"description":"Market the position is held on.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"properties":[],"variants":[]}},{"name":"trader","type":"string · uuid","required":true,"description":"Trader account the position belongs to.","example":"00000000-0000-4000-8000-000000000000","schema":{"type":"string · uuid","types":["string"],"description":"Trader account the position belongs to.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"properties":[],"variants":[]}},{"name":"size","type":"string · int32","required":true,"description":"Position size in base asset units, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Position size in base asset units, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"notional","type":"string · int32","required":true,"description":"Open notional of the position in quote currency, fp9 raw — size at entry price.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Open notional of the position in quote currency, fp9 raw — size at entry price.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"fraction","type":"string · int32","required":true,"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"margin","type":"string · int32","required":true,"description":"Margin currently backing the position, fp9 raw. Moves with pnl, funding and manual margin changes.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Margin currently backing the position, fp9 raw. Moves with pnl, funding and manual margin changes.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"pnl","type":"string · int32 · nullable","required":true,"description":"Realised pnl accumulated over every event of the position, fp9 raw.","example":"1000000000","schema":{"type":"string · int32 · nullable","types":["string"],"description":"Realised pnl accumulated over every event of the position, fp9 raw.","example":"1000000000","nullable":true,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"funding","type":"string · int32 · nullable","required":true,"description":"Funding paid (negative) or received (positive) over the life of the position, fp9 raw.","example":"1000000000","schema":{"type":"string · int32 · nullable","types":["string"],"description":"Funding paid (negative) or received (positive) over the life of the position, fp9 raw.","example":"1000000000","nullable":true,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"rolloverFee","type":"string · int32","required":true,"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"settlementOraclePrice","type":"string · int32","required":true,"description":"Always `1000000000` (1.0). Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `1000000000` (1.0). Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"fee","type":"string · int32","required":true,"description":"Trading fees charged over the life of the position, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Trading fees charged over the life of the position, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"feeRate","type":"string · int32","required":true,"description":"Fee rate applied to the position, fp9 raw fraction (`1000000` = 0.1%).","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Fee rate applied to the position, fp9 raw fraction (`1000000` = 0.1%).","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"exchangedQuote","type":"string · int32","required":true,"description":"Quote amount exchanged by the most recent event, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Quote amount exchanged by the most recent event, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"exchangedBase","type":"string · int32","required":true,"description":"Base amount exchanged by the most recent event, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Base amount exchanged by the most recent event, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"direction","type":"string · enum","required":true,"description":"Direction of the position.","example":"long","schema":{"type":"string · enum","types":["string"],"description":"Direction of the position.","enum":["long","short"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"eventName","type":"string · enum","required":true,"description":"Type of the most recent event applied to the position.","example":"addMargin","schema":{"type":"string · enum","types":["string"],"description":"Type of the most recent event applied to the position.","enum":["addMargin","removeMargin","closePosition","increasePosition","liquidate","forceClose","payFunding"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"pnlInEvent","type":"string · int32","required":true,"description":"Realised pnl of the most recent event, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Realised pnl of the most recent event, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"rawPnlInEvent","type":"string · int32","required":true,"description":"Realised pnl of the most recent event before the 60-second adjustment, fp9 raw. Differs from `pnlInEvent` only when the adjustment fired.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Realised pnl of the most recent event before the 60-second adjustment, fp9 raw. Differs from `pnlInEvent` only when the adjustment fired.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"profitAdjustmentApplied","type":"boolean","required":true,"description":"Whether the 60-second adjustment capped the profit of the most recent event — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment.","example":"true","schema":{"type":"boolean","types":["boolean"],"description":"Whether the 60-second adjustment capped the profit of the most recent event — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"holdingTimeMs","type":"string[]","required":true,"description":"How long the position was held before the most recent close, in milliseconds, counted from the open or the last increase. Null on events that are not closes.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"How long the position was held before the most recent close, in milliseconds, counted from the open or the last increase. Null on events that are not closes.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}},{"name":"feeInEvent","type":"string · int32","required":true,"description":"Fee charged by the most recent event, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Fee charged by the most recent event, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"fundingInEvent","type":"string · int32","required":true,"description":"Funding settled by the most recent event, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Funding settled by the most recent event, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"rolloverFeeInEvent","type":"string · int32","required":true,"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"executionFeeRate","type":"string · int32","required":true,"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"executionFeeInEvent","type":"string · int32","required":true,"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"executionFee","type":"string · int32","required":true,"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Always `0`. Kept for backward compatibility.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"timestamp","type":"string · date-time","required":true,"description":"Timestamp of the most recent event. Same value as `lastUpdatedAt`.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time","types":["string"],"description":"Timestamp of the most recent event. Same value as `lastUpdatedAt`.","example":"2026-05-01T12:30:00.000Z","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"isOnchain","type":"boolean","required":true,"description":"Always `true`. Kept for backward compatibility.","example":"true","schema":{"type":"boolean","types":["boolean"],"description":"Always `true`. Kept for backward compatibility.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"roe","type":"string · int32","required":true,"description":"Return on equity of the position — realised pnl over the margin put up, fp9 raw fraction.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Return on equity of the position — realised pnl over the margin put up, fp9 raw fraction.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"scalpingCoefficient","type":"string · int32","required":true,"description":"Dynamic spread multiplier the position was charged, fp9 raw (`1000000000` = 1.0). Above 1 when the trade fell inside the market scalping window.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Dynamic spread multiplier the position was charged, fp9 raw (`1000000000` = 1.0). Above 1 when the trade fell inside the market scalping window.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"closeReason","type":"string[]","required":true,"description":"Why the platform closed the position (for example `weekly_session_risk_close`). Null for positions closed by the trader and for open ones.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Why the platform closed the position (for example `weekly_session_risk_close`). Null for positions closed by the trader and for open ones.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}}],"schema":{"type":"object","types":["object"],"reference":"#/components/schemas/PositionResponse","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"idx","type":"string[]","required":true,"description":"Identificador de la posición. Mismo valor que `txId`.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Identificador de la posición. Mismo valor que `txId`.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}},{"name":"txId","type":"string[]","required":true,"description":"Identificador de la posición. Se mantiene por compatibilidad hacia atrás, siempre igual a `idx`.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Identificador de la posición. Se mantiene por compatibilidad hacia atrás, siempre igual a `idx`.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}},{"name":"version","type":"number","required":true,"description":"Revisión de la posición: incrementada por cada evento que se le aplica.","example":"0","schema":{"type":"number","types":["number"],"description":"Revisión de la posición: incrementada por cada evento que se le aplica.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"openedAt","type":"string · date-time","required":true,"description":"Cuándo se abrió la posición.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time","types":["string"],"description":"Cuándo se abrió la posición.","example":"2026-05-01T12:30:00.000Z","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"lastUpdatedAt","type":"string · date-time","required":true,"description":"Cuándo se aplicó el último evento a la posición.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time","types":["string"],"description":"Cuándo se aplicó el último evento a la posición.","example":"2026-05-01T12:30:00.000Z","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"closedAt","type":"string · date-time · nullable","required":true,"description":"Cuándo se cerró la posición; null mientras sigue abierta.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time · nullable","types":["string"],"description":"Cuándo se cerró la posición; null mientras sigue abierta.","example":"2026-05-01T12:30:00.000Z","nullable":true,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"type","type":"string · enum","required":true,"description":"Dirección de la posición. Mismo valor que `direction`.","example":"long","schema":{"type":"string · enum","types":["string"],"description":"Dirección de la posición. Mismo valor que `direction`.","enum":["long","short"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"status","type":"string · enum","required":true,"description":"Si la posición sigue abierta, fue cerrada por el trader o fue liquidada.","example":"opened","schema":{"type":"string · enum","types":["string"],"description":"Si la posición sigue abierta, fue cerrada por el trader o fue liquidada.","enum":["opened","closed","liquidated"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"market","type":"string · uuid","required":true,"description":"Mercado en el que se mantiene la posición.","example":"00000000-0000-4000-8000-000000000000","schema":{"type":"string · uuid","types":["string"],"description":"Mercado en el que se mantiene la posición.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"properties":[],"variants":[]}},{"name":"trader","type":"string · uuid","required":true,"description":"Cuenta del trader a la que pertenece la posición.","example":"00000000-0000-4000-8000-000000000000","schema":{"type":"string · uuid","types":["string"],"description":"Cuenta del trader a la que pertenece la posición.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"properties":[],"variants":[]}},{"name":"size","type":"string · int32","required":true,"description":"Tamaño de la posición en unidades del activo base, fp9 sin procesar.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Tamaño de la posición en unidades del activo base, fp9 sin procesar.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"notional","type":"string · int32","required":true,"description":"Nocional abierto de la posición en moneda de cotización, fp9 sin procesar — tamaño al precio de entrada.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Nocional abierto de la posición en moneda de cotización, fp9 sin procesar — tamaño al precio de entrada.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"fraction","type":"string · int32","required":true,"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"margin","type":"string · int32","required":true,"description":"Margen que actualmente respalda la posición, fp9 sin procesar. Cambia con pnl, financiación y cambios manuales de margen.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Margen que actualmente respalda la posición, fp9 sin procesar. Cambia con pnl, financiación y cambios manuales de margen.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"pnl","type":"string · int32 · nullable","required":true,"description":"Pnl realizado acumulado a lo largo de cada evento de la posición, fp9 sin procesar.","example":"1000000000","schema":{"type":"string · int32 · nullable","types":["string"],"description":"Pnl realizado acumulado a lo largo de cada evento de la posición, fp9 sin procesar.","example":"1000000000","nullable":true,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"funding","type":"string · int32 · nullable","required":true,"description":"Financiación pagada (negativa) o recibida (positiva) durante la vida de la posición, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32 · nullable","types":["string"],"description":"Financiación pagada (negativa) o recibida (positiva) durante la vida de la posición, fp9 en bruto.","example":"1000000000","nullable":true,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"rolloverFee","type":"string · int32","required":true,"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"settlementOraclePrice","type":"string · int32","required":true,"description":"Siempre `1000000000` (1.0). Se mantiene por compatibilidad con versiones anteriores.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `1000000000` (1.0). Se mantiene por compatibilidad con versiones anteriores.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"fee","type":"string · int32","required":true,"description":"Comisiones de trading cobradas durante la vida de la posición, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Comisiones de trading cobradas durante la vida de la posición, fp9 en bruto.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"feeRate","type":"string · int32","required":true,"description":"Tasa de comisión aplicada a la posición, fp9 fracción en bruto (`1000000` = 0.1%).","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Tasa de comisión aplicada a la posición, fp9 fracción en bruto (`1000000` = 0.1%).","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"exchangedQuote","type":"string · int32","required":true,"description":"Importe de cotización intercambiado por el evento más reciente, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Importe de cotización intercambiado por el evento más reciente, fp9 en bruto.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"exchangedBase","type":"string · int32","required":true,"description":"Importe base intercambiado por el evento más reciente, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Importe base intercambiado por el evento más reciente, fp9 en bruto.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"direction","type":"string · enum","required":true,"description":"Dirección de la posición.","example":"long","schema":{"type":"string · enum","types":["string"],"description":"Dirección de la posición.","enum":["long","short"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"eventName","type":"string · enum","required":true,"description":"Tipo del evento más reciente aplicado a la posición.","example":"addMargin","schema":{"type":"string · enum","types":["string"],"description":"Tipo del evento más reciente aplicado a la posición.","enum":["addMargin","removeMargin","closePosition","increasePosition","liquidate","forceClose","payFunding"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"pnlInEvent","type":"string · int32","required":true,"description":"Pnl realizado del evento más reciente, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Pnl realizado del evento más reciente, fp9 en bruto.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"rawPnlInEvent","type":"string · int32","required":true,"description":"Pnl realizado del evento más reciente antes del ajuste de 60 segundos, fp9 en bruto. Difiere de `pnlInEvent` solo cuando se activó el ajuste.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Pnl realizado del evento más reciente antes del ajuste de 60 segundos, fp9 en bruto. Difiere de `pnlInEvent` solo cuando se activó el ajuste.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"profitAdjustmentApplied","type":"boolean","required":true,"description":"Si el ajuste de 60 segundos limitó la ganancia del evento más reciente — dentro de un minuto de una apertura o un aumento de la posición, el pnl de la posición no puede crecer por encima de lo que era en ese momento.","example":"true","schema":{"type":"boolean","types":["boolean"],"description":"Si el ajuste de 60 segundos limitó la ganancia del evento más reciente — dentro de un minuto de una apertura o un aumento de la posición, el pnl de la posición no puede crecer por encima de lo que era en ese momento.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"holdingTimeMs","type":"string[]","required":true,"description":"Cuánto tiempo se mantuvo la posición antes del cierre más reciente, en milisegundos, contado desde la apertura o el último incremento. Nulo en eventos que no son cierres.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Cuánto tiempo se mantuvo la posición antes del cierre más reciente, en milisegundos, contado desde la apertura o el último incremento. Nulo en eventos que no son cierres.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}},{"name":"feeInEvent","type":"string · int32","required":true,"description":"Comisión cobrada por el evento más reciente, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Comisión cobrada por el evento más reciente, fp9 en bruto.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"fundingInEvent","type":"string · int32","required":true,"description":"Financiación liquidada por el evento más reciente, fp9 en bruto.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Financiación liquidada por el evento más reciente, fp9 en bruto.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"rolloverFeeInEvent","type":"string · int32","required":true,"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"executionFeeRate","type":"string · int32","required":true,"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"executionFeeInEvent","type":"string · int32","required":true,"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"executionFee","type":"string · int32","required":true,"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Siempre `0`. Se mantiene por compatibilidad hacia atrás.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"timestamp","type":"string · date-time","required":true,"description":"Marca de tiempo del evento más reciente. Mismo valor que `lastUpdatedAt`.","example":"2026-05-01T12:30:00.000Z","schema":{"type":"string · date-time","types":["string"],"description":"Marca de tiempo del evento más reciente. Mismo valor que `lastUpdatedAt`.","example":"2026-05-01T12:30:00.000Z","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"date-time"},"properties":[],"variants":[]}},{"name":"isOnchain","type":"boolean","required":true,"description":"Siempre `true`. Se mantiene por compatibilidad con versiones anteriores.","example":"true","schema":{"type":"boolean","types":["boolean"],"description":"Siempre `true`. Se mantiene por compatibilidad con versiones anteriores.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"roe","type":"string · int32","required":true,"description":"Rentabilidad sobre el capital de la posición — pnl realizado sobre el margen aportado, fp9 fracción sin procesar.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Rentabilidad sobre el capital de la posición — pnl realizado sobre el margen aportado, fp9 fracción sin procesar.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"scalpingCoefficient","type":"string · int32","required":true,"description":"Multiplicador dinámico de spread que se aplicó a la posición, fp9 sin procesar (`1000000000` = 1.0). Por encima de 1 cuando la operación quedó dentro de la ventana de scalping del mercado.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Multiplicador dinámico de spread que se aplicó a la posición, fp9 sin procesar (`1000000000` = 1.0). Por encima de 1 cuando la operación quedó dentro de la ventana de scalping del mercado.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"closeReason","type":"string[]","required":true,"description":"Por qué la plataforma cerró la posición (por ejemplo, `weekly_session_risk_close`). Nulo para las posiciones cerradas por el trader y para las abiertas.","example":"[\n  \"string\"\n]","schema":{"type":"string[]","types":["array"],"description":"Por qué la plataforma cerró la posición (por ejemplo, `weekly_session_risk_close`). Nulo para las posiciones cerradas por el trader y para las abiertas.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"string","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"variants":[]}}],"variants":[]},"example":"{\n  \"idx\": [\n    \"string\"\n  ],\n  \"txId\": [\n    \"string\"\n  ],\n  \"version\": 0,\n  \"openedAt\": \"2026-05-01T12:30:00.000Z\",\n  \"lastUpdatedAt\": \"2026-05-01T12:30:00.000Z\",\n  \"closedAt\": \"2026-05-01T12:30:00.000Z\",\n  \"type\": \"long\",\n  \"status\": \"opened\",\n  \"market\": \"00000000-0000-4000-8000-000000000000\",\n  \"trader\": \"00000000-0000-4000-8000-000000000000\",\n  \"size\": \"1000000000\",\n  \"notional\": \"1000000000\",\n  \"fraction\": \"1000000000\",\n  \"margin\": \"1000000000\",\n  \"pnl\": \"1000000000\",\n  \"funding\": \"1000000000\",\n  \"rolloverFee\": \"1000000000\",\n  \"settlementOraclePrice\": \"1000000000\",\n  \"fee\": \"1000000000\",\n  \"feeRate\": \"1000000000\",\n  \"exchangedQuote\": \"1000000000\",\n  \"exchangedBase\": \"1000000000\",\n  \"direction\": \"long\",\n  \"eventName\": \"addMargin\",\n  \"pnlInEvent\": \"1000000000\",\n  \"rawPnlInEvent\": \"1000000000\",\n  \"profitAdjustmentApplied\": true,\n  \"holdingTimeMs\": [\n    \"string\"\n  ],\n  \"feeInEvent\": \"1000000000\",\n  \"fundingInEvent\": \"1000000000\",\n  \"rolloverFeeInEvent\": \"1000000000\",\n  \"executionFeeRate\": \"1000000000\",\n  \"executionFeeInEvent\": \"1000000000\",\n  \"executionFee\": \"1000000000\",\n  \"timestamp\": \"2026-05-01T12:30:00.000Z\",\n  \"isOnchain\": true,\n  \"roe\": \"1000000000\",\n  \"scalpingCoefficient\": \"1000000000\",\n  \"closeReason\": [\n    \"string\"\n  ]\n}","headers":[]}],"security":[{"name":"bearer","type":"http · bearer","description":"Clave de API personal, con el prefijo `usk_`.","required":true,"scopes":[]}],"codeSamples":[{"label":"cURL","language":"bash","source":"curl --request PATCH 'https://api.upscale.trade/positions/{positionId}/margin' \\\n  --header 'Accept: application/json' \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'Content-Type: application/json' \\\n  --data-raw '{\n  \"marginChange\": \"1000000000\"\n}'"},{"label":"JavaScript","language":"javascript","source":"const response = await fetch(\"https://api.upscale.trade/positions/{positionId}/margin\", {\n  method: \"PATCH\",\n  headers: {\n    \"Accept\": \"application/json\",\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n  },\n  body: \"{\\n  \\\"marginChange\\\": \\\"1000000000\\\"\\n}\",\n});\nconsole.log(response.status, await response.text());"},{"label":"Python","language":"python","source":"import requests\n\nresponse = requests.request(\n    \"PATCH\",\n    \"https://api.upscale.trade/positions/{positionId}/margin\",\n    headers={\"Accept\":\"application/json\",\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"},\n    data=\"{\\n  \\\"marginChange\\\": \\\"1000000000\\\"\\n}\",\n    timeout=30,\n)\nprint(response.status_code, response.text)"}]},"breadcrumbs":[{"title":"Qué es el prop trading","url":"https://docs.upscale.trade/es"},{"title":"Developers","url":"https://docs.upscale.trade/es/developers"},{"title":"Cambiar el margen de la posición","url":"https://docs.upscale.trade/es/developers/operations/changemargin"}],"headings":[{"depth":2,"id":"authorization","title":"Autorización"},{"depth":2,"id":"parameters","title":"Parámetros"},{"depth":2,"id":"request-body-required","title":"Cuerpo de la solicitud · obligatorio"},{"depth":2,"id":"examples","title":"Ejemplos"},{"depth":2,"id":"responses","title":"Respuestas"}],"markdown":"# Cambiar el margen de la posición\n\n`PATCH /positions/{positionId}/margin`\n\nMueve el saldo de cotización dentro o fuera del margen de una posición abierta, lo que desplaza con ello su apalancamiento y su precio de liquidación.\n\n- La posición debe seguir abierta, y su cuenta debe pertenecer a quien llama y estar `active` — una cuenta bloqueada por el límite de capital gestionado se rechaza aquí.\n- El mercado debe estar abierto y no en modo de solo cierre.\n- `marginChange: \"0\"` se acepta y devuelve la posición sin cambios.\n- Añadir más de lo que cubre el saldo libre falla con `insufficient_balance`; retirar más de lo que la posición puede ceder falla con `non_positive_margin`.\n\n<a id=\"authorization\"></a>\n\n## Autorización\n\nbearer: http · bearer (obligatorio). Clave de API personal, con el prefijo `usk_`.\n\n<a id=\"parameters\"></a>\n\n## Parámetros\n\n- path: positionId (string · uuid; obligatorio). Identificador de posición. Su cuenta debe pertenecer al llamador.\n\nTipo: string · uuid\n\nformat: uuid\n\n<a id=\"request-body-marginchangerequest\"></a>\n\n## Cuerpo de la solicitud · MarginChangeRequest\n\napplication/json · obligatorio\n\nEsquema: MarginChangeRequest\n\nTipo: object\n\nCampos obligatorios: marginChange\n\nTipos de campos obligatorios: marginChange (string · int32; obligatorio)\n\n- marginChange (string · int32; obligatorio)\n\nmarginChange ejemplo: 1000000000\n\nmarginChange.Tipo: string · int32\n\nmarginChange.Importe de cotización con signo para mover dentro o fuera del margen de la posición, fp9 en bruto. Positivo añade margen y requiere esa cantidad de saldo libre; negativo lo retira y debe mantener positivo el margen restante. `0` se acepta y no cambia nada.\n\nmarginChange.format: int32\n\nmarginChange.pattern: ^(?:-?[1-9][0-9]*|0)$\n\nEjemplo\n\n\n\n```json\n{\n  \"marginChange\": \"1000000000\"\n}\n```\n\n<a id=\"example-curl\"></a>\n\n## Ejemplo · cURL\n\n```bash\ncurl --request PATCH 'https://api.upscale.trade/positions/{positionId}/margin' \\\n  --header 'Accept: application/json' \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'Content-Type: application/json' \\\n  --data-raw '{\n  \"marginChange\": \"1000000000\"\n}'\n```\n\n<a id=\"example-javascript\"></a>\n\n## Ejemplo · JavaScript\n\n```javascript\nconst response = await fetch(\"https://api.upscale.trade/positions/{positionId}/margin\", {\n  method: \"PATCH\",\n  headers: {\n    \"Accept\": \"application/json\",\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n  },\n  body: \"{\\n  \\\"marginChange\\\": \\\"1000000000\\\"\\n}\",\n});\nconsole.log(response.status, await response.text());\n```\n\n<a id=\"example-python\"></a>\n\n## Ejemplo · Python\n\n```python\nimport requests\n\nresponse = requests.request(\n    \"PATCH\",\n    \"https://api.upscale.trade/positions/{positionId}/margin\",\n    headers={\"Accept\":\"application/json\",\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"},\n    data=\"{\\n  \\\"marginChange\\\": \\\"1000000000\\\"\\n}\",\n    timeout=30,\n)\nprint(response.status_code, response.text)\n```\n\n<a id=\"response-401\"></a>\n\n## Respuesta 401\n\n**401**  — No autorizado\n\n<a id=\"response-403\"></a>\n\n## Respuesta 403\n\n**403**  — La cuenta pertenece a otro usuario (`account_access_denied`), o la solicitud se autentica con una clave de API mientras `api_trading` está deshabilitado en la cuenta (`api_trading_not_enabled`). La cuenta no está en un estado activo. El mercado está en pausa (`market_paused`) o solo acepta órdenes de cierre (`market_close_only`).\n\n<a id=\"response-404\"></a>\n\n## Respuesta 404\n\n**404**  — No existe ninguna posición con este identificador.\n\n<a id=\"response-429\"></a>\n\n## Respuesta 429\n\n**429**  — Se superó el límite de velocidad de la clave de API (`api_key_rate_limit_exceeded`). `Retry-After` indica cuándo volver; el cuerpo incluye el bucket (`read` / `write`), la ventana que se activó, su límite y `retryAt`.\n\n<a id=\"response-default-positionresponse\"></a>\n\n## Respuesta default · PositionResponse\n\n**default** application/json — Respuesta\n\nEsquema: PositionResponse\n\nTipo: object\n\nCampos obligatorios: idx, txId, version, openedAt, lastUpdatedAt, closedAt, type, status, market, trader, size, notional, fraction, margin, pnl, funding, rolloverFee, settlementOraclePrice, fee, feeRate, exchangedQuote, exchangedBase, direction, eventName, pnlInEvent, rawPnlInEvent, profitAdjustmentApplied, holdingTimeMs, feeInEvent, fundingInEvent, rolloverFeeInEvent, executionFeeRate, executionFeeInEvent, executionFee, timestamp, isOnchain, roe, scalpingCoefficient, closeReason\n\nTipos de campos obligatorios: idx (string[]; obligatorio), txId (string[]; obligatorio), version (number; obligatorio), openedAt (string · date-time; obligatorio), lastUpdatedAt (string · date-time; obligatorio), closedAt (string · date-time · nullable; obligatorio), type (string · enum; obligatorio), status (string · enum; obligatorio), market (string · uuid; obligatorio), trader (string · uuid; obligatorio), size (string · int32; obligatorio), notional (string · int32; obligatorio), fraction (string · int32; obligatorio), margin (string · int32; obligatorio), pnl (string · int32 · nullable; obligatorio), funding (string · int32 · nullable; obligatorio), rolloverFee (string · int32; obligatorio), settlementOraclePrice (string · int32; obligatorio), fee (string · int32; obligatorio), feeRate (string · int32; obligatorio), exchangedQuote (string · int32; obligatorio), exchangedBase (string · int32; obligatorio), direction (string · enum; obligatorio), eventName (string · enum; obligatorio), pnlInEvent (string · int32; obligatorio), rawPnlInEvent (string · int32; obligatorio), profitAdjustmentApplied (boolean; obligatorio), holdingTimeMs (string[]; obligatorio), feeInEvent (string · int32; obligatorio), fundingInEvent (string · int32; obligatorio), rolloverFeeInEvent (string · int32; obligatorio), executionFeeRate (string · int32; obligatorio), executionFeeInEvent (string · int32; obligatorio), executionFee (string · int32; obligatorio), timestamp (string · date-time; obligatorio), isOnchain (boolean; obligatorio), roe (string · int32; obligatorio), scalpingCoefficient (string · int32; obligatorio), closeReason (string[]; obligatorio)\n\n- idx (string[]; obligatorio)\n\nidx ejemplo: [\n  \"string\"\n]\n\nidx.Tipo: string[]\n\nidx.Identificador de la posición. Mismo valor que `txId`.\n\nidx.[]Tipo: string\n\n- txId (string[]; obligatorio)\n\ntxId ejemplo: [\n  \"string\"\n]\n\ntxId.Tipo: string[]\n\ntxId.Identificador de la posición. Se mantiene por compatibilidad hacia atrás, siempre igual a `idx`.\n\ntxId.[]Tipo: string\n\n- version (number; obligatorio)\n\nversion ejemplo: 0\n\nversion.Tipo: number\n\nversion.Revisión de la posición: incrementada por cada evento que se le aplica.\n\n- openedAt (string · date-time; obligatorio)\n\nopenedAt ejemplo: 2026-05-01T12:30:00.000Z\n\nopenedAt.Tipo: string · date-time\n\nopenedAt.Cuándo se abrió la posición.\n\nopenedAt.format: date-time\n\n- lastUpdatedAt (string · date-time; obligatorio)\n\nlastUpdatedAt ejemplo: 2026-05-01T12:30:00.000Z\n\nlastUpdatedAt.Tipo: string · date-time\n\nlastUpdatedAt.Cuándo se aplicó el último evento a la posición.\n\nlastUpdatedAt.format: date-time\n\n- closedAt (string · date-time · nullable; obligatorio)\n\nclosedAt ejemplo: 2026-05-01T12:30:00.000Z\n\nclosedAt.Tipo: string · date-time · nullable\n\nclosedAt.Cuándo se cerró la posición; null mientras sigue abierta.\n\nclosedAt.format: date-time\n\n- type (string · enum; obligatorio)\n\ntype ejemplo: long\n\ntype.Tipo: string · enum\n\ntype.Dirección de la posición. Mismo valor que `direction`.\n\ntype.Valores permitidos: [\"long\",\"short\"]\n\n- status (string · enum; obligatorio)\n\nstatus ejemplo: opened\n\nstatus.Tipo: string · enum\n\nstatus.Si la posición sigue abierta, fue cerrada por el trader o fue liquidada.\n\nstatus.Valores permitidos: [\"opened\",\"closed\",\"liquidated\"]\n\n- market (string · uuid; obligatorio)\n\nmarket ejemplo: 00000000-0000-4000-8000-000000000000\n\nmarket.Tipo: string · uuid\n\nmarket.Mercado en el que se mantiene la posición.\n\nmarket.format: uuid\n\nmarket.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$\n\n- trader (string · uuid; obligatorio)\n\ntrader ejemplo: 00000000-0000-4000-8000-000000000000\n\ntrader.Tipo: string · uuid\n\ntrader.Cuenta del trader a la que pertenece la posición.\n\ntrader.format: uuid\n\ntrader.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$\n\n- size (string · int32; obligatorio)\n\nsize ejemplo: 1000000000\n\nsize.Tipo: string · int32\n\nsize.Tamaño de la posición en unidades del activo base, fp9 sin procesar.\n\nsize.format: int32\n\nsize.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- notional (string · int32; obligatorio)\n\nnotional ejemplo: 1000000000\n\nnotional.Tipo: string · int32\n\nnotional.Nocional abierto de la posición en moneda de cotización, fp9 sin procesar — tamaño al precio de entrada.\n\nnotional.format: int32\n\nnotional.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- fraction (string · int32; obligatorio)\n\nfraction ejemplo: 1000000000\n\nfraction.Tipo: string · int32\n\nfraction.Siempre `0`. Se mantiene por compatibilidad hacia atrás.\n\nfraction.format: int32\n\nfraction.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- margin (string · int32; obligatorio)\n\nmargin ejemplo: 1000000000\n\nmargin.Tipo: string · int32\n\nmargin.Margen que actualmente respalda la posición, fp9 sin procesar. Cambia con pnl, financiación y cambios manuales de margen.\n\nmargin.format: int32\n\nmargin.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- pnl (string · int32 · nullable; obligatorio)\n\npnl ejemplo: 1000000000\n\npnl.Tipo: string · int32 · nullable\n\npnl.Pnl realizado acumulado a lo largo de cada evento de la posición, fp9 sin procesar.\n\npnl.format: int32\n\npnl.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- funding (string · int32 · nullable; obligatorio)\n\nfunding ejemplo: 1000000000\n\nfunding.Tipo: string · int32 · nullable\n\nfunding.Financiación pagada (negativa) o recibida (positiva) durante la vida de la posición, fp9 en bruto.\n\nfunding.format: int32\n\nfunding.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- rolloverFee (string · int32; obligatorio)\n\nrolloverFee ejemplo: 1000000000\n\nrolloverFee.Tipo: string · int32\n\nrolloverFee.Siempre `0`. Se mantiene por compatibilidad hacia atrás.\n\nrolloverFee.format: int32\n\nrolloverFee.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- settlementOraclePrice (string · int32; obligatorio)\n\nsettlementOraclePrice ejemplo: 1000000000\n\nsettlementOraclePrice.Tipo: string · int32\n\nsettlementOraclePrice.Siempre `1000000000` (1.0). Se mantiene por compatibilidad con versiones anteriores.\n\nsettlementOraclePrice.format: int32\n\nsettlementOraclePrice.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- fee (string · int32; obligatorio)\n\nfee ejemplo: 1000000000\n\nfee.Tipo: string · int32\n\nfee.Comisiones de trading cobradas durante la vida de la posición, fp9 en bruto.\n\nfee.format: int32\n\nfee.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- feeRate (string · int32; obligatorio)\n\nfeeRate ejemplo: 1000000000\n\nfeeRate.Tipo: string · int32\n\nfeeRate.Tasa de comisión aplicada a la posición, fp9 fracción en bruto (`1000000` = 0.1%).\n\nfeeRate.format: int32\n\nfeeRate.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- exchangedQuote (string · int32; obligatorio)\n\nexchangedQuote ejemplo: 1000000000\n\nexchangedQuote.Tipo: string · int32\n\nexchangedQuote.Importe de cotización intercambiado por el evento más reciente, fp9 en bruto.\n\nexchangedQuote.format: int32\n\nexchangedQuote.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- exchangedBase (string · int32; obligatorio)\n\nexchangedBase ejemplo: 1000000000\n\nexchangedBase.Tipo: string · int32\n\nexchangedBase.Importe base intercambiado por el evento más reciente, fp9 en bruto.\n\nexchangedBase.format: int32\n\nexchangedBase.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- direction (string · enum; obligatorio)\n\ndirection ejemplo: long\n\ndirection.Tipo: string · enum\n\ndirection.Dirección de la posición.\n\ndirection.Valores permitidos: [\"long\",\"short\"]\n\n- eventName (string · enum; obligatorio)\n\neventName ejemplo: addMargin\n\neventName.Tipo: string · enum\n\neventName.Tipo del evento más reciente aplicado a la posición.\n\neventName.Valores permitidos: [\"addMargin\",\"removeMargin\",\"closePosition\",\"increasePosition\",\"liquidate\",\"forceClose\",\"payFunding\"]\n\n- pnlInEvent (string · int32; obligatorio)\n\npnlInEvent ejemplo: 1000000000\n\npnlInEvent.Tipo: string · int32\n\npnlInEvent.Pnl realizado del evento más reciente, fp9 en bruto.\n\npnlInEvent.format: int32\n\npnlInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- rawPnlInEvent (string · int32; obligatorio)\n\nrawPnlInEvent ejemplo: 1000000000\n\nrawPnlInEvent.Tipo: string · int32\n\nrawPnlInEvent.Pnl realizado del evento más reciente antes del ajuste de 60 segundos, fp9 en bruto. Difiere de `pnlInEvent` solo cuando se activó el ajuste.\n\nrawPnlInEvent.format: int32\n\nrawPnlInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- profitAdjustmentApplied (boolean; obligatorio)\n\nprofitAdjustmentApplied ejemplo: true\n\nprofitAdjustmentApplied.Tipo: boolean\n\nprofitAdjustmentApplied.Si el ajuste de 60 segundos limitó la ganancia del evento más reciente — dentro de un minuto de una apertura o un aumento de la posición, el pnl de la posición no puede crecer por encima de lo que era en ese momento.\n\n- holdingTimeMs (string[]; obligatorio)\n\nholdingTimeMs ejemplo: [\n  \"string\"\n]\n\nholdingTimeMs.Tipo: string[]\n\nholdingTimeMs.Cuánto tiempo se mantuvo la posición antes del cierre más reciente, en milisegundos, contado desde la apertura o el último incremento. Nulo en eventos que no son cierres.\n\nholdingTimeMs.[]Tipo: string\n\n- feeInEvent (string · int32; obligatorio)\n\nfeeInEvent ejemplo: 1000000000\n\nfeeInEvent.Tipo: string · int32\n\nfeeInEvent.Comisión cobrada por el evento más reciente, fp9 en bruto.\n\nfeeInEvent.format: int32\n\nfeeInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- fundingInEvent (string · int32; obligatorio)\n\nfundingInEvent ejemplo: 1000000000\n\nfundingInEvent.Tipo: string · int32\n\nfundingInEvent.Financiación liquidada por el evento más reciente, fp9 en bruto.\n\nfundingInEvent.format: int32\n\nfundingInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- rolloverFeeInEvent (string · int32; obligatorio)\n\nrolloverFeeInEvent ejemplo: 1000000000\n\nrolloverFeeInEvent.Tipo: string · int32\n\nrolloverFeeInEvent.Siempre `0`. Se mantiene por compatibilidad hacia atrás.\n\nrolloverFeeInEvent.format: int32\n\nrolloverFeeInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- executionFeeRate (string · int32; obligatorio)\n\nexecutionFeeRate ejemplo: 1000000000\n\nexecutionFeeRate.Tipo: string · int32\n\nexecutionFeeRate.Siempre `0`. Se mantiene por compatibilidad hacia atrás.\n\nexecutionFeeRate.format: int32\n\nexecutionFeeRate.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- executionFeeInEvent (string · int32; obligatorio)\n\nexecutionFeeInEvent ejemplo: 1000000000\n\nexecutionFeeInEvent.Tipo: string · int32\n\nexecutionFeeInEvent.Siempre `0`. Se mantiene por compatibilidad hacia atrás.\n\nexecutionFeeInEvent.format: int32\n\nexecutionFeeInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- executionFee (string · int32; obligatorio)\n\nexecutionFee ejemplo: 1000000000\n\nexecutionFee.Tipo: string · int32\n\nexecutionFee.Siempre `0`. Se mantiene por compatibilidad hacia atrás.\n\nexecutionFee.format: int32\n\nexecutionFee.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- timestamp (string · date-time; obligatorio)\n\ntimestamp ejemplo: 2026-05-01T12:30:00.000Z\n\ntimestamp.Tipo: string · date-time\n\ntimestamp.Marca de tiempo del evento más reciente. Mismo valor que `lastUpdatedAt`.\n\ntimestamp.format: date-time\n\n- isOnchain (boolean; obligatorio)\n\nisOnchain ejemplo: true\n\nisOnchain.Tipo: boolean\n\nisOnchain.Siempre `true`. Se mantiene por compatibilidad con versiones anteriores.\n\n- roe (string · int32; obligatorio)\n\nroe ejemplo: 1000000000\n\nroe.Tipo: string · int32\n\nroe.Rentabilidad sobre el capital de la posición — pnl realizado sobre el margen aportado, fp9 fracción sin procesar.\n\nroe.format: int32\n\nroe.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- scalpingCoefficient (string · int32; obligatorio)\n\nscalpingCoefficient ejemplo: 1000000000\n\nscalpingCoefficient.Tipo: string · int32\n\nscalpingCoefficient.Multiplicador dinámico de spread que se aplicó a la posición, fp9 sin procesar (`1000000000` = 1.0). Por encima de 1 cuando la operación quedó dentro de la ventana de scalping del mercado.\n\nscalpingCoefficient.format: int32\n\nscalpingCoefficient.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- closeReason (string[]; obligatorio)\n\ncloseReason ejemplo: [\n  \"string\"\n]\n\ncloseReason.Tipo: string[]\n\ncloseReason.Por qué la plataforma cerró la posición (por ejemplo, `weekly_session_risk_close`). Nulo para las posiciones cerradas por el trader y para las abiertas.\n\ncloseReason.[]Tipo: string\n\nEjemplo\n\n\n\n```json\n{\n  \"idx\": [\n    \"string\"\n  ],\n  \"txId\": [\n    \"string\"\n  ],\n  \"version\": 0,\n  \"openedAt\": \"2026-05-01T12:30:00.000Z\",\n  \"lastUpdatedAt\": \"2026-05-01T12:30:00.000Z\",\n  \"closedAt\": \"2026-05-01T12:30:00.000Z\",\n  \"type\": \"long\",\n  \"status\": \"opened\",\n  \"market\": \"00000000-0000-4000-8000-000000000000\",\n  \"trader\": \"00000000-0000-4000-8000-000000000000\",\n  \"size\": \"1000000000\",\n  \"notional\": \"1000000000\",\n  \"fraction\": \"1000000000\",\n  \"margin\": \"1000000000\",\n  \"pnl\": \"1000000000\",\n  \"funding\": \"1000000000\",\n  \"rolloverFee\": \"1000000000\",\n  \"settlementOraclePrice\": \"1000000000\",\n  \"fee\": \"1000000000\",\n  \"feeRate\": \"1000000000\",\n  \"exchangedQuote\": \"1000000000\",\n  \"exchangedBase\": \"1000000000\",\n  \"direction\": \"long\",\n  \"eventName\": \"addMargin\",\n  \"pnlInEvent\": \"1000000000\",\n  \"rawPnlInEvent\": \"1000000000\",\n  \"profitAdjustmentApplied\": true,\n  \"holdingTimeMs\": [\n    \"string\"\n  ],\n  \"feeInEvent\": \"1000000000\",\n  \"fundingInEvent\": \"1000000000\",\n  \"rolloverFeeInEvent\": \"1000000000\",\n  \"executionFeeRate\": \"1000000000\",\n  \"executionFeeInEvent\": \"1000000000\",\n  \"executionFee\": \"1000000000\",\n  \"timestamp\": \"2026-05-01T12:30:00.000Z\",\n  \"isOnchain\": true,\n  \"roe\": \"1000000000\",\n  \"scalpingCoefficient\": \"1000000000\",\n  \"closeReason\": [\n    \"string\"\n  ]\n}\n```","text":"Cambiar el margen de la posición Mueve el saldo de cotización dentro o fuera del margen de una posición abierta, lo que desplaza con ello su apalancamiento y su precio de liquidación. - La posición debe seguir abierta, y su cuenta debe pertenecer a quien llama y estar `active` — una cuenta bloqueada por el límite de capital gestionado se rechaza aquí. - El mercado debe estar abierto y no en modo de solo cierre. - `marginChange: \"0\"` se acepta y devuelve la posición sin cambios. - Añadir más de lo que cubre el saldo libre falla con `insufficient_balance`; retirar más de lo que la posición puede ceder falla con `non_positive_margin`. PATCH /positions/{positionId}/margin Trading positionId Identificador de posición. Su cuenta debe pertenecer al llamador. string · uuid marginChange Signed quote amount to move in or out of the position margin, fp9 raw. Positive adds margin and requires that much free balance, negative withdraws it and must keep the remaining margin positive. `0` is accepted and changes nothing. string · int32 401 No autorizado 403 La cuenta pertenece a otro usuario (`account_access_denied`), o la solicitud se autentica con una clave de API mientras `api_trading` está deshabilitado en la cuenta (`api_trading_not_enabled`). La cuenta no está en un estado activo. El mercado está en pausa (`market_paused`) o solo acepta órdenes de cierre (`market_close_only`). 404 No existe ninguna posición con este identificador. 429 Se superó el límite de velocidad de la clave de API (`api_key_rate_limit_exceeded`). `Retry-After` indica cuándo volver; el cuerpo incluye el bucket (`read` / `write`), la ventana que se activó, su límite y `retryAt`. default Respuesta idx Position identifier. Same value as `txId`. string[] txId Position identifier. Kept for backward compatibility, always equal to `idx`. string[] version Revision of the position: incremented by every event applied to it. number openedAt When the position was opened. string · date-time lastUpdatedAt When the last event was applied to the position. string · date-time closedAt When the position was closed; null while it is still open. string · date-time · nullable type Direction of the position. Same value as `direction`. string · enum status Whether the position is still open, closed by the trader, or liquidated. string · enum market Market the position is held on. string · uuid trader Trader account the position belongs to. string · uuid size Position size in base asset units, fp9 raw. string · int32 notional Open notional of the position in quote currency, fp9 raw — size at entry price. string · int32 fraction Always `0`. Kept for backward compatibility. string · int32 margin Margin currently backing the position, fp9 raw. Moves with pnl, funding and manual margin changes. string · int32 pnl Realised pnl accumulated over every event of the position, fp9 raw. string · int32 · nullable funding Funding paid (negative) or received (positive) over the life of the position, fp9 raw. string · int32 · nullable rolloverFee Always `0`. Kept for backward compatibility. string · int32 settlementOraclePrice Always `1000000000` (1.0). Kept for backward compatibility. string · int32 fee Trading fees charged over the life of the position, fp9 raw. string · int32 feeRate Fee rate applied to the position, fp9 raw fraction (`1000000` = 0.1%). string · int32 exchangedQuote Quote amount exchanged by the most recent event, fp9 raw. string · int32 exchangedBase Base amount exchanged by the most recent event, fp9 raw. string · int32 direction Direction of the position. string · enum eventName Type of the most recent event applied to the position. string · enum pnlInEvent Realised pnl of the most recent event, fp9 raw. string · int32 rawPnlInEvent Realised pnl of the most recent event before the 60-second adjustment, fp9 raw. Differs from `pnlInEvent` only when the adjustment fired. string · int32 profitAdjustmentApplied Whether the 60-second adjustment capped the profit of the most recent event — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment. boolean holdingTimeMs How long the position was held before the most recent close, in milliseconds, counted from the open or the last increase. Null on events that are not closes. string[] feeInEvent Fee charged by the most recent event, fp9 raw. string · int32 fundingInEvent Funding settled by the most recent event, fp9 raw. string · int32 rolloverFeeInEvent Always `0`. Kept for backward compatibility. string · int32 executionFeeRate Always `0`. Kept for backward compatibility. string · int32 executionFeeInEvent Always `0`. Kept for backward compatibility. string · int32 executionFee Always `0`. Kept for backward compatibility. string · int32 timestamp Timestamp of the most recent event. Same value as `lastUpdatedAt`. string · date-time isOnchain Always `true`. Kept for backward compatibility. boolean roe Return on equity of the position — realised pnl over the margin put up, fp9 raw fraction. string · int32 scalpingCoefficient Dynamic spread multiplier the position was charged, fp9 raw (`1000000000` = 1.0). Above 1 when the trade fell inside the market scalping window. string · int32 closeReason Why the platform closed the position (for example `weekly_session_risk_close`). Null for positions closed by the trader and for open ones. string[]","api":{"title":"API pública de Upscale","version":"d796ac9","documentation":"https://docs.upscale.trade/es/developers","playgroundServer":"https://api.upscale.trade"}}