| | |
| | | import time |
| | | |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_trade |
| | | from log_module.log import logger_trade, logger_trade_position_api_request |
| | | from trade.huaxin import huaxin_trade_order_processor, huaxin_trade_api |
| | | from utils import huaxin_util, sell_util, tool |
| | | |
| | |
| | | if int("092958") <= int(tool.get_now_time_str().replace(":", "")) <= int("145655"): |
| | | __cancel_sell_thread_pool.submit(lambda: __cancel_sell_order(code, order_ref)) |
| | | return result |
| | | |
| | | |
| | | __code_sell_way_dict = {} |
| | | |
| | | |
| | | def set_code_sell_way(data): |
| | | fdata = {} |
| | | code = data["code"] |
| | | mode = data["mode"] |
| | | if mode == 1: |
| | | mode1_rate_index = data["mode1_rate_index"] |
| | | fdata["mode1_rate_index"] = mode1_rate_index |
| | | elif mode == 2: |
| | | # 第一笔卖的索引 |
| | | mode2_first_index = data["mode2_first_index"] |
| | | # 剩下几笔卖的索引 |
| | | mode2_left_index = data["mode2_left_index"] |
| | | fdata["mode2_first_index"] = mode2_first_index |
| | | fdata["mode2_left_index"] = mode2_left_index |
| | | fdata["code"] = code |
| | | fdata["mode"] = mode |
| | | __code_sell_way_dict[code] = fdata |
| | | # 保存卖的方式 |
| | | async_log_util.info(logger_trade_position_api_request, f"设置卖出方式:{fdata}") |
| | | |
| | | |
| | | # 计算卖出量 |
| | | def compute_sell_volume(code): |
| | | if code not in __code_sell_way_dict: |
| | | raise Exception("还没设置卖出方式") |
| | | sell_way = __code_sell_way_dict.get(code) |
| | | # TODO |
| | | return 100 |
| | | |