Administrator
2023-10-13 0577bc3b9d4165afeb1b2e65a55c861c68d5b727
测试影子订单
3个文件已修改
33 ■■■■ 已修改文件
third_data/kpl_api.py 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/trade_huaxin.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_api.py
@@ -4,7 +4,6 @@
from utils import middle_api_protocol
# 竞价
DABAN_TYPE_BIDDING = 8
# 涨停
@@ -35,12 +34,29 @@
        return middle_api_protocol.request(fdata)
def daBanList(pidType):
    data = "Order=1&a=DaBanList&st=50&c=HomeDingPan&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23" \
           f"&VerSion=5.8.0.2&Index=0&Is_st=1&PidType={pidType}&apiv=w32&Type=4&FilterMotherboard=0&Filter=0&FilterTIB=0" \
def daBanList(pidType, page_size=50, index=0):
    data = f"Order=1&a=DaBanList&st={page_size}&c=HomeDingPan&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23" \
           f"&VerSion=5.8.0.2&Index={index}&Is_st=1&PidType={pidType}&apiv=w32&Type=4&FilterMotherboard=0&Filter=0&FilterTIB=0" \
           "&FilterGem=0 "
    result = __base_request("https://apphq.longhuvip.com/w1/api/index.php", data=data)
    return result
def getLimitUpInfo():
    list_ = []
    page_size = 50
    MAX_SIZE = 150
    for i in range(0, 10):
        result_str = daBanList(DABAN_TYPE_LIMIT_UP, page_size=page_size, index=len(list_))
        result = json.loads(result_str)
        temp_list = result["list"]
        list_ += temp_list
        if len(temp_list) < page_size:
            result['list'] = list_
            return json.dumps(result)
        elif len(list_) > MAX_SIZE:
            return json.dumps(result)
    return None
# 市场行情-行业
@@ -116,4 +132,7 @@
if __name__ == "__main__":
    print(len(json.loads(daBanList(DABAN_TYPE_LIMIT_UP))["list"]))
    datas = json.loads(getLimitUpInfo())
    for d in datas["list"]:
        print(d[0], d[1])
    print(len(datas["list"]))
third_data/kpl_data_manager.py
@@ -328,7 +328,7 @@
        while True:
            if tool.is_trade_time():
                try:
                    results = kpl_api.daBanList(kpl_api.DABAN_TYPE_LIMIT_UP)
                    results = kpl_api.getLimitUpInfo()
                    result = json.loads(results)
                    start_time = time.time()
                    __upload_data("limit_up", result)
trade/trade_huaxin.py
@@ -42,7 +42,7 @@
        if code.find("00") != 0 and code.find("60") != 0:
            raise Exception("只支持00开头与60开头的代码下单")
        # 保存下单信息
        huaxin.huaxin_delegate_postion_manager.place_order(code, price, count, last_data)
        huaxin.huaxin_delegate_postion_manager.place_order(code, price, count, last_data,order_ref)
        if not constant.TRADE_ENABLE:
            return
        result = None