how to use websocket to get new info of orders on binance swap?

for example, I send 2 orders on binance swap: buy btcusdt 1.0 and sell ethusdt 2.0 and both are by ‘limit’ orders; I want to get the info by api for any trading on them, such as btcusdt 0.5, eth 0.2; how shall I write the code, shall I get an demo?
I know I should use this link ‘Binance API 使用文档’, but I don’t know the exact details.

There is no websocket stream for Swap order changes. You can get relevant order data from the Swap History endpoint.

https://binance-docs.github.io/apidocs/spot/en/#get-swap-history-user_data

1 Like

Hi tantialex
thanks for your reply;
I am not familar with this development, and I guess I should use the url like this ‘Buy/Sell Bitcoin, Ether and Altcoins | Cryptocurrency Exchange | Binance(HMAC SHA256)’;
then my question is that:

  1. how to generate my HMAC SHA256, could you show a demo?
  2. requests.get(this url) to get swap holding?
  3. how many time I can get this data after I post a new order?
  1. how to generate my HMAC SHA256, could you show a demo?

You can find samples of generating the signature in different languages here.

  1. requests.get(this url) to get swap holding?

You can find a sample example of Get Swap History in our official connectors.

Python Example

Other connectors

  1. how many time I can get this data after I post a new order?

It’s available right after the order is sent. However it will remain pending until it is matched. This time frame is unknown.

1 Like