mns-scheduler 1.3.1.2__py3-none-any.whl → 1.3.1.6__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.
Potentially problematic release.
This version of mns-scheduler might be problematic. Click here for more details.
- mns_scheduler/baidu/__init__.py +1 -1
- mns_scheduler/baidu/baidu_yun_pan_handle_service.py +2 -2
- mns_scheduler/company_info/announce/__init__.py +1 -1
- mns_scheduler/company_info/announce/company_announce_sync_service.py +1 -1
- mns_scheduler/company_info/base/__init__.py +1 -1
- mns_scheduler/company_info/base/sync_company_hold_info_api.py +1 -1
- mns_scheduler/company_info/clean/__init__.py +1 -1
- mns_scheduler/company_info/clean/company_info_clean_api.py +1 -1
- mns_scheduler/company_info/constant/__init__.py +1 -1
- mns_scheduler/company_info/de_list_stock/__init__.py +1 -1
- mns_scheduler/company_info/de_list_stock/de_list_stock_service.py +1 -1
- mns_scheduler/company_info/em_stock_info/__init__.py +1 -1
- mns_scheduler/company_info/em_stock_info/sync_em_stock_info_sync.py +8 -3
- mns_scheduler/company_info/remark/__init__.py +1 -1
- mns_scheduler/company_info/remark/company_remark_info_sync.py +1 -1
- mns_scheduler/concept/clean/kpl_concept_clean_api.py +1 -1
- mns_scheduler/db/script/__init__.py +1 -1
- mns_scheduler/db/script/col_move_script.py +1 -1
- mns_scheduler/db/script/db_move/__init__.py +1 -1
- mns_scheduler/db/script/db_move/col_move_one_service.py +1 -1
- mns_scheduler/db/script/sync/__init__.py +1 -1
- mns_scheduler/db/script/sync/remote_data_sync_to_local.py +1 -1
- mns_scheduler/db/script/sync/sync_hui_ce_test_data.py +1 -1
- mns_scheduler/db/script/sync/sync_hui_ce_test_data_01.py +1 -1
- mns_scheduler/db/script/update/__init__.py +1 -1
- mns_scheduler/db/script/update/update_col_field.py +1 -1
- mns_scheduler/debt/__init__.py +1 -1
- mns_scheduler/debt/kzz_bond_info_sync.py +1 -1
- mns_scheduler/extraIncome/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/common/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/common/symbol_handle_util.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/etf/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/etf/etf_one_minute_sync_task.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/index/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/index/main_index_sync_task.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/kzz/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/kzz/kzz_one_minute_sync_task.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/one_minute_sync_task.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/stock/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/stock/stock_one_minute_sync_task.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/upload/__init__.py +1 -1
- mns_scheduler/extraIncome/a_stock/one_minute/upload/etf_upload_to_baidu_task.py +95 -0
- mns_scheduler/extraIncome/a_stock/one_minute/upload/index_upload_to_baidu_task.py +87 -0
- mns_scheduler/extraIncome/a_stock/one_minute/upload/kzz_upload_to_baidu_task.py +95 -0
- mns_scheduler/extraIncome/a_stock/one_minute/upload/{upload_to_baidu_task.py → stock_upload_to_baidu_task.py} +4 -2
- mns_scheduler/extraIncome/hk/__init__.py +1 -1
- mns_scheduler/extraIncome/hk/hk_stock_qfq_daily_k_line.py +1 -1
- mns_scheduler/extraIncome/us/__init__.py +1 -1
- mns_scheduler/extraIncome/us/daily/__init__.py +1 -1
- mns_scheduler/extraIncome/us/daily/us_stock_qfq_daily_k_line.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/__init__.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/api/__init__.py +0 -7
- mns_scheduler/extraIncome/us/one_minute/api/alpha_vantage_api.py +2 -2
- mns_scheduler/extraIncome/us/one_minute/api/em_us_one_minute_api.py +139 -0
- mns_scheduler/extraIncome/us/one_minute/api/stock_etf_info_api.py +68 -0
- mns_scheduler/extraIncome/us/one_minute/api/y_finance_api.py +25 -9
- mns_scheduler/extraIncome/us/one_minute/etf/__init__.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/stock/__init__.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/__init__.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/etf/__init__.py +5 -1
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/etf/down_load_ETF_his_2024.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/etf/handle_down_load_fail_ETF.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/stock/{his → down_load/stock}/__init__.py +1 -1
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/stock/down_load_stock_his_01.py +203 -0
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/{down_load_stock_his_2024_02.py → stock/down_load_stock_his_02.py} +65 -16
- mns_scheduler/extraIncome/us/one_minute/stock/down_load/{down_load_stock_his_2024_01.py → stock/down_load_stock_his_2025.py} +10 -11
- mns_scheduler/extraIncome/us/one_minute/stock/now/__init__.py +7 -0
- mns_scheduler/extraIncome/us/one_minute/stock/now/us_etf_one_minute_sync.py +52 -0
- mns_scheduler/extraIncome/us/one_minute/stock/now/us_stock_one_minute_sync.py +141 -0
- mns_scheduler/finance/__init__.py +1 -1
- mns_scheduler/finance/em_financial_asset_liability_sync_service_api.py +1 -1
- mns_scheduler/finance/em_financial_profit_sync_service_api.py +1 -1
- mns_scheduler/finance/finance_common_api.py +1 -1
- mns_scheduler/finance/sync_financial_report_service_api.py +1 -1
- mns_scheduler/hk/__init__.py +1 -1
- mns_scheduler/hk/hk_company_info_sync_service_api.py +1 -1
- mns_scheduler/hk/hk_industry_info_sync_service_api.py +1 -1
- mns_scheduler/industry/__init__.py +1 -1
- mns_scheduler/industry/ths/__init__.py +1 -1
- mns_scheduler/industry/ths/ths_industry_index_service.py +1 -1
- mns_scheduler/industry/ths/ths_industry_sync_service.py +1 -1
- 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 +1 -1
- mns_scheduler/k_line/clean/daily/__init__.py +1 -1
- mns_scheduler/k_line/clean/daily/daily_k_line_clean_common_service.py +1 -1
- mns_scheduler/k_line/clean/daily/daily_k_line_service.py +1 -1
- 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 +1 -1
- mns_scheduler/k_line/clean/week_month/sub_new_week_month_k_line_service.py +1 -1
- 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/test/__init__.py +1 -1
- mns_scheduler/k_line/test/k_line_info_clean_his_data.py +1 -1
- mns_scheduler/k_line/year_quarter/__init__.py +1 -1
- mns_scheduler/k_line/year_quarter/year_quarter_line_sync.py +1 -1
- 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 +1 -1
- mns_scheduler/risk/__init__.py +1 -1
- mns_scheduler/risk/financial/annual_report_audit_check_api.py +1 -1
- mns_scheduler/risk/financial/profit_income_check_api.py +1 -1
- mns_scheduler/risk/financial_report_risk_check_api.py +1 -1
- mns_scheduler/risk/major_violations/register_and_investigate_stock_sync_api.py +1 -1
- mns_scheduler/risk/self/wei_pan_stock_api.py +1 -1
- mns_scheduler/risk/test/__init__.py +1 -1
- mns_scheduler/risk/test/fix_blask_list.py +1 -1
- mns_scheduler/risk/transactions/transactions_check_api.py +1 -1
- mns_scheduler/self_choose/__init__.py +1 -1
- mns_scheduler/self_choose/ths_self_choose_service.py +1 -1
- mns_scheduler/trade/auto_login/trader_auto_service.py +1 -1
- mns_scheduler/trade/auto_sell_service_api.py +2 -2
- mns_scheduler/trade/balance/__init__.py +1 -1
- mns_scheduler/trade/balance/ths_account_balance_service.py +1 -1
- mns_scheduler/trade/sync_position_api.py +1 -1
- mns_scheduler/trade/task/trader_task_service.py +1 -1
- mns_scheduler/trade/tfp/__init__.py +1 -1
- mns_scheduler/trade/tfp/stock_tfp_info_sync.py +1 -1
- mns_scheduler/us/__init__.py +1 -1
- mns_scheduler/us/baidu_yun_pan_handle_service.py +1 -1
- mns_scheduler/us/us_company_info_sync_service_api.py +1 -1
- mns_scheduler/zt/script/__init__.py +1 -1
- mns_scheduler/zt/script/fix_error_deal_day.py +1 -1
- mns_scheduler/zt/script/kcx_high_chg_open_his_data_handle.py +1 -1
- mns_scheduler/zt/script/sync_high_chg_pool_his_data.py +1 -1
- mns_scheduler/zt/script/sync_now_higt_chg_zt.py +1 -1
- mns_scheduler/zt/zt_pool/em_zt_pool_sync_api.py +1 -1
- mns_scheduler/zt/zt_pool/update_null_zt_reason_api.py +1 -1
- mns_scheduler/zz_task/data_sync_task.py +13 -3
- {mns_scheduler-1.3.1.2.dist-info → mns_scheduler-1.3.1.6.dist-info}/METADATA +1 -1
- mns_scheduler-1.3.1.6.dist-info/RECORD +210 -0
- mns_scheduler/extraIncome/us/one_minute/stock/his/us_stock_one_minute_his.py +0 -199
- mns_scheduler/extraIncome/us/one_minute/stock/his/us_stock_one_minute_his_2024.py +0 -212
- mns_scheduler/extraIncome/us/one_minute/stock/us_stock_one_minute_task.py +0 -26
- mns_scheduler-1.3.1.2.dist-info/RECORD +0 -204
- {mns_scheduler-1.3.1.2.dist-info → mns_scheduler-1.3.1.6.dist-info}/WHEEL +0 -0
- {mns_scheduler-1.3.1.2.dist-info → mns_scheduler-1.3.1.6.dist-info}/top_level.txt +0 -0
mns_scheduler/baidu/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import sys
|
|
@@ -11,7 +11,7 @@ import json
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
file_path = os.path.abspath(__file__)
|
|
14
|
-
end = file_path.index('mns') +
|
|
14
|
+
end = file_path.index('mns') + 17
|
|
15
15
|
project_path = file_path[0:end]
|
|
16
16
|
sys.path.append(project_path)
|
|
17
17
|
from bypy import ByPy
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_common.component.company.company_common_service_new_api as company_common_service_new_api
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_common.api.ths.company.ths_company_info_api as ths_company_info_api
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import datetime
|
|
@@ -13,10 +13,11 @@ import mns_common.api.em.real_time.east_money_stock_a_v2_api as east_money_stock
|
|
|
13
13
|
import mns_common.api.em.real_time.east_money_debt_api as east_money_debt_api
|
|
14
14
|
import mns_common.api.em.real_time.east_money_etf_api as east_money_etf_api
|
|
15
15
|
import mns_common.api.em.real_time.east_money_stock_hk_api as east_money_stock_hk_api
|
|
16
|
-
import mns_common.api.em.real_time.east_money_stock_us_api as east_money_stock_us_api
|
|
17
16
|
import mns_common.constant.db_name_constant as db_name_constant
|
|
18
17
|
import mns_common.component.cookie.cookie_info_service as cookie_info_service
|
|
19
18
|
|
|
19
|
+
import mns_common.api.em.real_time.east_money_stock_us_api as east_money_stock_us_api
|
|
20
|
+
|
|
20
21
|
mongodb_util = MongodbUtil('27017')
|
|
21
22
|
|
|
22
23
|
|
|
@@ -57,6 +58,7 @@ def sync_all_em_stock_info():
|
|
|
57
58
|
logger.error("同步东方财富港股信息异常:{}", e)
|
|
58
59
|
|
|
59
60
|
try:
|
|
61
|
+
em_cookie = cookie_info_service.get_em_cookie()
|
|
60
62
|
em_us_stock_info = east_money_stock_us_api.get_us_stock_real_time_quotes(em_cookie, proxies)
|
|
61
63
|
em_us_stock_info['_id'] = em_us_stock_info['symbol']
|
|
62
64
|
mongodb_util.save_mongo(em_us_stock_info, db_name_constant.EM_US_STOCK_INFO)
|
|
@@ -66,4 +68,7 @@ def sync_all_em_stock_info():
|
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
if __name__ == '__main__':
|
|
69
|
-
|
|
71
|
+
em_cookie = cookie_info_service.get_em_cookie()
|
|
72
|
+
em_us_stock_info = east_money_stock_us_api.get_us_stock_real_time_quotes(em_cookie, None)
|
|
73
|
+
em_us_stock_info['_id'] = em_us_stock_info['symbol']
|
|
74
|
+
mongodb_util.save_mongo(em_us_stock_info, db_name_constant.EM_US_STOCK_INFO)
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_common.api.ths.concept.web.ths_company_info_web as ths_company_info_web
|
mns_scheduler/debt/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_common.api.em.real_time.east_money_debt_api as east_money_debt_api
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_common.constant.extra_income_db_name as extra_income_db_name
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_scheduler.extraIncome.a_stock.one_minute.index.main_index_sync_task as main_index_sync_task
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
import sys
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
file_path = os.path.abspath(__file__)
|
|
12
|
+
end = file_path.index('mns') + 17
|
|
13
|
+
project_path = file_path[0:end]
|
|
14
|
+
sys.path.append(project_path)
|
|
15
|
+
from mns_common.db.MongodbUtil import MongodbUtil
|
|
16
|
+
from loguru import logger
|
|
17
|
+
import mns_scheduler.baidu.baidu_yun_pan_handle_service as baidu_yun_pan_handle_service
|
|
18
|
+
from mns_common.db.v2.MongodbUtilV2 import MongodbUtilV2
|
|
19
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
import mns_common.constant.extra_income_db_name as extra_income_db_name
|
|
22
|
+
import mns_common.component.em.em_stock_info_api as em_stock_info_api
|
|
23
|
+
|
|
24
|
+
mongodb_util = MongodbUtil('27017')
|
|
25
|
+
mongodbUtilV2_27019 = MongodbUtilV2('27019', extra_income_db_name.EXTRA_INCOME)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def upload_etf_to_baidu():
|
|
29
|
+
a_stock_path = '/A股/ETF/'
|
|
30
|
+
|
|
31
|
+
now_date_time = datetime.now()
|
|
32
|
+
now_year = now_date_time.year
|
|
33
|
+
month = now_date_time.month
|
|
34
|
+
a_stock_path = a_stock_path + str(now_year) + '/' + str(month)
|
|
35
|
+
# 创建路径
|
|
36
|
+
baidu_yun_pan_handle_service.mkdir_baidu_new_folder(a_stock_path)
|
|
37
|
+
em_a_etf_info_df = em_stock_info_api.get_etf_info()
|
|
38
|
+
|
|
39
|
+
em_a_etf_info_df = classify_symbol(em_a_etf_info_df)
|
|
40
|
+
|
|
41
|
+
em_a_etf_info_df['symbol'] = em_a_etf_info_df.apply(
|
|
42
|
+
lambda row: row['symbol'] + '.SZ' if row['classification'] in ['S', 'C']
|
|
43
|
+
else row['symbol'] + '.BJ' if row['classification'] in ['X']
|
|
44
|
+
else row['symbol'] + '.SH',
|
|
45
|
+
axis=1
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
file_folder_df = baidu_yun_pan_handle_service.get_file_folder(a_stock_path)
|
|
49
|
+
if data_frame_util.is_not_empty(file_folder_df):
|
|
50
|
+
# 去除文件名中的 .csv 后缀
|
|
51
|
+
file_folder_df['name'] = file_folder_df['name'].str.replace(r'\.csv$', '', regex=True)
|
|
52
|
+
em_a_etf_info_df = em_a_etf_info_df.loc[~(em_a_etf_info_df['symbol'].isin(file_folder_df['name']))]
|
|
53
|
+
fail_list = []
|
|
54
|
+
for stock_one in em_a_etf_info_df.itertuples():
|
|
55
|
+
symbol = stock_one.symbol
|
|
56
|
+
name = stock_one.name
|
|
57
|
+
try:
|
|
58
|
+
|
|
59
|
+
col_name = extra_income_db_name.ONE_MINUTE_K_LINE_BFQ_ETF + '_' + str(now_year)
|
|
60
|
+
|
|
61
|
+
if month < 10:
|
|
62
|
+
month_str = '0' + str(month)
|
|
63
|
+
else:
|
|
64
|
+
month_str = str(month)
|
|
65
|
+
begin_time = str(now_year) + '-' + month_str + '-01 09:00:00'
|
|
66
|
+
query = {'symbol': symbol, 'time': {"$gte": begin_time}}
|
|
67
|
+
one_minute_k_line_bfq_df = mongodbUtilV2_27019.find_query_data(col_name, query)
|
|
68
|
+
if data_frame_util.is_not_empty(one_minute_k_line_bfq_df):
|
|
69
|
+
one_minute_k_line_bfq_df = one_minute_k_line_bfq_df.sort_values(by=['time'], ascending=True)
|
|
70
|
+
del one_minute_k_line_bfq_df['_id']
|
|
71
|
+
del one_minute_k_line_bfq_df['symbol']
|
|
72
|
+
result = baidu_yun_pan_handle_service.upload_to_baidu(symbol, a_stock_path, one_minute_k_line_bfq_df)
|
|
73
|
+
if result != 0:
|
|
74
|
+
fail_list.append(symbol)
|
|
75
|
+
except BaseException as e:
|
|
76
|
+
fail_list.append(symbol)
|
|
77
|
+
logger.error("上传数据异常:{}", e)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def classify_symbol(etf_real_time_quotes):
|
|
81
|
+
etf_real_time_quotes['classification'] = etf_real_time_quotes['market'].apply(
|
|
82
|
+
lambda market: classify_symbol_one(market))
|
|
83
|
+
return etf_real_time_quotes
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# 单个股票分类
|
|
87
|
+
def classify_symbol_one(market):
|
|
88
|
+
if market == 0:
|
|
89
|
+
return 'S'
|
|
90
|
+
else:
|
|
91
|
+
return 'H'
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if __name__ == '__main__':
|
|
95
|
+
upload_etf_to_baidu()
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
from mns_common.db.MongodbUtil import MongodbUtil
|
|
10
|
+
from loguru import logger
|
|
11
|
+
import mns_scheduler.baidu.baidu_yun_pan_handle_service as baidu_yun_pan_handle_service
|
|
12
|
+
from mns_common.db.v2.MongodbUtilV2 import MongodbUtilV2
|
|
13
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
14
|
+
from datetime import datetime
|
|
15
|
+
import mns_common.constant.extra_income_db_name as extra_income_db_name
|
|
16
|
+
|
|
17
|
+
mongodb_util = MongodbUtil('27017')
|
|
18
|
+
mongodbUtilV2_27019 = MongodbUtilV2('27019', extra_income_db_name.EXTRA_INCOME)
|
|
19
|
+
|
|
20
|
+
main_index_list = [
|
|
21
|
+
"000001.SH",
|
|
22
|
+
"000016.SH",
|
|
23
|
+
"000010.SH",
|
|
24
|
+
"000009.SH",
|
|
25
|
+
"000015.SH",
|
|
26
|
+
"399001.SZ",
|
|
27
|
+
"399004.SZ",
|
|
28
|
+
"399005.SZ",
|
|
29
|
+
"399006.SZ",
|
|
30
|
+
"000300.SH",
|
|
31
|
+
"000905.SH",
|
|
32
|
+
"000688.SH",
|
|
33
|
+
"000903.SH",
|
|
34
|
+
"000906.SH",
|
|
35
|
+
"000852.SH",
|
|
36
|
+
"000932.SH",
|
|
37
|
+
"000933.SH",
|
|
38
|
+
"980017.SZ",
|
|
39
|
+
"399808.SZ",
|
|
40
|
+
"399997.SZ",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def upload_index_to_baidu():
|
|
45
|
+
a_stock_path = '/A股/主要指数/'
|
|
46
|
+
|
|
47
|
+
now_date_time = datetime.now()
|
|
48
|
+
now_year = now_date_time.year
|
|
49
|
+
month = now_date_time.month
|
|
50
|
+
a_stock_path = a_stock_path + str(now_year) + '/' + str(month)
|
|
51
|
+
# 创建路径
|
|
52
|
+
baidu_yun_pan_handle_service.mkdir_baidu_new_folder(a_stock_path)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
fail_list = []
|
|
59
|
+
for symbol in main_index_list:
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
|
|
63
|
+
col_name = extra_income_db_name.ONE_MINUTE_K_LINE_BFQ_MAIN_INDEX + '_' + str(now_year)
|
|
64
|
+
|
|
65
|
+
if month < 10:
|
|
66
|
+
month_str = '0' + str(month)
|
|
67
|
+
else:
|
|
68
|
+
month_str = str(month)
|
|
69
|
+
begin_time = str(now_year) + '-' + month_str + '-01 09:00:00'
|
|
70
|
+
query = {'symbol': symbol, 'time': {"$gte": begin_time}}
|
|
71
|
+
one_minute_k_line_bfq_df = mongodbUtilV2_27019.find_query_data(col_name, query)
|
|
72
|
+
if data_frame_util.is_not_empty(one_minute_k_line_bfq_df):
|
|
73
|
+
one_minute_k_line_bfq_df = one_minute_k_line_bfq_df.sort_values(by=['time'], ascending=True)
|
|
74
|
+
del one_minute_k_line_bfq_df['_id']
|
|
75
|
+
del one_minute_k_line_bfq_df['symbol']
|
|
76
|
+
result = baidu_yun_pan_handle_service.upload_to_baidu(symbol, a_stock_path, one_minute_k_line_bfq_df)
|
|
77
|
+
if result != 0:
|
|
78
|
+
fail_list.append(symbol)
|
|
79
|
+
except BaseException as e:
|
|
80
|
+
fail_list.append(symbol)
|
|
81
|
+
logger.error("上传数据异常:{}", e)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if __name__ == '__main__':
|
|
87
|
+
upload_index_to_baidu()
|