Skip to content

Commit

Permalink
Fixed marketBaseIncrement for zero ndigits (#194)
Browse files Browse the repository at this point in the history
* Fixed marketBaseIncrement for zero ndigits

* Moved import to the start of the file
  • Loading branch information
Sekuiya authored May 16, 2021
1 parent 60a1258 commit e56d3a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/exchange/coinbase_pro/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from datetime import datetime, timedelta
from requests.auth import AuthBase
from requests import Request
from math import floor

# Constants

Expand Down Expand Up @@ -355,7 +356,7 @@ def marketBaseIncrement(self, market, amount) -> float:
else:
nb_digits = 0

return float(f'%.{nb_digits}f'%(amount))
return floor(amount * 10 ** nb_digits) / 10 ** nb_digits

def authAPI(self, method: str, uri: str, payload: str='') -> pd.DataFrame:
if not isinstance(method, str):
Expand Down

0 comments on commit e56d3a8

Please sign in to comment.