Use python3/decimal instead of float when parsing ws

This commit is contained in:
Jacob Plaster
2019-01-21 14:43:37 +00:00
committed by Jacob Plaster
parent 3c8c3fb71e
commit 8dc745f149
2 changed files with 5 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ import json
import time
import random
from decimal import *
from .GenericWebsocket import GenericWebsocket, AuthError
from .SubscriptionManager import SubscriptionManager
from .WalletManager import WalletManager
@@ -354,7 +355,8 @@ class BfxWebsocket(GenericWebsocket):
async def on_message(self, message):
self.logger.debug(message)
msg = json.loads(message)
# convert float values to decimal
msg = json.loads(message, parse_float=Decimal)
self._emit('all', msg)
if type(msg) is dict:
# System messages are received as json