def process_ui_get_market_indicators_rr(msg, ui_conn_pipe): log.debug("enter") exch = msg.get("exchange") product = msg.get("product") num_periods = msg.get("periods", 0) start_time = msg.get("start_time", 0) market = get_market_by_product(exch, product) ind_list = {} if market: ind_list = market.get_indicator_list(num_periods, start_time) msg["type"] = "GET_MARKET_INDICATORS_RESP" msg["data"] = ind_list ui_conn_pipe.send(msg)
def process_ui_get_positions_rr(msg, ui_conn_pipe): log.debug("enter") exch = msg.get("exchange") product = msg.get("product") start_time = msg.get("start_time", 0) end_time = msg.get("end_time", 0) market = get_market_by_product(exch, product) pos_list = {} if market: log.info("get positions ") pos_list = market.get_positions_list(start_time, end_time) msg["type"] = "GET_MARKET_POSITIONS_RESP" msg["data"] = pos_list ui_conn_pipe.send(msg)
def process_ui_get_markets_rr(msg, ui_conn_pipe): log.debug("enter") m_dict = {} for m in get_market_list(): p_list = m_dict.get(m.exchange_name) if not p_list: m_dict[m.exchange_name] = [{ "product_id": m.product_id, "buy_paused": m.trading_paused_buy, "sell_paused": m.trading_paused_sell }] else: p_list.append({ "product_id": m.product_id, "buy_paused": m.trading_paused_buy, "sell_paused": m.trading_paused_sell }) msg["type"] = "GET_MARKETS_RESP" msg["data"] = m_dict ui_conn_pipe.send(msg)