Closing a Position
Closing a position is a simple way to close an open position. This is useful if you want to close a position at once, for example when you want to exit a position when a certain condition is met.
Method
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
order | Order | Order to close | - |
comment | Optional[str] | Comment to add to the order | "" |
tags | Optional[Dict[str, str]] | Tags to add to the order | {} |
Outputs
Order that was created to close the position.
Example usage
The below example shows how to close orders in the following scenarios:
- Close all pending orders
- Close all open position orders manually