Skip to content

Commit b47dfc5

Browse files
committed
Addressing issue #21 with parsing flaot numbers that have comma as a separator
1 parent a21df8a commit b47dfc5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

API/Endpoints/TradeEndpoint.py

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def post(self, id=None):
8181
self.th.updated_trade(trade)
8282
self.th.fire_trade_updated(trade, True)
8383
except Exception as e:
84+
self.th.logger.error(e)
8485
return json.dumps(APIResult.ErrorResult(100, str(e))), 500
8586

8687
return APIResult.OKResult(ids), 201

Bot/Target.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ def is_float_price(cls, price_str):
164164

165165
@classmethod
166166
def create_price_helper(cls, price_str):
167-
168-
s = str(price_str).strip().lower()
167+
#Issue 21 float parsing
168+
s = str(price_str).strip().lower().replace(',', '.')
169169
if PriceHelper.is_float_price(s):
170170
return PriceHelper(True, float(s), None, None)
171171

Bot/Value.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def __init__(self, obj: str):
1414
else:
1515
self.type = Value.Type.ABS
1616

17-
self.v = float(obj.replace('%', ''))
17+
#Issue 21 float parsing
18+
self.v = float(obj.replace('%', '').replace(',', '.'))
1819

1920
def is_abs(self):
2021
return self.type == Value.Type.ABS

0 commit comments

Comments
 (0)