Price, Stop_Price at Stop-Limit Order

Hei traders,

i am curious about the correct meaning for price, stopPrice when sending a new STOP, TAKE_PROFIT Order via API.

I want to place a Limit-Order. When i send the TAKE_PROFIT - order with correct Parameters, the order always get executed and filled at stopPrice and not at the price.
For my understanding, the stopPrice was intendet as a trigger to write the the limit-order to the order-book with the price as the execution-price.

Example.
ADAUSDT, LONG: I am in a position (1.1600USDT) and my TAKE_PROFIT - Order is set with a stopPrice at 1.1840USDT and a price at 1.1850USDT. I want to sell at 1.1850USDT and not at 1.1840USDT!!!
But when the latest price > stopPrice the order will be executed and filled before getting to 1.1850USDT
What am i doing wrong?

Hey ishuen,

See Example Below. First API-POST is a simple Market-Order (LONG). With this order, all is fine.
Second API-POST is the open order (TAKE_PROFIT). This order should get added to the orderbook as a Limit-Order when the stopPrice of 3.012 USDT is hit, and the Limit-Order should get filled and the position closed at a last-price of 3.020 USDT.
Everytime the order gets executed and filled and the position closed when last-price is >= stopPrice…

POST https://fapi.binance.com/fapi/v1/order?symbol=LITUSDT&side=BUY&type=MARKET&quantity=5.0&timestamp=1626695895284&signature=
POST https://fapi.binance.com/fapi/v1/order?symbol=LITUSDT&side=SELL&type=TAKE_PROFIT&quantity=5.0&reduceOnly=true&price=3.02&stopPrice=3.012&timestamp=1626695895896&signature=

Below you can see the answer, send back from binance.

BUY-ORDER: {'orderId': 524843302, 'symbol': 'LITUSDT', 'status': 'NEW', 'clientOrderId': 'qABvFfz1jRXidRfs8nXEDq', 'price': '0', 'avgPrice': '0.0000', 'origQty': '5', 'executedQty': '0', 'cumQty': '0', 'cumQuote': '0', 'timeInForce': 'GTC', 'type': 'MARKET', 'reduceOnly': False, 'closePosition': False, 'side': 'BUY', 'positionSide': 'BOTH', 'stopPrice': '0', 'workingType': 'CONTRACT_PRICE', 'priceProtect': False, 'origType': 'MARKET', 'updateTime': 1626695896713}

TAKE_PROFIT-ORDER: {'orderId': 524843324, 'symbol': 'LITUSDT', 'status': 'NEW', 'clientOrderId': 'irF3LQwYqhBULzbbUcwyPb', 'price': '3.020', 'avgPrice': '0.0000', 'origQty': '5', 'executedQty': '0', 'cumQty': '0', 'cumQuote': '0', 'timeInForce': 'GTC', 'type': 'TAKE_PROFIT', 'reduceOnly': True, 'closePosition': False, 'side': 'SELL', 'positionSide': 'BOTH', 'stopPrice': '3.012', 'workingType': 'CONTRACT_PRICE', 'priceProtect': False, 'origType': 'TAKE_PROFIT', 'updateTime': 1626695897286}

Hi.
Concept wise, your understanding sounds correct. Could you provide the raw query string (remove the signature) and the server log for investigation purpose?

Hi. Thanks for sharing the info. From here, I can see the requests are successfully sent as what you expected. However, the response objects show the orders are in NEW status. This means that the orders are placed in the order book but they are not yet completed. You can see executedQty are 0, they have not yet been filled. Could you find out the records when the status is FILLED?

POST https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&side=SELL&type=MARKET&quantity=20&timestamp=1626882121313&signature=
POST https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&side=BUY&type=STOP&quantity=20&reduceOnly=true&price=1.177&stopPrice=1.176&timestamp=1626882121916&signature=
POST https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&side=BUY&type=TAKE_PROFIT&quantity=20&reduceOnly=true&price=1.169&stopPrice=1.17&timestamp=1626882122507&signature=

MARKET_BUY - ORDER

  1. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882122435, ‘E’: 1626882122442, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘lIM3iHG4isqzkKrEs073co’, ‘S’: ‘SELL’, ‘o’: ‘MARKET’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘0’, ‘ap’: ‘0’, ‘sp’: ‘0’, ‘x’: ‘NEW’, ‘X’: ‘NEW’, ‘i’: 15039366234, ‘l’: ‘0’, ‘z’: ‘0’, ‘L’: ‘0’, ‘T’: 1626882122435, ‘t’: 0, ‘b’: ‘0’, ‘a’: ‘0’, ‘m’: False, ‘R’: False, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘MARKET’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

  2. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ACCOUNT_UPDATE’, ‘T’: 1626882122435, ‘E’: 1626882122442, ‘a’: {‘B’: [{‘a’: ‘USDT’, ‘wb’: ‘328.82925716’, ‘cw’: ‘305.38134796’, ‘bc’: ‘0’}], ‘P’: [{‘s’: ‘ADAUSDT’, ‘pa’: ‘-20’, ‘ep’: ‘1.17270’, ‘cr’: ‘-280.20071003’, ‘up’: ‘-0.00329080’, ‘mt’: ‘isolated’, ‘iw’: ‘23.44790920’, ‘ps’: ‘BOTH’, ‘ma’: ‘USDT’}], ‘m’: ‘ORDER’}}}

  3. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882122435, ‘E’: 1626882122442, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘lIM3iHG4isqzkKrEs073co’, ‘S’: ‘SELL’, ‘o’: ‘MARKET’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘0’, ‘ap’: ‘1.17270’, ‘sp’: ‘0’, ‘x’: ‘TRADE’, ‘X’: ‘FILLED’, ‘i’: 15039366234, ‘l’: ‘20’, ‘z’: ‘20’, ‘L’: ‘1.17270’, ‘n’: ‘0.00938160’, ‘N’: ‘USDT’, ‘T’: 1626882122435, ‘t’: 343193145, ‘b’: ‘0’, ‘a’: ‘0’, ‘m’: False, ‘R’: False, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘MARKET’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

STOP_LOSS - ORDER

  1. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882123027, ‘E’: 1626882123033, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘Ok3PAD33Re5xdqSX0myKO4’, ‘S’: ‘BUY’, ‘o’: ‘STOP’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘1.17700’, ‘ap’: ‘0’, ‘sp’: ‘1.17600’, ‘x’: ‘NEW’, ‘X’: ‘NEW’, ‘i’: 15039366528, ‘l’: ‘0’, ‘z’: ‘0’, ‘L’: ‘0’, ‘T’: 1626882123027, ‘t’: 0, ‘b’: ‘0’, ‘a’: ‘0’, ‘m’: False, ‘R’: True, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘STOP’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

TAKE_PROFIT - ORDER

  1. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882123605, ‘E’: 1626882123608, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘tHzlOBgT2xnXyoZaur6PWy’, ‘S’: ‘BUY’, ‘o’: ‘TAKE_PROFIT’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘1.16900’, ‘ap’: ‘0’, ‘sp’: ‘1.17000’, ‘x’: ‘NEW’, ‘X’: ‘NEW’, ‘i’: 15039366747, ‘l’: ‘0’, ‘z’: ‘0’, ‘L’: ‘0’, ‘T’: 1626882123605, ‘t’: 0, ‘b’: ‘0’, ‘a’: ‘0’, ‘m’: False, ‘R’: True, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘TAKE_PROFIT’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

6-10 are the USERSTREAM answers after TAKE_PROFIT-LIMIT-ORDER got executed and filled.

  1. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882348253, ‘E’: 1626882348259, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘tHzlOBgT2xnXyoZaur6PWy’, ‘S’: ‘BUY’, ‘o’: ‘TAKE_PROFIT’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘1.16900’, ‘ap’: ‘0’, ‘sp’: ‘1.17000’, ‘x’: ‘EXPIRED’, ‘X’: ‘EXPIRED’, ‘i’: 15039366747, ‘l’: ‘0’, ‘z’: ‘0’, ‘L’: ‘0’, ‘T’: 1626882348253, ‘t’: 0, ‘b’: ‘23.38000’, ‘a’: ‘0’, ‘m’: False, ‘R’: True, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘TAKE_PROFIT’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

  2. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882348253, ‘E’: 1626882348260, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘tHzlOBgT2xnXyoZaur6PWy’, ‘S’: ‘BUY’, ‘o’: ‘LIMIT’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘1.16900’, ‘ap’: ‘0’, ‘sp’: ‘1.17000’, ‘x’: ‘NEW’, ‘X’: ‘NEW’, ‘i’: 15039366747, ‘l’: ‘0’, ‘z’: ‘0’, ‘L’: ‘0’, ‘T’: 1626882348253, ‘t’: 0, ‘b’: ‘23.38000’, ‘a’: ‘0’, ‘m’: False, ‘R’: True, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘TAKE_PROFIT’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

  3. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ACCOUNT_UPDATE’, ‘T’: 1626882352079, ‘E’: 1626882352095, ‘a’: {‘B’: [{‘a’: ‘USDT’, ‘wb’: ‘328.89858117’, ‘cw’: ‘328.89858117’, ‘bc’: ‘0’}], ‘P’: [{‘s’: ‘ADAUSDT’, ‘pa’: ‘0’, ‘ep’: ‘0.00000’, ‘cr’: ‘-280.12671003’, ‘up’: ‘0’, ‘mt’: ‘isolated’, ‘iw’: ‘0’, ‘ps’: ‘BOTH’, ‘ma’: ‘USDT’}], ‘m’: ‘ORDER’}}}

  4. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882352079, ‘E’: 1626882352095, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘tHzlOBgT2xnXyoZaur6PWy’, ‘S’: ‘BUY’, ‘o’: ‘LIMIT’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘1.16900’, ‘ap’: ‘1.16900’, ‘sp’: ‘1.17000’, ‘x’: ‘TRADE’, ‘X’: ‘FILLED’, ‘i’: 15039366747, ‘l’: ‘20’, ‘z’: ‘20’, ‘L’: ‘1.16900’, ‘n’: ‘0.00467599’, ‘N’: ‘USDT’, ‘T’: 1626882352079, ‘t’: 343196167, ‘b’: ‘0’, ‘a’: ‘0’, ‘m’: True, ‘R’: True, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘TAKE_PROFIT’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0.07400000’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

  5. {‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1626882398984, ‘E’: 1626882398988, ‘o’: {‘s’: ‘ADAUSDT’, ‘c’: ‘Ok3PAD33Re5xdqSX0myKO4’, ‘S’: ‘BUY’, ‘o’: ‘STOP’, ‘f’: ‘GTC’, ‘q’: ‘20’, ‘p’: ‘1.17700’, ‘ap’: ‘0’, ‘sp’: ‘1.17600’, ‘x’: ‘CANCELED’, ‘X’: ‘CANCELED’, ‘i’: 15039366528, ‘l’: ‘0’, ‘z’: ‘0’, ‘L’: ‘0’, ‘T’: 1626882398984, ‘t’: 0, ‘b’: ‘0’, ‘a’: ‘0’, ‘m’: False, ‘R’: True, ‘wt’: ‘CONTRACT_PRICE’, ‘ot’: ‘STOP’, ‘ps’: ‘BOTH’, ‘cp’: False, ‘rp’: ‘0’, ‘pP’: False, ‘si’: 0, ‘ss’: 0}}}

This example was the best i could create as an simulation.

See #9, here all went as i wanted it to be. Order was send to the Orderbook at 1.1700USDT and filled at 1.16900USDT.

Normaly there is a bigger spread between Trigger and Price, and then the order gets filled at the trigger-price…

The “problem” is not connected to any code issues. I tried it several times by entering the orders in the web app or desktop app. Same ending.

At least, the orders get filled… more or less at the price i want it to be filled. I normaly use a spread between stopPrice and price of 0.3%, the TAKE_PROFIT or STOP_LOSS were filled 0.3% earlier than wanted… not that big problem.
Was just wondering why this happend.

In this example, the API and matching engine was working fine. The order really has the price = 1.169 and gets triggered when the stop price = 1.17. Then the order is filled as the specification. Let us know when that issue you mentioned before happens again, thanks.

POST https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&side=BUY&type=TAKE_PROFIT...&price=1.169&stopPrice=1.17&timestamp=1626882122507&signature=
{‘stream’: ‘…’, ‘data’: {‘e’: ‘ORDER_TRADE_UPDATE’, ... ‘p’: ‘1.16900’, ‘sp’: ‘1.17000’, ‘x’: ‘TRADE’, ‘X’: ‘FILLED’, ... ‘ot’: ‘TAKE_PROFIT’... }}}

Thanks ishuen,

if there are any issues in the future, il keep you updatet.

Cya