Skip to content
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

Reserved Balance (show balance reserved by open orders separately) #1584

Closed
kilrau opened this issue May 27, 2020 · 6 comments
Closed

Reserved Balance (show balance reserved by open orders separately) #1584

kilrau opened this issue May 27, 2020 · 6 comments
Assignees
Labels
command line (CLI) Relating to the command line interface tools enhancement New feature or request grpc gRPC API P1 top priority user request Requested by end-user

Comments

@kilrau
Copy link
Contributor

kilrau commented May 27, 2020

Exchanges usually show balance that is reserved by open orders slightly different, e.g. as "frozen", so should we. I prefer the term "reserved" since it's simply balance reserved for a certain open order.

Additionally, this reserved balance should be subtracted from tradinglimits to make placeorder balance checks account for it.

@kilrau kilrau added enhancement New feature or request P3 low priority labels May 27, 2020
@sangaman
Copy link
Collaborator

sangaman commented Jun 5, 2020

Do you mean subtracting the quantity from all our open orders from the numbers we return/display for balance calls?

@kilrau
Copy link
Contributor Author

kilrau commented Jun 11, 2020

Subtracting and showing it in a separate field or parenthesis e.g.:

simnet > getbalance

Balance:
┌──────────┬───────────────┬──────────────────────────────┬────────────────────────────────┐
│ Currency │ Total Balance │ Channel Balance (Tradable)   │ Wallet Balance (Not Tradable)  │
├──────────┼───────────────┼──────────────────────────────┼────────────────────────────────┤
│ BTC      │ 5.92217896    │ 0 (1 in orders | 2.5 pending)│ 1.96102386 (0.4611551 pending) │
├──────────┼───────────────┼──────────────────────────────┼────────────────────────────────┤

@kilrau kilrau changed the title Frozen Balance Reserved Balance Jun 11, 2020
@kilrau kilrau added command line (CLI) Relating to the command line interface tools grpc gRPC API labels Sep 10, 2020
@kilrau kilrau changed the title Reserved Balance Reserved Balance (show balance reserved by open orders separately) Sep 10, 2020
@kilrau kilrau added P2 mid priority user request Requested by end-user and removed P3 low priority labels Sep 11, 2020
@kilrau
Copy link
Contributor Author

kilrau commented Sep 11, 2020

This feature was requested from two users independently in the last days, so I am bumping prio here. Do you think it makes sense as described? @sangaman

@kilrau kilrau added P1 top priority and removed P2 mid priority labels Sep 14, 2020
@kilrau
Copy link
Contributor Author

kilrau commented Sep 14, 2020

Bumped prio to P1 since this is needed for #1896.

@kilrau
Copy link
Contributor Author

kilrau commented Oct 5, 2020

As just discussed with @raladev we have no collateralization for placeorder with nobalancechecks flag (#1916 (comment)). So while we want to restrict order placing by default (if e.g. all balance is used up by open orders), one can skip this check by appending --nobalancechecks to placeorder.

@kilrau
Copy link
Contributor Author

kilrau commented Oct 14, 2020

Closing here in favour of #1678 (comment)

@kilrau kilrau closed this as completed Oct 14, 2020
sangaman added a commit that referenced this issue Oct 15, 2020
This exposes the amounts reserved for open orders on the `TradingLimits`
call and subtracts reserved amounts from the `maxSell` and `maxBuy`
values returned by the call.

It also removes reserved order amounts from GetBalance - reversing #1584.

The logic to calculate max sell and buys is as follows:

1. Sum up all outbound and inbound balances across all channels, as well
as the maximum balances for a single channel, as we still aren't
expecting to use multi-path payments. For Connext there is a single
channel so we only have a single inbound & outbound value per currency.

2. Subtract reserved order amounts from the total inbound and outbound
balances calculated above. E.g. if we have outbound capacity of 1.2 ETH,
but we have an order to sell 0.7 ETH, our max sell would be 0.5 ETH.

3. Return the smaller of the amount calculated in step 2 or the maximum
single channel balance calculated in step 1.

Resolves #1678.
sangaman added a commit that referenced this issue Oct 15, 2020
This exposes the amounts reserved for open orders on the `TradingLimits`
call and subtracts reserved amounts from the `maxSell` and `maxBuy`
values returned by the call.

It also removes reserved order amounts from GetBalance - reversing #1584.

The logic to calculate max sell and buys is as follows:

1. Sum up all outbound and inbound balances across all channels, as well
as the maximum balances for a single channel, as we still aren't
expecting to use multi-path payments. For Connext there is a single
channel so we only have a single inbound & outbound value per currency.

2. Subtract reserved order amounts from the total inbound and outbound
balances calculated above. E.g. if we have outbound capacity of 1.2 ETH,
but we have an order to sell 0.7 ETH, our max sell would be 0.5 ETH.

3. Return the smaller of the amount calculated in step 2 or the maximum
single channel balance calculated in step 1.

Resolves #1678.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command line (CLI) Relating to the command line interface tools enhancement New feature or request grpc gRPC API P1 top priority user request Requested by end-user
Projects
None yet
Development

No branches or pull requests

2 participants