-
Notifications
You must be signed in to change notification settings - Fork 42
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
tradinglimits
should account for "reserved balance"
#1678
Comments
As just discussed, the plan for resolving this issue is:
I'm going to start on this ASAP, points 1-3 above are informational in nature whereas 4-5 changes the way we validate new order placement requests. I'll probably wind up implementing those in separate PRs. |
I'm going to open a separate issue for 4 & 5, this issue will just track returning the proper values for the |
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.
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.
How it is
Currently, calling
tradinglimites
calculates & displays total inbound and total outbound channel capacity for a respective assets' channel:How it should be
Max Buy/Max sell is reduced by quantity reserved quantity for open orders. We have a separate issue for calculating "reserved balance" and displaying it under
getbalance
already: #1584The text was updated successfully, but these errors were encountered: