-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Liqui: fetchBalance() should return only free balance #235
Comments
Hi, @mkutny ! Thanks for opening this issue! Really appreciate your involvement! It's not very clear from their docs, how we should calculate totals without fetching currently open orders. So we basically have these options for
It's not very clear, which one is better... Or, maybe, you can advise another way of summing the total for liqui? What do you think of it? |
Indeed, it seems that with Liqui you can't calculate totals without fetching open orders. At the same time
which aligns with common sense and I think it's a quite reasonable approach. At least in my case, I had to go through the following steps:
If And for the sake of completeness I would comment on your options:
If you put zero there unconditionally then when I stumble upon it I never know if it's indeed zero or I need to fetch open orders to decide. Zero is quite misleading.
BTW, just noticed that you explicitly set
Putting But what would be really nice if
|
I totally agree with you here, it was undefined in the beginning, but then there were some complaints, like this one here: #166, the guy asked for zeroes, when fields are unknown... I guess we will return it back to how it was before (like you suggested). Most of users still seem to want it explicit. Thx for such a comprehensive reply! |
Now it's going to be like this: https://github.com/ccxt-dev/ccxt/blob/33139c3355c45b9f8f2149dc50015308f976b432/ccxt.js#L14782 Here's a short snippet from there: let total = undefined;
let used = undefined;
if (balances['open_orders'] == 0) {
total = funds[currency];
used = 0.0;
}
let account = {
'free': funds[currency],
'used': used,
'total': total,
}; So, I, guess, it solves this particular issue and, if you don't mind, I'm closing it now. Please upgrade to fixed version 1.8.22+ (in several minutes) and see if all fields correspond to your expectations. They should ) Let us know if you have any difficulties or questions. Thx again! |
According to Liqui's API they return only free balance:
"Your account balance available for trading. Doesn’t include funds on your open orders".
At the moment
ccxt
not only puts this amount intofree
field (which is correct) but also copies the same value intototal
(which is wrong).The text was updated successfully, but these errors were encountered: