예제 #1
0
 /// <summary>
 /// 按建仓时间正向排序。
 /// </summary>
 /// <param name="detail1"></param>
 /// <param name="detail2"></param>
 /// <returns></returns>
 public static int SortByOpenTimeAsc(USePositionDetail detail1, USePositionDetail detail2)
 {
     if (detail1.OpenTime < detail2.OpenTime)
     {
         return(-1);
     }
     else if (detail1.OpenTime > detail2.OpenTime)
     {
         return(1);
     }
     else
     {
         return(detail1.ID.CompareTo(detail2.ID));
     }
 }
예제 #2
0
        /// <summary>
        /// 触发持仓明细变更事件。
        /// </summary>
        /// <param name="args"></param>
        protected virtual void FirePositionDetailChanged(USePositionDetail positionDetail)
        {
            if (positionDetail == null)
            {
                return;
            }
            USePositionDetailChangedEventArgs args = new USePositionDetailChangedEventArgs(positionDetail);

            Debug.WriteLine(string.Format("[{0}] positon detail changed,[Product:{1}][Direction:{2}].",
                                          ToString(), args.PositionDetail.Instrument, args.PositionDetail.Direction));

            if (OnPositionDetailChanged != null)
            {
                OnPositionDetailChanged(this, args);
            }
        }
예제 #3
0
        /// <summary>
        /// 克隆USePositionDetail对象。
        /// </summary>
        /// <returns></returns>
        public USePositionDetail Clone()
        {
            USePositionDetail entity = new USePositionDetail();

            entity.ID           = this.ID;
            entity.Instrument   = this.Instrument.Clone();
            entity.Direction    = this.Direction;
            entity.PositionType = this.PositionType;
            entity.OpenQty      = this.OpenQty;
            entity.OpenPrice    = this.OpenPrice;
            entity.OpenTime     = this.OpenTime;
            entity.CloseQty     = this.CloseQty;
            entity.CloseAmount  = this.CloseAmount;
            entity.ClosePrice   = this.ClosePrice;

            return(entity);
        }
예제 #4
0
 /// <summary>
 /// 持仓变更。
 /// </summary>
 /// <param name="position"></param>
 public USePositionDetailChangedEventArgs(USePositionDetail positionDetail)
 {
     this.PositionDetail = positionDetail;
 }