예제 #1
0
            void _acctVm_OnPositionDetailReturn(trade.PositionDetailInfo posiDetail)
            {
                PositionDetailItem posiItem = new PositionDetailItem();

                posiItem.Symbol            = posiDetail.InstrumentID;
                posiItem.TradeID           = posiDetail.TradeID;
                posiItem.HedgeFlag         = GetHedgeText(posiDetail.HedgeFlag);
                posiItem.Direction         = GetDirection(posiDetail.Direction);
                posiItem.OpenDate          = GetDate(posiDetail.OpenDate);
                posiItem.Volume            = posiDetail.Volume;
                posiItem.IsOpen            = posiItem.Volume > 0;
                posiItem.OpenPrice         = posiDetail.OpenPrice;
                posiItem.TradingDay        = GetDate(posiDetail.TradingDay);
                posiItem.ExchangeID        = posiDetail.ExchangeID;
                posiItem.CloseProfit       = posiDetail.CloseProfitByDate;
                posiItem.PositionProfit    = posiDetail.PositionProfitByDate;
                posiItem.Margin            = posiDetail.Margin;
                posiItem.MarginRateByMoney = posiDetail.MarginRateByMoney;
                posiItem.CloseVolume       = posiDetail.CloseVolume;
                posiItem.CloseAmount       = posiDetail.CloseAmount;

                posiItem.CloseDirection = posiDetail.Direction == trade.TradeDirectionType.BUY ?
                                          trade.TradeDirectionType.SELL : trade.TradeDirectionType.BUY;
                //posiItem.OffsetFlag = GetOffsetFlag(posiItem.Symbol, posiItem.OpenDate, posiItem.TradingDay);

                _positionDetailItems.Add(posiItem);

                UpdateTime = DateTime.Now;
            }
예제 #2
0
 void _client_OnPositionDetialReturn(trade.PositionDetailInfo obj)
 {
     if (OnPositionDetailReturn != null)
     {
         DispatcherHelper.Current.BeginInvoke(
             new Action(() => OnPositionDetailReturn(obj)));
     }
 }