Get position quantity
The get_position_quantity function returns the quantity of the currently held
position. This is useful if you want to check if you are currently holding
a position before placing a new order.
Method
Section titled “Method”tm.get_position_quantity()Inputs
Section titled “Inputs”None
Outputs
Section titled “Outputs”Quantity of the currently held position.
Example usage
Section titled “Example usage”import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# ... Your strategy code here
# Get position quantity position_quantity = tm.get_position_quantity()
# Print the position quantity tm.log(f"Position quantity: {position_quantity}")