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
#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>
 
 
 
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 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 void sell(std::string code, int volume, string price, bool forceSell = FALSE);
 
 
};