public virtual FIXCommissionData GetCommissionData(FIXExecutionReport report)
        {
            FIXCommissionData fIXCommissionData = new FIXCommissionData();

            fIXCommissionData.CommType   = FIXCommType.ToFIX(this.fCommType);
            fIXCommissionData.Commission = this.fCommission;
            if (this.fMinCommission != 0.0)
            {
                double num;
                switch (this.fCommType)
                {
                case CommType.PerShare:
                    num = this.fCommission * report.CumQty;
                    break;

                case CommType.Percent:
                    num = this.fCommission * report.CumQty * report.AvgPx;
                    break;

                case CommType.Absolute:
                    num = this.fCommission;
                    break;

                default:
                    throw new NotSupportedException("Commission type is not supported : " + this.fCommType);
                }
                if (num < this.fMinCommission)
                {
                    fIXCommissionData.CommType   = '3';
                    fIXCommissionData.Commission = this.fMinCommission;
                }
            }
            return(fIXCommissionData);
        }
Esempio n. 2
0
 public void AddReport(IOrder order, FIXExecutionReport report)
 {
     lock (this)
     {
         FIXDbServer.RemoveFIXGroup(this.connection, "atable", order.Id);
         FIXDbServer.SaveFIXGroup(this.connection, (FIXGroup)(order as SingleOrder), "ordertable", order.Id);
         IDbCommand cmd = this.connection.CreateCommand();
         cmd.CommandText = "";
         FIXDbServer.SetCommandParameter(cmd, "atable", DbType.Int32, order.Id);
         cmd.ExecuteNonQuery();
         cmd.Dispose();
         IDbCommand cmd2 = this.connection.CreateCommand();
         cmd2.CommandText = "";
         report.Id        = Convert.ToInt32(cmd2.ExecuteScalar());
         cmd2.Dispose();
         FIXDbServer.SaveFIXGroup(this.connection, report, "report.table", report.Id);
     }
 }
 public void Send(FIXExecutionReport message)
 {
 }
Esempio n. 4
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)));
        }
Esempio n. 5
0
        public TDistance Distance(double X, double Y)
        {
            DateTime  now       = Clock.Now;
            TDistance tdistance = new TDistance();
            double    num1      = Math.Abs(((FIXNewOrderSingle)this.order).Price);

            tdistance.X = X;
            tdistance.Y = num1;
            FIXExecutionReport fixExecutionReport = (FIXExecutionReport)null;

            if (this.order.Reports.Count != 0)
            {
                fixExecutionReport = (FIXExecutionReport)this.order.Reports[this.order.Reports.Count - 1];
            }
            if (fixExecutionReport == null)
            {
                return((TDistance)null);
            }
            if (((NewOrderSingle)this.order).OrdType == OrdType.Market && this.order.OrdStatus != OrdStatus.Filled)
            {
                return((TDistance)null);
            }
            StringBuilder stringBuilder = (StringBuilder)null;

            if (((NewOrderSingle)this.order).OrdType == OrdType.Market)
            {
                tdistance.X   = (double)fixExecutionReport.TransactTime.Ticks;
                tdistance.Y   = fixExecutionReport.Price;
                tdistance.dX  = Math.Abs(X - tdistance.X);
                tdistance.dY  = Math.Abs(Y - tdistance.Y);
                stringBuilder = new StringBuilder();
                if (fixExecutionReport.TransactTime.Second != 0 || fixExecutionReport.TransactTime.Minute != 0 || fixExecutionReport.TransactTime.Hour != 0)
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, (object)((object)this.order.OrdStatus).ToString(), (object)((object)((NewOrderSingle)this.order).Side).ToString(), (object)this.order.Instrument.Symbol, (object)((FIXNewOrderSingle)this.order).OrderQty, (object)"Market ", (object)this.order.AvgPx, (object)fixExecutionReport.TransactTime);
                }
                else
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, (object)((object)this.order.OrdStatus).ToString(), (object)((object)((NewOrderSingle)this.order).Side).ToString(), (object)this.order.Instrument.Symbol, (object)((FIXNewOrderSingle)this.order).OrderQty, (object)"Market ", (object)this.order.AvgPx, (object)fixExecutionReport.TransactTime.ToShortDateString());
                }
            }
            if (((NewOrderSingle)this.order).OrdType == OrdType.Stop || ((NewOrderSingle)this.order).OrdType == OrdType.StopLimit)
            {
                double num2 = Math.Abs(((FIXNewOrderSingle)this.order).StopPx);
                tdistance.X = X;
                tdistance.Y = num2;
                DateTime transactTime = this.order.Reports[0].TransactTime;
                tdistance.dX  = X <(double)transactTime.Ticks || (this.order.OrdStatus == OrdStatus.Filled || this.order.OrdStatus == OrdStatus.Cancelled || (this.order.OrdStatus == OrdStatus.Rejected || X > (double)now.Ticks)) && X> (double) fixExecutionReport.TransactTime.Ticks ? double.MaxValue : 0.0;
                tdistance.dY  = Math.Abs(Y - tdistance.Y);
                stringBuilder = new StringBuilder();
                if (transactTime.Second != 0 || transactTime.Minute != 0 || transactTime.Hour != 0)
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, (object)((object)this.order.OrdStatus).ToString(), (object)((object)((NewOrderSingle)this.order).Side).ToString(), (object)this.order.Instrument.Symbol, (object)((FIXNewOrderSingle)this.order).OrderQty, (object)"Stop At ", (object)num2, (object)fixExecutionReport.TransactTime);
                }
                else
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, (object)((object)this.order.OrdStatus).ToString(), (object)((object)((NewOrderSingle)this.order).Side).ToString(), (object)this.order.Instrument.Symbol, (object)((FIXNewOrderSingle)this.order).OrderQty, (object)"Stop At ", (object)num2, (object)fixExecutionReport.TransactTime.ToShortDateString());
                }
            }
            if (((NewOrderSingle)this.order).OrdType == OrdType.Limit || ((NewOrderSingle)this.order).OrdType == OrdType.StopLimit)
            {
                double num2 = Math.Abs(((FIXNewOrderSingle)this.order).Price);
                tdistance.X = X;
                tdistance.Y = num2;
                DateTime transactTime = this.order.Reports[0].TransactTime;
                tdistance.dX = X <(double)transactTime.Ticks || (this.order.OrdStatus == OrdStatus.Filled || this.order.OrdStatus == OrdStatus.Cancelled || (this.order.OrdStatus == OrdStatus.Rejected || X > (double)now.Ticks)) && X> (double) fixExecutionReport.TransactTime.Ticks ? double.MaxValue : 0.0;
                if (tdistance.dY > Math.Abs(Y - tdistance.Y))
                {
                    tdistance.dY  = Math.Abs(Y - tdistance.Y);
                    stringBuilder = new StringBuilder();
                    if (transactTime.Second != 0 || transactTime.Minute != 0 || transactTime.Hour != 0)
                    {
                        stringBuilder.AppendFormat(this.toolTipFormat, (object)((object)this.order.OrdStatus).ToString(), (object)((object)((NewOrderSingle)this.order).Side).ToString(), (object)this.order.Instrument.Symbol, (object)((FIXNewOrderSingle)this.order).OrderQty, (object)"Limit At ", (object)num2, (object)fixExecutionReport.TransactTime);
                    }
                    else
                    {
                        stringBuilder.AppendFormat(this.toolTipFormat, (object)((object)this.order.OrdStatus).ToString(), (object)((object)((NewOrderSingle)this.order).Side).ToString(), (object)this.order.Instrument.Symbol, (object)((FIXNewOrderSingle)this.order).OrderQty, (object)"Limit At ", (object)num2, (object)fixExecutionReport.TransactTime.ToShortDateString());
                    }
                }
            }
            if (stringBuilder != null)
            {
                tdistance.ToolTipText = ((object)stringBuilder).ToString();
            }
            return(tdistance);
        }
 public FIXExecutionReportEventArgs(FIXExecutionReport ExecutionReport)
 {
     this.VhfuUiEk7S = ExecutionReport;
 }
Esempio n. 7
0
 public void AddReport(IOrder order, FIXExecutionReport report)
 {
 }
Esempio n. 8
0
 public virtual void Send(FIXExecutionReport report)
 {
 }
Esempio n. 9
0
        public PadRange GetPadRangeY(Pad pad)
        {
            DateTime           now = Clock.Now;
            FIXExecutionReport fIXExecutionReport = null;

            if (this.order.Reports.Count != 0)
            {
                fIXExecutionReport = this.order.Reports[this.order.Reports.Count - 1];
            }
            if (fIXExecutionReport == null)
            {
                return(new PadRange(0.0, 0.0));
            }
            if (this.order.OrdType == OrdType.Market && this.order.OrdStatus != OrdStatus.Filled)
            {
                return(new PadRange(0.0, 0.0));
            }
            FIXExecutionReport fIXExecutionReport2 = this.order.Reports[0];
            DateTime           t            = new DateTime((long)pad.XMin);
            DateTime           t2           = new DateTime((long)pad.XMax);
            DateTime           transactTime = fIXExecutionReport2.TransactTime;
            DateTime           t3;

            if (this.order.OrdStatus == OrdStatus.Filled || this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected)
            {
                t3 = fIXExecutionReport.TransactTime;
            }
            else
            {
                t3 = now;
            }
            if (!(t <= t3) || !(t2 >= transactTime) || this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected)
            {
                return(new PadRange(0.0, 0.0));
            }
            double val  = this.order.AvgPx - 1E-10;
            double val2 = this.order.AvgPx + 1E-10;

            if (this.order.OrdType == OrdType.Limit)
            {
                int clientY = pad.ClientY(this.order.Price);
                if (this.order.Side == Side.Buy)
                {
                    val2 = pad.WorldY(clientY);
                    val  = this.order.Price;
                }
                else
                {
                    val  = pad.WorldY(clientY);
                    val2 = this.order.Price;
                }
            }
            if (this.order.OrdType == OrdType.Stop)
            {
                int clientY2 = pad.ClientY(this.order.StopPx);
                if (this.order.Side != Side.Buy)
                {
                    val2 = pad.WorldY(clientY2);
                    val  = this.order.StopPx;
                }
                else
                {
                    val  = pad.WorldY(clientY2);
                    val2 = this.order.StopPx;
                }
            }
            if (this.order.OrdType == OrdType.StopLimit)
            {
                int clientY3 = pad.ClientY(this.order.Price);
                int clientY4 = pad.ClientY(this.order.StopPx);
                if (this.order.Side == Side.Buy)
                {
                    val2 = pad.WorldY(clientY3);
                    val  = pad.WorldY(clientY4);
                }
                else
                {
                    val  = pad.WorldY(clientY3);
                    val2 = pad.WorldY(clientY4);
                }
            }
            return(new PadRange(Math.Min(val, val2), Math.Max(val, val2)));
        }
Esempio n. 10
0
        public TDistance Distance(double X, double Y)
        {
            DateTime  now       = Clock.Now;
            TDistance tDistance = new TDistance();
            double    num       = Math.Abs(this.order.Price);

            tDistance.X = X;
            tDistance.Y = num;
            FIXExecutionReport fIXExecutionReport = null;

            if (this.order.Reports.Count != 0)
            {
                fIXExecutionReport = this.order.Reports[this.order.Reports.Count - 1];
            }
            if (fIXExecutionReport == null)
            {
                return(null);
            }
            if (this.order.OrdType == OrdType.Market && this.order.OrdStatus != OrdStatus.Filled)
            {
                return(null);
            }
            StringBuilder stringBuilder = null;

            if (this.order.OrdType == OrdType.Market)
            {
                tDistance.X   = (double)fIXExecutionReport.TransactTime.Ticks;
                tDistance.Y   = fIXExecutionReport.Price;
                tDistance.dX  = Math.Abs(X - tDistance.X);
                tDistance.dY  = Math.Abs(Y - tDistance.Y);
                stringBuilder = new StringBuilder();
                if (fIXExecutionReport.TransactTime.Second != 0 || fIXExecutionReport.TransactTime.Minute != 0 || fIXExecutionReport.TransactTime.Hour != 0)
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, new object[]
                    {
                        this.order.OrdStatus.ToString(),
                        this.order.Side.ToString(),
                        this.order.Instrument.Symbol,
                        this.order.OrderQty,
                        "Market ",
                        this.order.AvgPx,
                        fIXExecutionReport.TransactTime
                    });
                }
                else
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, new object[]
                    {
                        this.order.OrdStatus.ToString(),
                        this.order.Side.ToString(),
                        this.order.Instrument.Symbol,
                        this.order.OrderQty,
                        "Market ",
                        this.order.AvgPx,
                        fIXExecutionReport.TransactTime.ToShortDateString()
                    });
                }
            }
            if (this.order.OrdType == OrdType.Stop || this.order.OrdType == OrdType.StopLimit)
            {
                num         = Math.Abs(this.order.StopPx);
                tDistance.X = X;
                tDistance.Y = num;
                DateTime transactTime = this.order.Reports[0].TransactTime;
                if (X >= (double)transactTime.Ticks && ((this.order.OrdStatus != OrdStatus.Filled && this.order.OrdStatus != OrdStatus.Cancelled && this.order.OrdStatus != OrdStatus.Rejected && X <= (double)now.Ticks) || X <= (double)fIXExecutionReport.TransactTime.Ticks))
                {
                    tDistance.dX = 0.0;
                }
                else
                {
                    tDistance.dX = 1.7976931348623157E+308;
                }
                tDistance.dY  = Math.Abs(Y - tDistance.Y);
                stringBuilder = new StringBuilder();
                if (transactTime.Second != 0 || transactTime.Minute != 0 || transactTime.Hour != 0)
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, new object[]
                    {
                        this.order.OrdStatus.ToString(),
                        this.order.Side.ToString(),
                        this.order.Instrument.Symbol,
                        this.order.OrderQty,
                        "Stop At ",
                        num,
                        fIXExecutionReport.TransactTime
                    });
                }
                else
                {
                    stringBuilder.AppendFormat(this.toolTipFormat, new object[]
                    {
                        this.order.OrdStatus.ToString(),
                        this.order.Side.ToString(),
                        this.order.Instrument.Symbol,
                        this.order.OrderQty,
                        "Stop At ",
                        num,
                        fIXExecutionReport.TransactTime.ToShortDateString()
                    });
                }
            }
            if (this.order.OrdType == OrdType.Limit || this.order.OrdType == OrdType.StopLimit)
            {
                num         = Math.Abs(this.order.Price);
                tDistance.X = X;
                tDistance.Y = num;
                DateTime transactTime2 = this.order.Reports[0].TransactTime;
                if (X >= (double)transactTime2.Ticks && ((this.order.OrdStatus != OrdStatus.Filled && this.order.OrdStatus != OrdStatus.Cancelled && this.order.OrdStatus != OrdStatus.Rejected && X <= (double)now.Ticks) || X <= (double)fIXExecutionReport.TransactTime.Ticks))
                {
                    tDistance.dX = 0.0;
                }
                else
                {
                    tDistance.dX = 1.7976931348623157E+308;
                }
                if (tDistance.dY > Math.Abs(Y - tDistance.Y))
                {
                    tDistance.dY  = Math.Abs(Y - tDistance.Y);
                    stringBuilder = new StringBuilder();
                    if (transactTime2.Second != 0 || transactTime2.Minute != 0 || transactTime2.Hour != 0)
                    {
                        stringBuilder.AppendFormat(this.toolTipFormat, new object[]
                        {
                            this.order.OrdStatus.ToString(),
                            this.order.Side.ToString(),
                            this.order.Instrument.Symbol,
                            this.order.OrderQty,
                            "Limit At ",
                            num,
                            fIXExecutionReport.TransactTime
                        });
                    }
                    else
                    {
                        stringBuilder.AppendFormat(this.toolTipFormat, new object[]
                        {
                            this.order.OrdStatus.ToString(),
                            this.order.Side.ToString(),
                            this.order.Instrument.Symbol,
                            this.order.OrderQty,
                            "Limit At ",
                            num,
                            fIXExecutionReport.TransactTime.ToShortDateString()
                        });
                    }
                }
            }
            if (stringBuilder != null)
            {
                tDistance.ToolTipText = stringBuilder.ToString();
            }
            return(tDistance);
        }
Esempio n. 11
0
        public void SendExecutionReport(FIXExecutionReport report)
        {
            OrderServicePair orderServicePair = this.orderServicePairs[report.ClOrdID];

            orderServicePair.Service.Send(report);
        }