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

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

        data = data.copy()

        if data.get('bid') is not None:
            data['bid'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['bid'], ctx
                )

        if data.get('ask') is not None:
            data['ask'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['ask'], ctx
                )

        if data.get('mid') is not None:
            data['mid'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['mid'], ctx
                )

        return Candlestick(**data)