def from_dict(data, ctx):
        """
        Instantiate a new PositionBookBucket from a dict (generally from
        loading a JSON response). The data used to instantiate the
        PositionBookBucket 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('longCountPercent') is not None:
            data['longCountPercent'] = ctx.convert_decimal_number(
                data.get('longCountPercent')
            )

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

        return PositionBookBucket(**data)