Administrator
2024-06-03 6729e5d25dfecf068fc41771f85753871ccffefa
删除可转债相关方法
6个文件已删除
4个文件已修改
2310 ■■■■■ 已修改文件
cb_main.py 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cb_main.spec 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/cb/l2_client_for_cb.py 482 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/cb/test_trade.py 541 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/cb/trade_client_for_cb.py 522 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/cb/trade_manager.py 616 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/trade_client.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin_trade_record_manager.py 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/trade_strategy.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cb_main.py
File was deleted
cb_main.spec
File was deleted
huaxin_client/cb/l2_client_for_cb.py
File was deleted
huaxin_client/cb/test_trade.py
File was deleted
huaxin_client/cb/trade_client_for_cb.py
File was deleted
huaxin_client/cb/trade_manager.py
File was deleted
huaxin_client/trade_client.py
@@ -265,7 +265,7 @@
        # 证券代码
        req_field.SecurityID = code
        req_field.Direction = traderapi.TORA_TSTP_D_Sell
        req_field.VolumeTotalOriginal = count
        req_field.SInfo = sinfo
        '''
@@ -292,7 +292,11 @@
            req_field.OrderPriceType = traderapi.TORA_TSTP_OPT_HomeBestPrice
        req_field.TimeCondition = traderapi.TORA_TSTP_TC_GFD
        req_field.VolumeCondition = traderapi.TORA_TSTP_VC_AV
        if count <= 0:
            req_field.VolumeCondition = traderapi.TORA_TSTP_VC_CV
        else:
            req_field.VolumeCondition = traderapi.TORA_TSTP_VC_AV
            req_field.VolumeTotalOriginal = count
        if order_ref:
            req_field.OrderRef = order_ref
test/test.py
@@ -1,29 +1,2 @@
import logging
import multiprocessing
import time
from huaxin_client.cb import trade_client_for_cb
from log_module.log import logger_info, printlog
from trade import huaxin_trade_api
if __name__ == "__main__":
    try:
        q_s_w_t_r, q_s_r_t_w = multiprocessing.Queue(), multiprocessing.Queue()
        huaxin_trade_api.run_pipe_trade(q_s_r_t_w, q_s_w_t_r)
        tradeProcess = multiprocessing.Process(
            target= trade_client_for_cb.run,
            args=(q_s_w_t_r, q_s_r_t_w))
        tradeProcess.start()
        time.sleep(3)
        printlog("获取委托结果", huaxin_trade_api.get_delegate_list())
        time.sleep(2)
        printlog("获取持仓结果", huaxin_trade_api.get_position_list(True))
    except Exception as e:
        logging.exception(e)
    finally:
        logger_info.debug("程序结束")
    pass
trade/huaxin_trade_record_manager.py
@@ -14,8 +14,10 @@
# 持仓记录
class PositionManager:
    __db = 2
    __redisManager = redis_manager.RedisManager(2)
    latest_positions = []
    __available_position_cache_dict = {}
    @classmethod
    def __get_redis(cls):
@@ -24,7 +26,8 @@
    # 保存代码的量
    @classmethod
    def __save_code_volume(cls, code, volume):
        RedisUtils.setex(cls.__get_redis(), f"available_position_{code}", tool.get_expire(), f"{volume}")
        cls.__available_position_cache_dict[code] = volume
        RedisUtils.setex_async(cls.__db, f"available_position_{code}", tool.get_expire(), f"{volume}")
    @classmethod
    def get_code_volume(cls, code):
@@ -34,6 +37,10 @@
        return int(val)
    @classmethod
    def get_code_volume_cache(cls, code):
        cls.__available_position_cache_dict.get(code)
    @classmethod
    def cache(cls, datas):
        cls.latest_positions = copy.deepcopy(datas)
trade/trade_strategy.py
@@ -79,6 +79,11 @@
                    limit_up_price = gpcode_manager.get_limit_up_price(code)
                    order_ref = huaxin_util.create_order_ref()
                    try:
                        # 如果卖量比持仓还大,就全部卖完
                        position_volume = PositionManager().get_code_volume_cache(code)
                        if position_volume and volume >= position_volume:
                            # 表示全部卖完
                            volume = -1
                        result = huaxin_sell_util.start_sell(code, volume, price_type, limit_up_price, limit_down_price,
                                                             current_price, blocking=True, request_id=request_id,
                                                             order_ref=order_ref)