| | |
| | | L_CANCEL_MIN_MONEY = 98 |
| | | |
| | | # 华鑫L2的卡位数量 |
| | | HUAXIN_L2_MAX_CODES_COUNT = 40 |
| | | HUAXIN_L2_MAX_CODES_COUNT = 50 |
| | | |
| | | TRADE_WAY_HUAXIN = "huaxin" |
| | | TRADE_WAY_JUEJIN = "juejin" |
| | |
| | | import json |
| | | import logging |
| | | import socket |
| | | import time |
| | | |
| | | from code_attribute import global_data_loader, code_volumn_manager, first_target_code_data_processor |
| | | from code_attribute.code_data_util import ZYLTGBUtil |
| | |
| | | |
| | | @classmethod |
| | | def push(cls, datas): |
| | | cls.__get_redis().lpush(cls.__L2_CODE_KEY, json.dumps(datas)) |
| | | cls.__get_redis().lpush(cls.__L2_CODE_KEY, json.dumps((int(time.time()), datas))) |
| | | |
| | | @classmethod |
| | | def pop(cls): |
| | |
| | | orderSysID = codes_data.get("orderSysID") |
| | | accountId = codes_data.get("accountId") |
| | | if code and orderSysID and accountId: |
| | | result = huaxin_trade_api.cancel_order(huaxin_trade_api.TRADE_DIRECTION_BUY, code, orderSysID, True) |
| | | result = huaxin_trade_api.cancel_order(huaxin_trade_api.TRADE_DIRECTION_BUY, code, |
| | | orderSysID, True) |
| | | print("---撤单结果----") |
| | | print(result) |
| | | if result["code"] == 0: |
| | |
| | | def __set_target_codes(): |
| | | while True: |
| | | try: |
| | | datas = huaxin_target_codes_manager.HuaXinL2SubscriptCodesManager.pop() |
| | | if datas: |
| | | _datas = huaxin_target_codes_manager.HuaXinL2SubscriptCodesManager.pop() |
| | | timestamp, datas = _datas[0], _datas[1] |
| | | # 只处理20s内的数据 |
| | | if time.time() - timestamp < 20 and datas: |
| | | codes = [d[0] for d in datas] |
| | | for code in codes: |
| | | block_info.init_code(code) |