Skip to content

Commit

Permalink
introduce price rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
Th0rgal committed Jul 15, 2020
1 parent af54e67 commit 7d3ece4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions binance/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ async def load(self):
# load rate limits
self.rate_limits = infos["rateLimits"]

# load asset precision
self.base_asset_precision = infos["baseAssetPrecision"]

self.loaded = True

@property
Expand Down Expand Up @@ -278,6 +281,8 @@ async def create_order(
)

if price:
if self.loaded:
price = round(price, self.base_asset_precision)
params["price"] = price
elif order_type in [
OrderType.LIMIT.value,
Expand Down

0 comments on commit 7d3ece4

Please sign in to comment.