Positions#
The position endpoints allow you to view and manage your open positions.
Get All Positions#
Get Open Position#
- TradingClient.get_open_position(symbol_or_asset_id: Union[UUID, str]) Union[Position, Dict[str, Any]] #
Gets the open position for an account for a single asset. Throws an APIError if the position does not exist.
- Parameters:
symbol_or_asset_id (Union[UUID, str]) – The symbol name of asset id of the position to get.
- Returns:
Open position of the asset.
- Return type:
Close All Positions#
- TradingClient.close_all_positions(cancel_orders: bool) Union[List[ClosePositionResponse], Dict[str, Any]] #
Liquidates all positions for an account.
Places an order for each open position to liquidate.
- Parameters:
cancel_orders (bool) – If true is specified, cancel all open orders before liquidating all positions.
- Returns:
- A list of responses from each closed position containing the status code and
order id.
- Return type:
List[ClosePositionResponse]
Close A Position#
- TradingClient.close_position(symbol_or_asset_id: Union[UUID, str], close_options: Optional[ClosePositionRequest] = None) Union[Order, Dict[str, Any]] #
Liquidates the position for a single asset.
Places a single order to close the position for the asset.
This method will throw an error if the position does not exist!
- Parameters:
symbol_or_asset_id (Union[UUID, str]) – The symbol name of asset id of the position to close.
close_options – The various close position request parameters.
- Returns:
The order that was placed to close the position.
- Return type: