admin
2023-12-05 276f6a0a8163b582959cfc671253b1ff8e898f74
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
#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;
};
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::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 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 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 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 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, string price);
 
    // Âô³ö
    static string sell(std::string code, int volume, int price_type, bool forceSell = FALSE);
 
    // »ñÈ¡³Ö²ÖÊý¾Ý
    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();
 
    //µ¼³ö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 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 del_sell_rule(CString id);
 
 
};