admin
2025-04-08 5c9991be21f57781573f04961ec511ac2938ea3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#pragma once
#include <rapidjson/rapidjson.h>
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <rapidjson/prettywriter.h>
 
#include <string>
#include <list>
#include "SocketManager.h"
#include <afx.h>
 
 
struct CodeInfo
{
    CString code;
    CString name;
    float rate;// ÕÇ·ù
};
struct SubscriptCodesResult {
 
    std::list<CodeInfo> codeInfos;
    CString updateTime;
};
 
 
class NetworkApi
{
private:
 
    static  string _TRADE_SERVER_ADDR;
    static  int _TRADE_SERVER_PORT ;
    static  string _COMMON_SERVER_ADDR ;
    static  int _COMMON_SERVER_PORT ;
 
 
    // ÍøÂçÇëÇó
  
    static std::string base_request(std::string data);
    // ÇëÇó½»Ò×·þÎñÆ÷
    static std::string base_trade_request(std::string data);
    static void __request(std::string code, int type);
    static std::list<wstring> __request_list(int type);
    static string get_rquest_id();
    static string get_sign(rapidjson::Document& document);
 
 
 
public:
    static std::string load_request_data(std::string data);
    // »ñÈ¡´úÂë¼òÒªÐÅÏ¢
    static std::wstring getCodeDesc(std::string code);
 
    // ÉèÖý»Ò×״̬
    static void set_buy_state(bool is_open);
 
    // »ñÈ¡ÂòÈë״̬
    static bool get_buy_state();
 
    // »ñÈ¡ÂòÈëģʽ
    static int get_buy_mode();
 
    // ÉèÖÃÂòÈëģʽ
    static void set_buy_mode(int mode);
 
 
    // »ñÈ¡×Ô¶¯³·Âôģʽ
    static int get_auto_cancel_sell_mode(string code);
 
    // ÉèÖÃ×Ô¶¯³·Âôģʽ
    static void set_auto_cancel_sell_mode(string code, int mode);
 
    // »ñÈ¡ÊÇ·ñÂò°å¿é¶ÀÃç
    static int get_buy_unique_block_mode();
 
    // ÉèÖÃÊÇ·ñÂò°å¿é¶ÀÃç
    static void set_buy_unique_block_mode(bool enable);
 
   
    // ¼Ó°×Ãûµ¥
    static void add_white(std::string code);
 
    // ¼ÓºÚÃûµ¥
    static void add_black(std::string code);
 
    // ¼ÓÔÝÍ£ÂòÈë
    static void add_pause_buy(std::string code);
 
    // ¼ÓÏëÂò
    static void add_want_buy(std::string code);
 
    // ¼Ó±ØÂò
    static void add_must_buy(std::string code);
 
    // ¼ÓÂÌ
    static void add_green_buy(std::string code);
 
    // ÒƳý°×Ãûµ¥
    static void remove_white(std::string code);
 
    // ÒƳýºÚÃûµ¥
    static void remove_black(std::string code);
 
    // ÒƳýÔÝÍ£ÂòÈë
    static void remove_pause_buy(std::string code);
 
    // ÒƳýÏëÂò
    static void remove_want_buy(std::string code);
 
    // ÒƳý±ØÂò
    static void remove_must_buy(std::string code);
 
    // ÒÆÂÌ
    static void remove_green_buy(std::string code);
 
    // °×Ãûµ¥Áбí
    static std::list<std::wstring> list_white();
 
    // ºÚÃûµ¥Áбí
    static std::list<std::wstring> list_black();
 
    // ÔÝÍ£ÂòÈëÁбí
    static std::list<std::wstring> list_pause_buy();
 
    // ÏëÂòÁбí
    static std::list<std::wstring> list_want_buy();
 
    // ±ØÂòÁбí
    static std::list<std::wstring> list_must_buy();
 
    // Â̵¥
    static std::list<std::wstring> list_green_buy();
 
    // »ñȡίÍÐÁбí
    static string list_delegate_records(CString updateTime,bool canCancel=FALSE);
 
    //³É½»Áбí
    static string list_deal_records();
 
    static void cancel_order(CString code, CString orderSysID,CString accountID);
 
    // ²éѯÊÇ·ñ¿ÉÒÔ³·µ¥
    static bool get_can_cancel_buy(std::string code);
 
    // ³·µ¥
    static void cancel_buy(CString code);
 
    // ÂòÈë
    static void buy(std::string code, int volume, int priceType);
 
    // Âô³ö
    static string sell(std::string code, int volume, int price_type, bool forceSell = FALSE);
 
    // ÂòÈë¿Éתծ
    static string buy_cb(std::string code, int volume);
 
    // Âô³ö¿Éתծ
    static string sell_cb(std::string code, int volume);
 
    // »ñÈ¡³Ö²ÖÊý¾Ý
    static string get_code_position_info(std::string code);
 
    // »ñȡϵ¥µÄ·´À¡ÐÅÏ¢
    static string get_sell_result(int order_ref);
 
    //ˢн»Ò×Êý¾Ý
    static void  sync_trade_data(string type);
 
    //»ñÈ¡×ʽðÏêÇé
    static string get_money();
 
    //»ñÈ¡»ªÐ˶©ÔÄ´úÂë
    static SubscriptCodesResult get_huaxin_subscript_codes();
 
    //»ñÈ¡»ªÐ˳ֲֶ©ÔÄ´úÂë
    static SubscriptCodesResult get_huaxin_position_subscript_codes();
 
    //µ¼³öL2Êý¾Ý
    static string export_l2_data(CString code);
 
    //ÿÈÕ³õʼ»¯
    static string every_init();
 
    //»ªöÎͨÐÅͨµÀ״̬
    static string huaxin_channel_states();
 
    //»ñÈ¡»·¾³×´Ì¬
    static string get_env_status();
 
    //Redis²âËÙ
    static string test_redis();
 
    //ͬ²½L1¶©ÔÄ´úÂë
    static string sync_l1_subscript_codes();
 
    //ͬ²½É¨Èë±æÊ¶¶È´úÂë
    static string sync_radical_buy_special_codes();
 
    //»ñȡϵͳÈÕÖ¾
    static string list_system_log(int start_index, int count);
 
    //»ñÈ¡´úÂë½»Ò×ÐÅÏ¢
    static string get_code_trade_info(CString code);
 
    //L2ÓÐЧ¼àÌýÊýÁ¿
    static string get_l2_listen_active_count();
 
    //±£´æÕýÔÚÔËÐеÄÊý¾Ý
    static string save_running_data();
 
    static string list_sell_rules();
 
    static string add_sell_rule(rapidjson::Document  doc);
 
    static string update_sell_rule(rapidjson::Document  doc);
 
    static string del_sell_rule(CString id);
 
 
    //À­È¡ËùÓгֲÖ
    static string get_all_positions();
 
 
 
    static string get_buy1_info(string code);
 
    // ÉèÖÃÿ¸ö´úÂë¿ÉÂòµÄ½ð¶î
    static void set_buy_money_and_count(int mormalCount, string normalMoneyJson,int radicalCount, string radicalMoneyJson, int default_buy_money);
 
    // »ñÈ¡ÂòÈëÉèÖÃ
    static string get_buy_money_and_count();
 
    // É¨Èë°å¿éµÄ´úÂëÊýÁ¿ÉèÖÃ
    static void set_radical_buy_block_count(string data);
 
 
    static string get_radical_buy_block_count();
 
 
 
 
    // »ñÈ¡µ¥Æ±ÂòÈë½ð¶î
    static int get_per_code_buy_money();
 
 
    // »ñÈ¡L2³É½»ÏÖ¼Û
    static string get_l2_deal_price(string code);
 
 
    static string repaire_task();
    
    // Í¬²½×ÔÓÉÁ÷ͨÁ¿
    static string sync_zylt_volume();
    
    // »ñÈ¡½ñÈÕÒѾ­¸üеÄ×ÔÓÉÁ÷ͨÁ¿µÄÊýÁ¿
    static string get_today_updated_zylt_volume_count();
 
    // Í¬²½ÀúÊ·KÏßÊý¾Ý
    static string sync_history_k_bars();
 
    // »ñÈ¡½ñÈÕÒѾ­¸üеÄKÏßµÄÊý¾Ý
    static string get_today_updated_history_k_bars_count();
 
    // »ñÈ¡ÂòÈëϵ¥ÉèÖÃ
    static string get_place_order_settings();
 
    // ÂòÈëϵ¥²ÎÊýÉèÖÃ
    static string set_place_order_settings(string radical_buy_data);
 
    // ¸ôÒ¹µ¥ÅÅ1
    static string get_buy_open_limit_up_codes();
 
    static string set_buy_open_limit_up_codes(list<string> codes);
 
    // »ñÈ¡´úÂëͬ°å¿éÀúÊ·ÕÇÍ£ÊýÁ¿
    static string get_same_block_limit_up_codes_count(list<string> codes);
 
    // »ñÈ¡³É½»¶ÓÁÐ
    static string get_code_deal_queue(string code, int min_money);
 
    //²âÊÔϵ¥
    static string test_place_order(string code);
 
    
};