mns-scheduler 1.2.7.5__py3-none-any.whl → 1.2.7.7__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.

@@ -1,98 +1,98 @@
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 mns_common.utils.date_handle_util as date_handle_util
9
- from datetime import datetime, time, timedelta
10
- from loguru import logger
11
- import mns_common.utils.data_frame_util as data_frame_util
12
- from mns_common.db.MongodbUtil import MongodbUtil
13
- import mns_common.api.ths.big_deal.ths_big_deal_api as ths_big_deal_api
14
- import time as sleep_time
15
- import mns_common.constant.db_name_constant as db_name_constant
16
-
17
- mongodb_util = MongodbUtil('27017')
18
-
19
-
20
- #
21
- def get_last_number(str_day):
22
- query = {'str_day': str_day}
23
- big_deal_df = mongodb_util.descend_query(query, db_name_constant.BIG_DEAL_NAME, "number", 1)
24
- if data_frame_util.is_empty(big_deal_df):
25
- return 1
26
- else:
27
- return list(big_deal_df['number'])[0]
28
-
29
-
30
- def create_index():
31
- mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("symbol", 1)])
32
- mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("str_day", 1)])
33
- mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("symbol", 1), ("str_day", 1)])
34
- mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("number", 1), ("str_day", 1)])
35
-
36
-
37
- def sync_ths_big_deal(tag):
38
- create_index()
39
- now_date_begin = datetime.now()
40
- str_day_begin = now_date_begin.strftime('%Y-%m-%d')
41
- number = get_last_number(str_day_begin)
42
- while True:
43
- now_date = datetime.now()
44
- begin_date = now_date + timedelta(minutes=-2)
45
- if tag or date_handle_util.is_trade_time(now_date):
46
- try:
47
- str_day = now_date.strftime('%Y-%m-%d')
48
- str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
49
-
50
- begin_str_date = begin_date.strftime('%Y-%m-%d %H:%M:%S')
51
-
52
- target_time_09_30 = time(9, 30)
53
- if now_date.time() < target_time_09_30:
54
- continue
55
- ths_big_deal_df = ths_big_deal_api.stock_fund_flow_big_deal(begin_str_date, str_now_date)
56
- if data_frame_util.is_empty(ths_big_deal_df):
57
- sleep_time.sleep(10)
58
- continue
59
- ths_big_deal_df['str_day'] = ths_big_deal_df['deal_time'].str.slice(0, 10)
60
- ths_big_deal_df = ths_big_deal_df.loc[ths_big_deal_df['str_day'] == str_day]
61
- ths_big_deal_df['number'] = number
62
- ths_big_deal_df['amount_str'] = ths_big_deal_df.amount.astype(str)
63
- ths_big_deal_df['type'] = ths_big_deal_df['type'].replace('买盘', 'buy')
64
- ths_big_deal_df['type'] = ths_big_deal_df['type'].replace("卖盘", "sell")
65
-
66
- ths_big_deal_df["_id"] = (ths_big_deal_df['deal_time'] + "-" + ths_big_deal_df['symbol'] + "-"
67
- + ths_big_deal_df['amount_str'] + "-" + ths_big_deal_df['type'])
68
- ths_big_deal_df.drop_duplicates('_id', keep='last', inplace=True)
69
- ths_big_deal_df['sync_str_date'] = str_now_date
70
- # 设置卖盘为负数
71
- ths_big_deal_df.loc[ths_big_deal_df['type'] == 'sell', 'amount'] = -ths_big_deal_df.loc[
72
- ths_big_deal_df['type'] == 'sell', 'amount']
73
-
74
- ths_big_deal_df['chg'] = ths_big_deal_df['chg'].str.replace('%', '')
75
- ths_big_deal_df['chg'] = ths_big_deal_df['chg'].astype(float)
76
-
77
- del ths_big_deal_df['amount_str']
78
- exist_code_df = mongodb_util.find_query_data_choose_field(db_name_constant.BIG_DEAL_NAME,
79
- {},
80
- {"_id": 1})
81
- if data_frame_util.is_empty(exist_code_df):
82
- new_df = ths_big_deal_df
83
- else:
84
- exist_code_list = list(exist_code_df['_id'])
85
- new_df = ths_big_deal_df.loc[~(ths_big_deal_df['_id'].isin(exist_code_list))]
86
-
87
- if data_frame_util.is_empty(new_df):
88
- continue
89
- mongodb_util.insert_mongo(new_df, db_name_constant.BIG_DEAL_NAME)
90
- number = number + 1
91
- except Exception as e:
92
- logger.error('策略执行异常:{}', e)
93
- elif date_handle_util.is_close_time(now_date):
94
- break
95
-
96
-
97
- if __name__ == '__main__':
98
- sync_ths_big_deal(False)
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 mns_common.utils.date_handle_util as date_handle_util
9
+ # from datetime import datetime, time, timedelta
10
+ # from loguru import logger
11
+ # import mns_common.utils.data_frame_util as data_frame_util
12
+ # from mns_common.db.MongodbUtil import MongodbUtil
13
+ # import mns_common.api.ths.big_deal.ths_big_deal_api as ths_big_deal_api
14
+ # import time as sleep_time
15
+ # import mns_common.constant.db_name_constant as db_name_constant
16
+ #
17
+ # mongodb_util = MongodbUtil('27017')
18
+ #
19
+ #
20
+ # #
21
+ # def get_last_number(str_day):
22
+ # query = {'str_day': str_day}
23
+ # big_deal_df = mongodb_util.descend_query(query, db_name_constant.BIG_DEAL_NAME, "number", 1)
24
+ # if data_frame_util.is_empty(big_deal_df):
25
+ # return 1
26
+ # else:
27
+ # return list(big_deal_df['number'])[0]
28
+ #
29
+ #
30
+ # def create_index():
31
+ # mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("symbol", 1)])
32
+ # mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("str_day", 1)])
33
+ # mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("symbol", 1), ("str_day", 1)])
34
+ # mongodb_util.create_index(db_name_constant.BIG_DEAL_NAME, [("number", 1), ("str_day", 1)])
35
+ #
36
+ #
37
+ # def sync_ths_big_deal(tag):
38
+ # create_index()
39
+ # now_date_begin = datetime.now()
40
+ # str_day_begin = now_date_begin.strftime('%Y-%m-%d')
41
+ # number = get_last_number(str_day_begin)
42
+ # while True:
43
+ # now_date = datetime.now()
44
+ # begin_date = now_date + timedelta(minutes=-2)
45
+ # if tag or date_handle_util.is_trade_time(now_date):
46
+ # try:
47
+ # str_day = now_date.strftime('%Y-%m-%d')
48
+ # str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
49
+ #
50
+ # begin_str_date = begin_date.strftime('%Y-%m-%d %H:%M:%S')
51
+ #
52
+ # target_time_09_30 = time(9, 30)
53
+ # if now_date.time() < target_time_09_30:
54
+ # continue
55
+ # ths_big_deal_df = ths_big_deal_api.stock_fund_flow_big_deal(begin_str_date, str_now_date)
56
+ # if data_frame_util.is_empty(ths_big_deal_df):
57
+ # sleep_time.sleep(10)
58
+ # continue
59
+ # ths_big_deal_df['str_day'] = ths_big_deal_df['deal_time'].str.slice(0, 10)
60
+ # ths_big_deal_df = ths_big_deal_df.loc[ths_big_deal_df['str_day'] == str_day]
61
+ # ths_big_deal_df['number'] = number
62
+ # ths_big_deal_df['amount_str'] = ths_big_deal_df.amount.astype(str)
63
+ # ths_big_deal_df['type'] = ths_big_deal_df['type'].replace('买盘', 'buy')
64
+ # ths_big_deal_df['type'] = ths_big_deal_df['type'].replace("卖盘", "sell")
65
+ #
66
+ # ths_big_deal_df["_id"] = (ths_big_deal_df['deal_time'] + "-" + ths_big_deal_df['symbol'] + "-"
67
+ # + ths_big_deal_df['amount_str'] + "-" + ths_big_deal_df['type'])
68
+ # ths_big_deal_df.drop_duplicates('_id', keep='last', inplace=True)
69
+ # ths_big_deal_df['sync_str_date'] = str_now_date
70
+ # # 设置卖盘为负数
71
+ # ths_big_deal_df.loc[ths_big_deal_df['type'] == 'sell', 'amount'] = -ths_big_deal_df.loc[
72
+ # ths_big_deal_df['type'] == 'sell', 'amount']
73
+ #
74
+ # ths_big_deal_df['chg'] = ths_big_deal_df['chg'].str.replace('%', '')
75
+ # ths_big_deal_df['chg'] = ths_big_deal_df['chg'].astype(float)
76
+ #
77
+ # del ths_big_deal_df['amount_str']
78
+ # exist_code_df = mongodb_util.find_query_data_choose_field(db_name_constant.BIG_DEAL_NAME,
79
+ # {},
80
+ # {"_id": 1})
81
+ # if data_frame_util.is_empty(exist_code_df):
82
+ # new_df = ths_big_deal_df
83
+ # else:
84
+ # exist_code_list = list(exist_code_df['_id'])
85
+ # new_df = ths_big_deal_df.loc[~(ths_big_deal_df['_id'].isin(exist_code_list))]
86
+ #
87
+ # if data_frame_util.is_empty(new_df):
88
+ # continue
89
+ # mongodb_util.insert_mongo(new_df, db_name_constant.BIG_DEAL_NAME)
90
+ # number = number + 1
91
+ # except Exception as e:
92
+ # logger.error('策略执行异常:{}', e)
93
+ # elif date_handle_util.is_close_time(now_date):
94
+ # break
95
+ #
96
+ #
97
+ # if __name__ == '__main__':
98
+ # sync_ths_big_deal(False)
@@ -125,7 +125,7 @@ def multi_threaded_k_line_sync(str_day):
125
125
 
126
126
  end_count = (page + 1) * MAX_PAGE_NUMBER
127
127
  begin_count = page * MAX_PAGE_NUMBER
128
- page_df = real_time_quotes_now.loc[begin_count:end_count]
128
+ page_df = real_time_quotes_now.iloc[begin_count:end_count]
129
129
 
130
130
  thread = threading.Thread(target=single_threaded_sync_task, args=(page_df, str_day, page))
131
131
  threads.append(thread)
@@ -27,8 +27,8 @@ def clean_history_data():
27
27
  if __name__ == '__main__':
28
28
  # k_line_info_clean_task.sync_k_line_info('2025-02-21', None)
29
29
  # k_line_info_clean_task.sync_k_line_info('2024-12-19', ['600992'])
30
- clean_history_data()
31
- k_line_info_clean_task.sync_k_line_info('2025-02-21', ['301458'])
30
+ # clean_history_data()
31
+ k_line_info_clean_task.sync_k_line_info('2025-03-18', None)
32
32
 
33
33
  # 001389 001359
34
34
  # k_line_info_clean_task.sync_k_line_info('2025-02-14', None)
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mns-scheduler
3
- Version: 1.2.7.5
3
+ Version: 1.2.7.7
4
4
 
@@ -1,6 +1,6 @@
1
1
  mns_scheduler/__init__.py,sha256=_nhtk1b00OsMAiqRATNrb3HD44RmgjSG5jqS-QLNMrQ,130
2
2
  mns_scheduler/big_deal/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
3
- mns_scheduler/big_deal/ths_big_deal_sync.py,sha256=aMFj-_pLprh4vGjSSzmr_tlYoPA0L4Lm0SkLRkQwIiw,4564
3
+ mns_scheduler/big_deal/ths_big_deal_sync.py,sha256=c3VmLEbEBB3uoQTFZ2HyOtijAiyVRP6wVgNgBS9EuVk,4744
4
4
  mns_scheduler/company_info/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
5
5
  mns_scheduler/company_info/announce/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
6
6
  mns_scheduler/company_info/announce/company_announce_sync_service.py,sha256=O0x0dqqnCmzzFenw4fShzWPAi_wegtvAZ9EB0ubrvnM,2808
@@ -90,7 +90,7 @@ mns_scheduler/irm/api/sz_stock_sns_sse_info_api.py,sha256=6iZpdQ1pARchL3kV-oEVPD
90
90
  mns_scheduler/k_line/__init__.py,sha256=ffZXFCLFdIwOsbxnw__u1MbQYh9yz7Bs8UMP6VF0X2M,161
91
91
  mns_scheduler/k_line/clean/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
92
92
  mns_scheduler/k_line/clean/k_line_info_clean_impl.py,sha256=2GgRc9Nb9wXMueoZhl9egYzjQP_NPhBCvj-XYcTlG9w,1238
93
- mns_scheduler/k_line/clean/k_line_info_clean_task.py,sha256=ey6xTXAxxXh8_8cPzsWmUtVmG8Sd7jXFbpRpTrFrLDo,7622
93
+ mns_scheduler/k_line/clean/k_line_info_clean_task.py,sha256=pBfW0XOJJrqjtQq9c63ooyXIr68nUkaVg0g-Ke8LFhs,7623
94
94
  mns_scheduler/k_line/clean/daily/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
95
95
  mns_scheduler/k_line/clean/daily/daily_k_line_clean_common_service.py,sha256=ZOqaiQuOSFJsKZSW8GEQf1UkveKvg66f-bsHGAybvAM,20447
96
96
  mns_scheduler/k_line/clean/daily/daily_k_line_service.py,sha256=AmnswvYlkO0gadMongt089WKWXdd-Cnku5AO0HSgDG0,6906
@@ -103,7 +103,7 @@ mns_scheduler/k_line/sync/__init__.py,sha256=ffZXFCLFdIwOsbxnw__u1MbQYh9yz7Bs8UM
103
103
  mns_scheduler/k_line/sync/bfq_k_line_sync.py,sha256=RC887GGTOal_MpGzJvZVlfQI2m3vK_L5xVBjKV9SCyg,4218
104
104
  mns_scheduler/k_line/sync/daily_week_month_line_sync.py,sha256=czNFTSx-1_xJF4BmfiY7SSxrfMESqjITmTyZL_AlyVo,6026
105
105
  mns_scheduler/k_line/test/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
106
- mns_scheduler/k_line/test/k_line_info_clean_his_data.py,sha256=Bnwpj7WIzHxW4pSKPal_iadpqez0CeB2HqKUWiekBI8,1477
106
+ mns_scheduler/k_line/test/k_line_info_clean_his_data.py,sha256=mXnvUWNzSZxBeuZcDygRCUuJV9kW4mmstKAas1dZ2tY,1473
107
107
  mns_scheduler/kpl/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
108
108
  mns_scheduler/kpl/selection/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
109
109
  mns_scheduler/kpl/selection/index/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
@@ -175,7 +175,7 @@ mns_scheduler/zt/zt_pool/ths_zt_pool_sync_api.py,sha256=3OGBmWEX6G-fTuONgoB6Lu5x
175
175
  mns_scheduler/zt/zt_pool/update_null_zt_reason_api.py,sha256=1uoiR2Uw46kDfjkvNg2US5rd_4OIkYO3872gIJOufUY,2135
176
176
  mns_scheduler/zz_task/__init__.py,sha256=QWBdZwBCvQw8aS4hnL9_pg3U3ZiNLUXzlImyy9WhUcI,163
177
177
  mns_scheduler/zz_task/data_sync_task.py,sha256=MA2RfrM_neT3ElejjF34XXq3fUA8B01lVyJBuOHOYrc,23507
178
- mns_scheduler-1.2.7.5.dist-info/METADATA,sha256=4vB2ulao4-_Qg867LgPB8rl-aOm2o6Sierj6KFWqNZM,64
179
- mns_scheduler-1.2.7.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
180
- mns_scheduler-1.2.7.5.dist-info/top_level.txt,sha256=PXQDFBGR1pWmsUbH5yiLAh71P5HZODTRED0zJ8CCgOc,14
181
- mns_scheduler-1.2.7.5.dist-info/RECORD,,
178
+ mns_scheduler-1.2.7.7.dist-info/METADATA,sha256=fm10BitTagrVPfHXNaK8zRjgMPdtND06nlFRJfgJKCc,64
179
+ mns_scheduler-1.2.7.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
180
+ mns_scheduler-1.2.7.7.dist-info/top_level.txt,sha256=PXQDFBGR1pWmsUbH5yiLAh71P5HZODTRED0zJ8CCgOc,14
181
+ mns_scheduler-1.2.7.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5