(self, broker, need_data='ht.json', quotation_engines=[FixedDataEngine],
log_handler=DefaultLogHandler(), ext_stocks=[])
| 17 | |
| 18 | class FixedMainEngine(MainEngine): |
| 19 | def __init__(self, broker, need_data='ht.json', quotation_engines=[FixedDataEngine], |
| 20 | log_handler=DefaultLogHandler(), ext_stocks=[]): |
| 21 | super(FixedMainEngine, self).__init__(broker, need_data, [], log_handler) |
| 22 | if type(quotation_engines) != list: |
| 23 | quotation_engines = [quotation_engines] |
| 24 | self.quotation_engines = [] |
| 25 | # 修改时间缓存 |
| 26 | self._cache = {} |
| 27 | # 文件进程映射 |
| 28 | self._process_map = {} |
| 29 | # 文件模块映射 |
| 30 | self._modules = {} |
| 31 | self._names = None |
| 32 | # 加载锁 |
| 33 | self.lock = Lock() |
| 34 | # 加载线程 |
| 35 | self._watch_thread = Thread(target=self._load_strategy, name="FixedMainEngine.watch_reload_strategy") |
| 36 | positions = [p['stock_code'] for p in self.user.position] |
| 37 | positions.extend(ext_stocks) |
| 38 | for quotation_engine in quotation_engines: |
| 39 | self.quotation_engines.append(quotation_engine(self.event_engine, self.clock_engine, positions)) |
| 40 | |
| 41 | def load(self, names, strategy_file): |
| 42 | with self.lock: |
nothing calls this directly
no test coverage detected