Function jet_margin::jet_margin::close_position
source · [−]pub fn close_position(
ctx: Context<'_, '_, '_, '_, ClosePosition<'_>>
) -> Result<()>
Expand description
Close out a position, removing it from the account.
Since there is a finite number of positions a single account can maintain it may be necessary for a user to close out old positions to take new ones.
Accounts
Name | Type | Description |
authority | signer | The authority that can change the margin account. |
receiver | writable | The receiver for the rent released. |
margin_account | writable | The margin account with the position to close. |
position_token_mint | read_only | The mint for the position token being deregistered. |
token_account | writable | The token account for the position being closed. |
token_program | read_only | The spl token program. |
Events
Event Name | Description |
events::PositionClosed | Marks the closure of the position. |