• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# QuickFix.Account类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: submitOrder

        /// <summary>
        /// submit an order to IB using a incomming FIX new order single
        /// </summary>
        /// <param name="myMsg"></param>
        private void submitOrder(KaiTrade.Interfaces.IMessage myMsg)
        {
            QuickFix.Message myQFOrder = null;
            try
            {
                // Extract the raw FIX Message from the inbound message
                string strOrder = myMsg.Data;

                // Use QuickFix to handle the message
                myQFOrder = new QuickFix.Message(strOrder);

                // Use product manager to validate the product specified on
                // the order exists for this adapter

                // Get the product associated with the FIX message

                //QuickFix.Symbol symbol = new QuickFix.Symbol();
                //myQFOrder.getField(symbol);

                QuickFix.Side mySide = new QuickFix.Side();
                QuickFix.OrdType myOrdType = new QuickFix.OrdType();
                QuickFix.OrderQty myOrderQty = new QuickFix.OrderQty();
                QuickFix.Price myPrice = new QuickFix.Price();
                QuickFix.StopPx myStopPx = new QuickFix.StopPx();
                QuickFix.Account myAccount = new QuickFix.Account();

                QuickFix.ClOrdID myClOrdID = new QuickFix.ClOrdID();
                QuickFix.TimeInForce myTimeInForce = new QuickFix.TimeInForce();

                // the account code is mandatory
                if (myQFOrder.isSetField(myAccount))
                {
                    myQFOrder.getField(myAccount);
                }
                else
                {
                    this.SendAdvisoryMessage("IB TWS: you need to provide a valid account");
                    throw new Exception("IB TWS: you need to provide a valid account");
                }

                myQFOrder.getField(myClOrdID);

                // Get the Order type
                myQFOrder.getField(myOrdType);

                // Get the QTY
                myQFOrder.getField(myOrderQty);

                // get the Side of the order
                myQFOrder.getField(mySide);

                // Set order duration
                myQFOrder.getField(myTimeInForce);

                // Prices
                if (myQFOrder.isSetField(myPrice))
                {
                    myQFOrder.getField(myPrice);
                }

                if (myQFOrder.isSetField(myStopPx))
                {
                    myQFOrder.getField(myStopPx);
                }

                // get the contract
                TWSLib.IContract myContract = getIBContract(myQFOrder);
                if (myContract == null)
                {
                    this.SendAdvisoryMessage("IB TWS: cannot find a valid contract");
                    throw new Exception("IB TWS: cannot find a valid contract");
                }

                // create an IB Order
                TWSLib.IOrder myIBOrder = m_Host.TWS.createOrder();

                myIBOrder.whatIf = 0;
                myIBOrder.account = myAccount.getValue();

                if(myOrdType.getValue() == QuickFix.OrdType.LIMIT)
                {
                    myIBOrder.orderType = "LMT";
                    myIBOrder.lmtPrice = myPrice.getValue();
                }
                else if(myOrdType.getValue() == QuickFix.OrdType.MARKET)
                {
                    myIBOrder.orderType = "MKT";
                }
                else if (myOrdType.getValue() == QuickFix.OrdType.STOP)
                {
                    myIBOrder.orderType = "STP";
                    myIBOrder.auxPrice = myStopPx.getValue();
                    if (myPrice.getValue() == -1)
                    {
                        myIBOrder.lmtPrice = myStopPx.getValue();
                    }
//.........这里部分代码省略.........
开发者ID:junwin,项目名称:TradingTools,代码行数:101,代码来源:KTAIB.cs


示例2: getAccount

 public QuickFix.Account getAccount()
 {
     QuickFix.Account value = new QuickFix.Account();
     getField(value); return value;
 }
开发者ID:jaubrey,项目名称:quickfix,代码行数:5,代码来源:NewOrderCross.cs


示例3: HandleExecReport

        /// <summary>
        /// Handle an incomming execution report
        /// </summary>
        /// <param name="myMsg"></param>
        public void HandleExecReport(KaiTrade.Interfaces.Message myMsg)
        {
            try
            {
                if (m_Log.IsInfoEnabled)
                {
                    m_Log.Info("OrderService:HandleExecReport:" + myMsg.Data);
                }
                if (m_ORLog.IsInfoEnabled)
                {
                    m_ORLog.Info("OrderService:HandleExecReport:" + myMsg.Data);
                }
                // Get order manager
                KaiTrade.Interfaces.OrderManager myOM = KTAFacade.Instance().Factory.GetOrderManager();

                //Create a quickfix message object
                QuickFix.Message myFixMsg = new QuickFix.Message(myMsg.Data);

                QuickFix.ExecID myExecID = new QuickFix.ExecID();
                myFixMsg.getField(myExecID);

                // check if we have already processed this report
                if (!myOM.RecordExecutionReport(myExecID.getValue(), myFixMsg))
                {
                    // we have processed this already
                    m_Log.Warn("HandleExecReport: Duplicate Exec Report:" + myMsg.Data);
                    return;
                }

                // these fields must be present
                QuickFix.OrderID myOrderID = new QuickFix.OrderID();
                myFixMsg.getField(myOrderID);

                QuickFix.ExecType myExecType = new QuickFix.ExecType();
                myFixMsg.getField(myExecType);

                QuickFix.OrdStatus myOrdStatus = new QuickFix.OrdStatus();
                myFixMsg.getField(myOrdStatus);

                // we need the clordid to update an existing order - if
                // it is not present or unknow we create a synthetic order
                QuickFix.ClOrdID myClOrdID = new QuickFix.ClOrdID();
                KaiTrade.Interfaces.Order myOrder = null;
                if (myFixMsg.isSetField(myClOrdID))
                {
                    myFixMsg.getField(myClOrdID);
                    myOrder = myOM.GetOrderWithClOrdIDID(myClOrdID.getValue());
                }
                if (myOrder == null)
                {
                    myOrder = CreateSyntheticOrder(myFixMsg);
                }

                // add the ExecRep to the Order
                KaiTrade.Interfaces.Fill myFill = new K2DataObjects.FillData();
                myFill.OrderID = myOrder.Identity;
                myFill.SetUpFromFixExecReport(myFixMsg.ToString());

                myOrder.FillsList.Add(myFill);

                // update mandatory fields
                myOrder.OrderID = myOrderID;
                myOrder.OrdStatus = myOrdStatus;
                QuickFix.Text myText = new QuickFix.Text();
                if (myFixMsg.isSetField(myText))
                {
                    myFixMsg.getField(myText);
                    myOrder.Text = myText.getValue();
                }

                QuickFix.Account myAccount = new QuickFix.Account();
                if (myFixMsg.isSetField(myAccount))
                {
                    myFixMsg.getField(myAccount);

                    myOrder.Account = myAccount;
                }

                // process the execution depanding on type of ExecReport
                switch (myExecType.getValue())
                {
                    case QuickFix.ExecType.NEW:
                        processGeneralExecRep(ref myOrder, myFixMsg);
                        /*
                        if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
                        {
                            order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                        }
                        else
                        {
                            m_Log.Error("HandleExecReport:OrderStatus new not expected");
                        }
                         * */
                        break;
                    case QuickFix.ExecType.FILL:
                        if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
//.........这里部分代码省略.........
开发者ID:junwin,项目名称:TradingTools,代码行数:101,代码来源:OrderService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# QuickFix.ClOrdID类代码示例发布时间:2022-05-24
下一篇:
C# QuickFix类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap