mns-common 1.4.3.9__py3-none-any.whl → 1.4.4.5__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-common might be problematic. Click here for more details.

@@ -166,7 +166,8 @@ def sync_stock_gdfx_free_top_10(stock_gdfx_free_top_10_em_df, period, symbol, st
166
166
  stock_gdfx_free_top_10_em_df['str_day'] = str_day
167
167
 
168
168
  stock_gdfx_free_top_10_em_df['symbol'] = symbol
169
- stock_gdfx_free_top_10_em_df['_id'] = symbol + '_' + stock_gdfx_free_top_10_em_df.index + '_' + period
169
+ stock_gdfx_free_top_10_em_df[
170
+ '_id'] = symbol + '_' + period + '_' + stock_gdfx_free_top_10_em_df.shareholder_name
170
171
  stock_gdfx_free_top_10_em_df['period'] = period
171
172
 
172
173
  query_exist = {'symbol': symbol, 'period': period}
@@ -187,7 +188,7 @@ def sync_stock_gdfx_top_10(stock_gdfx_top_10_em_df, period, symbol, str_day):
187
188
  if stock_gdfx_top_10_em_df is not None and stock_gdfx_top_10_em_df.shape[0] > 0:
188
189
  stock_gdfx_top_10_em_df['str_day'] = str_day
189
190
  stock_gdfx_top_10_em_df['symbol'] = symbol
190
- stock_gdfx_top_10_em_df['_id'] = symbol + '_' + stock_gdfx_top_10_em_df.index + '_' + period
191
+ stock_gdfx_top_10_em_df['_id'] = symbol + '_' + period + '_' + stock_gdfx_top_10_em_df.shareholder_name
191
192
  stock_gdfx_top_10_em_df['period'] = period
192
193
 
193
194
  query_exist = {'symbol': symbol, 'period': period}
@@ -213,6 +214,7 @@ def sync_stock_gdfx_free_top_10_one_day(str_day):
213
214
  get_stock_gdfx_free_top_10_em(str_day, real_time_one.symbol)
214
215
  except BaseException as e:
215
216
  logger.error('同步所有股票前十大流通股本异常:{},{}', real_time_one.symbol, e)
217
+ logger.info('同步所有股票股东列表完成:{}', str_day)
216
218
 
217
219
 
218
220
  from datetime import datetime
@@ -0,0 +1,167 @@
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 json
9
+ import requests
10
+
11
+ '''
12
+
13
+ '''
14
+
15
+
16
+ def trade_buy(symbol, buy_price, buy_volume, terminal):
17
+ '''
18
+ 买入
19
+ :param symbol:
20
+ :param buy_price:
21
+ :param buy_volume:
22
+ :param terminal:
23
+ :return:
24
+ '''
25
+ param_buy = {
26
+ 'symbol': symbol,
27
+ 'buy_price': buy_price,
28
+ 'buy_volume': buy_volume,
29
+ 'terminal': terminal}
30
+ param_json = json.dumps(param_buy)
31
+ response = request_trader_post('/buy', param_json)
32
+ if response.status_code != 200:
33
+ buy_result = {"message": '买入失败'}
34
+ else:
35
+ buy_result = response.json()
36
+ return buy_result
37
+
38
+
39
+ def trade_sell(symbol, sell_price, sell_volume, terminal):
40
+ '''
41
+ 卖出
42
+ :param symbol:
43
+ :param sell_price:
44
+ :param sell_volume:
45
+ :param terminal:
46
+ :return:
47
+ '''
48
+ param_sell = {
49
+ 'symbol': symbol,
50
+ 'sell_price': sell_price,
51
+ 'sell_volume': sell_volume,
52
+ 'terminal': terminal}
53
+ param_json = json.dumps(param_sell)
54
+ response = request_trader_post('/sell', param_json)
55
+ if response.status_code != 200:
56
+ sell_result = {"message": '卖出失败'}
57
+ else:
58
+ sell_result = response.json()
59
+ return sell_result
60
+
61
+
62
+ def auto_ipo_buy(terminal):
63
+ '''
64
+ 自动打新
65
+ :param terminal:
66
+ :return:
67
+ '''
68
+ param_auto_ipo = {
69
+ 'terminal': terminal}
70
+ param_json = json.dumps(param_auto_ipo)
71
+ response = request_trader_get('/auto/ipo/buy', param_json)
72
+ if response.status_code != 200:
73
+ result = {"message": '自动打新失败'}
74
+ else:
75
+ result = response.json()
76
+ return result
77
+
78
+
79
+ def get_position(terminal):
80
+ '''
81
+ 获取持仓
82
+ :param terminal:
83
+ :return:
84
+ '''
85
+ param_position = {
86
+ 'terminal': terminal}
87
+ param_json = json.dumps(param_position)
88
+ response = request_trader_get('/position', param_json)
89
+ if response.status_code != 200:
90
+ result = {"message": '获取持仓失败'}
91
+ else:
92
+ result = response.json()
93
+ return result
94
+
95
+
96
+ def order_cancel(entrust_no, terminal):
97
+ '''
98
+ 撤单
99
+ :param entrust_no:
100
+ :param terminal:
101
+ :return:
102
+ '''
103
+ param_cancel = {
104
+ "entrust_no": entrust_no,
105
+ 'terminal': terminal}
106
+ param_json = json.dumps(param_cancel)
107
+ response = request_trader_post('/cancel', param_json)
108
+ if response.status_code != 200:
109
+ result = {"message": '撤单失败'}
110
+ else:
111
+ result = response.json()
112
+ return result
113
+
114
+
115
+ # 自动登陆接口
116
+ def auto_login(terminal):
117
+ '''
118
+ 自动登陆客户端
119
+ :param terminal:
120
+ :return:
121
+ '''
122
+ param_position = {
123
+ 'terminal': terminal}
124
+ param_json = json.dumps(param_position)
125
+ response = request_trader_post('/auto/login', param_json)
126
+ if response.status_code != 200:
127
+ result = {"message": '获取持仓失败'}
128
+ else:
129
+ result = response.json()
130
+ return result
131
+
132
+
133
+ def request_trader_post(url, param):
134
+ total_url = "http://127.0.0.1:5002/api/trade" + url
135
+ headers = {
136
+ "Content-Type": "application/json"
137
+ }
138
+ return requests.post(total_url, data=param, headers=headers)
139
+
140
+
141
+ def request_trader_get(url, param):
142
+ total_url = "http://127.0.0.1:5002/api/trade" + url
143
+ headers = {
144
+ "Content-Type": "application/json"
145
+ }
146
+ return requests.get(total_url, data=param, headers=headers)
147
+
148
+
149
+ if __name__ == '__main__':
150
+ # auto_login('qmt')
151
+ # get_position('qmt')
152
+ # terminal_test = 'easy_trader'
153
+ # order_cancel('251145121', terminal_test)
154
+ # get_position(terminal_test)
155
+ # auto_ipo_buy(terminal_test)
156
+ buy_result_test = trade_buy(
157
+ '688693.SH',
158
+ 36.39,
159
+ 1000,
160
+ 'ths')
161
+ entrust_no_test = buy_result_test['entrust_no']
162
+ order_cancel(entrust_no_test, 'ths')
163
+ # trade_sell(
164
+ # '301314',
165
+ # 35.77,
166
+ # 100,
167
+ # 'easy_trader')
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mns-common
3
- Version: 1.4.3.9
3
+ Version: 1.4.4.5
4
4
 
@@ -11,7 +11,7 @@ mns_common/api/em/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0
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=ygF4LZWKtHQxilE9NpkyC0m96_yXzRJzo7ktyUcclDs,10499
14
+ mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py,sha256=m0zMMAOaeSKyJniIQxnIP2KC3Q3MNp7ZSEOEkaMwBR0,10604
15
15
  mns_common/api/em/real_time/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
16
16
  mns_common/api/em/real_time/east_money_debt_api.py,sha256=jMvMZtlrDfExl_4jZ1hepHX8rUoeVLoLSOIhRBjkUGk,14753
17
17
  mns_common/api/em/real_time/east_money_etf_api.py,sha256=tCyH4fNx-KfVRFuNGkgM8d_xkvR0oAfr8T3e7_XrjTM,14414
@@ -92,6 +92,7 @@ mns_common/component/data/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3
92
92
  mns_common/component/data/data_init_api.py,sha256=VFPmjk_Js16q42l3h1o__6DU1Dpnbf0BJlCBksU12q8,5355
93
93
  mns_common/component/deal/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
94
94
  mns_common/component/deal/deal_service_api.py,sha256=XV_L8qfeTPbojmNXFjnUe-5ZTp3ADT3ett0j-gPuPVI,3806
95
+ mns_common/component/deal/deal_service_v2_api.py,sha256=QmiMQeaCGV8Izuilihp_1_h3s2rCQUg8Lf6Qay5qX3A,4184
95
96
  mns_common/component/deal/terminal_enum.py,sha256=JUkSTXLQW1fob05PCCzIBg_VKlGmqaJEa0GOvrQH6e0,275
96
97
  mns_common/component/em/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
97
98
  mns_common/component/em/em_real_time_quotes_api.py,sha256=9VAwzj_am-Jd4zG57bhrVjXrrsytzymSu8CIs7T7Lc0,2144
@@ -156,7 +157,7 @@ mns_common/utils/date_handle_util.py,sha256=XS-MyA8_7k35LOCFAYOHgVcVkMft_Kc4Wa9U
156
157
  mns_common/utils/db_util.py,sha256=hSmfNAN4vEeEaUva6_cicZEhb2jSnib-Gvk2reke1vc,2590
157
158
  mns_common/utils/file_util.py,sha256=egWu6PenGPRp_ixrNTHKarT4dAnOT6FETR82EHUZJnQ,1042
158
159
  mns_common/utils/ip_util.py,sha256=UTcYfz_uytB__6nlBf7T-izuI7hi4XdB6ET0sJgEel4,969
159
- mns_common-1.4.3.9.dist-info/METADATA,sha256=6W1cXESGmq6IMeRoLmssuW-lo6UzEG6YyKfPDEaYnRg,61
160
- mns_common-1.4.3.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
161
- mns_common-1.4.3.9.dist-info/top_level.txt,sha256=ZC58kAR-8Hvc6U2xhYNBNLAh3mb6sZazbdj5nZpvEkQ,11
162
- mns_common-1.4.3.9.dist-info/RECORD,,
160
+ mns_common-1.4.4.5.dist-info/METADATA,sha256=q0Vyl1FVLRhOQdXd4YHHnKV8cnP8JAOzmsu2k-aUkbo,61
161
+ mns_common-1.4.4.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
162
+ mns_common-1.4.4.5.dist-info/top_level.txt,sha256=ZC58kAR-8Hvc6U2xhYNBNLAh3mb6sZazbdj5nZpvEkQ,11
163
+ mns_common-1.4.4.5.dist-info/RECORD,,