def purge_cached_orders(self, before):
    orders = self.to_array(self.orders)
    orders = [order for order in orders if ((order['status'] == 'open') or (order['timestamp'] >= before))]
    self.orders = self.index_by(orders, 'id')
    return self.orders
def purge_cached_orders(self, before):
    orders = self.to_array(self.orders)
    orders = [order for order in orders if ((order['status'] == 'open') or (order['timestamp'] >= before))]
    self.orders = self.index_by(orders, 'id')
    return self.orders