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


C# Order.OnExecutionCommand方法代码示例

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


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

示例1: Cancel

        public void Cancel(Order order)
        {
            if (order.IsNotSent)
                throw new ArgumentException($"Can not cancel order that is not sent {order}");

            var command = new ExecutionCommand(ExecutionCommandType.Cancel, order)
            {
                DateTime = this.framework.Clock.DateTime,
                OrderId = order.Id,
                ClOrderId = order.ClOrderId,
                ProviderOrderId = order.ProviderOrderId,
                ProviderId = order.ProviderId,
                RouteId = order.RouteId,
                PortfolioId = order.PortfolioId
            };
            command.DateTime = order.DateTime;
            command.Instrument = order.Instrument;
            command.InstrumentId = order.InstrumentId;
            command.Provider = order.Provider;
            command.Portfolio = order.Portfolio;
            command.Side = order.Side;
            command.OrdType = order.Type;
            command.TimeInForce = order.TimeInForce;
            command.Price = order.Price;
            command.StopPx = order.StopPx;
            command.Qty = order.Qty;
            command.OCA = order.OCA;
            command.Text = order.Text;
            command.Account = order.Account;
            command.ClientID = order.ClientID;
            command.ClientId = order.ClientId;
            Messages.Add(command);
            order.OnExecutionCommand(command);
            this.framework.EventServer.OnExecutionCommand(command);
            if (IsPersistent)
                Server?.Save(command, -1);
            order.Provider.Send(command);
        }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:38,代码来源:OrderManager.cs

示例2: Send

        public void Send(Order order)
        {
            if (!order.IsNotSent)
                throw new ArgumentException($"Can not send order that has been already sent {order}");

            this.framework.EventServer.OnSendOrder(order);
            if (order.Id == -1)
                Register(order);

            if (order.IsOCA)
            {
                List<Order> list;
                this.ordersByOCAList.TryGetValue(order.OCA, out list);
                this.ordersByOCAList[order.OCA] = list = list ?? new List<Order>();
                list.Add(order);
            }

            Orders.Add(order);
            this.ordersById[order.Id] = order;

            if (this.framework.Mode == FrameworkMode.Realtime)
                this.ordersByClOrderId[order.ClOrderId] = order;

            order.DateTime = this.framework.Clock.DateTime;
            order.Status = OrderStatus.PendingNew;
            var command = new ExecutionCommand(ExecutionCommandType.Send, order)
            {
                DateTime = order.DateTime,
                Id = order.Id,
                OrderId = order.Id,
                ClOrderId = order.ClOrderId,
                ProviderOrderId = order.ProviderOrderId,
                ProviderId = order.ProviderId,
                RouteId = order.RouteId,
                PortfolioId = order.PortfolioId,
                TransactTime = order.TransactTime,
                Instrument = order.Instrument,
                InstrumentId = order.InstrumentId,
                Provider = order.Provider,
                Portfolio = order.Portfolio,
                Side = order.Side,
                OrdType = order.Type,
                TimeInForce = order.TimeInForce,
                Price = order.Price,
                StopPx = order.StopPx,
                Qty = order.Qty,
                OCA = order.OCA,
                Text = order.Text,
                Account = order.Account,
                ClientID = order.ClientID,
                ClientId = order.ClientId
            };
            Messages.Add(command);
            order.OnExecutionCommand(command);
            this.framework.EventServer.OnExecutionCommand(command);
            this.framework.EventServer.OnPendingNewOrder(order, true);
            if (IsPersistent)
                Server?.Save(command, -1);
            order.Provider.Send(command);
        }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:60,代码来源:OrderManager.cs

示例3: Replace

        public void Replace(Order order, double price, double stopPx, double qty)
        {
            if (order.IsNotSent)
                throw new ArgumentException($"Can not replace order that is not sent {order}");

            var command = new ExecutionCommand(ExecutionCommandType.Replace, order)
            {
                DateTime = this.framework.Clock.DateTime,
                Id = order.Id,
                OrderId = order.Id,
                ClOrderId = order.ClOrderId,
                ProviderOrderId = order.ProviderOrderId,
                ProviderId = order.ProviderId,
                RouteId = order.RouteId,
                PortfolioId = order.PortfolioId,
                TransactTime = order.TransactTime,
                Instrument = order.Instrument,
                InstrumentId = order.InstrumentId,
                Provider = order.Provider,
                Portfolio = order.Portfolio,
                Side = order.Side,
                OrdType = order.Type,
                TimeInForce = order.TimeInForce,
                Price = order.Price,
                StopPx = order.StopPx,
                Qty = order.Qty,
                OCA = order.OCA,
                Text = order.Text,
                Account = order.Account,
                ClientID = order.ClientID,
                ClientId = order.ClientId
            };
            Messages.Add(command);
            order.OnExecutionCommand(command);
            this.framework.EventServer.OnExecutionCommand(command);
            if (IsPersistent)
                Server?.Save(command, -1);
            order.Provider.Send(command);
        }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:39,代码来源:OrderManager.cs

示例4: Load

 public void Load(string name = null, int clientId = -1)
 {
     var messages = LoadMessages(name, clientId);
     foreach (var msg in messages)
     {
         msg.IsLoaded = true;
         var typeId = msg.TypeId;
         switch (typeId)
         {
             case DataObjectType.ExecutionReport:
                 this.framework.EventServer.OnExecutionReport((ExecutionReport)msg);
                 break;
             case DataObjectType.ExecutionCommand:
                 {
                     var command = (ExecutionCommand)msg;
                     switch (command.Type)
                     {
                         case ExecutionCommandType.Send:
                             {
                                 var order = new Order(command);
                                 command.Order = order;
                                 command.Instrument = this.framework.InstrumentManager.GetById(command.InstrumentId);
                                 command.Portfolio = this.framework.PortfolioManager.GetById(command.PortfolioId);
                                 command.Provider = this.framework.ProviderManager.GetExecutionProvider(command.ProviderId);
                                 order.Instrument = command.Instrument;
                                 order.Portfolio = command.Portfolio;
                                 order.Provider = command.Provider;
                                 lock (this.obj)
                                     this.counter = Math.Max(this.counter, order.Id);
                                 this.framework.EventServer.OnSendOrder(order);
                                 Orders.Add(order);
                                 this.ordersById[order.Id] = order;
                                 if (this.framework.Mode == FrameworkMode.Realtime)
                                     this.ordersByClOrderId[order.ClOrderId] = order;
                                 Messages.Add(command);
                                 order.OnExecutionCommand(command);
                                 this.framework.EventServer.OnExecutionCommand(command);
                                 this.framework.EventServer.OnPendingNewOrder(order, true);
                                 break;
                             }
                         case ExecutionCommandType.Cancel:
                         case ExecutionCommandType.Replace:
                             this.ordersById[command.OrderId].OnExecutionCommand(command);
                             break;
                     }
                     break;
                 }
             default:
                 if (typeId == DataObjectType.AccountReport)
                     this.framework.EventServer.OnAccountReport((AccountReport)msg);
                 break;
         }
     }
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:54,代码来源:OrderManager.cs


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