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


C# QuickFix.IsSetAccount方法代码示例

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


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

示例1: OnMessage

        public void OnMessage(QuickFix.FIX44.NewOrderSingle n, SessionID s)
        {
            Console.WriteLine("* Got a NewOrderSingle.  Responding with an ExecutionReport.");

            Symbol symbol = n.Symbol;
            Side side = n.Side;
            OrdType ordType = n.OrdType;
            OrderQty orderQty = n.OrderQty;
            Price price = new Price(DEFAULT_MARKET_PRICE);
            ClOrdID clOrdID = n.ClOrdID;

            switch (ordType.getValue())
            {
                case OrdType.LIMIT:
                    price = n.Price;
                    if (price.Obj == 0)
                        throw new IncorrectTagValue(price.Tag);
                    break;
                case OrdType.MARKET: break;
                default: throw new IncorrectTagValue(ordType.Tag);
            }

            QuickFix.FIX44.ExecutionReport exReport = new QuickFix.FIX44.ExecutionReport(
                new OrderID(GenOrderID()),
                new ExecID(GenExecID()),
                new ExecType(ExecType.FILL),
                new OrdStatus(OrdStatus.FILLED),
                symbol, //shouldn't be here?
                side,
                new LeavesQty(0),
                new CumQty(orderQty.getValue()),
                new AvgPx(price.getValue()));

            exReport.Set(clOrdID);
            exReport.Set(symbol);
            exReport.Set(orderQty);
            exReport.Set(new LastQty(orderQty.getValue()));
            exReport.Set(new LastPx(price.getValue()));

            if (n.IsSetAccount())
                exReport.SetField(n.Account);

            try
            {
                Session.SendToTarget(exReport, s);
            }
            catch (SessionNotFound ex)
            {
                Console.WriteLine("==session not found exception!==");
                Console.WriteLine(ex.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
开发者ID:gbirchmeier,项目名称:QfnDemoApps,代码行数:56,代码来源:PilotAcc44App.cs

示例2: Translate

        /// <summary>
        ///  Translate FIX44 NewOrderSingle message to OrderData
        /// </summary>
        /// <param name="n">The message</param>
        /// <returns>The order data</returns>
        /// <exception cref="QuickFix.IncorrectTagValue"></exception>
        public static OrderData Translate(QuickFix.FIX44.NewOrderSingle n)
        {
            ValidateIsSupportedOrderType(n.OrdType);

            return TranslateOrderImpl(n.Symbol,
                                      n.Side,
                                      n.OrdType,
                                      n.OrderQty,
                                      n.Price,
                                      n.ClOrdID,
                                      n.IsSetAccount() ? n.Account : null);
        }
开发者ID:naziway,项目名称:testtask,代码行数:18,代码来源:TranslateFixMessages.cs

示例3: OnMessage

        public void OnMessage(QuickFix.FIX40.NewOrderSingle n, SessionID s)
        {
            Symbol symbol = n.Symbol;
            Side side = n.Side;
            OrdType ordType = n.OrdType;
            OrderQty orderQty = n.OrderQty;
            Price price = n.Price;
            ClOrdID clOrdID = n.ClOrdID;

            if (ordType.getValue() != OrdType.LIMIT)
                throw new IncorrectTagValue(ordType.Tag);

            QuickFix.FIX40.ExecutionReport exReport = new QuickFix.FIX40.ExecutionReport(
                new OrderID(GenOrderID()),
                new ExecID(GenExecID()),
                new ExecTransType(ExecTransType.NEW),
                new OrdStatus(OrdStatus.FILLED),
                symbol,
                side,
                orderQty,
                new LastShares(orderQty.getValue()),
                new LastPx(price.getValue()),
                new CumQty(orderQty.getValue()),
                new AvgPx(price.getValue()));

            exReport.Set(clOrdID);

            if (n.IsSetAccount())
                exReport.SetField(n.Account);

            try
            {
                Session.SendToTarget(exReport, s);
            }
            catch (SessionNotFound ex)
            {
                Console.WriteLine("==session not found exception!==");
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("==unknown exception==");
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.StackTrace);
            }
        }
开发者ID:ChuangYang,项目名称:quickfixn,代码行数:46,代码来源:Executor.cs


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