| | |
| | | 初始化数据 |
| | | :return: |
| | | """ |
| | | codes = None |
| | | codes = [] |
| | | # 获取目标代码 |
| | | for i in range(3): |
| | | try: |
| | |
| | | break |
| | | except: |
| | | time.sleep(5) |
| | | logger_system.info(f'可转债正股数量:{len(codes)}') |
| | | if codes: |
| | | # 设置订阅代码 |
| | | spi.set_codes_data(codes) |
| | | # 获取目标代码的收盘价 |
| | | pre_price_dict = None |
| | | pre_price_dict = {} |
| | | for i in range(3): |
| | | try: |
| | | pre_price_dict = get_pre_price(codes) |
| | |
| | | break |
| | | except: |
| | | time.sleep(5) |
| | | logger_system.info(f'可转债正股昨日收盘价数量:{len(codes)}') |
| | | if pre_price_dict: |
| | | for k in pre_price_dict: |
| | | limit_up_price = tool.to_price(decimal.Decimal(str(pre_price_dict[k])) * decimal.Decimal("1.1")) |
| | | if k.find("00") == 0 or k.find("60") == 0: |
| | | limit_up_price = tool.to_price(decimal.Decimal(str(pre_price_dict[k])) * decimal.Decimal("1.1")) |
| | | else: |
| | | limit_up_price = tool.to_price(decimal.Decimal(str(pre_price_dict[k])) * decimal.Decimal("1.2")) |
| | | Lev2MdSpi.limit_up_price_dict[k] = round(float(limit_up_price), 2) |
| | | |
| | | |