Skip to content

Commit

Permalink
Round all numbers in order book to 5th digit after decimal point
Browse files Browse the repository at this point in the history
Signed-off-by: alfred richardsn <rchrdsn@protonmail.ch>
  • Loading branch information
r4rdsn committed Oct 3, 2019
1 parent de1ccae commit 430ae89
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,22 @@ async def orders_list(
line += emojize(':pause_button: ')

if 'sum_sell' in order:
line += '{} '.format(order['sum_sell'])
line += '{:,.5f} '.format(order['sum_sell'].to_decimal())
line += '{} → '.format(order['sell'])

if 'sum_buy' in order:
line += '{} '.format(order['sum_buy'])
line += '{:,.5f} '.format(order['sum_buy'].to_decimal())
line += order['buy']

if 'price_sell' in order:
if invert:
line += ' ({} {}/{})'.format(order['price_buy'], order['buy'], order['sell'])
line += ' ({:,.5f} {}/{})'.format(
order['price_buy'].to_decimal(), order['buy'], order['sell']
)
else:
line += ' ({} {}/{})'.format(order['price_sell'], order['sell'], order['buy'])
line += ' ({:,.5f} {}/{})'.format(
order['price_sell'].to_decimal(), order['sell'], order['buy']
)

if user_id is not None and order['user_id'] == user_id:
line = f'*{line}*'
Expand Down

0 comments on commit 430ae89

Please sign in to comment.