def json_parse(json_wrapper): ch = json_wrapper.get_string(OutputKey.KeyChannelCh) parse = ChannelParser(ch) candlestick_event = CandlestickEvent() candlestick_event.symbol = parse.symbol candlestick_event.interval = "" candlestick_event.timestamp = json_wrapper.get_int("ts") tick = json_wrapper.get_object(OutputKey.KeyTick) data = Candlestick.json_parse(tick) candlestick_event.data = data return candlestick_event
def json_parse(json_wrapper): ch = json_wrapper.get_string(OutputKey.KeyChannelRep) parse = ChannelParser(ch) candlestick_event = CandlestickRequest() candlestick_event.symbol = parse.symbol candlestick_event.interval = "" tick = json_wrapper.get_array(OutputKey.KeyData) candlestick_list = list() for item in tick.get_items(): data = Candlestick.json_parse(item) candlestick_list.append(data) candlestick_event.data = candlestick_list return candlestick_event
def __init__(self): self.symbol = "" self.timestamp = 0 self.interval = CandlestickInterval.INVALID self.data = Candlestick()