コード例 #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
ファイル: USeOrderDriver.cs プロジェクト: handayu/TFS-WebKit
        /// <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;
 }