Skip to content

Entering a Short Position

Entering a short position means you are going short on an asset. This is useful if you want to enter a position at once, for example when you want to enter a position when a certain condition is met.

Often, you want to enter a short position when you think the price will go down.

Method

tm.enter_short_position_market(quantity, comment="", tags={})

Inputs

ParameterArgument typeDescriptionDefault Value
quantityfloatQuantity to short-
commentOptional[str]Comment to add to the order""
tagsOptional[Dict[str, str]]Tags to add to the order{}
stop_loss_percentOptional[float]Stop loss percentageNone
take_profit_percentOptional[float]Take profit percentageNone

Outputs

Order that was created to enter the position.

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# ... Your strategy code here
# Enter a short position
order = tm.enter_short_position_market(
quantity=1,
comment="Entering short position",
tags={"reason": "Signal"},
stop_loss_percent=5,
take_profit_percent=10
)
# ... Your strategy code here