def add(self, order):
    order = {'id': (order.get('order_id') or order['id']), 'side': order['side'], 'price': Decimal(order['price']), 'size': Decimal((order.get('size') or order['remaining_size']))}
    if (order['side'] == 'buy'):
        bids = self.get_bids(order['price'])
        if (bids is None):
            bids = [order]
        else:
            bids.append(order)
        self.set_bids(order['price'], bids)
    else:
        asks = self.get_asks(order['price'])
        if (asks is None):
            asks = [order]
        else:
            asks.append(order)
        self.set_asks(order['price'], asks)
def add(self, order):
    order = {'id': (order.get('order_id') or order['id']), 'side': order['side'], 'price': Decimal(order['price']), 'size': Decimal((order.get('size') or order['remaining_size']))}
    if (order['side'] == 'buy'):
        bids = self.get_bids(order['price'])
        if (bids is None):
            bids = [order]
        else:
            bids.append(order)
        self.set_bids(order['price'], bids)
    else:
        asks = self.get_asks(order['price'])
        if (asks is None):
            asks = [order]
        else:
            asks.append(order)
        self.set_asks(order['price'], asks)