admin
2022-08-25 14db1514fec89db599766d4996b4bb1fead0eff0
app/JsonUtil.h
@@ -6,6 +6,8 @@
#include "LimitUpCapture.h"
#include "TradeListCapture.h"
#include "IndustryCapture.h"
#include "CurrentPriceCapture.h"
#include "TaskChecker.h"
class JsonUtil {
@@ -198,6 +200,23 @@
      return toJsonStr(root);
   }
   static  std::string loadGPPriceData(std::list<CurrentPriceData> dataList) {
      Json::Value root;
      root["type"] = 40;
      Json::Value data;
      std::list<CurrentPriceData>::iterator ele;
      int index = 0;
      for (ele = dataList.begin();ele != dataList.end();ele++) {
         Json::Value item;
         item["code"] = (*ele).code;
         item["price"] = (*ele).price;
         data[index++] = item;
      }
      root["data"] = data;
      return toJsonStr(root);
   }
   static  std::string loadGPCodeData(std::list<IndustryData> codeList) {
      Json::Value root;
@@ -217,12 +236,13 @@
      return toJsonStr(root);
   }
   static  std::string loadHeartbeatData(int client,string memery) {
   static  std::string loadHeartbeatData(int client,string memery,string ownMemery) {
      Json::Value root;
      root["type"] = 30;
      Json::Value data;
      data["client"] = client;
      data["memery"] = memery;
      data["own_memery"] = ownMemery;
      root["data"] = data;
      return toJsonStr(root);
   }
@@ -252,6 +272,19 @@
      return toJsonStr(root);
   }
   static std::string toJson(ClientEnvState state) {
      Json::Value root;
      root["ths_l2_win"] = state.ths_l2_win;
      root["ths_fp_1"] = state.ths_fp_1;
      root["ths_fp_2"] = state.ths_fp_2;
      root["ths_trade_success"] = state.ths_trade_success;
      root["l2_channel_valid_count"] = state.l2_channel_valid_count;
      root["l2_channel_invalid_count"] = state.l2_channel_invalid_count;
      root["limitUp"] = state.limitUp;
      root["tradeSuccess"] = state.tradeSuccess;
      return toJsonStr(root);
   }