| | |
| | | )) |
| | | |
| | | |
| | | __combined_df_cache = {} |
| | | |
| | | |
| | | def extract_big_order_of_code(dir_path, code=None): |
| | | """ |
| | | 提取代码的大单 |
| | |
| | | print("拼接数据不存在") |
| | | return |
| | | |
| | | if not code: |
| | | codes = extract_big_order_codes(dir_path) |
| | | print("总代码数量:", len(codes)) |
| | | for code in codes: |
| | | extract_big_order_of_code(dir_path, code) |
| | | if code: |
| | | output_path = os.path.join(dir_path, f"big_buy_{code}.csv") |
| | | else: |
| | | output_path = os.path.join(dir_path, f"big_buy.csv") |
| | | |
| | | if os.path.exists(output_path): |
| | | print("路径已存在") |
| | | print("路径已存在:", output_path) |
| | | return |
| | | df = __combined_df_cache.get(combined_path) |
| | | if not df: |
| | | df = pd.read_csv(combined_path) |
| | | __combined_df_cache[combined_path] = df |
| | | df_copy = df.copy() |
| | | if code: |
| | | df_copy = df_copy[df_copy["SecurityID"] == int(code)] |
| | |
| | | @param code: |
| | | @return: |
| | | """ |
| | | |
| | | def first_last(group): |
| | | """ |
| | | 获取第一条数据与最后一条 |
| | | @param group: |
| | | @return: |
| | | """ |
| | | return pd.Series({ |
| | | }) |
| | | |
| | | combined_path = os.path.join(dir_path, 'combined.csv') |
| | | if not os.path.exists(combined_path): |
| | | print("拼接数据不存在") |