def __init__(self, **kwargs): super().__init__() self.currency = Utils.safe_string(kwargs, 'currency') self.balance = Utils.safe_float(kwargs, 'balance') self.available = Utils.safe_float(kwargs, 'available') self.freeze = Utils.safe_float(kwargs, 'freeze')
def json_parse(json_array): trade = Trade() trade.price = Utils.safe_float(json_array, 5) trade.amount = Utils.safe_float(json_array, 6) trade.side = 'buy' if Utils.safe_string(json_array, 4) == 'bid' else 'sell' trade.timestamp = Utils.safe_integer(json_array, 2) return trade
def json_parse(data): obj = PriceDepthEvent() if isinstance(data[0], list): data = data[0] obj.timestamp = Utils.safe_integer(data, 3) obj.data = { 'asks': [DepthEntry.json_parse(e) for e in data[4]['asks']], 'bids': [DepthEntry.json_parse(e) for e in data[5]['bids']] } else: obj.data_type = 'E' obj.timestamp = Utils.safe_integer(data, 2) obj.data = { 'side': 'buy' if 'bid' == Utils.safe_string(data, 4).lower() else 'sell', 'price': Utils.safe_float(data, 5), 'amount': Utils.safe_float(data, 6), } return obj
def __init__(self, **kwargs): super().__init__() self.is_memo = kwargs['isMemo'] if 'isMemo' in kwargs else False self.address = Utils.safe_string(kwargs, 'address') self.memo = Utils.safe_string(kwargs, 'memo')