tw.new_swap: use match statement where practicable
This commit is contained in:
parent
a24653eb83
commit
305874a59c
1 changed files with 5 additions and 6 deletions
|
|
@ -189,12 +189,11 @@ class NewSwap(New):
|
|||
from ..term import get_char
|
||||
|
||||
def get_trade_limit():
|
||||
if type(self.swap_cfg.trade_limit) is UniAmt:
|
||||
return self.swap_cfg.trade_limit
|
||||
elif type(self.swap_cfg.trade_limit) is float:
|
||||
return (
|
||||
UniAmt(int(c.data['expected_amount_out']), from_unit='satoshi')
|
||||
* self.swap_cfg.trade_limit)
|
||||
match self.swap_cfg.trade_limit:
|
||||
case UniAmt(): # can’t use positional arg here (not supported by Decimal)
|
||||
return self.swap_cfg.trade_limit
|
||||
case float(x):
|
||||
return UniAmt(int(c.data['expected_amount_out']), from_unit='satoshi') * x
|
||||
|
||||
while True:
|
||||
self.cfg._util.qmsg(f'Retrieving data from {c.rpc.host}...')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue