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


C# IInstruction.SetInstructionMessage方法代码示例

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


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

示例1: PerformAction

        public void PerformAction(InstructionEngineActions action, IInstruction instruction)
        {
            RebalanceResults result;
            PortfolioCompareAction pfAction;
            string instructionMessage = "";
            string tempMessage = "";

            switch (action)
            {
                case InstructionEngineActions.PlaceSizeBaseCloseOrders:
                    pfAction = PortfolioCompareAction.CloseOrders;
                    break;
                case InstructionEngineActions.RunRebalance:
                    pfAction = PortfolioCompareAction.Rebalance;
                    break;
                case InstructionEngineActions.BuyModel:
                    pfAction = PortfolioCompareAction.BuyModel;
                    break;
                case InstructionEngineActions.PlaceCashFundOrders:
                    pfAction = PortfolioCompareAction.CashFundOrders;
                    break;
                case InstructionEngineActions.PlaceFreeUpCashFundOrder:
                    placeCashFundOrder((ICashWithdrawalInstruction)instruction);
                    return;
                case InstructionEngineActions.CreateFreeUpCashRebalanceInstruction:
                    createRebalanceInstruction((ICashWithdrawalInstruction)instruction);
                    return;
                case InstructionEngineActions.CreateMoneyTransferOrder:
                    createMoneyTransferOrder((ICashWithdrawalInstruction)instruction);
                    return;
                case InstructionEngineActions.LiquidatePortfolio:
                    liquidatePortfolio((IClientDepartureInstruction)instruction);
                    return;
                case InstructionEngineActions.SettleAccount:
                    settleAccount((IClientDepartureInstruction)instruction);
                    return;
                case InstructionEngineActions.TransferAllCash:
                    transferAllCash((IClientDepartureInstruction)instruction);
                    return;
                case InstructionEngineActions.TerminateAccount:
                    terminateAccount((IClientDepartureInstruction)instruction);
                    return;
                default:
                    throw new ApplicationException("Unknown action");
            }

            PortfolioCompareSetting setting = new PortfolioCompareSetting(pfAction, instruction, this.engineParams);
            PortfolioComparer.PortfolioComparer comparer = new PortfolioComparer.PortfolioComparer(setting, getFeeFactory(FeeFactoryInstanceTypes.Commission));

            IList updateableOrders = comparer.CompareToModel(out result);
            instruction.SetInstructionMessage((int)result);

            if (updateableOrders != null && updateableOrders.Count > 0)
            {
                switch (action)
                {
                    case InstructionEngineActions.PlaceSizeBaseCloseOrders:
                        instructionMessage = string.Format("{0} sizebased orders were created for instruments that are not in the modelportfolio.", updateableOrders.Count.ToString());
                        break;
                    case InstructionEngineActions.RunRebalance:
                    case InstructionEngineActions.BuyModel:
                        tempMessage = getNumberofMonetaryOrders(updateableOrders, true);
                        if (tempMessage != "0")
                            tempMessage = string.Format(" and {0} monetary order(s)", tempMessage);
                        else
                            tempMessage = string.Empty;
                        instructionMessage = string.Format("{0} amountbased orders {1} are created during rebalance", getNumberofMonetaryOrders(updateableOrders, false), tempMessage);
                        break;
                    case InstructionEngineActions.PlaceCashFundOrders:
                        instructionMessage = string.Format("{0} cash management fund order(s) were created.", updateableOrders.Count.ToString());
                        break;
                }
                instruction.UpdateableOrders = updateableOrders;
                instruction.Message = instructionMessage;
            }
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:76,代码来源:InstructionEngine.cs


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