public void UpdatePositionSummary(Trader obj, List <UserPosition> ups, bool isAdd) { LogError(() => { lock (obj.Account.BailAccount) { foreach (var v in ups) { try { var m = market.Get(v.Order.Contract.Name); obj.Calc(v, isAdd, m == null ? 0 : m.NewestDealPrice); } catch (Exception e) { Singleton <TextLog> .Instance.Error(e, "UpdatePositionSummary"); } } } if (OnPositionSummaryChanged != null && ups.Count > 0) { var u = ups[0]; var ps = obj.GetPositionSummary(u.Order.Contract.Code, u.Order.PositionType); var v = ps; var pd = new PositionSummaryData { OrderType = v.OrderType, Commission = 0, TotalValue = v.TotalValue, Maintain = 0, ClosableCount = obj.GetClosableCount(v), FloatProfit = v.FloatProfit, BuyTotal = v.BuyTotal, BuyPrice = v.BuyPrice, Count = v.Count, PositionType = v.PositionType, ContractId = v.Contract.Id, CloseProfit = v.CloseProfit, TraderId = obj.Id, When = DateTime.Now }; pds.Save(pd); RaisePC(ps, obj); } }); }