| | |
| | | # 暂停自动买 |
| | | logger.info(f"在交易方法函数处 关闭了 自动买") |
| | | return |
| | | if current_price < 3 or current_price > 50: |
| | | if current_price < 3 or current_price > 30: |
| | | # 当前单价超出预设限制 |
| | | logger.info(f"当前标的个股{sec_name}单价超出预设限制!预设值3 < current_price < 50,当前最新价{current_price}") |
| | | logger.info(f"当前标的个股{sec_name}单价超出预设限制!预设值3 < current_price < 30,当前最新价{current_price}") |
| | | return |
| | | price = round(float(current_price), 2) |
| | | volume = (int(buy_order_value / price) // 100) * 100 |
| | |
| | | account_management.finance_management() |
| | | logger.info(f"更新的资金数据data_cache.account_finance_dict=={data_cache.account_finance_dict}") |
| | | if symbol[-6:] in data_cache.account_positions_dict: |
| | | logger.info(f"该股已经持仓==》{sec_name}") |
| | | pass |
| | | |
| | | # 因为上面的更新持仓数据函数会计算 今日新增持仓数量,所以如果再手动新增持仓数据会重复计算【考虑到持仓函数有可能会有延迟,这也可能是同时运行一段时间没有出现BUG的原因,先暂时保留以下这段代码,只是注释】 |
| | | # # 买票后添加 持仓代码集合 |
| | | # data_cache.position_symbols_set.add(symbol) |
| | | # # 买票后添加 今日新增持仓代码集合 |
| | | # data_cache.addition_position_symbols_set.add(symbol) |
| | | # logger.info(f"当前持仓数量:::{len(data_cache.position_symbols_set)}") |
| | | # logger.info(f"今日新增持仓数量:::{len(data_cache.addition_position_symbols_set)}") |
| | | # todo 当前为测试阶段的冗余打印 |
| | | # 检测持仓信息中有无下单个股且有该个股的当前持仓,只有当前持仓数量不为0时,才认为交易成功 |
| | | for i in data_cache.account_positions_dict: |
| | | # print(i) |
| | | if i['securityID'] == symbol[-6:]: |
| | | # print(i['currentPosition']) |
| | | if i['currentPosition'] == 0: |
| | | logger.info(f"【{i['securityName']}】交易失败~") |
| | | else: |
| | | # 买票后添加 持仓代码集合 |
| | | data_cache.position_symbols_set.add(symbol) |
| | | logger.info(f"【{i['securityName']}】交易成功!") |
| | | |
| | | |
| | | # 下单买入函数(按可用资金的一定比例,在涨停价买)【按金额买 高级版】 |