Пример #1
0
 public PadRange GetPadRangeY(Pad pad)
 {
   DateTime now = Clock.Now;
   FIXExecutionReport fixExecutionReport1 = (FIXExecutionReport) null;
   if (this.order.Reports.Count != 0)
     fixExecutionReport1 = (FIXExecutionReport) this.order.Reports[this.order.Reports.Count - 1];
   if (fixExecutionReport1 == null)
     return new PadRange(0.0, 0.0);
   if (((NewOrderSingle) this.order).OrdType == OrdType.Market && this.order.OrdStatus != OrdStatus.Filled)
     return new PadRange(0.0, 0.0);
   FIXExecutionReport fixExecutionReport2 = (FIXExecutionReport) this.order.Reports[0];
   DateTime dateTime1 = new DateTime((long) pad.XMin);
   DateTime dateTime2 = new DateTime((long) pad.XMax);
   DateTime transactTime = fixExecutionReport2.TransactTime;
   DateTime dateTime3 = this.order.OrdStatus == OrdStatus.Filled || this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected ? fixExecutionReport1.TransactTime : now;
   if (!(dateTime1 <= dateTime3) || !(dateTime2 >= transactTime) || (this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected))
     return new PadRange(0.0, 0.0);
   double val1 = this.order.AvgPx - 0.0 / 1.0;
   double val2 = this.order.AvgPx + 0.0 / 1.0;
   if (((NewOrderSingle) this.order).OrdType == OrdType.Limit)
   {
     int ClientY = pad.ClientY(((FIXNewOrderSingle) this.order).Price);
     if (((NewOrderSingle) this.order).Side == Side.Buy)
     {
       val2 = pad.WorldY(ClientY);
       val1 = ((FIXNewOrderSingle) this.order).Price;
     }
     else
     {
       val1 = pad.WorldY(ClientY);
       val2 = ((FIXNewOrderSingle) this.order).Price;
     }
   }
   if (((NewOrderSingle) this.order).OrdType == OrdType.Stop)
   {
     int ClientY = pad.ClientY(((FIXNewOrderSingle) this.order).StopPx);
     if (((NewOrderSingle) this.order).Side != Side.Buy)
     {
       val2 = pad.WorldY(ClientY);
       val1 = ((FIXNewOrderSingle) this.order).StopPx;
     }
     else
     {
       val1 = pad.WorldY(ClientY);
       val2 = ((FIXNewOrderSingle) this.order).StopPx;
     }
   }
   if (((NewOrderSingle) this.order).OrdType == OrdType.StopLimit)
   {
     int ClientY1 = pad.ClientY(((FIXNewOrderSingle) this.order).Price);
     int ClientY2 = pad.ClientY(((FIXNewOrderSingle) this.order).StopPx);
     if (((NewOrderSingle) this.order).Side == Side.Buy)
     {
       val2 = pad.WorldY(ClientY1);
       val1 = pad.WorldY(ClientY2);
     }
     else
     {
       val1 = pad.WorldY(ClientY1);
       val2 = pad.WorldY(ClientY2);
     }
   }
   return new PadRange(Math.Min(val1, val2), Math.Max(val1, val2));
 }