-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated to lastest 2.1 spot exchange API
- Loading branch information
1 parent
4e5ebc0
commit bd370ec
Showing
10 changed files
with
600 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
def round_up(value: float, precision: int) -> float: | ||
def round_up(value: str | float, precision: int) -> float: | ||
"""Rounds number to upper precision 0.13 -> 0.2""" | ||
pwr = 10**precision | ||
value = float(value) | ||
rounded = round((value * pwr) / pwr, precision) | ||
if rounded < value: | ||
rounded = round((value * pwr + 1) / pwr, precision) | ||
return rounded | ||
|
||
|
||
def round_down(value: float, precision: int) -> float: | ||
def round_down(value: str | float, precision: int) -> float: | ||
"""Rounds number to lower precision 0.13 -> 0.1""" | ||
value = float(value) | ||
pwr = 10**precision | ||
return round((value * pwr) / pwr, precision) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.