Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.

Commit 0f45180

Browse files
committed
feat: 2023-Q1 cralwer
1 parent 8e12bf7 commit 0f45180

12 files changed

+16561
-15634
lines changed

log/crawler.log

Lines changed: 175 additions & 0 deletions
Large diffs are not rendered by default.

main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ def main():
4242
输入:")
4343
if input_value == '1':
4444
page_index = 1
45-
get_fund_list(page_index) # 执行申万行业信息入库
45+
get_fund_list(page_index)
4646
elif input_value == '2':
47-
acquire_fund_base() # 执行行业股票信息入库
47+
acquire_fund_base()
4848
elif input_value == '3':
49-
page_index = 1
49+
# 将第1步和第2步合并
50+
page_index = 506
5051
sync_fund_base(page_index)
5152
elif input_value == '4':
53+
# 由于执行3, 快照页基金基础数据不全,需要补充
5254
further_complete_base_info()
5355
elif input_value == '5':
5456
update_fund_archive_status()
@@ -61,6 +63,7 @@ def main():
6163
elif input_value == '9':
6264
all_stock_holder_detail()
6365
elif input_value == '10':
66+
#先执行9,再执行10
6467
calculate_quarter_fund_total()
6568
elif input_value == '11':
6669
output_high_score_funds()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
代码,晨星专属号,名称,类型,页码,备注
2+
519610, 0P00017PZ8, 银河旺利灵活配置混合A, 2016-05-13, 2983, 页面跳转有问题
3+
519611, 0P00017PZ9, 银河旺利灵活配置混合C, 2016-05-13, 2983, 页面跳转有问题
4+
519612, 0P00017PZA, 银河旺利灵活配置混合I, 2016-05-13, 2983, 页面跳转有问题

output/fund_morning_quarter_catch.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
代码,晨星专属号,名称,类型,股票总仓位,页码,备注
2+
010340, 0P0001KZO6, 易方达高质量严选三年持有期混合, 2020-11-12, 91.97, 1999, li[16]
3+
010314, 0P0001L5IO, 摩根士丹利华鑫内需增长混合A, 2020-12-16, 93.24, 1989, li[16]

output/fund_morning_snapshot.csv

Lines changed: 16339 additions & 15624 deletions
Large diffs are not rendered by default.

output/fund_morning_snapshot_orm.csv

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
代码,晨星专属号,名称,类型,三年评级,五年评级,今年回报率
2+
301153601957396480, 004685, 0P0001BW1T, 金元顺安元启灵活配置混合, 灵活配置, 5, 5, 4.64
3+
301153619657359360, 001606, 0P00016EBI, 农银汇理工业4.0灵活配置混合, 灵活配置, 5, 5, 10.03
4+
301153637088886784, 005669, 0P0001CPZD, 前海开源公用事业行业股票, 沪港深股票, 5, 5, -0.51
5+
301153654499442688, 002190, 0P00017LPU, 农银汇理新能源主题灵活配置混合A, 积极配置 - 大盘成长, 5, 4, -5.32
6+
301153671842889728, 002258, 0P0001BG97, 大成国企改革灵活配置混合, 积极配置 - 大盘成长, 5, 5, 6.56
7+
301153689605767168, 003834, 0P0001ACCP, 华夏能源革新股票A, 大盘成长股票, 5, 4, 2.70
8+
301153707200872448, 002943, 0P0001992T, 广发多因子灵活配置混合, 积极配置 - 中小盘, 5, 5, 7.18
9+
301153724649177088, 590003, F0000004HJ, 中邮核心优势灵活配置混合, 积极配置 - 大盘成长, 5, 4, 5.48
10+
301153742114258944, 000729, 0P00013OUD, 建信中小盘先锋股票A, 中盘成长股票, 5, 5, -0.08
11+
301153759445123072, 001476, 0P0001660F, 中银智能制造股票A, 大盘成长股票, 5, 5, -2.01
12+
301153776780181504, 165516, 0P0000VO6G, 信诚周期轮动混合(LOF)A, 积极配置 - 大盘成长, 5, 5, 16.76
13+
301153794090074112, 006234, 0P0001IG9U, 万家汽车新趋势混合C, 灵活配置, 5, 0, 9.83
14+
301153811383189504, 000991, 0P00015AHP, 工银战略转型股票A, 中盘平衡股票, 5, 5, 2.06
15+
301153828764385280, 090018, 0P0000VE3A, 大成新锐产业混合, 积极配置 - 中小盘, 5, 5, 1.99
16+
301153846065889280, 001300, 0P00015YLW, 大成睿景灵活配置混合A, 积极配置 - 中小盘, 5, 5, 1.76
17+
301153863405142016, 001301, 0P00015YNO, 大成睿景灵活配置混合C, 积极配置 - 中小盘, 5, 5, 1.52
18+
301153880815697920, 519702, 0P0000RROL, 交银趋势优先混合A, 积极配置 - 大盘成长, 5, 5, 1.85
19+
301153898192699392, 166301, 0P0001610K, 华商新趋势优选灵活配置混合, 灵活配置, 5, 5, 12.85
20+
301153915490009088, 000336, 0P0000ZQ30, 农银研究精选混合, 积极配置 - 大盘成长, 5, 5, -2.67
21+
301153932950896640, 000689, 0P00013NSK, 前海开源新经济灵活配置混合A, 灵活配置, 5, 5, -4.60
22+
301153950214651904, 540008, 0P0000NX49, 汇丰晋信低碳先锋股票A, 大盘成长股票, 5, 3, -4.69
23+
301153967482601472, 004475, 0P0001BF42, 华泰柏瑞富利灵活配置混合A, 积极配置 - 大盘平衡, 5, 5, 13.60
24+
301153984838631424, 006233, 0P0001IG9T, 万家汽车新趋势混合A, 灵活配置, 5, 0, 10.00
25+
301154002257575936, 001532, 0P0001ABM1, 华安文体健康主题灵活配置混合A, 积极配置 - 中小盘, 5, 5, -3.76
26+
301154019647160320, 005094, 0P0001C87G, 万家臻选混合, 积极配置 - 大盘成长, 5, 5, 12.52

screenshot/top100_compare.jpg

1.48 MB
Loading

src/acquire_fund_quarter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ def crawlData(start, end):
233233
print(current_thread().getName(), 'page_start', page_start)
234234
sleep(3)
235235
except(BaseException):
236+
print('start', start)
236237
chrome_driver.close()
237-
raise BaseException
238+
# raise BaseException
238239
chrome_driver.close()
239240
thread_count = 6
240241
total_start_time = time()

src/fund_info/supplement.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def update_archive_status(self):
2626
funds = fund_query.select_quarter_fund(0, 15000)
2727
print("funds's len", len(funds))
2828
for index in range(start, len(funds)):
29-
# print("index", index)
29+
if index % 50 == 0:
30+
print("index", index)
3031
fund_item = funds[index]
3132
fund_code = fund_item[0]
3233
fund_api = FundApier(fund_code, platform='zh_fund')

src/fund_statistic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ def all_stocks_rank(each_statistic=None):
238238
df_other_list.to_excel(writer, sheet_name=other_market)
239239

240240
writer.save()
241+
print('输出到:', output_file, "完成\n" )
241242

242243

243244
def all_stock_holder_detail(each_statistic=None, *, quarter_index=None, threshold=0):
@@ -273,7 +274,7 @@ def all_stock_holder_detail(each_statistic=None, *, quarter_index=None, threshol
273274
elif bool(re.search("^(8|4)(3|7)\d{4}$", stock_code)):
274275
path = 'A股/北交所'
275276
else:
276-
print('stock_name_code', stock_name_code)
277+
print('该%s没有匹配股票市场:', stock_name_code)
277278
hold_fund_list = sorted(
278279
stock[1]['fund_list'], key=lambda x: x['持有市值(亿元)'], reverse=True)
279280
df_list = pd.DataFrame(hold_fund_list)

0 commit comments

Comments
 (0)