Administrator
2024-06-11 cbc235efc551dc041bbec43ba1bf6efb750338d4
bug修复
3个文件已修改
35 ■■■■ 已修改文件
test/test.py 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/tool.py 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test.py
@@ -1,6 +1,7 @@
import decimal
import l2_data_util
from code_attribute.code_data_util import ZYLTGBUtil
from code_attribute.gpcode_manager import CodesNameManager
from huaxin_client import l1_subscript_codes_manager
from third_data.history_k_data_util import JueJinHttpApi
@@ -24,7 +25,14 @@
if __name__ == "__main__":
    price = 9.5
    code = "600774"
    limit_up_price = tool.to_price(decimal.Decimal(str(price)) * decimal.Decimal(tool.get_limit_up_rate(code)))
    print(limit_up_price)
    codes_sh, codes_sz = l1_subscript_codes_manager.get_codes(False)
    codes = set()
    if codes_sh:
        for code_byte in codes_sh:
            codes.add(code_byte.decode())
        for code_byte in codes_sz:
            codes.add(code_byte.decode())
    updated_codes = ZYLTGBUtil.get_today_updated_volume_codes()
    codes = codes - set(updated_codes)
    print(codes)
trade/huaxin/huaxin_trade_server.py
@@ -243,8 +243,8 @@
                        list_ = JueJinApi.get_exchanges_codes(["SHSE", "SZSE"])
                        fdatas = []
                        for d in list_:
                            # if not tool.is_can_buy_code(d["sec_id"]):
                            #     continue
                            if not tool.is_target_code(d["sec_id"]):
                                continue
                            if d["sec_level"] != 1:
                                continue
utils/tool.py
@@ -313,11 +313,24 @@
def is_can_buy_code(code):
    if code.find("00") == 0 or code.find("60") == 0:# or code.find("30") == 0:
    if code.find("00") == 0 or code.find("60") == 0:  # or code.find("30") == 0:
        return True
    return False
def is_target_code(code):
    """
    是否是目标代码
    @param code:
    @return:
    """
    prefixes = ["00", "60", "68", "30"]
    for prefix in prefixes:
        if code.find(prefix) == 0:
            return True
    return False
def get_limit_up_rate(code):
    # 获取涨停倍数
    if code.find("00") == 0 or code.find("60") == 0: