/// <summary>
        /// CLOSE COMMAND OF MARKETAREA SPOT COMMAND
        /// </summary>
        /// <param name="CommandID"></param>
        internal void CloseCommand(string Cmd)
        {
            Business.OpenTrade Command = new Business.OpenTrade();
            Command = Model.CommandFramework.CommandFrameworkInstance.ExtractCommand(Cmd);

            #region Find In Symbol List And Remove Command
            //Command = TradingServer.Facade.FacadeFindOpenTradeInCommandExecutor(CommandID);
            #endregion

            TradingServer.Facade.FacadeFillInstanceToCommand(Command);

            #region Check Status Trade Of Symbol(Full Access,Close Only, No)
            if (Command.Symbol.Trade == "No")
            {
                string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(2, false, "CM009", Command);

                Command.Investor.ClientCommandQueue.Add(Message);

                return;
            }
            #endregion

            if (Command.Symbol != null && Command.Investor != null && Command.Type != null && Command.IGroupSecurity != null)
            {
                if (Command.Type.ID == 1 || Command.Type.ID == 2)
                {
                    //Call Dealer
                    Business.RequestDealer newRequestDealer = new Business.RequestDealer();
                    newRequestDealer.InvestorID = Command.Investor.InvestorID;
                    newRequestDealer.MaxDev = Command.MaxDev;
                    newRequestDealer.Name = "Close";
                    newRequestDealer.Request = Command;
                    newRequestDealer.TimeClientRequest = DateTime.Now;

                    TradingServer.Facade.FacadeSendRequestToDealer(newRequestDealer);
                }
                else
                {
                    Command.Symbol.MarketAreaRef.CloseCommand(Command);
                }
            }
            else
            {
                if (Command.Investor != null)
                {
                    //Add Result To Client Command Queue Of Investor
                    string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(2, false, "CM001", Command);

                    Command.Investor.ClientCommandQueue.Add(Message);
                }
            }
        }
        /// <summary>
        /// MAKE COMMAND OF MARKETAREA SPOT COMMAND
        /// </summary>
        /// <param name="Cmd"></param>
        internal void MakeCommand(string Cmd)
        {
            Business.OpenTrade Command = new OpenTrade();
            Command = Model.CommandFramework.CommandFrameworkInstance.ExtractCommand(Cmd);

            if (Command.Symbol.IsTrade == false)
            {
                string Message = "CMD12369$False,CM034";
                Command.Investor.ClientCommandQueue.Add(Message);
                return;
            }

            if (Business.Market.IsOpen == false)
            {
                string Message = "CMD12369$False,CM033";
                Command.Investor.ClientCommandQueue.Add(Message);
                return;
            }

            if (Command.Symbol.IsHoliday == 1)
            {
                string Message = "CMD12369$False,CM035";
                Command.Investor.ClientCommandQueue.Add(Message);
                return;
            }

            #region Get Setting IsTrade In Group
            bool IsTradeGroup = false;
            if (Business.Market.InvestorGroupList != null)
            {
                int count = Business.Market.InvestorGroupList.Count;
                for (int i = 0; i < count; i++)
                {
                    if (Business.Market.InvestorGroupList[i].InvestorGroupID == Command.Investor.InvestorGroupInstance.InvestorGroupID)
                    {
                        if (Business.Market.InvestorGroupList[i].ParameterItems != null)
                        {
                            int countParameter = Business.Market.InvestorGroupList[i].ParameterItems.Count;
                            for (int j = 0; j < countParameter; j++)
                            {
                                if (Business.Market.InvestorGroupList[i].ParameterItems[j].Code == "G01")
                                {
                                    if (Business.Market.InvestorGroupList[i].ParameterItems[j].BoolValue == 1)
                                        IsTradeGroup = true;

                                    break;
                                }
                            }
                        }
                        break;
                    }
                }
            }
            #endregion

            if (IsTradeGroup == true)
            {
                if (Command.Symbol == null || Command.Investor == null || Command.Type == null || Command.IGroupSecurity == null)
                {
                    #region Check Investor != null Then Return Error To Client
                    if (Command.Investor != null)
                    {
                        //Add Result To Client Command Queue Of Investor
                        string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM001", Command);

                        Command.Investor.ClientCommandQueue.Add(Message);
                    }
                    #endregion

                    return;
                }   //End If Check Instant Symbol,Investor,Type,IGroupSecurity
                else
                {
                    #region Check Lots Minimum And Maximum In IGroupSecurity And Check IsTrade In IGroupSecurity
                    bool IsTrade = false;
                    double Minimum = -1;
                    double Maximum = -1;
                    double Step = -1;
                    bool ResultCheckStepLots = false;

                    #region Get Config IGroupSecurity
                    if (Command.IGroupSecurity.IGroupSecurityConfig != null)
                    {
                        int countIGroupSecurityConfig = Command.IGroupSecurity.IGroupSecurityConfig.Count;
                        for (int i = 0; i < countIGroupSecurityConfig; i++)
                        {
                            if (Command.IGroupSecurity.IGroupSecurityConfig[i].Code == "B01")
                            {
                                if (Command.IGroupSecurity.IGroupSecurityConfig[i].BoolValue == 1)
                                    IsTrade = true;
                            }

                            if (Command.IGroupSecurity.IGroupSecurityConfig[i].Code == "B11")
                            {
                                double.TryParse(Command.IGroupSecurity.IGroupSecurityConfig[i].NumValue, out Minimum);
                            }

                            if (Command.IGroupSecurity.IGroupSecurityConfig[i].Code == "B12")
                            {
                                double.TryParse(Command.IGroupSecurity.IGroupSecurityConfig[i].NumValue, out Maximum);
                            }

                            if (Command.IGroupSecurity.IGroupSecurityConfig[i].Code == "B13")
                            {
                                double.TryParse(Command.IGroupSecurity.IGroupSecurityConfig[i].NumValue, out Step);
                            }
                        }
                    }
                    #endregion

                    if (IsTrade == true)
                    {
                        ResultCheckStepLots = Command.IGroupSecurity.CheckStepLots(Minimum, Maximum, Step, Command.Size);

                        #region If Check Step Lots False Return Client
                        if (ResultCheckStepLots == false)
                        {
                            string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM002", Command);

                            Command.Investor.ClientCommandQueue.Add(Message);

                            return;
                        }
                        #endregion

                        #region Check Status Trade Of Symbol(Full Access,Close Only, No)
                        if (Command.Symbol.Trade != "Full access")
                        {
                            string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM003", Command);

                            Command.Investor.ClientCommandQueue.Add(Message);

                            return;
                        }
                        #endregion

                        #region Check Stop Loss And Take Profit
                        if (Command.StopLoss > 0 || Command.TakeProfit > 0)
                        {
                            if (Command.Type.ID == 1 || Command.Type.ID == 2)
                            {
                                #region Check Limit And Stop Of Open Trade
                                bool ResultCheckLimit = false;

                                ResultCheckLimit = Command.Symbol.CheckLimitAndStop(Command.Symbol.Name, Command.Type.ID, Command.StopLoss, Command.TakeProfit,
                                                                    Command.Symbol.LimitStopLevel, Command.Symbol.Digit);

                                if (ResultCheckLimit == false)
                                {
                                    string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM004", Command);

                                    Command.Investor.ClientCommandQueue.Add(Message);

                                    return;
                                }
                                #endregion
                            }
                            else if (Command.Type.ID == 7 || Command.Type.ID == 8 || Command.Type.ID == 9 || Command.Type.ID == 10)
                            {
                                #region Check Limit And Stop Of Pending Order
                                bool ResultCheckLimit = false;
                                ResultCheckLimit = Command.Symbol.CheckLimitAndStopPendingOrder(Command.Symbol.Name, Command.Type.ID, Command.OpenPrice,
                                    Command.StopLoss, Command.TakeProfit, Command.Symbol.LimitStopLevel, Command.Symbol.Digit);

                                if (ResultCheckLimit == false)
                                {
                                    string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM005", Command);

                                    Command.Investor.ClientCommandQueue.Add(Message);

                                    return;
                                }
                                #endregion
                            }
                        }
                        #endregion

                        #region Check Setting IsLong
                        switch (Command.Type.ID)
                        {
                            #region Case Sell
                            case 2:
                                {
                                    if (Command.Symbol.LongOnly == true)
                                    {
                                        string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM006", Command);

                                        Command.Investor.ClientCommandQueue.Add(Message);

                                        return;
                                    }
                                }
                                break;
                            #endregion

                            #region Case Sell Limit
                            case 8:
                                {
                                    if (Command.Symbol.LongOnly == true)
                                    {
                                        string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM006", Command);

                                        Command.Investor.ClientCommandQueue.Add(Message);

                                        return;
                                    }
                                }
                                break;
                            #endregion

                            #region Case Sell Stop
                            case 10:
                                {
                                    if (Command.Symbol.LongOnly == true)
                                    {
                                        string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM006", Command);

                                        Command.Investor.ClientCommandQueue.Add(Message);

                                        return;
                                    }
                                }
                                break;
                            #endregion
                        }
                        #endregion

                        #region If Command Type == 1 Or 2 Then Call Dealer Else Then Call Function In MarketArea(SpotCommand, FutureCommand....)
                        if (Command.Type.ID == 1 || Command.Type.ID == 2)
                        {
                            //Call Dealer
                            Business.RequestDealer newRequestDealer = new Business.RequestDealer();
                            newRequestDealer.InvestorID = Command.Investor.InvestorID;
                            newRequestDealer.MaxDev = Command.MaxDev;
                            newRequestDealer.Name = "Open";
                            newRequestDealer.Request = Command;
                            newRequestDealer.TimeClientRequest = DateTime.Now;

                            TradingServer.Facade.FacadeSendRequestToDealer(newRequestDealer);
                        }
                        else
                        {
                            Command.Symbol.MarketAreaRef.AddCommand(Command);
                        }
                        #endregion
                    }   //End If Check IsTrade In IGroupSecurity
                    else
                    {
                        string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM007", Command);

                        Command.Investor.ClientCommandQueue.Add(Message);

                        return;
                    }   //End If Check Is Trade In IGroupSecurity
                    #endregion
                }   //End Else Check Instant Symbol,Investor,Type,IGroupSecurity
            }   //End If Check IsTrade In Group
            else
            {
                if (Command.Investor != null)
                {
                    //Add Result To Client Command Queue Of Investor
                    string Message = Model.CommandFramework.CommandFrameworkInstance.ExtractCommandToString(1, false, "CM008", Command);

                    Command.Investor.ClientCommandQueue.Add(Message);
                }

                return;
            }   //End Else Check IsTrade In Group
        }