#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);
|
|
|
};
|