mns-scheduler 1.0.8.7__py3-none-any.whl → 1.4.3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mns_scheduler/__init__.py +1 -3
- mns_scheduler/company_info/announce/company_announce_sync_service.py +65 -0
- mns_scheduler/company_info/{company_info_sync_api.py → base/sync_company_base_info_api.py} +239 -227
- mns_scheduler/company_info/base/sync_company_hold_info_api.py +37 -0
- mns_scheduler/company_info/base/sync_company_product_area_industry.py +161 -0
- mns_scheduler/company_info/clean/company_info_clean_api.py +133 -0
- mns_scheduler/company_info/constant/company_constant_data.py +497 -0
- mns_scheduler/company_info/{de_list_stock_service.py → de_list_stock/de_list_stock_service.py} +1 -1
- mns_scheduler/company_info/em_stock_info/__init__.py +7 -0
- mns_scheduler/company_info/em_stock_info/sync_em_stock_info_sync.py +80 -0
- mns_scheduler/company_info/remark/__init__.py +7 -0
- mns_scheduler/company_info/remark/company_remark_info_sync.py +46 -0
- mns_scheduler/concept/clean/kpl_concept_clean_api.py +1 -1
- mns_scheduler/concept/clean/ths_concept_clean_api.py +74 -51
- mns_scheduler/concept/ths/common/ths_concept_sync_common_api.py +112 -56
- mns_scheduler/concept/ths/common/ths_concept_update_common_api.py +6 -6
- mns_scheduler/concept/ths/detaill/__init__.py +0 -0
- mns_scheduler/concept/ths/detaill/ths_concept_detail_api.py +226 -0
- mns_scheduler/concept/ths/sync_new_index/sync_ths_concept_new_index_api.py +169 -0
- mns_scheduler/concept/ths/update_concept_info/sync_one_concept_all_symbols_api.py +11 -23
- mns_scheduler/concept/ths/update_concept_info/sync_one_symbol_all_concepts_api.py +19 -15
- mns_scheduler/db/col_move_service.py +10 -7
- mns_scheduler/db/db_status.py +1 -1
- mns_scheduler/db/script/__init__.py +7 -0
- mns_scheduler/db/script/col_move_script.py +45 -0
- mns_scheduler/db/script/db_move/__init__.py +7 -0
- mns_scheduler/db/script/db_move/col_move_one_service.py +34 -0
- mns_scheduler/db/script/sync/__init__.py +7 -0
- mns_scheduler/db/script/sync/local_mongo_util.py +231 -0
- mns_scheduler/db/script/sync/remote_data_sync_to_local.py +105 -0
- mns_scheduler/db/script/sync/remote_mongo_util.py +306 -0
- mns_scheduler/db/script/sync/sync_hui_ce_test_data.py +80 -0
- mns_scheduler/db/script/sync/sync_hui_ce_test_data_01.py +69 -0
- mns_scheduler/db/script/update/__init__.py +7 -0
- mns_scheduler/db/script/update/update_col_field.py +36 -0
- mns_scheduler/finance/__init__.py +1 -1
- mns_scheduler/finance/{em_financial_asset_liability_sync_service_api.py → em/em_financial_asset_liability_sync_service_api.py} +3 -3
- mns_scheduler/finance/{em_financial_profit_sync_service_api.py → em/em_financial_profit_sync_service_api.py} +30 -25
- mns_scheduler/finance/{finance_common_api.py → em/finance_common_api.py} +4 -4
- mns_scheduler/finance/sync_financial_report_service_task.py +202 -0
- mns_scheduler/finance/xue_qiu/down_load_xueqiu_report_api.py +77 -0
- mns_scheduler/finance/xue_qiu/sync_xue_qiu_fiance_data.py +161 -0
- mns_scheduler/hk/__init__.py +1 -1
- mns_scheduler/hk/hk_company_info_sync_service_api.py +49 -5
- mns_scheduler/hk/hk_industry_info_sync_service_api.py +68 -0
- mns_scheduler/industry/__init__.py +7 -0
- mns_scheduler/industry/ths/__init__.py +7 -0
- mns_scheduler/industry/ths/ths_industry_index_service.py +58 -0
- mns_scheduler/industry/ths/ths_industry_sync_service.py +68 -0
- mns_scheduler/irm/__init__.py +1 -1
- mns_scheduler/irm/api/__init__.py +1 -1
- mns_scheduler/irm/api/sh_stock_sns_sse_info_api.py +1 -1
- mns_scheduler/irm/api/sz_stock_sns_sse_info_api.py +1 -1
- mns_scheduler/irm/stock_irm_cninfo_service.py +15 -13
- mns_scheduler/k_line/clean/daily/__init__.py +1 -1
- mns_scheduler/k_line/clean/daily/daily_k_line_clean_common_service.py +57 -7
- mns_scheduler/k_line/clean/daily/daily_k_line_service.py +16 -3
- mns_scheduler/k_line/clean/k_line_info_clean_impl.py +3 -2
- mns_scheduler/k_line/clean/k_line_info_clean_task.py +42 -31
- mns_scheduler/k_line/clean/week_month/__init__.py +1 -1
- mns_scheduler/k_line/clean/week_month/normal_week_month_k_line_service.py +125 -27
- mns_scheduler/k_line/clean/week_month/sub_new_week_month_k_line_service.py +72 -17
- mns_scheduler/k_line/common/__init__.py +7 -0
- mns_scheduler/k_line/common/k_line_common_api.py +188 -0
- mns_scheduler/k_line/hot_stocks/__init__.py +1 -1
- mns_scheduler/k_line/hot_stocks/recent_hot_stocks_clean_service.py +1 -1
- mns_scheduler/k_line/month_week_daily/bfq_k_line_sync.py +77 -0
- mns_scheduler/k_line/{sync → month_week_daily}/daily_week_month_line_sync.py +14 -14
- mns_scheduler/k_line/sync_status/__init__.py +7 -0
- mns_scheduler/k_line/sync_status/k_line_sync_status_check.py +54 -0
- mns_scheduler/k_line/test/__init__.py +7 -0
- mns_scheduler/k_line/test/k_line_info_clean_his_data.py +41 -0
- mns_scheduler/k_line/year_quarter/__init__.py +7 -0
- mns_scheduler/k_line/year_quarter/year_quarter_line_sync.py +76 -0
- mns_scheduler/kpl/selection/symbol/sync_best_choose_symbol.py +4 -2
- mns_scheduler/kpl/selection/symbol/sync_kpl_concept_symbol_choose_reason_api.py +108 -0
- mns_scheduler/kpl/selection/total/sync_kpl_best_total_sync_api.py +12 -7
- mns_scheduler/lhb/__init__.py +1 -1
- mns_scheduler/lhb/stock_lhb_sync_service.py +1 -1
- mns_scheduler/open/__init__.py +1 -1
- mns_scheduler/open/sync_one_day_open_data_to_db_service.py +6 -22
- mns_scheduler/risk/__init__.py +1 -1
- mns_scheduler/risk/compliance/__init__.py +0 -0
- mns_scheduler/risk/compliance/undisclosed_annual_report_api.py +71 -0
- mns_scheduler/risk/financial/__init__.py +0 -0
- mns_scheduler/risk/financial/annual_report_audit_check_api.py +54 -0
- mns_scheduler/risk/financial/net_assets_check_api.py +75 -0
- mns_scheduler/risk/financial/profit_income_check_api.py +80 -0
- mns_scheduler/risk/financial/stock_equity_mortgage_check_api.py +1 -0
- mns_scheduler/risk/financial_report_risk_check_api.py +42 -0
- mns_scheduler/risk/major_violations/__init__.py +0 -0
- mns_scheduler/risk/{register_and_investigate_stock_sync_api.py → major_violations/register_and_investigate_stock_sync_api.py} +17 -8
- mns_scheduler/risk/self/__init__.py +0 -0
- mns_scheduler/risk/{wei_pan_stock_api.py → self/wei_pan_stock_api.py} +10 -4
- mns_scheduler/risk/test/__init__.py +7 -0
- mns_scheduler/{finance → risk}/test/fix_blask_list.py +6 -10
- mns_scheduler/risk/transactions/__init__.py +0 -0
- mns_scheduler/risk/transactions/transactions_check_api.py +183 -0
- mns_scheduler/self_choose/__init__.py +7 -0
- mns_scheduler/self_choose/ths_self_choose_service.py +158 -0
- mns_scheduler/trade/auto_ipo_buy_api.py +2 -2
- mns_scheduler/trade/auto_login/__init__.py +7 -0
- mns_scheduler/trade/auto_login/trader_auto_service.py +32 -0
- mns_scheduler/trade/auto_sell_service_api.py +10 -8
- mns_scheduler/trade/balance/__init__.py +7 -0
- mns_scheduler/trade/balance/ths_account_balance_service.py +7 -0
- mns_scheduler/trade/sync_position_api.py +41 -8
- mns_scheduler/trade/task/__init__.py +7 -0
- mns_scheduler/trade/task/trader_task_service.py +65 -0
- mns_scheduler/trade/tfp/__init__.py +7 -0
- mns_scheduler/trade/tfp/stock_tfp_info_sync.py +56 -0
- mns_scheduler/zb/stock_zb_pool_sync.py +1 -15
- mns_scheduler/zt/high_chg/sync_high_chg_pool_service.py +2 -3
- mns_scheduler/zt/high_chg/sync_high_chg_real_time_quotes_service.py +12 -8
- mns_scheduler/zt/open_data/kcx_high_chg_open_data_sync.py +10 -25
- mns_scheduler/zt/script/__init__.py +1 -1
- mns_scheduler/zt/script/fix_error_deal_day.py +41 -0
- mns_scheduler/zt/script/kcx_high_chg_open_his_data_handle.py +2 -11
- mns_scheduler/zt/script/sync_high_chg_pool_his_data.py +2 -2
- mns_scheduler/zt/script/sync_now_higt_chg_zt.py +43 -0
- mns_scheduler/zt/zt_pool/em_zt_pool_sync_api.py +413 -0
- mns_scheduler/zt/zt_pool/ths_zt_pool_sync_api.py +193 -0
- mns_scheduler/zt/zt_pool/update_null_zt_reason_api.py +58 -0
- mns_scheduler/zz_task/compensation/__init__.py +0 -0
- mns_scheduler/zz_task/compensation/compensate_task.py +161 -0
- mns_scheduler/zz_task/compensation/compensate_task_one_day.py +142 -0
- mns_scheduler/zz_task/data_sync_task.py +271 -121
- {mns_scheduler-1.0.8.7.dist-info → mns_scheduler-1.4.3.2.dist-info}/METADATA +1 -1
- mns_scheduler-1.4.3.2.dist-info/RECORD +169 -0
- {mns_scheduler-1.0.8.7.dist-info → mns_scheduler-1.4.3.2.dist-info}/WHEEL +1 -1
- mns_scheduler/backup/app/ths_new_concept_sync_app.py +0 -122
- mns_scheduler/backup/em/em_new_concept_his_sync.py +0 -99
- mns_scheduler/backup/em/em_new_concept_sync_common_api.py +0 -139
- mns_scheduler/backup/em/em_new_concept_sync_web.py +0 -55
- mns_scheduler/backup/wen_cai/wen_cai_concept_sync.py +0 -51
- mns_scheduler/big_deal/ths_big_deal_sync.py +0 -98
- mns_scheduler/company_info/company_constant_data.py +0 -322
- mns_scheduler/concept/ths/sync_new_index/sync_ths_concept_by_ak_api.py +0 -103
- mns_scheduler/concept/ths/sync_new_index/sync_ths_new_concept_by_web_api.py +0 -89
- mns_scheduler/finance/financial_high_risk_stock_clean_service_api.py +0 -202
- mns_scheduler/finance/sync_financial_report_service_api.py +0 -113
- mns_scheduler/real_time/realtime_quotes_now_create_db_index.py +0 -27
- mns_scheduler/real_time/realtime_quotes_now_sync.py +0 -232
- mns_scheduler/risk/stock_equity_mortgage_sync_api.py +0 -32
- mns_scheduler/zt/zt_pool/zt_pool_sync_api.py +0 -151
- mns_scheduler/zz_task/sync_realtime_quotes_task.py +0 -28
- mns_scheduler-1.0.8.7.dist-info/RECORD +0 -112
- /mns_scheduler/{backup/app → company_info/announce}/__init__.py +0 -0
- /mns_scheduler/{backup/em → company_info/base}/__init__.py +0 -0
- /mns_scheduler/{backup/wen_cai → company_info/clean}/__init__.py +0 -0
- /mns_scheduler/{big_deal → company_info/constant}/__init__.py +0 -0
- /mns_scheduler/{real_time → company_info/de_list_stock}/__init__.py +0 -0
- /mns_scheduler/{backup → finance/em}/__init__.py +0 -0
- /mns_scheduler/finance/{test → xue_qiu}/__init__.py +0 -0
- /mns_scheduler/k_line/{sync → month_week_daily}/__init__.py +0 -0
- {mns_scheduler-1.0.8.7.dist-info → mns_scheduler-1.4.3.2.dist-info}/top_level.txt +0 -0
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') + 16
|
|
6
|
-
project_path = file_path[0:end]
|
|
7
|
-
sys.path.append(project_path)
|
|
8
|
-
from datetime import datetime
|
|
9
|
-
import mns_common.component.self_choose.black_list_service_api as black_list_service_api
|
|
10
|
-
import mns_scheduler.finance.finance_common_api as finance_common_api
|
|
11
|
-
from loguru import logger
|
|
12
|
-
import mns_common.constant.db_name_constant as db_name_constant
|
|
13
|
-
from mns_common.db.MongodbUtil import MongodbUtil
|
|
14
|
-
import mns_common.component.trade_date.trade_date_common_service_api as trade_date_common_service_api
|
|
15
|
-
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
16
|
-
import pandas as pd
|
|
17
|
-
|
|
18
|
-
# 1.无保留意见/标准报告:报告没问题。(没有发现造假,但也不能保证为真)
|
|
19
|
-
#
|
|
20
|
-
# 2.带强调事项段的无保留意见:报告没问题,但是有亏损获对其可持续经营有重大疑虑(可能造假,至少是在粉饰报表)
|
|
21
|
-
#
|
|
22
|
-
# 3.保留意见报告:有问题,财务造假
|
|
23
|
-
#
|
|
24
|
-
# 4.否定意见报告:有很大问题
|
|
25
|
-
#
|
|
26
|
-
# 5.无法表示意见报告:不让查
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
mongodb_util = MongodbUtil('27017')
|
|
30
|
-
# 审核标准意见
|
|
31
|
-
OPINION_TYPE = "标准无保留意见"
|
|
32
|
-
|
|
33
|
-
# 利润为负的时候最小营业收入 主板 3.2亿
|
|
34
|
-
MIN_INCOME_MAIN = 320000000
|
|
35
|
-
# 利润为负的时候最小营业收入 科创 创业 1.2亿
|
|
36
|
-
MIN_INCOME_SUB = 120000000
|
|
37
|
-
# 最大负债比
|
|
38
|
-
MAX_LIABILITY_RATIO = 90
|
|
39
|
-
# 负载超过90%时候最小净资产
|
|
40
|
-
MIN_NET_ASSET = 1000000000
|
|
41
|
-
# 排除校验负债比的行业
|
|
42
|
-
EXCLUDE_INDUSTRY = ['保险', '银行', '证券']
|
|
43
|
-
|
|
44
|
-
# 最迟出报告的天数
|
|
45
|
-
LATE_REPORT_DAYS = 3
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
#### 退市新规 ####
|
|
49
|
-
# 1 股价类:连续20个交易日估价低于1元
|
|
50
|
-
# 2 市值类: 主板小于5亿、创业板3亿
|
|
51
|
-
# 3 财务类: (1) 利润总额 净利润 扣非净利润三者最小值为负 且营业收入小于3亿 创业板营业收入小于1元
|
|
52
|
-
# (2) 资不抵债
|
|
53
|
-
|
|
54
|
-
# 财报审核
|
|
55
|
-
def financial_report_check(new_report_df, period_time, period, report_type):
|
|
56
|
-
if period == 4:
|
|
57
|
-
# 年报异常审核
|
|
58
|
-
year_report_exception_check(new_report_df, period_time, report_type)
|
|
59
|
-
# 负债过高
|
|
60
|
-
liability_ratio_check(report_type, new_report_df, period_time)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# 年报审核异常
|
|
64
|
-
def year_report_exception_check(new_report_df, period_time, report_type):
|
|
65
|
-
new_report_one_df = new_report_df.loc[new_report_df['REPORT_DATE'] == period_time]
|
|
66
|
-
# 审核意见
|
|
67
|
-
opinion_type = list(new_report_one_df['OPINION_TYPE'])[0]
|
|
68
|
-
symbol = list(new_report_one_df['SECURITY_CODE'])[0]
|
|
69
|
-
name = list(new_report_one_df['SECURITY_NAME_ABBR'])[0]
|
|
70
|
-
now_date = datetime.now()
|
|
71
|
-
str_day = now_date.strftime('%Y-%m-%d')
|
|
72
|
-
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
73
|
-
|
|
74
|
-
# 年报有问题
|
|
75
|
-
if opinion_type != OPINION_TYPE:
|
|
76
|
-
id_key = symbol + "_" + period_time + "_" + black_list_service_api.FINANCIAL_PROBLEM_ANNUAL_REPORT
|
|
77
|
-
black_list_service_api.save_black_stock(id_key,
|
|
78
|
-
symbol,
|
|
79
|
-
name,
|
|
80
|
-
str_day,
|
|
81
|
-
str_now_date,
|
|
82
|
-
'年报审计有问题:' + "[" + str(opinion_type) + "]",
|
|
83
|
-
'年报审计有问题',
|
|
84
|
-
'',
|
|
85
|
-
black_list_service_api.FINANCIAL_PROBLEM_ANNUAL_REPORT)
|
|
86
|
-
|
|
87
|
-
if report_type == db_name_constant.EM_STOCK_PROFIT:
|
|
88
|
-
# 利润总额 净利润 扣除非经常性损益后的净利润 三者最小为负
|
|
89
|
-
# 利润总额
|
|
90
|
-
total_profit = list(new_report_one_df['TOTAL_PROFIT'])[0]
|
|
91
|
-
# 净利润
|
|
92
|
-
net_profit = list(new_report_one_df['NETPROFIT'])[0]
|
|
93
|
-
# 营业利润
|
|
94
|
-
operate_profit = list(new_report_one_df['OPERATE_PROFIT'])[0]
|
|
95
|
-
# 持续经营净利润
|
|
96
|
-
continued_profit = list(new_report_one_df['CONTINUED_NETPROFIT'])[0]
|
|
97
|
-
# 归属于母公司股东的净利润
|
|
98
|
-
parent_profit = list(new_report_one_df['PARENT_NETPROFIT'])[0]
|
|
99
|
-
# 扣除非经常性损益后的净利润
|
|
100
|
-
deduct_parent_profit = list(new_report_one_df['DEDUCT_PARENT_NETPROFIT'])[0]
|
|
101
|
-
# 营业总收入
|
|
102
|
-
total_operate_income = list(new_report_one_df['TOTAL_OPERATE_INCOME'])[0]
|
|
103
|
-
if total_operate_income == 0:
|
|
104
|
-
# 营业收入
|
|
105
|
-
total_operate_income = list(new_report_one_df['OPERATE_INCOME'])[0]
|
|
106
|
-
|
|
107
|
-
# 最小利润收入
|
|
108
|
-
min_profit = min(total_profit, net_profit, operate_profit,
|
|
109
|
-
continued_profit, parent_profit, deduct_parent_profit)
|
|
110
|
-
if min_profit < 0:
|
|
111
|
-
|
|
112
|
-
classification = common_service_fun_api.classify_symbol_one(symbol)
|
|
113
|
-
if ((classification in ['S', 'H'] and total_operate_income < MIN_INCOME_MAIN)
|
|
114
|
-
| (classification in ['K', 'C'] and total_operate_income < MIN_INCOME_SUB)):
|
|
115
|
-
id_key = symbol + "_" + period_time + "_" + black_list_service_api.FINANCIAL_PROBLEM_PROFIT
|
|
116
|
-
min_profit = round(min_profit / common_service_fun_api.TEN_THOUSAND, 1)
|
|
117
|
-
total_operate_income = round(total_operate_income / common_service_fun_api.HUNDRED_MILLION, 1)
|
|
118
|
-
|
|
119
|
-
black_list_service_api.save_black_stock(id_key,
|
|
120
|
-
symbol,
|
|
121
|
-
name,
|
|
122
|
-
str_day,
|
|
123
|
-
str_now_date,
|
|
124
|
-
'年报:利润:' + '[' + str(min_profit) + '万]' + '收入:' + str(
|
|
125
|
-
total_operate_income) + '[' + '亿元]--' + '触发退市风险',
|
|
126
|
-
'年报:利润:' + '[' + str(min_profit) + '万]' + '收入:' + str(
|
|
127
|
-
total_operate_income) + '[' + '亿元]--' + '触发退市风险',
|
|
128
|
-
'',
|
|
129
|
-
black_list_service_api.FINANCIAL_PROBLEM_PROFIT)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
# 负债比校验
|
|
133
|
-
def liability_ratio_check(report_type, new_report_df, period_time):
|
|
134
|
-
if report_type == db_name_constant.EM_STOCK_ASSET_LIABILITY:
|
|
135
|
-
new_report_df = new_report_df.sort_values(by=['REPORT_DATE'], ascending=False)
|
|
136
|
-
new_report_one_df = new_report_df.iloc[0:1]
|
|
137
|
-
# 负债比
|
|
138
|
-
liability_ratio = list(new_report_one_df['liability_ratio'])[0]
|
|
139
|
-
# 净资产
|
|
140
|
-
net_asset = round(list(new_report_one_df['TOTAL_ASSETS'])[0] - list(new_report_one_df['TOTAL_LIABILITIES'])[0],
|
|
141
|
-
2)
|
|
142
|
-
|
|
143
|
-
symbol = list(new_report_one_df['SECURITY_CODE'])[0]
|
|
144
|
-
name = list(new_report_one_df['SECURITY_NAME_ABBR'])[0]
|
|
145
|
-
now_date = datetime.now()
|
|
146
|
-
str_day = now_date.strftime('%Y-%m-%d')
|
|
147
|
-
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
148
|
-
id_key = symbol + "_" + period_time + "_" + black_list_service_api.FINANCIAL_PROBLEM_DEBT
|
|
149
|
-
|
|
150
|
-
query_company = {'_id': symbol, 'industry': {'$in': EXCLUDE_INDUSTRY}}
|
|
151
|
-
if mongodb_util.exist_data_query(db_name_constant.COMPANY_INFO, query_company):
|
|
152
|
-
return None
|
|
153
|
-
|
|
154
|
-
if liability_ratio >= MAX_LIABILITY_RATIO:
|
|
155
|
-
black_list_service_api.save_black_stock(id_key,
|
|
156
|
-
symbol,
|
|
157
|
-
name,
|
|
158
|
-
str_day,
|
|
159
|
-
str_now_date,
|
|
160
|
-
'负债过高:' + "[" + str(
|
|
161
|
-
liability_ratio) + "]" + "," + "净资产:" + str(round(
|
|
162
|
-
net_asset / common_service_fun_api.HUNDRED_MILLION, 0)) + "亿",
|
|
163
|
-
'负债过高:' + "[" + str(liability_ratio) + "]",
|
|
164
|
-
'',
|
|
165
|
-
black_list_service_api.FINANCIAL_PROBLEM_DEBT)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
# 未出财报
|
|
169
|
-
def un_report_check(sync_time, now_year, period, period_time):
|
|
170
|
-
un_report_asset_df = finance_common_api.find_un_report_symbol(period_time,
|
|
171
|
-
db_name_constant.EM_STOCK_ASSET_LIABILITY)
|
|
172
|
-
un_report_profit_df = finance_common_api.find_un_report_symbol(period_time,
|
|
173
|
-
db_name_constant.EM_STOCK_PROFIT)
|
|
174
|
-
un_report_df = pd.concat([un_report_asset_df, un_report_profit_df])
|
|
175
|
-
if period == 4 or period == 1:
|
|
176
|
-
last_report_day = str(now_year) + "-05-01"
|
|
177
|
-
elif period == 2:
|
|
178
|
-
last_report_day = str(now_year) + "-07-01"
|
|
179
|
-
elif period == 3:
|
|
180
|
-
last_report_day = str(now_year) + "-10-01"
|
|
181
|
-
max_report_day = trade_date_common_service_api.get_before_trade_date(last_report_day, LATE_REPORT_DAYS)
|
|
182
|
-
if max_report_day >= sync_time:
|
|
183
|
-
|
|
184
|
-
for un_asset_one in un_report_df.itertuples():
|
|
185
|
-
symbol = un_asset_one.symbol
|
|
186
|
-
id_key = symbol + "_" + period_time + "_" + black_list_service_api.FINANCIAL_PROBLEM_NOT_REPORT
|
|
187
|
-
name = un_asset_one.name
|
|
188
|
-
now_date = datetime.now()
|
|
189
|
-
str_day = now_date.strftime('%Y-%m-%d')
|
|
190
|
-
try:
|
|
191
|
-
|
|
192
|
-
black_list_service_api.save_black_stock(id_key,
|
|
193
|
-
symbol,
|
|
194
|
-
name,
|
|
195
|
-
str_day,
|
|
196
|
-
sync_time,
|
|
197
|
-
'未出财报',
|
|
198
|
-
'未出财报',
|
|
199
|
-
'',
|
|
200
|
-
black_list_service_api.FINANCIAL_PROBLEM_NOT_REPORT)
|
|
201
|
-
except Exception as e:
|
|
202
|
-
logger.error("更新未出报告异常:{},{},{}", symbol, period_time, e)
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') + 16
|
|
6
|
-
project_path = file_path[0:end]
|
|
7
|
-
sys.path.append(project_path)
|
|
8
|
-
from datetime import datetime
|
|
9
|
-
|
|
10
|
-
import mns_common.constant.db_name_constant as db_name_constant
|
|
11
|
-
import mns_scheduler.finance.em_financial_profit_sync_service_api as em_financial_profit_sync_service_api
|
|
12
|
-
from mns_common.db.MongodbUtil import MongodbUtil
|
|
13
|
-
from loguru import logger
|
|
14
|
-
import \
|
|
15
|
-
mns_scheduler.finance.em_financial_asset_liability_sync_service_api as em_financial_asset_liability_sync_service_api
|
|
16
|
-
import mns_scheduler.finance.financial_high_risk_stock_clean_service_api as financial_high_risk_stock_clean_service_api
|
|
17
|
-
import mns_common.utils.data_frame_util as data_frame_util
|
|
18
|
-
import mns_scheduler.finance.finance_common_api as finance_common_api
|
|
19
|
-
|
|
20
|
-
mongodb_util = MongodbUtil('27017')
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# 上市公司年报披露时间:每年1月1日一- 4月30日。
|
|
24
|
-
# 2、上市公司中年报披露时间:每年7月1日--8月30日。
|
|
25
|
-
# 3、上市公司季报披露时间:
|
|
26
|
-
# 1季报:每年4月1日-- -4月30日。
|
|
27
|
-
# 2季报(中报) :每年7月1日--8月30日。
|
|
28
|
-
# 3季报:每年10月1日--10月31日4季报(年报) :每年1月1日--4月30日
|
|
29
|
-
|
|
30
|
-
def sync_financial_report():
|
|
31
|
-
now_date = datetime.now()
|
|
32
|
-
now_year = now_date.year
|
|
33
|
-
now_month = now_date.month
|
|
34
|
-
sync_time = now_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
35
|
-
# 年报
|
|
36
|
-
if 1 <= now_month <= 5:
|
|
37
|
-
period = 4
|
|
38
|
-
period_time = str(now_year - 1) + "-12-31 00:00:00"
|
|
39
|
-
sync_profit_report(period_time, sync_time, period)
|
|
40
|
-
sync_asset_liability_report(period_time, sync_time, period)
|
|
41
|
-
|
|
42
|
-
# 一季报
|
|
43
|
-
elif now_month == 5:
|
|
44
|
-
period = 1
|
|
45
|
-
period_time = str(now_year) + "-03-31 00:00:00"
|
|
46
|
-
sync_profit_report(period_time, sync_time, period)
|
|
47
|
-
sync_asset_liability_report(period_time, sync_time, period)
|
|
48
|
-
|
|
49
|
-
# 二季报
|
|
50
|
-
elif 7 <= now_month <= 8:
|
|
51
|
-
period = 2
|
|
52
|
-
period_time = str(now_year) + "-06-30 00:00:00"
|
|
53
|
-
sync_profit_report(period_time, sync_time, period)
|
|
54
|
-
sync_asset_liability_report(period_time, sync_time, period)
|
|
55
|
-
# 三季报
|
|
56
|
-
elif now_month == 10:
|
|
57
|
-
period = 3
|
|
58
|
-
period_time = str(now_year) + "-09-30 00:00:00"
|
|
59
|
-
sync_profit_report(period_time, sync_time, period)
|
|
60
|
-
sync_asset_liability_report(period_time, sync_time, period)
|
|
61
|
-
# 未出报告check
|
|
62
|
-
financial_high_risk_stock_clean_service_api.un_report_check(sync_time, now_year, period, period_time)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# 同步资产表
|
|
66
|
-
def sync_asset_liability_report(period_time, sync_time, period):
|
|
67
|
-
un_report_asset_df = finance_common_api.find_un_report_symbol(period_time,
|
|
68
|
-
db_name_constant.EM_STOCK_ASSET_LIABILITY)
|
|
69
|
-
for un_report_asset_one in un_report_asset_df.itertuples():
|
|
70
|
-
try:
|
|
71
|
-
symbol = un_report_asset_one.symbol
|
|
72
|
-
new_asset_df = em_financial_asset_liability_sync_service_api.get_em_asset_liability_api(symbol)
|
|
73
|
-
# 负债比
|
|
74
|
-
new_asset_df['liability_ratio'] = round(
|
|
75
|
-
new_asset_df['TOTAL_LIABILITIES'] * 100 / new_asset_df['TOTAL_ASSETS'],
|
|
76
|
-
2)
|
|
77
|
-
new_asset_df['sync_time'] = sync_time
|
|
78
|
-
if data_frame_util.is_empty(new_asset_df):
|
|
79
|
-
continue
|
|
80
|
-
new_asset_df['symbol'] = symbol
|
|
81
|
-
mongodb_util.insert_mongo(new_asset_df, db_name_constant.EM_STOCK_ASSET_LIABILITY)
|
|
82
|
-
|
|
83
|
-
# 年报审核
|
|
84
|
-
financial_high_risk_stock_clean_service_api.financial_report_check(new_asset_df, period_time, period,
|
|
85
|
-
db_name_constant.EM_STOCK_ASSET_LIABILITY)
|
|
86
|
-
|
|
87
|
-
except Exception as e:
|
|
88
|
-
logger.error("同步资产表异常:{},{},{}", symbol, period_time, e)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# 同步利润表
|
|
92
|
-
def sync_profit_report(period_time, sync_time, period):
|
|
93
|
-
un_report_profit_df = finance_common_api.find_un_report_symbol(period_time, db_name_constant.EM_STOCK_PROFIT)
|
|
94
|
-
for un_report_profit_one in un_report_profit_df.itertuples():
|
|
95
|
-
try:
|
|
96
|
-
symbol = un_report_profit_one.symbol
|
|
97
|
-
new_profit_df = em_financial_profit_sync_service_api.get_em_profit_api(symbol)
|
|
98
|
-
if data_frame_util.is_empty(new_profit_df):
|
|
99
|
-
continue
|
|
100
|
-
new_profit_df['sync_time'] = sync_time
|
|
101
|
-
|
|
102
|
-
new_profit_df['symbol'] = symbol
|
|
103
|
-
mongodb_util.insert_mongo(new_profit_df, db_name_constant.EM_STOCK_PROFIT)
|
|
104
|
-
|
|
105
|
-
# 年报审核
|
|
106
|
-
financial_high_risk_stock_clean_service_api.financial_report_check(new_profit_df, period_time,
|
|
107
|
-
period, db_name_constant.EM_STOCK_PROFIT)
|
|
108
|
-
except Exception as e:
|
|
109
|
-
logger.error("同步利润表异常:{},{},{}", symbol, period_time, e)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if __name__ == '__main__':
|
|
113
|
-
sync_financial_report()
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') + 17
|
|
6
|
-
project_path = file_path[0:end]
|
|
7
|
-
sys.path.append(project_path)
|
|
8
|
-
from loguru import logger
|
|
9
|
-
from mns_common.db.MongodbUtil import MongodbUtil
|
|
10
|
-
mongodb_util = MongodbUtil('27017')
|
|
11
|
-
|
|
12
|
-
def create_db_index(str_day):
|
|
13
|
-
query_trade_day = {'_id': str_day}
|
|
14
|
-
is_trade_day = mongodb_util.exist_data_query('trade_date_list', query_trade_day)
|
|
15
|
-
if is_trade_day:
|
|
16
|
-
try:
|
|
17
|
-
mongodb_util.create_index('realtime_quotes_now_' + str_day, [("symbol", 1)])
|
|
18
|
-
mongodb_util.create_index('realtime_quotes_now_' + str_day, [("number", 1)])
|
|
19
|
-
mongodb_util.create_index('realtime_quotes_now_' + str_day, [("symbol", 1), ("number", 1)])
|
|
20
|
-
mongodb_util.create_index('realtime_quotes_now_' + str_day, [("str_now_date", 1)])
|
|
21
|
-
logger.info("创建索引成功:{}", str_day)
|
|
22
|
-
except BaseException:
|
|
23
|
-
logger.warning("创建索引异常:{}", )
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if __name__ == '__main__':
|
|
27
|
-
create_db_index("2023-08-11")
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') + 17
|
|
6
|
-
project_path = file_path[0:end]
|
|
7
|
-
sys.path.append(project_path)
|
|
8
|
-
|
|
9
|
-
import datetime
|
|
10
|
-
import mns_common.utils.date_handle_util as date_util
|
|
11
|
-
import mns_common.component.company.company_common_service_api as company_common_service_api
|
|
12
|
-
from loguru import logger
|
|
13
|
-
import mns_common.api.em.east_money_stock_api as east_money_stock_api
|
|
14
|
-
import time
|
|
15
|
-
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
16
|
-
import mns_common.component.data.data_init_api as data_init_api
|
|
17
|
-
import mns_scheduler.real_time.realtime_quotes_now_create_db_index as realtime_quotes_now_create_db_index_api
|
|
18
|
-
import pandas as pd
|
|
19
|
-
from mns_common.db.MongodbUtil import MongodbUtil
|
|
20
|
-
from mns_common.utils.async_fun import async_fun
|
|
21
|
-
import mns_scheduler.trade.auto_sell_service_api as auto_sell_service_api
|
|
22
|
-
import mns_common.constant.db_name_constant as db_name_constant
|
|
23
|
-
import warnings
|
|
24
|
-
|
|
25
|
-
warnings.filterwarnings("ignore")
|
|
26
|
-
|
|
27
|
-
mongodb_util = MongodbUtil('27017')
|
|
28
|
-
order = ["_id",
|
|
29
|
-
"symbol",
|
|
30
|
-
"name",
|
|
31
|
-
"industry",
|
|
32
|
-
"chg",
|
|
33
|
-
"quantity_ratio",
|
|
34
|
-
"amount_level",
|
|
35
|
-
"real_exchange",
|
|
36
|
-
"disk_ratio",
|
|
37
|
-
'real_disk_diff_amount_exchange',
|
|
38
|
-
'max_real_main_inflow_multiple',
|
|
39
|
-
'sum_main_inflow_disk',
|
|
40
|
-
"main_inflow_multiple",
|
|
41
|
-
'super_main_inflow_multiple',
|
|
42
|
-
'disk_diff_amount',
|
|
43
|
-
"disk_diff_amount_exchange",
|
|
44
|
-
"exchange",
|
|
45
|
-
"amount",
|
|
46
|
-
"today_main_net_inflow",
|
|
47
|
-
"today_main_net_inflow_ratio",
|
|
48
|
-
"super_large_order_net_inflow",
|
|
49
|
-
"super_large_order_net_inflow_ratio",
|
|
50
|
-
"large_order_net_inflow",
|
|
51
|
-
"large_order_net_inflow_ratio",
|
|
52
|
-
"super_main_inflow_multiple",
|
|
53
|
-
"up_speed",
|
|
54
|
-
"up_speed_05",
|
|
55
|
-
"now_price",
|
|
56
|
-
"high",
|
|
57
|
-
"low",
|
|
58
|
-
"open",
|
|
59
|
-
"yesterday_price",
|
|
60
|
-
"volume",
|
|
61
|
-
"total_mv",
|
|
62
|
-
"flow_mv",
|
|
63
|
-
"list_date",
|
|
64
|
-
"wei_bi",
|
|
65
|
-
"buy_1_num",
|
|
66
|
-
"sell_1_num",
|
|
67
|
-
"outer_disk",
|
|
68
|
-
"inner_disk",
|
|
69
|
-
"average_price",
|
|
70
|
-
"classification",
|
|
71
|
-
"str_now_date",
|
|
72
|
-
"number"]
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# 实时表移除数据
|
|
76
|
-
@async_fun
|
|
77
|
-
def remove_real_time_data(number, realtime_quotes_db_name):
|
|
78
|
-
if number % 50 == 0:
|
|
79
|
-
remove_query = {'number': {"$lte": number - 50}}
|
|
80
|
-
mongodb_util.remove_data(remove_query, realtime_quotes_db_name)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def remove_real_time_all_data():
|
|
84
|
-
remove_query = {}
|
|
85
|
-
mongodb_util.remove_data(remove_query, db_name_constant.REAL_TIME_QUOTES_NOW)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
# 保存实时表数据
|
|
89
|
-
def save_real_time_quotes(real_time_quotes, now_date, realtime_quotes_db_name, number):
|
|
90
|
-
if 'first_sw_industry' in real_time_quotes.columns:
|
|
91
|
-
real_time_quotes.drop(columns=['first_sw_industry'], inplace=True)
|
|
92
|
-
if 'second_sw_industry' in real_time_quotes.columns:
|
|
93
|
-
real_time_quotes.drop(columns=['second_sw_industry'], inplace=True)
|
|
94
|
-
if 'third_sw_industry' in real_time_quotes.columns:
|
|
95
|
-
real_time_quotes.drop(columns=['third_sw_industry'], inplace=True)
|
|
96
|
-
real_time_quotes.symbol = real_time_quotes.symbol.astype(str)
|
|
97
|
-
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S:%f')
|
|
98
|
-
real_time_quotes['_id'] = real_time_quotes['symbol'] + '-' + str_now_date
|
|
99
|
-
|
|
100
|
-
try:
|
|
101
|
-
|
|
102
|
-
real_time_quotes = real_time_quotes[order]
|
|
103
|
-
real_time_quotes['sum_main_inflow_disk'] = round(real_time_quotes['sum_main_inflow_disk'], 2)
|
|
104
|
-
mongodb_util.insert_mongo(real_time_quotes, realtime_quotes_db_name)
|
|
105
|
-
# 移除现在的数据
|
|
106
|
-
remove_real_time_data(number, realtime_quotes_db_name)
|
|
107
|
-
except BaseException as e:
|
|
108
|
-
logger.error('保存实时数据异常:{}', e)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
# 保存历史表数据
|
|
112
|
-
def save_real_time_quotes_his(real_time_quotes, now_date, realtime_quotes_db_name, number_his):
|
|
113
|
-
if 'first_sw_industry' in real_time_quotes.columns:
|
|
114
|
-
real_time_quotes.drop(columns=['first_sw_industry'], inplace=True)
|
|
115
|
-
if 'second_sw_industry' in real_time_quotes.columns:
|
|
116
|
-
real_time_quotes.drop(columns=['second_sw_industry'], inplace=True)
|
|
117
|
-
if 'third_sw_industry' in real_time_quotes.columns:
|
|
118
|
-
real_time_quotes.drop(columns=['third_sw_industry'], inplace=True)
|
|
119
|
-
real_time_quotes.symbol = real_time_quotes.symbol.astype(str)
|
|
120
|
-
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S:%f')
|
|
121
|
-
real_time_quotes['_id'] = real_time_quotes['symbol'] + '-' + str_now_date
|
|
122
|
-
|
|
123
|
-
try:
|
|
124
|
-
real_time_quotes['number'] = number_his
|
|
125
|
-
|
|
126
|
-
real_time_quotes = real_time_quotes[order]
|
|
127
|
-
mongodb_util.insert_mongo(real_time_quotes, realtime_quotes_db_name)
|
|
128
|
-
except Exception as e:
|
|
129
|
-
logger.error('保存实时历史数据异常:{}', e)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def handle_init_real_time_quotes_data(real_time_quotes_now, str_now_date, number):
|
|
133
|
-
# exclude b symbol
|
|
134
|
-
real_time_quotes_now = common_service_fun_api.exclude_b_symbol(real_time_quotes_now.copy())
|
|
135
|
-
# classification symbol
|
|
136
|
-
real_time_quotes_now = common_service_fun_api.classify_symbol(real_time_quotes_now.copy())
|
|
137
|
-
# fix industry
|
|
138
|
-
real_time_quotes_now = fix_industry_data(real_time_quotes_now.copy())
|
|
139
|
-
# calculate parameter
|
|
140
|
-
real_time_quotes_now = data_init_api.calculate_parameter_factor(real_time_quotes_now.copy())
|
|
141
|
-
|
|
142
|
-
real_time_quotes_now = real_time_quotes_now.loc[real_time_quotes_now['amount'] != 0]
|
|
143
|
-
real_time_quotes_now['str_now_date'] = str_now_date
|
|
144
|
-
real_time_quotes_now['number'] = number
|
|
145
|
-
return real_time_quotes_now
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
# fix 错杀数据 有成交量的数据
|
|
149
|
-
def fix_industry_data(real_time_quotes_now):
|
|
150
|
-
# fix industry
|
|
151
|
-
real_time_quotes_now_r = company_common_service_api.amendment_industry(real_time_quotes_now.copy())
|
|
152
|
-
|
|
153
|
-
symbol_list = list(real_time_quotes_now_r['symbol'])
|
|
154
|
-
|
|
155
|
-
na_real_now = real_time_quotes_now.loc[
|
|
156
|
-
~(real_time_quotes_now['symbol'].isin(symbol_list))]
|
|
157
|
-
|
|
158
|
-
na_real_now = na_real_now.loc[na_real_now['amount'] != 0]
|
|
159
|
-
|
|
160
|
-
real_time_quotes_now_result = pd.concat([real_time_quotes_now_r, na_real_now], axis=0)
|
|
161
|
-
return real_time_quotes_now_result
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
def sync_realtime_quotes():
|
|
165
|
-
# 移除昨日数据
|
|
166
|
-
remove_real_time_all_data()
|
|
167
|
-
|
|
168
|
-
now_date_init = datetime.datetime.now()
|
|
169
|
-
str_day_init = now_date_init.strftime('%Y-%m-%d')
|
|
170
|
-
realtime_quotes_db_name = db_name_constant.REAL_TIME_QUOTES_NOW + "_" + str_day_init
|
|
171
|
-
number_his = common_service_fun_api.realtime_quotes_now_max_number(realtime_quotes_db_name, 'number')
|
|
172
|
-
number_his = number_his + 1
|
|
173
|
-
number = common_service_fun_api.realtime_quotes_now_max_number(
|
|
174
|
-
db_name_constant.REAL_TIME_QUOTES_NOW + '_' + str_day_init, 'number')
|
|
175
|
-
number = number + 1
|
|
176
|
-
realtime_quotes_now_create_db_index_api.create_db_index(str_day_init)
|
|
177
|
-
while True:
|
|
178
|
-
now_date = datetime.datetime.now()
|
|
179
|
-
|
|
180
|
-
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
181
|
-
if bool(date_util.is_trade_time(now_date)):
|
|
182
|
-
try:
|
|
183
|
-
real_time_quotes_now = east_money_stock_api.get_real_time_quotes_all_stocks()
|
|
184
|
-
real_time_quotes_now = handle_init_real_time_quotes_data(real_time_quotes_now.copy(),
|
|
185
|
-
str_now_date, number)
|
|
186
|
-
save_real_time_quotes(real_time_quotes_now.copy(), now_date, db_name_constant.REAL_TIME_QUOTES_NOW,
|
|
187
|
-
number)
|
|
188
|
-
try:
|
|
189
|
-
auto_sell_service_api.auto_sell_stock(real_time_quotes_now.copy())
|
|
190
|
-
except Exception as e:
|
|
191
|
-
logger.error("自动卖出执行异常:{}", e)
|
|
192
|
-
# 集合竞价前同步
|
|
193
|
-
if date_util.is_call_auction(str_now_date):
|
|
194
|
-
if number % 4 == 0:
|
|
195
|
-
save_real_time_quotes_his(real_time_quotes_now.copy(), now_date, realtime_quotes_db_name,
|
|
196
|
-
number_his)
|
|
197
|
-
number_his = number_his + 1
|
|
198
|
-
# 开盘前一个小时同步
|
|
199
|
-
elif date_util.is_begin_one_hour(now_date):
|
|
200
|
-
save_real_time_quotes_his(real_time_quotes_now.copy(), now_date, realtime_quotes_db_name,
|
|
201
|
-
number_his)
|
|
202
|
-
number_his = number_his + 1
|
|
203
|
-
# 下午同步次数
|
|
204
|
-
elif date_util.is_afternoon_time(now_date):
|
|
205
|
-
if number % 3 == 0:
|
|
206
|
-
save_real_time_quotes_his(real_time_quotes_now.copy(), now_date, realtime_quotes_db_name,
|
|
207
|
-
number_his)
|
|
208
|
-
number_his = number_his + 1
|
|
209
|
-
|
|
210
|
-
else:
|
|
211
|
-
# 10:30 到11:30
|
|
212
|
-
if number % 2 == 0:
|
|
213
|
-
save_real_time_quotes_his(real_time_quotes_now.copy(), now_date, realtime_quotes_db_name,
|
|
214
|
-
number_his)
|
|
215
|
-
number_his = number_his + 1
|
|
216
|
-
|
|
217
|
-
logger.info("同步实时行情信息:{}", number)
|
|
218
|
-
number = number + 1
|
|
219
|
-
|
|
220
|
-
except Exception as e:
|
|
221
|
-
number_his = number_his + 1
|
|
222
|
-
number = number + 1
|
|
223
|
-
logger.error("获取实时行情信息:{}", e)
|
|
224
|
-
elif bool(date_util.is_no_trade_time(now_date)):
|
|
225
|
-
|
|
226
|
-
break
|
|
227
|
-
else:
|
|
228
|
-
time.sleep(1)
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if __name__ == '__main__':
|
|
232
|
-
sync_realtime_quotes()
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') + 16
|
|
6
|
-
project_path = file_path[0:end]
|
|
7
|
-
sys.path.append(project_path)
|
|
8
|
-
|
|
9
|
-
# 股权质押 https://data.eastmoney.com/gpzy/pledgeRatio.aspx
|
|
10
|
-
|
|
11
|
-
import requests
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def get_equity_mortgage():
|
|
15
|
-
url = (
|
|
16
|
-
'https://datacenter-web.eastmoney.com/api/data/v1/get?callback=jQuery1123018114616341595302_1715993497168&sortColumns=PLEDGE_RATIO&sortTypes=-1'
|
|
17
|
-
'&pageSize=50000'
|
|
18
|
-
'&pageNumber=1'
|
|
19
|
-
'&reportName=RPT_CSDC_LIST&columns=ALL"eColumns=&source=WEB'
|
|
20
|
-
'&client=WEB'
|
|
21
|
-
'&filter=(TRADE_DATE%3D%272024-05-17%27)')
|
|
22
|
-
|
|
23
|
-
headers = {
|
|
24
|
-
"Content-Type": "application/json"
|
|
25
|
-
}
|
|
26
|
-
r = requests.post(url, headers=headers)
|
|
27
|
-
data_json = r.json()
|
|
28
|
-
print(data_json)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if __name__ == '__main__':
|
|
32
|
-
get_equity_mortgage()
|