From 7d3ece40f59cb6cf1692780c455233229afa39c2 Mon Sep 17 00:00:00 2001 From: Thomas Marchand Date: Wed, 15 Jul 2020 19:42:01 +0200 Subject: [PATCH] introduce price rounding --- binance/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/binance/client.py b/binance/client.py index 53787f1..9892451 100644 --- a/binance/client.py +++ b/binance/client.py @@ -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 @@ -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,