Closed SpaceMonkeyForever closed 3 years ago
It looks like my PR might be wrong. The key to listen to margin orders might have a different endpoint (hard to decipher Binance API, it mentions only one endpoint for all user data). If I revert my PR, I get the following error:
Not a margin account.
Which seems to make sense because on Binance I don't have a cross margin account, only an isolated margin account and the API key I'm using is marked as follows:
I wonder if Binance API is really that bad. Maybe I have to fund my cross margin account first then enable this flag then try again.
On the other hand, I believe the current API end-point (without my PR) is deprecated.... and I'm not sure if my PR is using the correct end-point or not.
After depositing money into my margin wallet and reverting my PR, I can receive data but only for cross margin orders.
So essentially, the current code works fine but it's only for cross margin data but not for isolated margin data. My PR is wrong and I will cancel it until I find the correct fix (if it exists) to use v3 api for cross margin as well as being able to listen to cross margin orders.
I found the documentation:
While implementing the isolated stream, I found out it's already implemented.....
This is the correct code:
var result= _client.Margin.IsolatedUserStream.StartIsolatedMarginUserStream("BTCUSDT");
Why isn't there a way to subscribe to margin order updates like we have for spot?
We have
Margin.UserStream.StartUserStream()
which btw had a bug that I fixed https://github.com/JKorf/Binance.Net/pull/608 but we don't have a corresponding Margin.Subscribe method. I believe I can use Spot.Subscribe because it makes the same request to the same endpoint and listens to the correct WebSocket (looking at https://github.com/binance/binance-spot-api-docs/blob/master/user-data-stream.md), but I don't get any data:Logs suggests websocket is connected:
I can see in debugger that the client thinks it's connected: