| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | start = time.time() |
| | | print(getZYLTAmount("000333"), time.time() - start) |
| | | limit_up_infos = getLimitUpInfo() |
| | | limit_up_infos = json.loads(limit_up_infos) |
| | | print(limit_up_infos) |
| | |
| | | insertDate=insertDate, direction=direction, |
| | | is_shadow_order=is_shadow_order) |
| | | try: |
| | | if order.direction == str(huaxin_util.TORA_TSTP_D_Sell): |
| | | # 刷新持仓列表 |
| | | huaxin_trade_data_update.add_position_list() |
| | | TradeResultProcessor.process_buy_order(order) |
| | | TradeResultProcessor.process_sell_order(order) |
| | | finally: |
| | |
| | | from trade import trade_manager |
| | | from trade.huaxin import huaxin_trade_api, huaxin_trade_record_manager |
| | | from trade.huaxin.huaxin_trade_order_processor import HuaxinOrderEntity, TradeResultProcessor |
| | | from utils import huaxin_util, tool |
| | | from utils import huaxin_util, tool, init_data_util |
| | | import concurrent.futures |
| | | |
| | | trade_data_request_queue = queue.Queue() |
| | |
| | | # 获取持仓股的涨停价 |
| | | position_codes = set() |
| | | for d in datas: |
| | | gpcode_manager.get_limit_up_price(d["securityID"]) |
| | | limit_up_price = gpcode_manager.get_limit_up_price(d["securityID"]) |
| | | if not limit_up_price: |
| | | init_data_util.re_set_price_pre(d["securityID"]) |
| | | if d["prePosition"] > 0: |
| | | position_codes.add(d["securityID"]) |
| | | queue_l1_r_strategy_w.put_nowait( |
| | |
| | | manager = outside_api_command_manager.ApiCommandManager() |
| | | manager.init(middle_api_protocol.SERVER_HOST, |
| | | middle_api_protocol.SERVER_PORT, |
| | | OutsideApiCommandCallback()) |
| | | OutsideApiCommandCallback(),trade_client_count=30) |
| | | manager.run(blocking=False) |
| | | |
| | | # 监听L2数据 |
| | |
| | | 对一系列的代码交易变量,下单,撤单进行管理 |
| | | """ |
| | | # 交易管理器 |
| | | 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)) |