Skip to content

Commit

Permalink
Update Version 1.1.6.16
Browse files Browse the repository at this point in the history
  • Loading branch information
uJhin committed Jan 18, 2021
1 parent 0e8498d commit 8026dad
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
2 changes: 1 addition & 1 deletion upbit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__all__ = ['client']
__module_name__ = 'upbit-client'

__version__ = '1.1.6.15'
__version__ = '1.1.6.16'
__released_version__ = pkg_version.get_versions(__module_name__)
__latest_version__ = __released_version__[0]

Expand Down
2 changes: 1 addition & 1 deletion upbit/pkg_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def get_versions(package_name):
resp = requests.get(url)
data = resp.json()
versions = data["releases"].keys()
return sorted(versions, key=LooseVersion, reverse=True)
return sorted(versions, key=LooseVersion, reverse=True)
43 changes: 43 additions & 0 deletions upbit/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

from typing import Union


def validate_price(price: Union[int, float, str]) -> float:
"""
Documents: https://docs.upbit.com/docs/market-info-trade-price-detail
[Order price units]
~10 : 0.01
~100 : 0.1
~1,000 : 1
~10,000 : 5
~100,000 : 10
~500,000 : 50
~1,000,000 : 100
~2,000,000 : 500
+2,000,000 : 1,000
"""

price = float(price)
unit = 0.01
if price <= 10:
unit = 0.01
elif price <= 100:
unit = 0.1
elif price <= 1_000:
unit = 1
elif price <= 10_000:
unit = 5
elif price <= 100_000:
unit = 10
elif price <= 500_000:
unit = 50
elif price <= 1_000_000:
unit = 100
elif price <= 2_000_000:
unit = 500
elif price > 2_000_000:
unit = 1000
else:
raise ValueError('Invaild Price')
return price - (price % unit)

0 comments on commit 8026dad

Please sign in to comment.