| | |
| | | :return: |
| | | """ |
| | | results = JueJinHttpApi.get_exchanges_codes("SHSE,SZSE", sec_types=[8], skip_suspended=True, skip_st=True, |
| | | fields="symbol, sec_type, sec_id,sec_name, underlying_symbol, delisted_date") |
| | | fields="symbol, sec_type, sec_id,sec_name, underlying_symbol, delisted_date, sec_level") |
| | | fresults = [] |
| | | for r in results: |
| | | tool.get_now_date_str() |
| | | if int(tool.get_now_date_str('%Y%m%d')) >= int(r['delisted_date'].strftime('%Y%m%d')): |
| | | if r['sec_name'].find('转') == -1 or r['sec_level'] != 1 or int(tool.get_now_date_str('%Y%m%d')) >= int( |
| | | r['delisted_date'].strftime('%Y%m%d')): |
| | | continue |
| | | fresults.append(r) |
| | | print(len(fresults)) |
| | | return [x['underlying_symbol'].split('.')[1] for x in fresults] |
| | | # 排除同一股票有2个转债 |
| | | cb_count_dict = {} |
| | | exclude_codes = [] |
| | | for r in fresults: |
| | | if r['underlying_symbol'] not in cb_count_dict: |
| | | cb_count_dict[r['underlying_symbol']] = [] |
| | | cb_count_dict[r['underlying_symbol']].append(r['symbol']) |
| | | if len(cb_count_dict[r['underlying_symbol']]) > 1: |
| | | print(r['underlying_symbol'], cb_count_dict[r['underlying_symbol']]) |
| | | exclude_codes.extend(cb_count_dict[r['underlying_symbol']]) |
| | | ffresults = [] |
| | | for x in fresults: |
| | | if x['symbol'] in exclude_codes: |
| | | continue |
| | | ffresults.append(x) |
| | | return [x['underlying_symbol'].split('.')[1] for x in ffresults] |
| | | |
| | | |
| | | def get_pre_price(codes): |