Skip to content

Commit

Permalink
Decimal is useful. # TODO: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
seii-saintway committed Oct 1, 2020
1 parent cf26e97 commit dceb5ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@
"metadata": {},
"outputs": [],
"source": [
"from decimal import Decimal\n",
"with open('sample-history.txt', 'a', 1) as fsh, open('transaction-history.txt', 'a', 1) as fth:\n",
" while True:\n",
" bought_unit_amounts = [\n",
" int(float(asset.get('free_amount', '0')) / TRADE_UNIT) for asset in prv.get_asset().get('assets', []) \\\n",
" int(Decimal(asset.get('free_amount', '0')) / Decimal(repr(TRADE_UNIT))) for asset in prv.get_asset().get('assets', []) \\\n",
" if asset.get('asset', '') == 'eth'\n",
" ] if not isinstance(prv, Mock) else []\n",
"\n",
Expand Down

0 comments on commit dceb5ca

Please sign in to comment.