How to submit short order with a trailing stop?

I’m trying to submit a short sale on a stock but I want to add a trailing stop, like so:

api.submit_order(
symbol=‘AMD’,
qty=1,
side=‘sell’,
type=‘trailing_stop’,
trail_percent=4.0,
time_in_force=‘day’,
)

However this does not get filled on the paper account. I think the trailing stop might not be right because it is a short sale

@John_Jay That order should work. It should sell (ie sell short if one doesn’t have a position) if the price of AMD drops 4% below the “high water mark” (HWM). The HWM begins tracking when the order is placed. It doesn’t look back in history to get a HWM. So, did the price of AMD drop 4% from the highest price as of the time you placed the order? Only then would it have executed.

I believe what the original poster was trying to ask was how do you set a trailing stop percent on a short sell rather than how to set a sell to execute once the stock drops a certain percentage. For example, if I short a stock at $50, and it goes up a certain percentage, that position should be closed via a buy to cover or whatever. I have been trying to figure this out as well as it seems putting a trail percent on a short sell order makes the order not go through.

@anthony1 If you have an existing short position (eg hold -10 shares of XYZ and a cost basis of $10.00), you can place a trailing stop order to ‘buy to cover’ if/when the price goes up to $10.50 with an order like this

curl --request POST \
     --url https://paper-api.alpaca.markets/v2/orders \
     --header 'APCA-API-KEY-ID: xxxxx' \
     --header 'APCA-API-SECRET-KEY: xxxxx' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "side": "buy",
  "type": "trailing_stop",
  "time_in_force": "gtc",
  "symbol": "XYZ",
  "qty": "10",
  "trail_price": "10.50"
}
'

Is that what you were trying to do?

Oh yes, thank you very much.

1 Like