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
        private void D35FmNWSPm(double obj0, double obj1)
        {
            SingleOrder singleOrder = this.PYBF7sahqY as SingleOrder;

            if (singleOrder.IsDone)
            {
                return;
            }
            if (obj1 < singleOrder.LeavesQty)
            {
                this.aXtFGP76FH = false;
                ExecutionReport report = new ExecutionReport();
                report.TransactTime     = Clock.Now;
                report.ClOrdID          = singleOrder.ClOrdID;
                report.ExecType         = ExecType.PartialFill;
                report.OrdStatus        = OrdStatus.PartiallyFilled;
                report.Symbol           = singleOrder.Symbol;
                report.Side             = singleOrder.Side;
                report.OrdType          = singleOrder.OrdType;
                report.AvgPx            = (singleOrder.AvgPx * singleOrder.CumQty + obj0 * obj1) / (singleOrder.CumQty + obj1);
                report.OrderQty         = singleOrder.OrderQty;
                report.LastQty          = obj1;
                report.CumQty           = singleOrder.CumQty + obj1;
                report.LeavesQty        = singleOrder.LeavesQty - obj1;
                report.LastPx           = obj0;
                report.Price            = singleOrder.Price;
                report.StopPx           = singleOrder.StopPx;
                report.SecurityType     = singleOrder.SecurityType;
                report.SecurityExchange = singleOrder.SecurityExchange;
                report.Currency         = singleOrder.Currency;
                report.Text             = singleOrder.Text;
                FIXCommissionData commissionData = this.A8bFJItyyx.CommissionProvider.GetCommissionData((FIXExecutionReport)report);
                report.CommType   = FIXCommType.FromFIX(commissionData.CommType);
                report.Commission = commissionData.Commission;
                report.AvgPx      = this.A8bFJItyyx.SlippageProvider.GetExecutionPrice(report);
                this.A8bFJItyyx.JPVPJSWclF(report);
            }
            else
            {
                this.D7GFelmgQp();
                this.A8bFJItyyx.MyIPdEI7fi.Remove((object)this.PYBF7sahqY.ClOrdID);
                this.aXtFGP76FH = true;
                obj1            = singleOrder.LeavesQty;
                ExecutionReport report = new ExecutionReport();
                report.TransactTime     = Clock.Now;
                report.ClOrdID          = singleOrder.ClOrdID;
                report.ExecType         = ExecType.Fill;
                report.OrdStatus        = OrdStatus.Filled;
                report.Symbol           = singleOrder.Symbol;
                report.Side             = singleOrder.Side;
                report.OrdType          = singleOrder.OrdType;
                report.AvgPx            = (singleOrder.AvgPx * singleOrder.CumQty + obj0 * obj1) / (singleOrder.CumQty + obj1);
                report.OrderQty         = singleOrder.OrderQty;
                report.LastQty          = singleOrder.LeavesQty;
                report.CumQty           = singleOrder.OrderQty;
                report.LeavesQty        = 0.0;
                report.LastPx           = obj0;
                report.Price            = singleOrder.Price;
                report.StopPx           = singleOrder.StopPx;
                report.SecurityType     = singleOrder.SecurityType;
                report.SecurityExchange = singleOrder.SecurityExchange;
                report.Currency         = singleOrder.Currency;
                report.Text             = singleOrder.Text;
                FIXCommissionData commissionData = this.A8bFJItyyx.CommissionProvider.GetCommissionData((FIXExecutionReport)report);
                report.CommType   = FIXCommType.FromFIX(commissionData.CommType);
                report.Commission = commissionData.Commission;
                report.AvgPx      = this.A8bFJItyyx.SlippageProvider.GetExecutionPrice(report);
                this.A8bFJItyyx.JPVPJSWclF(report);
            }
        }
Esempio n. 3
0
        private void DdBEZNiZyZ(Portfolio obj0)
        {
            obj0.LwTsbC870d(true);
            IDbCommand command1 = this.connection.CreateCommand();
//      command1.CommandText = gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7996);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(8138), DbType.Int32, (object) obj0.Id);
            IDataReader dataReader1 = command1.ExecuteReader();

            while (dataReader1.Read())
            {
                int int32_1 = dataReader1.GetInt32(0);
                dataReader1.GetInt32(1);
                string      string1     = dataReader1.GetString(2);
                int         int32_2     = dataReader1.GetInt32(3);
                DateTime    dateTime    = dataReader1.GetDateTime(4);
                int         int32_3     = dataReader1.GetInt32(5);
                string      string2     = dataReader1.GetString(6);
                double      double1     = dataReader1.GetDouble(7);
                double      double2     = dataReader1.GetDouble(8);
                string      string3     = dataReader1.GetString(9);
                string      string4     = dataReader1.GetString(10);
                string      string5     = dataReader1.GetString(11);
                double      double3     = dataReader1.GetDouble(12);
                string      string6     = dataReader1.GetString(13);
                Transaction transaction = new Transaction();
                transaction.nx8WA03O1L(int32_1);
                transaction.ClOrdID    = string1;
                transaction.ReportId   = int32_2;
                transaction.DateTime   = dateTime;
                transaction.Instrument = InstrumentManager.Instruments.GetById(int32_3);
                transaction.Side       = FIXSide.FromFIX(string2[0]);
                transaction.Price      = double1;
                transaction.Qty        = double2;
                transaction.Text       = string3;
                TransactionCost transactionCost = (TransactionCost)Activator.CreateInstance(Type.GetType(string.Format("s", (object)string5, (object)string4)), true);
                transactionCost.CommType    = FIXCommType.FromFIX(string6[0]);
                transactionCost.Commission  = double3;
                transaction.TransactionCost = transactionCost;
                if (transaction.Instrument == null)
                {
                    transaction.Instrument = this.xKIEA4RkYI(int32_3);
                }
                obj0.Add(transaction);
            }
            dataReader1.Close();
            command1.Dispose();
            IDbCommand command2 = this.connection.CreateCommand();

//      command2.CommandText = gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(8180);
            FIXDbServer.SetCommandParameter(command2, "sss", DbType.Int32, (object)obj0.Id);
            IDataReader dataReader2 = command2.ExecuteReader();

            while (dataReader2.Read())
            {
                int int32 = dataReader2.GetInt32(0);
                dataReader2.GetInt32(1);
                DateTime           dateTime    = dataReader2.GetDateTime(2);
                string             @string     = dataReader2.GetString(3);
                double             @double     = dataReader2.GetDouble(4);
                string             str         = dataReader2.IsDBNull(5) ? "" : dataReader2.GetString(5);
                AccountTransaction transaction = new AccountTransaction();
                transaction.G7YBAhR7LA(int32);
                transaction.DateTime = dateTime;
                transaction.Currency = CurrencyManager.Currencies[@string];
                transaction.Value    = @double;
                transaction.Text     = str;
                obj0.Account.Add(transaction);
            }
            dataReader2.Close();
            command2.Dispose();
            obj0.LwTsbC870d(false);
        }
Esempio n. 4
0
        private void Execute(double price, double qty)
        {
            SingleOrder singleOrder = this.fOrder as SingleOrder;

            if (singleOrder.IsDone)
            {
                return;
            }
            if (qty < singleOrder.LeavesQty)
            {
                this.fExecuted = false;
                ExecutionReport executionReport = new ExecutionReport();
                executionReport.TransactTime     = Clock.Now;
                executionReport.ClOrdID          = singleOrder.ClOrdID;
                executionReport.ExecType         = ExecType.PartialFill;
                executionReport.OrdStatus        = OrdStatus.PartiallyFilled;
                executionReport.Symbol           = singleOrder.Symbol;
                executionReport.Side             = singleOrder.Side;
                executionReport.OrdType          = singleOrder.OrdType;
                executionReport.AvgPx            = (singleOrder.AvgPx * singleOrder.CumQty + price * qty) / (singleOrder.CumQty + qty);
                executionReport.OrderQty         = singleOrder.OrderQty;
                executionReport.LastQty          = qty;
                executionReport.CumQty           = singleOrder.CumQty + qty;
                executionReport.LeavesQty        = singleOrder.LeavesQty - qty;
                executionReport.LastPx           = price;
                executionReport.Price            = singleOrder.Price;
                executionReport.StopPx           = singleOrder.StopPx;
                executionReport.SecurityType     = singleOrder.SecurityType;
                executionReport.SecurityExchange = singleOrder.SecurityExchange;
                executionReport.Currency         = singleOrder.Currency;
                executionReport.Text             = singleOrder.Text;
                FIXCommissionData commissionData = this.fProvider.CommissionProvider.GetCommissionData(executionReport);
                executionReport.CommType   = FIXCommType.FromFIX(commissionData.CommType);
                executionReport.Commission = commissionData.Commission;
                executionReport.AvgPx      = this.fProvider.SlippageProvider.GetExecutionPrice(executionReport);
                this.fProvider.EmitExecutionReport(executionReport);
                return;
            }
            this.Disconnect();
            this.fProvider.fProcessors.Remove(this.fOrder.ClOrdID);
            this.fExecuted = true;
            qty            = singleOrder.LeavesQty;
            ExecutionReport executionReport2 = new ExecutionReport();

            executionReport2.TransactTime     = Clock.Now;
            executionReport2.ClOrdID          = singleOrder.ClOrdID;
            executionReport2.ExecType         = ExecType.Fill;
            executionReport2.OrdStatus        = OrdStatus.Filled;
            executionReport2.Symbol           = singleOrder.Symbol;
            executionReport2.Side             = singleOrder.Side;
            executionReport2.OrdType          = singleOrder.OrdType;
            executionReport2.AvgPx            = (singleOrder.AvgPx * singleOrder.CumQty + price * qty) / (singleOrder.CumQty + qty);
            executionReport2.OrderQty         = singleOrder.OrderQty;
            executionReport2.LastQty          = singleOrder.LeavesQty;
            executionReport2.CumQty           = singleOrder.OrderQty;
            executionReport2.LeavesQty        = 0.0;
            executionReport2.LastPx           = price;
            executionReport2.Price            = singleOrder.Price;
            executionReport2.StopPx           = singleOrder.StopPx;
            executionReport2.SecurityType     = singleOrder.SecurityType;
            executionReport2.SecurityExchange = singleOrder.SecurityExchange;
            executionReport2.Currency         = singleOrder.Currency;
            executionReport2.Text             = singleOrder.Text;
            FIXCommissionData commissionData2 = this.fProvider.CommissionProvider.GetCommissionData(executionReport2);

            executionReport2.CommType   = FIXCommType.FromFIX(commissionData2.CommType);
            executionReport2.Commission = commissionData2.Commission;
            executionReport2.AvgPx      = this.fProvider.SlippageProvider.GetExecutionPrice(executionReport2);
            this.fProvider.EmitExecutionReport(executionReport2);
        }