| | |
| | | return False, None, "还有大单没撤单" |
| | | |
| | | |
| | | def place_order_success(self, code): |
| | | self.clear(code) |
| | | def place_order_success(self, code): |
| | | self.clear(code) |
| | | |
| | | |
| | | def cancel_success(self, code): |
| | | self.clear(code) |
| | | def cancel_success(self, code): |
| | | self.clear(code) |
| | | |
| | | |
| | | # ---------------------------------独苗撤------------------------------- |
| | |
| | | import copy |
| | | import logging |
| | | import random |
| | | import time as t |
| | | |
| | | from code_attribute import big_money_num_manager, code_volumn_manager, code_data_util, industry_codes_sort, \ |
| | | limit_up_time_manager, global_data_loader, gpcode_manager, code_nature_analyse |
| | | import constant |
| | | from code_attribute.code_nature_analyse import HighIncreaseCodeManager |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from l2.huaxin import l2_huaxin_util, huaxin_delegate_postion_manager |
| | | from l2.l2_sell_manager import L2MarketSellManager, L2LimitUpSellManager |
| | | from l2.l2_transaction_data_manager import HuaXinSellOrderStatisticManager |
| | | from l2.transaction_progress import TradeBuyQueue |
| | | from log_module import async_log_util, log_export |
| | | from third_data import kpl_data_manager, block_info, history_k_data_util |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | from third_data import kpl_data_manager, block_info |
| | | from utils import global_util, ths_industry_util, tool, buy_condition_util |
| | | import l2_data_util |
| | | from db import redis_manager_delegate as redis_manager |
| | | from third_data.code_plate_key_manager import CodePlateKeyBuyManager, KPLCodeJXBlockManager, LimitUpCodesPlateKeyManager |
| | | from third_data.code_plate_key_manager import CodePlateKeyBuyManager, KPLCodeJXBlockManager |
| | | from trade import trade_manager, trade_queue_manager, l2_trade_factor, l2_trade_util, \ |
| | | trade_result_manager, current_price_process_manager, trade_data_manager, trade_huaxin, trade_record_log_util |
| | | from l2 import l2_data_manager, l2_log, l2_data_source_util, code_price_manager, \ |
| | | transaction_progress, cancel_buy_strategy, l2_data_log |
| | | transaction_progress, cancel_buy_strategy |
| | | from l2.cancel_buy_strategy import SCancelBigNumComputer, HourCancelBigNumComputer, DCancelBigNumComputer, \ |
| | | LCancelBigNumComputer, LatestCancelIndexManager, LCancelRateManager, GCancelBigNumComputer |
| | | from l2.l2_data_manager import L2DataException, OrderBeginPosInfo |
| | |
| | | is_near_big_order = False |
| | | try: |
| | | count = 0 |
| | | for i in range(place_order_index-1, -1, -1): |
| | | for i in range(place_order_index - 1, -1, -1): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | money = val["num"]*float(val["price"]) |
| | | if money <50*100: |
| | | money = val["num"] * float(val["price"]) |
| | | if money < 50 * 100: |
| | | continue |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2( |
| | | code, |
| | |
| | | if left_count <= 0: |
| | | continue |
| | | |
| | | if money >= 299*100: |
| | | if money >= 299 * 100: |
| | | if count < 1: |
| | | is_near_big_order = True |
| | | else: |
| | | count+=1 |
| | | count += 1 |
| | | if count >= 1: |
| | | break |
| | | except: |
| | | pass |
| | | |
| | | |
| | | |
| | | fdata = {"code_info": (code, code_name), "total_num": total_nums, |
| | | "finish_num": deal_or_cancel_num, |
| | |
| | | "trade_progress_percent": round( |
| | | total_left_num * float(limit_up_price) * 100 * 100 / buy1_money, 2), # 成交进度比例 |
| | | "limit_up_price": float(gpcode_manager.get_limit_up_price(code)), |
| | | "is_near_big_order":is_near_big_order |
| | | "is_near_big_order": is_near_big_order |
| | | } |
| | | fdatas.append(fdata) |
| | | except Exception as e: |
| | |
| | | self.send_response({"code": 0, "data": {"mode": sell_mode}}, client_id, request_id) |
| | | except Exception as e: |
| | | self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) |
| | | |
| | | elif ctype == "set_per_code_buy_money": |
| | | # 设置单只票的买入金额 |
| | | money = data["money"] |
| | | if money > 30000: |
| | | raise Exception("最多只能设置3w") |
| | | constant.BUY_MONEY_PER_CODE = money |
| | | self.send_response({"code": 0, "data": {"money": money}}, client_id, request_id) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | self.send_response({"code": 1, "msg": f"数据处理出错:{e}"}, client_id, request_id) |
| | |
| | | logger_system.info("create TradeServer") |
| | | t1 = threading.Thread(target=lambda: clear_invalid_client(), daemon=True) |
| | | t1.start() |
| | | |
| | | |
| | | |
| | | laddr = "0.0.0.0", 10008 |
| | | try: |