gateio / gatews

Gate Websocket V4 SDK
89 stars 35 forks source link

'available balance' via WS? #47

Open LKresta opened 1 year ago

LKresta commented 1 year ago

Hello,

is there a way to get/compute 'available balance' based on WS notifications?

When REST API is used to obtain account balance (https://www.gate.io/docs/developers/apiv4/en/#query-futures-account) the information includes total and available amounts (and doesn't include any sort of 'valid as of' time). WS notification (https://www.gate.io/docs/developers/futures/ws/en/#positions-notification) only provides total amount and change amount. But the available amount likely does not follow the same change. Is there a way to compute/keep track of it?

E.g. since total = position_margin + order_margin + available and position margin is part of position updates if I had the order_margin I could compute the available amount myself. But I don't know where to get order_margin from/how to keep track of it.

Thanks, L.