How do I know that the order which comes to me is an order relating to an existing position, and not an order opening a new position?

In the system of copy trading, orders from the master trader’s account arrive from websocket. How do I know that the order which comes to me is an order relating to an existing position, and not an order opening a new position? For example:
The master opened a new long position at 1:00 a.m.
A new client joined the system at 2:00 a.m.
Master sets an additional order to the existing long position at 3:00 a.m.

Well, in fact this order should not trigger the new client (and it should trigger for the old clients), because the new client does not have an initial order that opened a position at 1:00 a.m. , and it is incorrect to open a position without an initial order by this additional order that was sent at 3:00 a.m.

Does the order have an indication that it is an order opening a position or is it an order being added to an already open position ?

after the order is filled, there is a position open into your account.
If there is an existing position, the filled order will have an impact to it.
If there is no existing position, it will open a new one.

@dino What you wrote is correct. However, the question was different.
Example:
{‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1653501464463, ‘E’: 1653501464468, ‘o.s’: ‘BTCUSDT’, ‘o.c’: ‘ios_st_DUJgRr5PnVFch’, ‘o.S’: ‘SELL’, ‘o.o’: ‘LIMIT’, ‘o.f’: ‘GTC’, ‘o.q’: ‘0.005’, ‘o.p’: ‘30493.40’, ‘o.ap’: ‘0’, ‘o.sp’: ‘0’, ‘o.x’: ‘NEW’, ‘o.X’: ‘NEW’, ‘o.i’: 5535758073, ‘o.l’: ‘0’, ‘o.z’: ‘0’, ‘o.L’: ‘0’, ‘o.T’: 1653501464463, ‘o.t’: 0, ‘o.b’: ‘0’, ‘o.a’: ‘152.46700’, ‘o.m’: False, ‘o.R’: False, ‘o.wt’: ‘CONTRACT_PRICE’, ‘o.ot’: ‘LIMIT’, ‘o.ps’: ‘BOTH’, ‘o.cp’: False, ‘o.rp’: ‘0’, ‘o.pP’: False, ‘o.si’: 121330676, ‘o.ss’: 1, ‘o.st’: ‘OTO’}

{‘e’: ‘ORDER_TRADE_UPDATE’, ‘T’: 1653501653678, ‘E’: 1653501653683, ‘o.s’: ‘BTCUSDT’, ‘o.c’: 'ios_st_fBtHKgzlYxroLH, ‘o.S’: ‘BUY’, ‘o.o’: ‘LIMIT’, ‘o.f’: ‘GTC’, ‘o.q’: ‘0.034’, ‘o.p’: ‘28650’, ‘o.ap’: ‘0’, ‘o.sp’: ‘0’, ‘o.x’: ‘NEW’, ‘o.X’: ‘NEW’, ‘o.i’: 5535784719, ‘o.l’: ‘0’, ‘o.z’: ‘0’, ‘o.L’: ‘0’, ‘o.T’: 1653501653678, ‘o.t’: 0, ‘o.b’: ‘974.10000’, ‘o.a’: ‘524.28700’, ‘o.m’: False, ‘o.R’: False, ‘o.wt’: ‘CONTRACT_PRICE’, ‘o.ot’: ‘LIMIT’, ‘o.ps’: ‘BOTH’, ‘o.cp’: False, ‘o.rp’: ‘0’, ‘o.pP’: False, ‘o.si’: 121331201, ‘o.ss’: 1, ‘o.st’: ‘OTO’}

In the example there are two orders received from the websocket. First is a buy order and the second is a sell order.

How do I understand that the first order opens a short position and the second order is a take-profit to it, rather than the first order opens a short position and the second opens a long position?

but for spot Binance you don’t have positions

Im asking about Futures.

Futures has 2 types of position mode: Hedge or one-way.

For one symbol,

  • Hedge allow you to open both short and long position.
  • One-way only allow one position. For this mode:
    • if you place a 0.5 BTC buy order, then you will hold 0.5 BTC long position
    • then you place a 1BTC sell order. Exchange first close your long position, then open a 0.5 BTC short position.
    • that’s why we call it one-way, only one position allowed.

In your case above, the “ps” is “BOTH”, which is a one-way position mode. So you will know what position you are holding.

This topic has a few details of it: Enable Hedge Mode on Futures API

I guess you have to set the type TAKE_PROFIT for your tp, like that you will know if this is a tp or just the opening trade