def subscribe(id_or_symbols):
"""
???????????????????????????handle_bar???bar??????
?????????????????????????????handle_bar??????
:param id_or_ins: ???
:type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`]
"""
current_universe = Environment.get_instance().get_universe()
if isinstance(id_or_symbols, six.string_types):
order_book_id = instruments(id_or_symbols).order_book_id
current_universe.add(order_book_id)
elif isinstance(id_or_symbols, Instrument):
current_universe.add(id_or_symbols.order_book_id)
elif isinstance(id_or_symbols, Iterable):
for item in id_or_symbols:
current_universe.add(assure_order_book_id(item))
else:
raise RQInvalidArgument(_(u"unsupported order_book_id type"))
verify_that('id_or_symbols')._are_valid_instruments("subscribe", id_or_symbols)
Environment.get_instance().update_universe(current_universe)
评论列表
文章目录