Instantiate a new OrderBook from a dict (generally from loading a JSON
        response). The data used to instantiate the OrderBook is a shallow copy
        of the dict passed in, with any complex child types instantiated
        appropriately.

def from_dict(data, ctx):
        """
        Instantiate a new OrderBook from a dict (generally from loading a JSON
        response). The data used to instantiate the OrderBook is a shallow copy
        of the dict passed in, with any complex child types instantiated
        appropriately.
        """

        data = data.copy()

        if data.get('price') is not None:
            data['price'] = ctx.convert_decimal_number(
                data.get('price')
            )

        if data.get('bucketWidth') is not None:
            data['bucketWidth'] = ctx.convert_decimal_number(
                data.get('bucketWidth')
            )

        if data.get('buckets') is not None:
            data['buckets'] = [
                ctx.instrument.OrderBookBucket.from_dict(d, ctx)
                for d in data.get('buckets')
            ]

        return OrderBook(**data)