Commit 272fe64d authored by Maodashu's avatar Maodashu

修复websocket成交记录解析bug

parent b5d1fec8
......@@ -159,13 +159,13 @@ namespace OTWebSocket.API.Services
liveOrder.OTUpdateTimestamp = orderJson["exchange_update"].ToObject<DateTime>().ToUniversalTime();
liveOrder.UpdateTimestamp = Timestamp.Now;
liveOrder.Status = orderJson["status"].ToString();
if (orderJson["last_trans"] != null)
if (orderJson["last_trans"] != null && orderJson["last_trans"].HasValues)
{
string tid = orderJson["last_trans"]["exchange_tid"].ToString();
OTDealInfo dealInfo = new OTDealInfo();
dealInfo.Id = tid;
dealInfo.TradeTime = orderJson["last_trans"]["dealt_time"].ToObject<DateTime>().ToUniversalTime();
dealInfo.DealtAmount = orderJson["last_trans"]["account"].ToObject<decimal>();
dealInfo.TradeTime = orderJson["last_trans"]["dealt_time"].ToObject<DateTime>();
dealInfo.DealtAmount = orderJson["last_trans"]["dealt_amount"].ToObject<decimal>();
dealInfo.DealtPrice = orderJson["last_trans"]["dealt_price"].ToObject<decimal>();
dealInfo.DealtVolume = dealInfo.DealtAmount * dealInfo.DealtPrice;
dealInfo.Commission = orderJson["last_trans"]["commission"].ToObject<decimal>();
......@@ -176,7 +176,7 @@ namespace OTWebSocket.API.Services
liveOrder.Deals.Add(dealInfo);
}
}
liveOrder.Comment = "WS更新成功";
//liveOrder.Comment = "WS更新成功";
_logger.Debug($"更新redis缓存{JObject.FromObject(liveOrder)}");
_redisService.SetLiveOrder(liveOrder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment