当前位置: 首页>>代码示例>>C#>>正文


C# Business.CalculatorMarginCommand方法代码示例

本文整理汇总了C#中Business.CalculatorMarginCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Business.CalculatorMarginCommand方法的具体用法?C# Business.CalculatorMarginCommand怎么用?C# Business.CalculatorMarginCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Business的用法示例。


在下文中一共展示了Business.CalculatorMarginCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckValidAccountInvestor

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Command"></param>
        /// <returns></returns>
        public bool CheckValidAccountInvestor(Business.OpenTrade Command)
        {
            bool Result = false;
            if (Command != null)
            {
                //Calculator Margin Level
                double tempMarginLevel = 0;
                double tempProfit = 0;
                double tempTotalMargin = 0;
                double tempEquity = 0;
                double tempFreeMargin = 0;
                double marginPending = 0;
                double marginCommand = 0;
                bool isExits = false;

                List<Business.OpenTrade> tempOpenTrade = new List<OpenTrade>();
                List<Business.OpenTrade> listPending = new List<OpenTrade>();
                if (Command.Investor.CommandList != null)
                {
                    int count = Command.Investor.CommandList.Count;
                    for (int i = 0; i < count; i++)
                    {
                        if (Command.Investor.CommandList[i].ID == Command.ID)
                            isExits = true;

                        bool isPending = TradingServer.Model.TradingCalculate.Instance.CheckIsPendingPosition(Command.Investor.CommandList[i].Type.ID);
                        if (isPending)
                        {
                            Command.CalculatorMarginCommand(Command.Investor.CommandList[i]);
                            listPending.Add(Command.Investor.CommandList[i]);
                        }
                        else
                        {
                            Command.CalculatorMarginCommand(Command.Investor.CommandList[i]);
                            tempOpenTrade.Add(Command.Investor.CommandList[i]);
                        }

                        //if (Command.Investor.CommandList[i].Type.ID == 7 ||
                        //    Command.Investor.CommandList[i].Type.ID == 8 ||
                        //    Command.Investor.CommandList[i].Type.ID == 9 ||
                        //    Command.Investor.CommandList[i].Type.ID == 10 ||
                        //    Command.Investor.CommandList[i].Type.ID == 17 ||
                        //    Command.Investor.CommandList[i].Type.ID == 18 ||
                        //    Command.Investor.CommandList[i].Type.ID == 19 ||
                        //    Command.Investor.CommandList[i].Type.ID == 20)
                        //{
                        //    if (Command.Type.ID == 7 || Command.Type.ID == 8 || Command.Type.ID == 9 || Command.Type.ID == 10 ||
                        //        Command.Type.ID == 17 || Command.Type.ID == 18 || Command.Type.ID == 19 || Command.Type.ID == 20)
                        //    {
                        //        Command.CalculatorMarginCommand(Command.Investor.CommandList[i]);
                        //        listPending.Add(Command.Investor.CommandList[i]);
                        //        marginPending += Command.Investor.CommandList[i].Margin;
                        //    }
                        //}
                        //else
                        //{
                        //tempOpenTrade.Add(Command.Investor.CommandList[i]);
                        //}
                    }
                }

                Command.CalculatorMarginCommand(Command);

                if (!isExits)
                {
                    bool isPendingCommand = TradingServer.Model.TradingCalculate.Instance.CheckIsPendingPosition(Command.Type.ID);
                    if (isPendingCommand)
                        listPending.Add(Command);
                    else
                        tempOpenTrade.Add(Command);
                }

                //Business.Margin newMargin = new Business.Margin();
                //newMargin = Command.Symbol.CalculationTotalMargin(tempOpenTrade);
                ////marginCommand = newMargin.TotalMargin + newMargin.TotalFreezeMargin;
                //marginCommand = newMargin.TotalFreezeMargin;

                Business.Margin newMargin = new Business.Margin();
                newMargin = Command.Symbol.CalculationTotalMarginPending(listPending, tempOpenTrade);
                //tempTotalMargin = marginCommand + marginPending;
                tempTotalMargin = newMargin.TotalMargin + newMargin.TotalFreezeMargin;

                //if (Command.Type.ID == 7 || Command.Type.ID == 8 || Command.Type.ID == 9 || Command.Type.ID == 10 ||
                //    Command.Type.ID == 17 || Command.Type.ID == 18 || Command.Type.ID == 19 || Command.Type.ID == 20)
                //{
                //    tempTotalMargin = marginCommand + Command.Margin + marginPending;
                //}
                //else
                //{
                //    tempTotalMargin = marginCommand;
                //}

                tempProfit = Command.Investor.Profit + Command.Profit;
                tempEquity = Command.Investor.Balance + Command.Investor.Credit + tempProfit;
                tempFreeMargin = tempEquity - tempTotalMargin;
//.........这里部分代码省略.........
开发者ID:ngthanhducit,项目名称:TradingServer1502,代码行数:101,代码来源:OpenTrade.Calculation.cs


注:本文中的Business.CalculatorMarginCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。