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