We develop a trading terminal.
Let’s imagine we have 1000 users who opened positions with ST/TP.
If I understand correctly, we should:
Open 1000 WebSocket connections for each API key separately. Docs
Reopen it each 1 hour
All the time we should very carefully check that WS working correctly to be sure Binance sends to us a notification about one of SL/TP is being executed. (We close the last one)
What kind of limits we can find here and crash on it?
How do you think how many servers do we need for this task? (is only to check SL/TP)?
If something wrong with WS how to check the positions, in the circle each tick?
Open 1000 WebSocket connections for each API key separately. Docs
1 websocket connection may include up to 1024 streams, each stream corresponding to a user data stream.
All the time we should very carefully check that WS working correctly to be sure Binance sends to us a notification about one of SL/TP is being executed.
You should trust the ping/pong interface to determine if connection to the server is still ongoing, instead of intentionally triggering events.
What kind of limits we can find here and crash on it?
As mentioned previously, 1 connection can have a maximum of 1024 streams. As for the maximum amount of open connections, this depends on your setup.
How do you think how many servers do we need for this task? (is only to check SL/TP)?
This depends on your use-case. We do not provide any suggestions, it is the responsibility of the client to monitor the performance of the connections and handle them accordingly.
If something wrong with WS how to check the positions, in the circle each tick?
The alternative to WS implementation is the web API, This would require the client to poll the account information endpoint to periodically obtain position information. This is not efficient when compared to the WS implementation and is not suggested for production.