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

@@ -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)
@@ -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.6
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
@@ -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.6.dist-info/METADATA,sha256=JNhRfn2QYkzpCeZTMqEle3QvQVWtNwWjCnkP0kUgnck,64
179
+ mns_scheduler-1.2.7.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
180
+ mns_scheduler-1.2.7.6.dist-info/top_level.txt,sha256=PXQDFBGR1pWmsUbH5yiLAh71P5HZODTRED0zJ8CCgOc,14
181
+ mns_scheduler-1.2.7.6.dist-info/RECORD,,