Closed sangaman closed 4 years ago
Trading Limits: ββββββββββββ¬βββββββββββ¬ββββββββββββ¬ββββββββββββββββββββ¬βββββββββββββββββββ β Currency β Max Buy β Max Sell β Reserved Outbound β Reserved Inbound β ββββββββββββΌβββββββββββΌββββββββββββΌββββββββββββββββββββΌβββββββββββββββββββ€ β BTC β 0.781 β 1.0809095 β 0 β 0 β ββββββββββββΌβββββββββββΌββββββββββββΌββββββββββββββββββββΌβββββββββββββββββββ€ β LTC β 4.899638 β 4.9 β 0 β 0 β ββββββββββββ΄βββββββββββ΄ββββββββββββ΄ββββββββββββββββββββ΄βββββββββββββββββββ simnet > sell 4 LTC/BTC 0.25 1 remaining 4 LTC entered the order book as 06d2a270-0ee1-11eb-af7c-f51a32600023 no matches found simnet > tradinglimits Error: 13 INTERNAL: Assertion failed simnet > getbalance
Balance: ββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ β Currency β Total Balance β Wallet Balance (Not Tradable) β Channel Balance (Tradable) β ββββββββββββΌββββββββββββββββΌββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€ β BTC β 1.19943114 β 0.09952164 β 1.0999095 β ββββββββββββΌββββββββββββββββΌββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€ β LTC β 5 β 0 β 5 β ββββββββββββ΄ββββββββββββββββ΄ββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββ simnet >
This exposes the amounts reserved for open orders on the
TradingLimits
call and subtracts reserved amounts from themaxSell
andmaxBuy
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:
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.
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.
Return the smaller of the amount calculated in step 2 or the maximum single channel balance calculated in step 1.
Resolves #1678.
Example cli formatted output below, let me know if I should tweak the format or headers. I wasn't sure about the clearest way to display this info.