[新功能] 增加扩展注册接口,供调度等其他模块注册其服务接口

This commit is contained in:
msincenselee 2019-12-07 22:08:05 +08:00
parent 56092fe759
commit e9e6a3bb99

View File

@ -1,7 +1,7 @@
""""""
import traceback
from typing import Optional
from typing import Optional, Callable
from vnpy.event import Event, EventEngine
from vnpy.rpc import RpcServer
@ -56,6 +56,11 @@ class RpcEngine(BaseEngine):
self.server.register(self.main_engine.get_all_contracts)
self.server.register(self.main_engine.get_all_active_orders)
def register(self, func: Callable):
""" 扩展注册接口"""
if self.server:
self.server.register(func)
def load_setting(self):
""""""
setting = load_json(self.setting_filename)