Close Position
Close position for a given market.
Opposite short-term market orders are used. If provided, the position is only reduced by a size of reduce_by. Note that at the moment Rubin doesn’t support spot trading.
Method Declaration
Python
Parameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
account | query | Account | true | The wallet address that owns the subaccount. |
subaccount | query | Subaccount | true | Subaccount to close |
market_params | query | OrderMarketParams | true | Market parameters |
reduced_by | query | BigDecimal | false | |
client_id | query | ClientId | true |
Response
| Status | Meaning | Schema | |
|---|---|---|---|
200 | OK | TxHash | |
400 | Bad Request | The request was malformed or invalid. | |
404 | Not Found | The subaccount was not found. |
Examples: Rust