JKorf / Binance.Net

A C# .netstandard client library for the Binance REST and Websocket Spot and Futures API focusing on clear usage and models
https://jkorf.github.io/Binance.Net/
MIT License
1.04k stars 427 forks source link

Getting all open orders via futures stream #1296

Open tr5x opened 1 year ago

tr5x commented 1 year ago

Hi!

I was wondering if it's possible to get all the open orders via futures stream?

There is method SubscribeToUserDataUpdatesAsync which can be used to get info on changes to positions (onAccountUpdate) and individual orders (onOrderUpdate), but I can find a way to get updates on all open orders, similar to positions in onAccountUpdate.

I can get open orders via API call GetOpenOrdersAsync, but need to do it very often, so getting this info from stream would be ideal.

Thanks a lot!

JKorf commented 1 year ago

I'm not sure what you're looking for. The general way to do it is to use GetOpenOrdersAsync first and then update the data with updates from onOrderUpdate in the SubscribeToUserDataUpdatesAsync

tr5x commented 12 months ago

Hi, thanks for your response!

This is what I do. But I had a problem recently when websocket didn't send info about order fill, and my algo got stuck. In the DB I have an open order, and treat it as such, but in reality this order is already filled. At the moment I just get all open orders using GetOpenOrdersAsync to check if the data in the DB and Binance match. But Binance has limitations on the number of API calls, so I can't do it very often.

That's why I wanted to ask if there is a way to receive all open orders, not just changes, via websocket?

Thanks!