I use create_order() from python-binance.readthedocs.io as such in the spot account for the SIDE_SELL:
`order = client.create_order(
symbol=ticker,
side=SIDE_SELL,
type=ORDER_TYPE_STOP_LOSS_LIMIT,
timeInForce=TIME_IN_FORCE_GTC,
quantity=quantity,
price=final_stop_loss,
trailingDelta=rounded_trailing_delta,
newClientOrderId=trade_ref
)`
This works just fine.
I do the mirror version in the margin account for a SIDE_BUY:
`order = client.create_margin_order(
symbol=ticker,
side=SIDE_BUY,
type=ORDER_TYPE_STOP_LOSS_LIMIT,
timeInForce=TIME_IN_FORCE_GTC,
quantity=quantity,
price=final_stop_loss,
trailingDelta=rounded_trailing_delta,
newClientOrderId=trade_ref
)`
It should work but does not. The error I receive is
APIError(code=-1102): Mandatory parameter 'stopPrice' was not sent, was empty/null, or malformed.
But ‘stopPrice’ is not a needed variable when placing a Trailing Stop Order with a trailingDelta. If I put a stopPrice Binance places a basic Limit Order with a trigger (stopPrice) and an execution price (price)
This is from Binance itself:
Trailing Stop Order Examples ; Excluding stop price POST ‘https://api.binance.com/api/v3/order?symbol=BTCUSDT&side=BUY&type=STOP_LOSS_LIMIT&timeInForce=GTC&quantity=0.01&price=42000&trailingDelta=500×tamp=&signature=’
Which confirms I should be right. I am at loss…