mns-common 1.4.1.8__py3-none-any.whl → 1.5.7.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_common/api/akshare/__init__.py +0 -1
- mns_common/api/akshare/k_line_api.py +19 -2
- mns_common/api/akshare/stock_bid_ask_api.py +10 -3
- mns_common/api/akshare/stock_zb_pool.py +2 -0
- mns_common/api/akshare/stock_zt_pool_api.py +1 -1
- mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +62 -7
- mns_common/api/em/real_time/__init__.py +1 -1
- mns_common/api/em/real_time/east_money_debt_api.py +140 -70
- mns_common/api/em/real_time/east_money_etf_api.py +138 -27
- mns_common/api/em/real_time/east_money_stock_a_api.py +24 -28
- mns_common/api/em/real_time/east_money_stock_a_v2_api.py +97 -53
- mns_common/api/em/real_time/east_money_stock_common_api.py +174 -0
- mns_common/api/em/real_time/east_money_stock_hk_api.py +223 -272
- mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +260 -0
- mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +154 -0
- mns_common/api/em/real_time/east_money_stock_us_api.py +146 -82
- mns_common/api/em/real_time/real_time_quotes_repeat_api.py +195 -0
- mns_common/api/k_line/stock_k_line_data_api.py +11 -1
- mns_common/api/kpl/common/kpl_common_api.py +35 -0
- mns_common/api/proxies/liu_guan_proxy_api.py +55 -5
- mns_common/api/ths/company/company_product_area_industry_index_query.py +46 -0
- mns_common/api/ths/company/ths_company_info_api.py +2 -1
- mns_common/api/ths/company/ths_company_info_web.py +159 -0
- mns_common/api/ths/concept/app/ths_concept_index_app.py +3 -1
- mns_common/api/ths/wen_cai/ths_wen_cai_api.py +1 -1
- mns_common/api/ths/zt/ths_stock_zt_pool_api.py +20 -1
- mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +105 -29
- mns_common/api/xueqiu/xue_qiu_k_line_api.py +2 -2
- mns_common/component/common_service_fun_api.py +26 -6
- mns_common/component/data/data_init_api.py +13 -8
- mns_common/component/deal/deal_service_api.py +70 -8
- mns_common/component/deal/deal_service_v2_api.py +167 -0
- mns_common/component/em/em_stock_info_api.py +9 -3
- mns_common/component/main_line/main_line_zt_reason_service.py +237 -0
- mns_common/component/proxies/proxy_common_api.py +141 -45
- mns_common/component/us/us_stock_etf_info_api.py +125 -0
- mns_common/constant/db_name_constant.py +40 -16
- mns_common/constant/extra_income_db_name.py +79 -19
- mns_common/constant/strategy_classify.py +17 -2
- mns_common/db/MongodbUtil.py +3 -0
- mns_common/db/MongodbUtilLocal.py +3 -0
- {mns_common-1.4.1.8.dist-info → mns_common-1.5.7.2.dist-info}/METADATA +1 -1
- {mns_common-1.4.1.8.dist-info → mns_common-1.5.7.2.dist-info}/RECORD +47 -41
- mns_common/api/ths/concept/web/ths_company_info_web.py +0 -163
- mns_common/component/qmt/qmt_buy_service.py +0 -172
- mns_common/component/task/real_time_data_sync_check.py +0 -110
- /mns_common/component/{qmt → main_line}/__init__.py +0 -0
- /mns_common/component/{task → us}/__init__.py +0 -0
- {mns_common-1.4.1.8.dist-info → mns_common-1.5.7.2.dist-info}/WHEEL +0 -0
- {mns_common-1.4.1.8.dist-info → mns_common-1.5.7.2.dist-info}/top_level.txt +0 -0
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
mns_common/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
2
2
|
mns_common/api/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
3
|
-
mns_common/api/akshare/__init__.py,sha256=
|
|
4
|
-
mns_common/api/akshare/k_line_api.py,sha256=
|
|
5
|
-
mns_common/api/akshare/stock_bid_ask_api.py,sha256=
|
|
3
|
+
mns_common/api/akshare/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
4
|
+
mns_common/api/akshare/k_line_api.py,sha256=IfqJDG2e-_Ry1f_MqjIff6jad9IIC3TjnpmaJ9H_pbk,4290
|
|
5
|
+
mns_common/api/akshare/stock_bid_ask_api.py,sha256=Af9t6Pv_-p7PJJ_7rF_JVaGBomkvePMMqALwuBh2Gfw,4139
|
|
6
6
|
mns_common/api/akshare/stock_dt_pool.py,sha256=sKedOTzqsBZprJHJEr2sRYa8xbeSK7tRenqBE3wOdUc,2245
|
|
7
|
-
mns_common/api/akshare/stock_zb_pool.py,sha256=
|
|
8
|
-
mns_common/api/akshare/stock_zt_pool_api.py,sha256
|
|
7
|
+
mns_common/api/akshare/stock_zb_pool.py,sha256=3v1aLwMfnL51puVh8n6q_Xr9YYlrQDieaqMywAdJ0rE,2262
|
|
8
|
+
mns_common/api/akshare/stock_zt_pool_api.py,sha256=-j_GZI3TTPV8XWnczgGjct5XZAHZdlptBcECv7Rfyzw,1929
|
|
9
9
|
mns_common/api/akshare/yjyg_sync_api.py,sha256=cvk50_XhJWUqduOiC15SYvQTCQqECt6td_L2Hvnl7Jg,4108
|
|
10
10
|
mns_common/api/em/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
11
11
|
mns_common/api/em/concept/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
12
12
|
mns_common/api/em/concept/em_concept_index_api.py,sha256=PP87ES8a_y0o3SKLzBsPrc7DCPI3MBCD-4SmoUUirl0,8285
|
|
13
13
|
mns_common/api/em/gd/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
14
|
-
mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py,sha256=
|
|
15
|
-
mns_common/api/em/real_time/__init__.py,sha256=
|
|
16
|
-
mns_common/api/em/real_time/east_money_debt_api.py,sha256=
|
|
17
|
-
mns_common/api/em/real_time/east_money_etf_api.py,sha256=
|
|
18
|
-
mns_common/api/em/real_time/east_money_stock_a_api.py,sha256=
|
|
19
|
-
mns_common/api/em/real_time/east_money_stock_a_v2_api.py,sha256=
|
|
20
|
-
mns_common/api/em/real_time/
|
|
21
|
-
mns_common/api/em/real_time/
|
|
14
|
+
mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py,sha256=I2-JjFjTjvOxjNAPzuJ1GK7ynvwJcZa_EbmRB2_pmm0,11813
|
|
15
|
+
mns_common/api/em/real_time/__init__.py,sha256=itoGlqKhsx7EVXQoD1vchDKQ5GPB16vDjofTSuQtrXg,161
|
|
16
|
+
mns_common/api/em/real_time/east_money_debt_api.py,sha256=L9r7PKUusspEAPZ_YHp1Gx7KIJF0UGZuyTjLzVzgGRc,16004
|
|
17
|
+
mns_common/api/em/real_time/east_money_etf_api.py,sha256=856qjcq4asHvpiZklDqMkBsm1s3dG6b4OrmcPSgCDso,18738
|
|
18
|
+
mns_common/api/em/real_time/east_money_stock_a_api.py,sha256=L0qixU0-1jb8bO2FVQakJmiV3Dabw0biVAa94GpVnWs,12455
|
|
19
|
+
mns_common/api/em/real_time/east_money_stock_a_v2_api.py,sha256=5TcnKGcjTj1ZZ2RFLOT1uvY5KqrILEB56tq3fuABH28,17123
|
|
20
|
+
mns_common/api/em/real_time/east_money_stock_common_api.py,sha256=_jZKWIHpcf7pu5X5S4Lp_m9-LIsULMLNmY1LjG78kag,8325
|
|
21
|
+
mns_common/api/em/real_time/east_money_stock_hk_api.py,sha256=U51Hg5dJJtOQuYiVlgkH_X-1qWZpOPuT-LXOp3ZBdp4,13333
|
|
22
|
+
mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py,sha256=GEialRF41hnZWBL4ueESM7MMl0U_ARAoNSt2popOAEU,8248
|
|
23
|
+
mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py,sha256=uGBq81e7uBbNLuKxu8tXCS3F5u5C0_IgXrYite47Fpk,5872
|
|
24
|
+
mns_common/api/em/real_time/east_money_stock_us_api.py,sha256=vtcLCVhBY3d-A9czeTnamITrMYuEX91v9NRXNxLQotU,16567
|
|
25
|
+
mns_common/api/em/real_time/real_time_quotes_repeat_api.py,sha256=llnY1nIkcF3dsxUy8B40cHIglklNvlh5_fvC26R57Bk,7597
|
|
22
26
|
mns_common/api/hk/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
23
27
|
mns_common/api/hk/ths_hk_company_info_api.py,sha256=Cxlbuccopa0G1s8o0uTnnyLn2QaxOvbDpJQJOj7J8a8,5360
|
|
24
28
|
mns_common/api/k_line/__init__.py,sha256=itoGlqKhsx7EVXQoD1vchDKQ5GPB16vDjofTSuQtrXg,161
|
|
25
|
-
mns_common/api/k_line/stock_k_line_data_api.py,sha256=
|
|
29
|
+
mns_common/api/k_line/stock_k_line_data_api.py,sha256=eR9fd4xbXcNKIT-pDMbgnQMUA1cpueRmzPwl6jnWJW8,3720
|
|
26
30
|
mns_common/api/k_line/stock_minute_data_api.py,sha256=FNe9I_lvgdyEsKQVzdA0vZ5CWeB-KGtJiCpj0YPRuwY,5322
|
|
27
31
|
mns_common/api/kpl/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
28
32
|
mns_common/api/kpl/common/__init__.py,sha256=8b2PuXJM5fLoq71cWPXp695czQuaRtyR6OVHajGjDPc,161
|
|
29
|
-
mns_common/api/kpl/common/kpl_common_api.py,sha256=
|
|
33
|
+
mns_common/api/kpl/common/kpl_common_api.py,sha256=ZcLq60pQ1_57JsQRaVo3J0lq2ra4CP3TfxOQY3pTOC4,5650
|
|
30
34
|
mns_common/api/kpl/common/kpl_common_field_constant.py,sha256=HVAE2zKU1inXbx_W_901KO3MdRjax7cLnhhvmLIT1LY,4754
|
|
31
35
|
mns_common/api/kpl/concept/__init__.py,sha256=8b2PuXJM5fLoq71cWPXp695czQuaRtyR6OVHajGjDPc,161
|
|
32
36
|
mns_common/api/kpl/concept/kpl_concept_api.py,sha256=_Ks_yqLzx8TqqbMFj51_nyfBT7C0y855_Kg_jObHQRw,607
|
|
@@ -43,37 +47,38 @@ mns_common/api/kpl/symbol/symbol_his_quotes_api.py,sha256=5F9L8V2UI_YUYe2dO6FbVK
|
|
|
43
47
|
mns_common/api/msg/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
44
48
|
mns_common/api/msg/push_msg_api.py,sha256=z8jDqFWygfxnCFFfQp4K-llgg27nRLv7Mx72lOddBH0,1390
|
|
45
49
|
mns_common/api/proxies/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
46
|
-
mns_common/api/proxies/liu_guan_proxy_api.py,sha256=
|
|
50
|
+
mns_common/api/proxies/liu_guan_proxy_api.py,sha256=MLoq13xT0uffqUWSCemTwQZlF20YC7EIcr3PFeY8_p8,3762
|
|
47
51
|
mns_common/api/qmt/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
48
52
|
mns_common/api/qmt/qmt_minunte_tick_data.py,sha256=uwSw_AkA9RaD3pXPKzxqi4TKEkpglmFUwtYl9r5E6G8,3019
|
|
49
53
|
mns_common/api/ths/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
50
54
|
mns_common/api/ths/big_deal/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
51
55
|
mns_common/api/ths/big_deal/ths_big_deal_api.py,sha256=gxtIUbowxx8gDJZfT2RISrhXVmvsgbdclYbxUiZsTlY,3644
|
|
52
56
|
mns_common/api/ths/company/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
57
|
+
mns_common/api/ths/company/company_product_area_industry_index_query.py,sha256=Jhuc9wYQPDl2crudZYfaI1-ALSW0-5rO-ElLC32_tqg,1961
|
|
53
58
|
mns_common/api/ths/company/ths_company_announce_api.py,sha256=10N_FmtqqKwRNP_l-KrZHG90Sd73U6xOT_zz7S5vxp0,2209
|
|
54
|
-
mns_common/api/ths/company/ths_company_info_api.py,sha256=
|
|
59
|
+
mns_common/api/ths/company/ths_company_info_api.py,sha256=7Wt6VYlRUmyXo2e8tyh00_K9GbrGrlR6vvYpIhuUL_c,9575
|
|
60
|
+
mns_common/api/ths/company/ths_company_info_web.py,sha256=sD_qa3CSXKcuRG3N_3-rzrKn08yKrUxbiZ6DnL3jQ6w,7153
|
|
55
61
|
mns_common/api/ths/concept/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
56
62
|
mns_common/api/ths/concept/app/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
57
63
|
mns_common/api/ths/concept/app/ths_concept_detail_app.py,sha256=cDme8_AFCY24YC9nSw9gUNjGqjbEHd2k-rK0zmLW3Rc,7087
|
|
58
|
-
mns_common/api/ths/concept/app/ths_concept_index_app.py,sha256=
|
|
64
|
+
mns_common/api/ths/concept/app/ths_concept_index_app.py,sha256=fRhDjjyvEHBiYFvOvz4fIjElS4ZztajjFmzUZJzLhbQ,8267
|
|
59
65
|
mns_common/api/ths/concept/web/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
60
66
|
mns_common/api/ths/concept/web/ths_common_js_api.py,sha256=ekU9BtSX0xFkeFDVn9QQG_qgQXhpSmZKGKpgkDbeYk4,381
|
|
61
|
-
mns_common/api/ths/concept/web/ths_company_info_web.py,sha256=7FBnUA0R5FtyssSEZJKmYuukQL-UGPN843tPQaEvMOE,7731
|
|
62
67
|
mns_common/api/ths/concept/web/ths_concept_detail_web.py,sha256=KM0aeouVeVYrewSSqqLUGWybv2LTL-1GYI7Tprfks_U,7139
|
|
63
68
|
mns_common/api/ths/concept/web/ths_concept_index_web.py,sha256=zULAWpnmpnwc2MOZt7fiMHuAFoJZoln50dunWCGCvHY,7300
|
|
64
69
|
mns_common/api/ths/self_choose/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
65
70
|
mns_common/api/ths/self_choose/ths_self_choose_api.py,sha256=TkV4r8iRkgcm4OaclUTTJ19TNNiO0z_DbIFkc-G_wFc,6012
|
|
66
71
|
mns_common/api/ths/wen_cai/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
67
|
-
mns_common/api/ths/wen_cai/ths_wen_cai_api.py,sha256=
|
|
72
|
+
mns_common/api/ths/wen_cai/ths_wen_cai_api.py,sha256=e_HoW_MVpYLIUSnClTCA9U2QJ5o1GGge6ZIPrs93zLs,4947
|
|
68
73
|
mns_common/api/ths/zt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
|
-
mns_common/api/ths/zt/ths_stock_zt_pool_api.py,sha256=
|
|
70
|
-
mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py,sha256=
|
|
74
|
+
mns_common/api/ths/zt/ths_stock_zt_pool_api.py,sha256=p60HEkppR2WVSs6W7afROcOHUrx-GY0JfuWj2p4ub9o,11294
|
|
75
|
+
mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py,sha256=CkJIzhzaBZ0gssqWtfOTI0hZbNTcz5rcqbaD0gR55MM,20005
|
|
71
76
|
mns_common/api/us/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
72
77
|
mns_common/api/us/ths_us_company_info_api.py,sha256=qQjv4F-ovQ2uuu-FlBAnxjvVA7qj9y_x5WZtUoyoEW4,241
|
|
73
78
|
mns_common/api/xueqiu/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
74
|
-
mns_common/api/xueqiu/xue_qiu_k_line_api.py,sha256=
|
|
79
|
+
mns_common/api/xueqiu/xue_qiu_k_line_api.py,sha256=yABuo5AsJRj6ElXkq8Xzwe-LIWzS0fo-g2fJtzLswoA,3535
|
|
75
80
|
mns_common/component/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
76
|
-
mns_common/component/common_service_fun_api.py,sha256=
|
|
81
|
+
mns_common/component/common_service_fun_api.py,sha256=cVPG3dzn1XKvjmmeaWHRPbC_mzGoxeC2ffo45FBEIqY,7259
|
|
77
82
|
mns_common/component/cache/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
78
83
|
mns_common/component/cache/cache_service.py,sha256=QX7tjR1iGsoCyGt6O41w8aRbZ-3xXQ-53Ps3nmUzAGQ,809
|
|
79
84
|
mns_common/component/classify/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
@@ -89,13 +94,14 @@ mns_common/component/cookie/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94
|
|
|
89
94
|
mns_common/component/cookie/cookie_enum.py,sha256=O4-cEhJI7EibdtVo83kfBKKAXj31WmdWHSzQV0F3FDM,373
|
|
90
95
|
mns_common/component/cookie/cookie_info_service.py,sha256=j2xfo5Pzfzp3_ILkY2K9b2W_rys7lB1IhGm8jHKRxF0,924
|
|
91
96
|
mns_common/component/data/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
92
|
-
mns_common/component/data/data_init_api.py,sha256=
|
|
97
|
+
mns_common/component/data/data_init_api.py,sha256=VFPmjk_Js16q42l3h1o__6DU1Dpnbf0BJlCBksU12q8,5355
|
|
93
98
|
mns_common/component/deal/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
94
|
-
mns_common/component/deal/deal_service_api.py,sha256=
|
|
99
|
+
mns_common/component/deal/deal_service_api.py,sha256=tfMYFq7cAsTmlVnG8cLOkp4TLT62U4dwFdt7dQFNyJo,5594
|
|
100
|
+
mns_common/component/deal/deal_service_v2_api.py,sha256=QmiMQeaCGV8Izuilihp_1_h3s2rCQUg8Lf6Qay5qX3A,4184
|
|
95
101
|
mns_common/component/deal/terminal_enum.py,sha256=JUkSTXLQW1fob05PCCzIBg_VKlGmqaJEa0GOvrQH6e0,275
|
|
96
102
|
mns_common/component/em/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
97
103
|
mns_common/component/em/em_real_time_quotes_api.py,sha256=9VAwzj_am-Jd4zG57bhrVjXrrsytzymSu8CIs7T7Lc0,2144
|
|
98
|
-
mns_common/component/em/em_stock_info_api.py,sha256=
|
|
104
|
+
mns_common/component/em/em_stock_info_api.py,sha256=5efmntSKUgLBBHG_1q328oWbk4WYrrdF8H3F4AR2UCA,1379
|
|
99
105
|
mns_common/component/exception/ExceptionMonitor.py,sha256=Ma8DsXcU357ni0l_PAFhRZ-nxghiVvnUWE3vu_UeqSk,2731
|
|
100
106
|
mns_common/component/exception/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
101
107
|
mns_common/component/hk/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
@@ -111,12 +117,12 @@ mns_common/component/k_line/common/k_line_common_service_api.py,sha256=UODqzK3eA
|
|
|
111
117
|
mns_common/component/k_line/patterns/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
112
118
|
mns_common/component/k_line/patterns/k_line_patterns_service_api.py,sha256=C5mg49OhACILto657H513sg1-lOmYlgCXl7y_Gw88ro,1809
|
|
113
119
|
mns_common/component/k_line/patterns/pattern_Enum.py,sha256=bl8cH1H3BWdj_deVO124oSGYMPUtDQWvqqWk_5rf5rQ,509
|
|
120
|
+
mns_common/component/main_line/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
121
|
+
mns_common/component/main_line/main_line_zt_reason_service.py,sha256=rreEYoOs7iZxhdNr0dQCU1aeovZYTqIZKsnFUkbXB04,10552
|
|
114
122
|
mns_common/component/price/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
115
123
|
mns_common/component/price/trade_price_service_api.py,sha256=0loBjbOt__o-ngc2Q4n5lF8_0x2WINRpL-cH1341Uaw,4396
|
|
116
124
|
mns_common/component/proxies/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
117
|
-
mns_common/component/proxies/proxy_common_api.py,sha256=
|
|
118
|
-
mns_common/component/qmt/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
119
|
-
mns_common/component/qmt/qmt_buy_service.py,sha256=tLTgrSxCcxuMhADRBBrW4ZWR_3MdbMZvvMdH5hbwyJU,7190
|
|
125
|
+
mns_common/component/proxies/proxy_common_api.py,sha256=ij7a9ea1YhVJcNcDPUsy2wfSG4fWrpZHvK8FJGbk3AU,8264
|
|
120
126
|
mns_common/component/real_time/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
121
127
|
mns_common/component/real_time/real_time_common_service_api.py,sha256=Sq9OBC4ZZq9X7CaK09tmUMaXF7xibcyzrX0LOimxAzk,1378
|
|
122
128
|
mns_common/component/redis_msg/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
@@ -124,25 +130,25 @@ mns_common/component/redis_msg/redis_msg_publish_service.py,sha256=jcNEfQpARCPyl
|
|
|
124
130
|
mns_common/component/self_choose/__init__.py,sha256=voLVczBLoJxYDgDvbh9AGbYT30OnRMwew59pHx2r2fE,513
|
|
125
131
|
mns_common/component/self_choose/black_list_service_api.py,sha256=BUySMNHDM3OzXe3g7WGola8_yGZ0ub_fjHj7e6-eB7s,1993
|
|
126
132
|
mns_common/component/self_choose/self_choose_service_api.py,sha256=v-ThYn5OMva-ciawOFaGi_joxDzLp5HYUHuIP7wz5Z8,1456
|
|
127
|
-
mns_common/component/task/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
128
|
-
mns_common/component/task/real_time_data_sync_check.py,sha256=GYh1nRuu3-WW6osEPCoCmcArAbbTtMaygbTwQPO5P18,3920
|
|
129
133
|
mns_common/component/tfp/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
130
134
|
mns_common/component/tfp/stock_tfp_api.py,sha256=_iScNNUmzEXeZ32PFQ_bFs3CErQk_188ESS3hUgCH7E,4455
|
|
131
135
|
mns_common/component/trade_date/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
132
136
|
mns_common/component/trade_date/trade_date_common_service_api.py,sha256=PHrcUjgLdNKbqyMGot0poKtiLBys_wRZoheMhPJE-U4,3032
|
|
137
|
+
mns_common/component/us/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
138
|
+
mns_common/component/us/us_stock_etf_info_api.py,sha256=lwlMsjp2pwJVBHcNz0jwdfED-FTQgawSg06VIoDXt6s,5565
|
|
133
139
|
mns_common/component/zt/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
134
140
|
mns_common/component/zt/zt_common_service_api.py,sha256=6pHRLLJjKcLLBA-xXkAU8SE6DZ5dgVFBRVjJmhkL0II,11945
|
|
135
141
|
mns_common/constant/__init__.py,sha256=xu36nA6MJTauswUWPfKIKH0E-lpOAHTw2TL5QI_6TeY,165
|
|
136
142
|
mns_common/constant/black_list_classify_enum.py,sha256=I8U_DcltzYvlWjgn-TFLImgVgPuO0lxMnEJAQJBljdo,3995
|
|
137
|
-
mns_common/constant/db_name_constant.py,sha256=
|
|
143
|
+
mns_common/constant/db_name_constant.py,sha256=ZwFWxUGP_MPn_n-O6dVVaSyEw5SDuFxKxNLgujcY8kw,5387
|
|
138
144
|
mns_common/constant/east_money_stock_api.py,sha256=mW0b8sEgkf8WJtars2frOQYzsWgjIl4FDYEwcCcCSZY,7557
|
|
139
|
-
mns_common/constant/extra_income_db_name.py,sha256=
|
|
145
|
+
mns_common/constant/extra_income_db_name.py,sha256=g7acnZ9bIYdAyMmTQXFfLMmbAVHEEIvrxtTNRsm-3l4,4263
|
|
140
146
|
mns_common/constant/price_enum.py,sha256=nhcPxk0AFdQAp8IsNr5EP9xURLqqJuSl6ljIzTp7Wyo,1093
|
|
141
147
|
mns_common/constant/redis_msg_constant.py,sha256=fMtI_WbJ2IkMX4qGwvR5MkMO0NqU8XgUUZqQzHIRscU,501
|
|
142
148
|
mns_common/constant/self_choose_constant.py,sha256=Xnzp9cn5x5_UdqF4gozSDErkzafnbCYBjDH8YpTEU84,777
|
|
143
|
-
mns_common/constant/strategy_classify.py,sha256=
|
|
144
|
-
mns_common/db/MongodbUtil.py,sha256=
|
|
145
|
-
mns_common/db/MongodbUtilLocal.py,sha256=
|
|
149
|
+
mns_common/constant/strategy_classify.py,sha256=ltt1wdUPJQm5uG_iVf6_NzCH65xvllTfi92i-oC0wIY,2152
|
|
150
|
+
mns_common/db/MongodbUtil.py,sha256=ViVyQ1tVBMDrxGBiLPM3BgvCTghgZM81snMA9RYZHfs,11728
|
|
151
|
+
mns_common/db/MongodbUtilLocal.py,sha256=rSx_gjrXd5HD7FwPW7CFweFvtmBTLED8phGVJ60f6qs,7582
|
|
146
152
|
mns_common/db/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
|
|
147
153
|
mns_common/db/v2/MongodbUtilV2.py,sha256=REXIVOygLGRcHyLOtU5iO-6d7clfV5CuyzvbT1oL10Q,11686
|
|
148
154
|
mns_common/db/v2/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
|
|
@@ -154,7 +160,7 @@ mns_common/utils/date_handle_util.py,sha256=XS-MyA8_7k35LOCFAYOHgVcVkMft_Kc4Wa9U
|
|
|
154
160
|
mns_common/utils/db_util.py,sha256=hSmfNAN4vEeEaUva6_cicZEhb2jSnib-Gvk2reke1vc,2590
|
|
155
161
|
mns_common/utils/file_util.py,sha256=egWu6PenGPRp_ixrNTHKarT4dAnOT6FETR82EHUZJnQ,1042
|
|
156
162
|
mns_common/utils/ip_util.py,sha256=UTcYfz_uytB__6nlBf7T-izuI7hi4XdB6ET0sJgEel4,969
|
|
157
|
-
mns_common-1.
|
|
158
|
-
mns_common-1.
|
|
159
|
-
mns_common-1.
|
|
160
|
-
mns_common-1.
|
|
163
|
+
mns_common-1.5.7.2.dist-info/METADATA,sha256=CZJ7_uHnwPfSWjI76OtK1DNuMPjL9JjIkvi2dRsWoIE,61
|
|
164
|
+
mns_common-1.5.7.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
165
|
+
mns_common-1.5.7.2.dist-info/top_level.txt,sha256=ZC58kAR-8Hvc6U2xhYNBNLAh3mb6sZazbdj5nZpvEkQ,11
|
|
166
|
+
mns_common-1.5.7.2.dist-info/RECORD,,
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') + 14
|
|
6
|
-
project_path = file_path[0:end]
|
|
7
|
-
sys.path.append(project_path)
|
|
8
|
-
|
|
9
|
-
from loguru import logger
|
|
10
|
-
import pandas as pd
|
|
11
|
-
import requests
|
|
12
|
-
from bs4 import BeautifulSoup
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# 获取股票基本信息
|
|
16
|
-
# https://basic.10jqka.com.cn/mobile/301016/companyprofilen.html?showtab=1&broker=anelicaiapp
|
|
17
|
-
def get_company_info(symbol: str = "688272") -> pd.DataFrame:
|
|
18
|
-
try:
|
|
19
|
-
url = f"http://basic.10jqka.com.cn/mobile/{symbol}/companyprofilen.html?broker=pingan"
|
|
20
|
-
headers = {
|
|
21
|
-
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iOS AYLCAPP/9.1.2.0/h4526a24eb9445522492fd64caae11b1f scheme/anelicaiapp deviceinfo/I|9.1.2.0|NA|h4526a24eb9445522492fd64caae11b1f pastheme/0",
|
|
22
|
-
"Cookie": "ps_login_app_name=AYLCAPP;ps_login_token_id=N_C993F777ACC500B354C762A2627A8862348FC8163799A08EBEB2301C28A2135D220475787D0E81425C1134E15D8CC8761D639FEDBD46C00FE8EA6482C1E42D9801B19918FB3F5C34;ps_login_union_id=edc29089a2b64e3882062297030a0386;PAS.CURRENTUNIONID=edc29089a2b64e3882062297030a0386"
|
|
23
|
-
}
|
|
24
|
-
r = requests.get(url, headers=headers)
|
|
25
|
-
soup = BeautifulSoup(r.content.decode("utf-8"), 'lxml')
|
|
26
|
-
soup.find('table', attrs={'class': 'leveldatail-tab'}).find_all('tr')
|
|
27
|
-
temp_df = pd.read_html(r.content)[0]
|
|
28
|
-
temp_df = temp_df.T
|
|
29
|
-
temp_df = temp_df.iloc[1:2]
|
|
30
|
-
temp_df.rename(columns={
|
|
31
|
-
0: "name",
|
|
32
|
-
1: "former_name",
|
|
33
|
-
2: "registered_address",
|
|
34
|
-
3: "chairman",
|
|
35
|
-
4: "board_secretary",
|
|
36
|
-
5: "main_business",
|
|
37
|
-
6: "company_type",
|
|
38
|
-
7: "controlling_shareholder",
|
|
39
|
-
8: "actual_controller",
|
|
40
|
-
9: "ultimate_controller",
|
|
41
|
-
10: "list_date",
|
|
42
|
-
11: "issue_price",
|
|
43
|
-
12: "number_workers",
|
|
44
|
-
13: "tel",
|
|
45
|
-
14: "url",
|
|
46
|
-
15: "email"
|
|
47
|
-
}, inplace=True)
|
|
48
|
-
|
|
49
|
-
return temp_df
|
|
50
|
-
except BaseException as e:
|
|
51
|
-
logger.error("获取symbol控制人基本信息异常:{},{}", symbol, e)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# 获取股票详细信息
|
|
55
|
-
# HK市场 https://basic.10jqka.com.cn/mobile/HK1456/profile.html https://basic.10jqka.com.cn/mobile/HK1456/company.html
|
|
56
|
-
# https://basic.10jqka.com.cn/new/HK1456/company.html
|
|
57
|
-
# https://basic.10jqka.com.cn/astockph/briefinfo/index.html?showhead=0&fromshare=1&code=300430&marketid=33&client_userid=ESgcM&back_source=hyperlink&share_hxapp=isc&fontzoom=no#/company/ziliao
|
|
58
|
-
def get_company_info_detail(symbol: str = "688272") -> pd.DataFrame:
|
|
59
|
-
try:
|
|
60
|
-
url = f'https://basic.10jqka.com.cn/basicapi/company_info/merge_info/v1/base_info/?code={symbol}&market=33&type=stock'
|
|
61
|
-
headers = {
|
|
62
|
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0',
|
|
63
|
-
'Host': 'basic.10jqka.com.cn',
|
|
64
|
-
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
|
65
|
-
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
|
|
66
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
67
|
-
'Connection': 'keep-alive',
|
|
68
|
-
'Cookie': 'v=A0CN8EBXN21LtMtpV6ldAxf6Ec8XySSbxq14l7rRDNvuNe77Ytn0Ixa9SDQJ',
|
|
69
|
-
'Upgrade-Insecure-Requests': '1',
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
r = requests.get(url, headers=headers)
|
|
73
|
-
data_json = r.json()
|
|
74
|
-
status_code = data_json['status_code']
|
|
75
|
-
status_msg = data_json['status_msg']
|
|
76
|
-
if status_code != 0 or status_msg != 'success':
|
|
77
|
-
logger.error("获取symbol公司详细信息异常:{}", symbol)
|
|
78
|
-
if len(data_json['data']['industry']) == 0:
|
|
79
|
-
return None
|
|
80
|
-
data_df = pd.DataFrame(data_json['data']['industry'], index=[0])
|
|
81
|
-
data_df = data_df[[
|
|
82
|
-
'hy',
|
|
83
|
-
'hycode',
|
|
84
|
-
'hy2',
|
|
85
|
-
'hy2code',
|
|
86
|
-
'hy3',
|
|
87
|
-
'hy3code',
|
|
88
|
-
]]
|
|
89
|
-
|
|
90
|
-
business_nature = data_json['data']['business_nature']
|
|
91
|
-
name = data_json['data']['code_name']
|
|
92
|
-
intro = data_json['data']['intro']
|
|
93
|
-
base_business = data_json['data']['base_business']
|
|
94
|
-
|
|
95
|
-
address = data_json['data']['address']
|
|
96
|
-
data_df['symbol'] = symbol
|
|
97
|
-
data_df['name'] = name
|
|
98
|
-
|
|
99
|
-
data_df['business_nature'] = business_nature
|
|
100
|
-
|
|
101
|
-
if len(data_json['data']['management']['holder_controller']) > 0:
|
|
102
|
-
holder_controller = pd.DataFrame(data_json['data']['management']['holder_controller'])
|
|
103
|
-
holder_controller_name = str(list(holder_controller['name'])).strip('[').strip(']').replace("'", "")
|
|
104
|
-
holder_controller_rate = holder_controller['rate']
|
|
105
|
-
data_df['holder_controller_name'] = holder_controller_name
|
|
106
|
-
data_df['holder_controller_rate'] = sum(holder_controller_rate)
|
|
107
|
-
else:
|
|
108
|
-
data_df['holder_controller_name'] = '暂无'
|
|
109
|
-
data_df['holder_controller_rate'] = 0
|
|
110
|
-
if len(data_json['data']['management']['final_controller']) > 0:
|
|
111
|
-
final_controller = pd.DataFrame(data_json['data']['management']['final_controller'])
|
|
112
|
-
final_controller_name = str(list(final_controller['name'])).strip('[').strip(']').replace("'", "")
|
|
113
|
-
final_controller_rate = sum(final_controller['rate'])
|
|
114
|
-
data_df['final_controller_name'] = final_controller_name
|
|
115
|
-
data_df['final_controller_rate'] = final_controller_rate
|
|
116
|
-
else:
|
|
117
|
-
data_df['final_controller_name'] = '暂无'
|
|
118
|
-
data_df['final_controller_rate'] = 0
|
|
119
|
-
if len(data_json['data']['management']['actual_controller']) > 0:
|
|
120
|
-
actual_controller = pd.DataFrame(data_json['data']['management']['actual_controller'])
|
|
121
|
-
actual_controller_name = str(list(actual_controller['name'])).strip('[').strip(']').replace("'", "")
|
|
122
|
-
actual_controller_rate = sum(actual_controller['rate'])
|
|
123
|
-
data_df['actual_controller_name'] = actual_controller_name
|
|
124
|
-
data_df['actual_controller_rate'] = actual_controller_rate
|
|
125
|
-
else:
|
|
126
|
-
data_df['actual_controller_name'] = '暂无'
|
|
127
|
-
data_df['actual_controller_rate'] = 0
|
|
128
|
-
|
|
129
|
-
data_df['base_business'] = base_business
|
|
130
|
-
data_df['intro'] = intro
|
|
131
|
-
data_df['address'] = address
|
|
132
|
-
market_id = data_json['data']['market_id']
|
|
133
|
-
data_df['market_id'] = market_id
|
|
134
|
-
# 初始化数据
|
|
135
|
-
data_df['main_business_list'] = [[]]
|
|
136
|
-
data_df['most_profitable_business'] = ''
|
|
137
|
-
data_df['most_profitable_business_rate'] = ''
|
|
138
|
-
data_df['most_profitable_business_profit'] = ''
|
|
139
|
-
|
|
140
|
-
# 业务构成
|
|
141
|
-
main_business_list = data_json['data']['main_business']
|
|
142
|
-
# 最盈利业务
|
|
143
|
-
profitable_business = data_json['data']['profitable_business']
|
|
144
|
-
|
|
145
|
-
data_df['main_business_list'] = [main_business_list]
|
|
146
|
-
|
|
147
|
-
most_profitable_business = profitable_business['name']
|
|
148
|
-
|
|
149
|
-
most_profitable_business_rate = profitable_business['profit_rate']
|
|
150
|
-
|
|
151
|
-
most_profitable_business_profit = profitable_business['profit']
|
|
152
|
-
|
|
153
|
-
data_df['most_profitable_business'] = most_profitable_business
|
|
154
|
-
data_df['most_profitable_business_rate'] = most_profitable_business_rate
|
|
155
|
-
data_df['most_profitable_business_profit'] = most_profitable_business_profit
|
|
156
|
-
return data_df
|
|
157
|
-
except BaseException as e:
|
|
158
|
-
logger.warning("获取symbol公司详细信息异常:{},{}", symbol, e)
|
|
159
|
-
return data_df
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if __name__ == '__main__':
|
|
163
|
-
get_company_info_detail('603683')
|
|
@@ -1,172 +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
|
-
import time, datetime, traceback, sys
|
|
9
|
-
from xtquant import xtdata
|
|
10
|
-
from xtquant.xttrader import XtQuantTrader, XtQuantTraderCallback
|
|
11
|
-
from xtquant.xttype import StockAccount
|
|
12
|
-
from xtquant import xtconstant
|
|
13
|
-
|
|
14
|
-
# 定义一个类 创建类的实例 作为状态的容器
|
|
15
|
-
class _a():
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
A = _a()
|
|
20
|
-
A.bought_list = []
|
|
21
|
-
A.hsa = xtdata.get_stock_list_in_sector('沪深A股')
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def interact():
|
|
25
|
-
"""执行后进入repl模式"""
|
|
26
|
-
import code
|
|
27
|
-
code.InteractiveConsole(locals=globals()).interact()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
xtdata.download_sector_data()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class MyXtQuantTraderCallback(XtQuantTraderCallback):
|
|
35
|
-
def on_disconnected(self):
|
|
36
|
-
"""
|
|
37
|
-
连接断开
|
|
38
|
-
:return:
|
|
39
|
-
"""
|
|
40
|
-
print(datetime.datetime.now(), '连接断开回调')
|
|
41
|
-
|
|
42
|
-
def on_stock_order(self, order):
|
|
43
|
-
"""
|
|
44
|
-
委托回报推送
|
|
45
|
-
:param order: XtOrder对象
|
|
46
|
-
:return:
|
|
47
|
-
"""
|
|
48
|
-
print(datetime.datetime.now(), '委托回调 投资备注', order.order_remark)
|
|
49
|
-
|
|
50
|
-
def on_stock_trade(self, trade):
|
|
51
|
-
"""
|
|
52
|
-
成交变动推送
|
|
53
|
-
:param trade: XtTrade对象
|
|
54
|
-
:return:
|
|
55
|
-
"""
|
|
56
|
-
print(datetime.datetime.now(), '成交回调', trade.order_remark, f"委托方向(48买 49卖) {trade.offset_flag} 成交价格 {trade.traded_price} 成交数量 {trade.traded_volume}")
|
|
57
|
-
|
|
58
|
-
def on_order_error(self, order_error):
|
|
59
|
-
"""
|
|
60
|
-
委托失败推送
|
|
61
|
-
:param order_error:XtOrderError 对象
|
|
62
|
-
:return:
|
|
63
|
-
"""
|
|
64
|
-
# print("on order_error callback")
|
|
65
|
-
# print(order_error.order_id, order_error.error_id, order_error.error_msg)
|
|
66
|
-
print(f"委托报错回调 {order_error.order_remark} {order_error.error_msg}")
|
|
67
|
-
|
|
68
|
-
def on_cancel_error(self, cancel_error):
|
|
69
|
-
"""
|
|
70
|
-
撤单失败推送
|
|
71
|
-
:param cancel_error: XtCancelError 对象
|
|
72
|
-
:return:
|
|
73
|
-
"""
|
|
74
|
-
print(datetime.datetime.now(), sys._getframe().f_code.co_name)
|
|
75
|
-
|
|
76
|
-
def on_order_stock_async_response(self, response):
|
|
77
|
-
"""
|
|
78
|
-
异步下单回报推送
|
|
79
|
-
:param response: XtOrderResponse 对象
|
|
80
|
-
:return:
|
|
81
|
-
"""
|
|
82
|
-
print(f"异步委托回调 投资备注: {response.order_remark}")
|
|
83
|
-
|
|
84
|
-
def on_cancel_order_stock_async_response(self, response):
|
|
85
|
-
"""
|
|
86
|
-
:param response: XtCancelOrderResponse 对象
|
|
87
|
-
:return:
|
|
88
|
-
"""
|
|
89
|
-
print(datetime.datetime.now(), sys._getframe().f_code.co_name)
|
|
90
|
-
|
|
91
|
-
def on_account_status(self, status):
|
|
92
|
-
"""
|
|
93
|
-
:param response: XtAccountStatus 对象
|
|
94
|
-
:return:
|
|
95
|
-
"""
|
|
96
|
-
print(datetime.datetime.now(), sys._getframe().f_code.co_name)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if __name__ == '__main__':
|
|
100
|
-
|
|
101
|
-
print("start")
|
|
102
|
-
# 指定客户端所在路径, 券商端指定到 userdata_mini文件夹
|
|
103
|
-
# 注意:如果是连接投研端进行交易,文件目录需要指定到f"{安装目录}\userdata"
|
|
104
|
-
path = r'D:\Program Files\qmt\国金证券QMT交易端\userdata_mini'
|
|
105
|
-
# 生成session id 整数类型 同时运行的策略不能重复
|
|
106
|
-
session_id = int(time.time())
|
|
107
|
-
xt_trader = XtQuantTrader(path, session_id)
|
|
108
|
-
# 开启主动请求接口的专用线程 开启后在on_stock_xxx回调函数里调用XtQuantTrader.query_xxx函数不会卡住回调线程,但是查询和推送的数据在时序上会变得不确定
|
|
109
|
-
# 详见: http://docs.thinktrader.net/vip/pages/ee0e9b/#开启主动请求接口的专用线程
|
|
110
|
-
# xt_trader.set_relaxed_response_order_enabled(True)
|
|
111
|
-
|
|
112
|
-
# 创建资金账号为 800068 的证券账号对象 股票账号为STOCK 信用CREDIT 期货FUTURE
|
|
113
|
-
acc = StockAccount('8882352999', 'STOCK')
|
|
114
|
-
# 创建交易回调类对象,并声明接收回调
|
|
115
|
-
callback = MyXtQuantTraderCallback()
|
|
116
|
-
xt_trader.register_callback(callback)
|
|
117
|
-
# 启动交易线程
|
|
118
|
-
xt_trader.start()
|
|
119
|
-
# 建立交易连接,返回0表示连接成功
|
|
120
|
-
connect_result = xt_trader.connect()
|
|
121
|
-
print('建立交易连接,返回0表示连接成功', connect_result)
|
|
122
|
-
# 对交易回调进行订阅,订阅后可以收到交易主推,返回0表示订阅成功
|
|
123
|
-
subscribe_result = xt_trader.subscribe(acc)
|
|
124
|
-
print('对交易回调进行订阅,订阅后可以收到交易主推,返回0表示订阅成功', subscribe_result)
|
|
125
|
-
# 取账号信息
|
|
126
|
-
account_info = xt_trader.query_stock_asset(acc)
|
|
127
|
-
# 取可用资金
|
|
128
|
-
available_cash = account_info.m_dCash
|
|
129
|
-
|
|
130
|
-
print(acc.account_id, '可用资金', available_cash)
|
|
131
|
-
# 查账号持仓
|
|
132
|
-
positions = xt_trader.query_stock_positions(acc)
|
|
133
|
-
# 取各品种 总持仓 可用持仓
|
|
134
|
-
position_total_dict = {i.stock_code: i.m_nVolume for i in positions}
|
|
135
|
-
position_available_dict = {i.stock_code: i.m_nCanUseVolume for i in positions}
|
|
136
|
-
print(acc.account_id, '持仓字典', position_total_dict)
|
|
137
|
-
print(acc.account_id, '可用持仓字典', position_available_dict)
|
|
138
|
-
|
|
139
|
-
# 买入 浦发银行 最新价 两万元
|
|
140
|
-
stock = '600000.SH'
|
|
141
|
-
target_amount = 20000
|
|
142
|
-
full_tick = xtdata.get_full_tick([stock])
|
|
143
|
-
print(f"{stock} 全推行情: {full_tick}")
|
|
144
|
-
current_price = full_tick[stock]['lastPrice']
|
|
145
|
-
# 买入金额 取目标金额 与 可用金额中较小的
|
|
146
|
-
buy_amount = min(target_amount, available_cash)
|
|
147
|
-
# 买入数量 取整为100的整数倍
|
|
148
|
-
buy_vol = int(buy_amount / current_price / 100) * 100
|
|
149
|
-
print(f"当前可用资金 {available_cash} 目标买入金额 {target_amount} 买入股数 {buy_vol}股")
|
|
150
|
-
async_seq = xt_trader.order_stock_async(acc, stock, xtconstant.STOCK_BUY, buy_vol, xtconstant.FIX_PRICE,
|
|
151
|
-
current_price,
|
|
152
|
-
'strategy_name', stock)
|
|
153
|
-
|
|
154
|
-
# 卖出 500股
|
|
155
|
-
stock = '513130.SH'
|
|
156
|
-
# 目标数量
|
|
157
|
-
target_vol = 500
|
|
158
|
-
# 可用数量
|
|
159
|
-
available_vol = position_available_dict[stock] if stock in position_available_dict else 0
|
|
160
|
-
# 卖出量取目标量与可用量中较小的
|
|
161
|
-
sell_vol = min(target_vol, available_vol)
|
|
162
|
-
print(f"{stock} 目标卖出量 {target_vol} 可用数量 {available_vol} 卖出 {sell_vol}股")
|
|
163
|
-
if sell_vol > 0:
|
|
164
|
-
async_seq = xt_trader.order_stock_async(acc, stock, xtconstant.STOCK_SELL, sell_vol,
|
|
165
|
-
xtconstant.LATEST_PRICE,
|
|
166
|
-
-1,
|
|
167
|
-
'strategy_name', stock)
|
|
168
|
-
print(f"下单完成 等待回调")
|
|
169
|
-
# 阻塞主线程退出
|
|
170
|
-
# xt_trader.run_forever()
|
|
171
|
-
# 如果使用vscode pycharm等本地编辑器 可以进入交互模式 方便调试 (把上一行的run_forever注释掉 否则不会执行到这里)
|
|
172
|
-
interact()
|
|
@@ -1,110 +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
|
-
import datetime
|
|
10
|
-
import mns_common.utils.date_handle_util as date_util
|
|
11
|
-
from mns_common.db.MongodbUtil import MongodbUtil
|
|
12
|
-
import mns_common.constant.db_name_constant as db_name_constant
|
|
13
|
-
import mns_common.utils.cmd_util as cmd_util
|
|
14
|
-
import mns_common.utils.data_frame_util as data_frame_util
|
|
15
|
-
import time
|
|
16
|
-
from loguru import logger
|
|
17
|
-
import mns_common.component.trade_date.trade_date_common_service_api as trade_date_common_service_api
|
|
18
|
-
|
|
19
|
-
mongodb_util = MongodbUtil('27017')
|
|
20
|
-
REAL_TIME_SCHEDULER_NAME = "realtime_quotes_now_sync"
|
|
21
|
-
# 实时同步 bat
|
|
22
|
-
REAL_TIME_TASK_NAME_PATH = 'H:\\real_time_task.bat'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# 获取同步任务pid
|
|
26
|
-
def get_real_time_quotes_task(all_cmd_processes):
|
|
27
|
-
return all_cmd_processes[
|
|
28
|
-
(all_cmd_processes['total_info'].str.contains(REAL_TIME_SCHEDULER_NAME, case=False, na=False))
|
|
29
|
-
| (all_cmd_processes['total_info'].str.contains(REAL_TIME_SCHEDULER_NAME, case=False, na=False))]
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# 关闭实时行情任务
|
|
33
|
-
def real_time_sync_task_close():
|
|
34
|
-
all_cmd_processes = cmd_util.get_all_process()
|
|
35
|
-
if data_frame_util.is_empty(all_cmd_processes):
|
|
36
|
-
return False
|
|
37
|
-
all_cmd_processes_real_time_task = get_real_time_quotes_task(all_cmd_processes)
|
|
38
|
-
if data_frame_util.is_empty(all_cmd_processes_real_time_task):
|
|
39
|
-
return False
|
|
40
|
-
for match_task_one in all_cmd_processes_real_time_task.itertuples():
|
|
41
|
-
try:
|
|
42
|
-
processes_pid = match_task_one.process_pid
|
|
43
|
-
# 关闭当前进程
|
|
44
|
-
cmd_util.kill_process_by_pid(processes_pid)
|
|
45
|
-
except BaseException as e:
|
|
46
|
-
logger.error("关闭实时行情任务异常:{}", e)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# 重开定时任务同步
|
|
50
|
-
def real_time_sync_task_open():
|
|
51
|
-
all_cmd_processes = cmd_util.get_all_process()
|
|
52
|
-
if data_frame_util.is_empty(all_cmd_processes):
|
|
53
|
-
return False
|
|
54
|
-
all_cmd_processes_real_time_task = get_real_time_quotes_task(all_cmd_processes)
|
|
55
|
-
if data_frame_util.is_empty(all_cmd_processes_real_time_task):
|
|
56
|
-
# 重开定时任务
|
|
57
|
-
cmd_util.open_bat_file(REAL_TIME_TASK_NAME_PATH)
|
|
58
|
-
# 防止太快重开多个
|
|
59
|
-
time.sleep(3)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def query_data_exist(str_day):
|
|
63
|
-
col_name = db_name_constant.REAL_TIME_QUOTES_NOW + '_' + str_day
|
|
64
|
-
query = {'symbol': '000001'}
|
|
65
|
-
return mongodb_util.exist_data_query(col_name, query)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def exist_sync_task():
|
|
69
|
-
all_cmd_processes = cmd_util.get_all_process()
|
|
70
|
-
if data_frame_util.is_empty(all_cmd_processes):
|
|
71
|
-
return False
|
|
72
|
-
all_cmd_processes_real_time_task = get_real_time_quotes_task(all_cmd_processes)
|
|
73
|
-
if data_frame_util.is_empty(all_cmd_processes_real_time_task):
|
|
74
|
-
return False
|
|
75
|
-
else:
|
|
76
|
-
return True
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def check_data_sync_task_status():
|
|
80
|
-
now_date = datetime.datetime.now()
|
|
81
|
-
if bool(is_data_sync_time(now_date)):
|
|
82
|
-
if bool(1 - exist_sync_task()):
|
|
83
|
-
real_time_sync_task_open()
|
|
84
|
-
time.sleep(1)
|
|
85
|
-
else:
|
|
86
|
-
time.sleep(5)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def is_data_sync_time(now_date):
|
|
90
|
-
# return True
|
|
91
|
-
hour = now_date.hour
|
|
92
|
-
minute = now_date.minute
|
|
93
|
-
second = now_date.second
|
|
94
|
-
str_now_day = now_date.strftime('%Y-%m-%d')
|
|
95
|
-
is_trade_day = trade_date_common_service_api.is_trade_day(str_now_day)
|
|
96
|
-
trade_time = (hour == 9 and minute >= 15) \
|
|
97
|
-
or (hour == 10) \
|
|
98
|
-
or (hour == 11 and minute < 30) \
|
|
99
|
-
or (hour == 11 and minute == 30 and second < 5) \
|
|
100
|
-
or (hour == 12 and minute == 59) \
|
|
101
|
-
or (hour == 13) \
|
|
102
|
-
or (hour == 14) \
|
|
103
|
-
or (hour == 15 and minute == 0 and second < 10)
|
|
104
|
-
|
|
105
|
-
return is_trade_day and trade_time
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if __name__ == '__main__':
|
|
109
|
-
# check_data_sync_task_status()
|
|
110
|
-
check_data_sync_task_status()
|
|
File without changes
|