Browse Source

Merge #696: Fix relfee cjfee display issues caused by the use of float in ob-watcher.py

942ea58 Fix relfee cjfee display issues caused by the use of float (Kristaps Kaupe)
master
Adam Gibson 5 years ago
parent
commit
68cf5de051
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 4
      scripts/obwatch/ob-watcher.py

4
scripts/obwatch/ob-watcher.py

@ -81,7 +81,7 @@ def cjfee_display(cjfee, order, btc_unit, rel_unit):
if order['ordertype'] in ['absoffer', 'swabsoffer']: if order['ordertype'] in ['absoffer', 'swabsoffer']:
return satoshi_to_unit(cjfee, order, btc_unit, rel_unit) return satoshi_to_unit(cjfee, order, btc_unit, rel_unit)
elif order['ordertype'] in ['reloffer', 'swreloffer']: elif order['ordertype'] in ['reloffer', 'swreloffer']:
return str(float(cjfee) * rel_unit_to_factor[rel_unit]) + rel_unit return str(Decimal(cjfee) * rel_unit_to_factor[rel_unit]) + rel_unit
def satoshi_to_unit(sat, order, btc_unit, rel_unit): def satoshi_to_unit(sat, order, btc_unit, rel_unit):
@ -148,7 +148,7 @@ class OrderbookPageRequestHeader(http.server.SimpleHTTPRequestHandler):
o = dict(row) o = dict(row)
if 'cjfee' in o: if 'cjfee' in o:
o['cjfee'] = int(o['cjfee']) if o['ordertype']\ o['cjfee'] = int(o['cjfee']) if o['ordertype']\
== 'swabsoffer' else float(o['cjfee']) == 'swabsoffer' else str(Decimal(o['cjfee']))
result.append(o) result.append(o)
return result return result

Loading…
Cancel
Save