public void AnalysisTrade(TraceDataSocket receiveData)
        {
            Dictionary <string, string> dic = GetPairs(receiveData.ch);
            //取data索引为0,为最新一条
            int      len = receiveData.tick.data.Length - 1;
            DateTime dt  = UtilsHelper.GetTime(long.Parse(receiveData.tick.data[len].
                                                          datumTs.ToString().Substring(0, 10)));
            var obj = new
            {
                CurrencyName    = dic[CRRENCY_NAME],
                TransactionDate = dt.ToString("yyyy-MM-dd HH:mm:ss:ff"),
                Amount          = receiveData.tick.data[len].amount,
                Price           = receiveData.tick.data[len].price,
                Direction       = receiveData.tick.data[0].direction
            };
            string json = JsonConvert.SerializeObject(obj);

            RedisHelper.SetAsync(obj.CurrencyName, json, timeOut);
        }
Exemplo n.º 2
0
 public void ExecuteTradeJob(TraceDataSocket receiveData)
 {
     lock (objTradeLock)
     {
         if (isTradeFlg)
         {
             isTradeFlg = false;
             try
             {
                 var service = ServerLocation._iServiceProvider.Resolve <BitBaseService>();
                 service.AnalysisTrade(receiveData);
             }
             catch (Exception ex)
             {
                 LogManage.Job.Error($"ExecuteDetpthQueueJob执行报错:{ex}");
             }
             finally
             {
                 isTradeFlg = true;
             }
         }
     }
 }