In September, I already have written about this problem (Liability information in websocket (cross margin)). I am still getting errors because of it.
My program works, but it could be faster and reliable if you implement my proposals.
Add in rest method /sapi/v1/margin/account field “Time of last account update”. If I receive WebSocket event “outboundAccountPosition” and in 1ms query /sapi/v1/margin/account it not means that I will receive fresher data as it was in WebSocket event.
This can help, but would be better:
- Liability information in websocket (cross margin). I would not query rest API every time when balance changes.
- Add in WebSocket event “outboundAccountPosition” field “Event reason type” like in futures WebSocket event “ACCOUNT_UPDATE” field “m”. It is needed for synchronization orders and account information in my app. I would cancel or place correct orders in matters of milliseconds, and not getting errors about insufficient balance.
- Send information about borrows/repays over “outboundAccountPosition”. I cannot get status of borrows/repays, and sometimes I get error -3007 “You have pending borrow or repayment, please try again later.”
I don’t have any problems on futures, but on cross-margin I’m constantly getting errors related with borrows/repays and incorrect state of orders and account information.