Ejemplo n.º 1
0
        /// <summary>
        /// 触发持仓变更事件。
        /// </summary>
        /// <param name="args"></param>
        protected virtual void FirePositionChanged(USePosition position)
        {
            if (position == null)
            {
                return;
            }
            USePositionChangedEventArgs args = new USePositionChangedEventArgs(position);

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

            if (OnPositionChanged != null)
            {
                OnPositionChanged(this, args);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 克隆USePosition对象。
        /// </summary>
        /// <returns></returns>
        public USePosition Clone()
        {
            USePosition position = new USePosition();

            position.Instrument        = this.Instrument.Clone();
            position.Direction         = this.Direction;
            position.NewPosition       = this.NewPosition;
            position.OldPosition       = this.OldPosition;
            position.YesterdayPosition = this.YesterdayPosition;
            position.OpenQty           = this.OpenQty;
            position.AvgPirce          = this.AvgPirce;
            position.Amount            = this.Amount;
            position.CloseQty          = this.CloseQty;
            position.NewFrozonPosition = this.NewFrozonPosition;
            position.OldFrozonPosition = this.OldFrozonPosition;

            return(position);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 持仓变更。
 /// </summary>
 /// <param name="position"></param>
 public USePositionChangedEventArgs(USePosition position)
 {
     this.Position = position;
 }