| | |
| | | 对一系列的代码交易变量,下单,撤单进行管理 |
| | | """ |
| | | # 交易管理器 |
| | | import copy |
| | | import datetime |
| | | import json |
| | | import threading |
| | |
| | | __redis_manager = redis_manager.RedisManager(2) |
| | | __instance = None |
| | | |
| | | |
| | | def __new__(cls, *args, **kwargs): |
| | | if not cls.__instance: |
| | | cls.__instance = super(CodesTradeStateManager, cls).__new__(cls, *args, **kwargs) |
| | |
| | | return cache_result[1] |
| | | return TRADE_STATE_NOT_TRADE |
| | | |
| | | def get_trade_state_dict(self): |
| | | return copy.deepcopy(self.__trade_state_cache) |
| | | |
| | | # 设置交易状态 |
| | | def set_trade_state(self, code, state): |
| | | async_log_util.info(logger_trade, "set_trade_state {}-{}".format(code, state)) |