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


C# API.Order类代码示例

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


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

示例1: OnOrderRejected

        public override void OnOrderRejected(Order order)
        {
            EnumOpenClose OpenClose = DualPosition.OrderRejected(order);

            double flag = order.Side == OrderSide.Buy ? 1 : -1;

            if (EnumOpenClose.OPEN == OpenClose)
            {
                // 开仓被拒绝,不再新开仓
                // 有可能是钱不够
                // 有可能是超出持仓限制
                // 有可能是非交易时间
                TargetPosition -= flag * order.LeavesQty;
                return;
            }

            EnumError error = TextResponse.FromText(order.Text);

            // 无法平仓,不重发单
            // 能出现这个问题是持仓计算错误,这已经是策略持仓计算错误了
            if (error == EnumError.OVER_CLOSETODAY_POSITION
                || error == EnumError.OVER_CLOSEYESTERDAY_POSITION
                || error == EnumError.OVER_CLOSE_POSITION)
            {
                TargetPosition -= flag * order.LeavesQty;
                return;
            }

            // 当前状态禁止此项操作,时间不对,应当等下次操作
        }
开发者ID:jimmyhuo,项目名称:OpenQuant,代码行数:30,代码来源:TargetPositionModule.cs

示例2: CheckOpenClose

        public static EnumOpenClose CheckOpenClose(Order order)
        {
            string text = order.Text;
            EnumOpenClose OpenClose = EnumOpenClose.OPEN;

            if (text.StartsWith("{") && text.EndsWith("}"))
            {
                TextParameter parameter = JsonConvert.DeserializeObject<TextParameter>(text);
                switch (parameter.Type)
                {
                    case EnumGroupType.COMMON:
                        {
                            TextCommon t = JsonConvert.DeserializeObject<TextCommon>(text);
                            OpenClose = t.OpenClose;
                        }
                        break;
                    case EnumGroupType.QUOTE:
                        {
                            TextQuote t = JsonConvert.DeserializeObject<TextQuote>(text);
                            OpenClose = t.OpenClose;
                        }
                        break;
                }
            }

            return OpenClose;
        }
开发者ID:jimmyhuo,项目名称:OpenQuant,代码行数:27,代码来源:OpenCloseHelper.cs

示例3: OnOrderFilled

        public override void OnOrderFilled(Order order)
        {
            dualPosition.Filled(order);

            // 检查仓位是否正确,是否要发新单
            Process();
        }
开发者ID:kit998,项目名称:OpenQuant,代码行数:7,代码来源:TargetPositionModule.cs

示例4: OnOrderRejected

 public override void OnOrderRejected(Order order)
 {
     //lock(this)
     {
         SubOrder(order);
         base.OnOrderRejected(order);
     }
 }
开发者ID:vcfriend,项目名称:OpenQuant,代码行数:8,代码来源:TargetOrderBookModule.cs

示例5: OnOrderPartiallyFilled

 public override void OnOrderPartiallyFilled(Order order)
 {
     //lock (this)
     {
         SubOrder(order);
         base.OnOrderPartiallyFilled(order);
     }
 }
开发者ID:vcfriend,项目名称:OpenQuant,代码行数:8,代码来源:TargetOrderBookModule.cs

示例6: OrderTracker

 public OrderTracker(Order order)
 {
     Order = order;
     this.QuantityToFill = order.Qty;
     this.OriginalPrice = order.Price;
     this.AmountToFill = this.QuantityToFill*this.OriginalPrice;
     FilledAmount = 0;
     FilledQuantity = 0;
 }
开发者ID:aggarwalmanuj,项目名称:open-quant,代码行数:9,代码来源:OrderTracker.cs

示例7: OnOrderCancelled

        public override void OnOrderCancelled(Order order)
        {
            dualPosition.OrderCancelled(order);

            // 追单
            if (!timeHelper.IsTradingTime())
            {
                return;
            }

            ResendOrder(order);
        }
开发者ID:houzhongxu,项目名称:OpenQuant,代码行数:12,代码来源:TargetPositionModule.cs

示例8: OnOrderCancelled

        public override void OnOrderCancelled(Order order)
        {
            dualPosition.OrderCancelled(order);

            // 追单
            if (!IsWorkingTime())
            {
                return;
            }

            ResendOrder(order);
        }
开发者ID:kit998,项目名称:OpenQuant,代码行数:12,代码来源:TargetPositionModule.cs

示例9: SQ_OrderManager_OrderListUpdated

		private static void SQ_OrderManager_OrderListUpdated(object sender, EventArgs e)
		{
			OpenQuant.orders.Clear();
			Map.OQ_SQ_Order.Clear();
			Map.SQ_OQ_Order.Clear();
			foreach (SingleOrder singleOrder in OrderManager.Orders.All)
			{
				Order order = new Order(singleOrder);
				OpenQuant.orders.Add(order);
				Map.OQ_SQ_Order[order] = singleOrder;
				Map.SQ_OQ_Order[singleOrder] = order;
			}
		}
开发者ID:houzhongxu,项目名称:OpenQuant.API,代码行数:13,代码来源:OpenQuant.cs

示例10: CheckOpenClose

        public static EnumOpenClose CheckOpenClose(Order order)
        {
            string text = order.Text;
            EnumOpenClose OpenClose = EnumOpenClose.OPEN;

            if (text.StartsWith("{") && text.EndsWith("}"))
            {
                TextCommon parameter = JsonConvert.DeserializeObject<TextCommon>(text);
                OpenClose = parameter.OpenClose;
            }

            return OpenClose;
        }
开发者ID:vcfriend,项目名称:OpenQuant,代码行数:13,代码来源:OpenCloseHelper.cs

示例11: AdjustPostOrderProcessing

        protected override void AdjustPostOrderProcessing(Order order)
        {
            if (IsLegComplete)
                return;

            double temp = FilledAmount - AmountToFill;
            if (temp < order.AvgPrice)
            {
                Log.WriteDebugLog(
                    LegName,
                    this.Instrument,
                    string.Format("The remainder amount is {0:c2} which is less than the price {1:c2}. So finalizing ther leg", temp, order.AvgPrice));

                FilledAmount = AmountToFill;
            }
        }
开发者ID:aggarwalmanuj,项目名称:open-quant,代码行数:16,代码来源:AmountTradeLeg.cs

示例12: OnOrderCancelled

        // 这下面有问题,不能这么直接减,因为撤单可能只是中间状态,后面还要补上来的
        // 而其它状态可以认为单子改变,可以修改了
        // 但如果是手动撤单,因为目标挂单没减,会再自动重挂
        // 但如果这么一减,想挂单的数就少了,系统的撤单重挂功能就无效了
        public override void OnOrderCancelled(Order order)
        {
            //lock(this)
            {
                // 如果不是通过双向持仓工具,而是手工下单,就不会记录下来
                // 这样还是有问题,如果是使用的双向持仓工具,手工下单就会出错

                // 有这个单子,是调整所产生,不改变挂单表
                if (!cancelList.Remove(order))
                {
                    // 没有找到,表示非调整,要改变挂单表
                    SubOrder(order);
                }
                    
                base.OnOrderCancelled(order);
            }
        }
开发者ID:huangzhengyong,项目名称:OpenQuant,代码行数:21,代码来源:TargetOrderBookModule.cs

示例13: HandleBarOpen

        /// <summary>
        /// 
        /// </summary>
        /// <param name="bar"></param>
        public virtual void HandleBarOpen(Bar bar)
        {
            if (bar.BeginTime >= triggerTime)
            {
                if (openPrice == null)
                {
                    openPrice = bar.Open;
                }

                if (!HasPosition && closingOrder == null)
                {
                    OrderSide? side = null;
                    double targetPrice = openPrice.Value;
                    double targetQuantity = 0;

                    if (longPositionQuantity.HasValue && longPositionQuantity.Value > 0)
                    {
                        side = OrderSide.Sell;
                        targetPrice = GetSlippageAdjustedPrice(openPrice.Value, side.Value);
                        targetQuantity = longPositionQuantity.Value;
                    }

                    if (shortPositionQuantity.HasValue && shortPositionQuantity.Value > 0)
                    {
                        side = OrderSide.Buy;
                        targetPrice = GetSlippageAdjustedPrice(openPrice.Value, side.Value);
                        targetQuantity = shortPositionQuantity.Value;
                    }

                    targetPrice = RoundPrice(targetPrice);

                    if (side.HasValue)
                    {
                        closingOrder = LimitOrder(side.Value, targetQuantity, targetPrice, "Auto closing order");

                        LogOrder("Closing", Instrument.Symbol, side.Value, targetQuantity, targetPrice);

                        if (AutoSubmit)
                            closingOrder.Send();
                    }
                }
            }
        }
开发者ID:aggarwalmanuj,项目名称:open-quant,代码行数:47,代码来源:BaseClosingStrategyOld.cs

示例14: SubOrder

        private void SubOrder(Order order)
        {
            // 市价不会挂单,所以不会记录到目标挂单助手中
            if (order.Type != OrderType.Limit)
                return;

            double price = order.Price;
            double size = order.LastQty;

            //lock(this)
            {
                if (order.Side == OrderSide.Buy)
                {
                    TargetOrderBook.Buy.Change(price, -size);
                }
                else
                {
                    TargetOrderBook.Sell.Change(price, -size);
                }
            }
        }
开发者ID:huangzhengyong,项目名称:OpenQuant,代码行数:21,代码来源:TargetOrderBookModule.cs

示例15: CheckLongShort

 public static PositionSide CheckLongShort(Order order,EnumOpenClose OpenClose)
 {
     if (EnumOpenClose.OPEN == OpenClose)
     {
         if (order.Side == OrderSide.Buy)
         {
             return PositionSide.Long;
         }
     }
     else
     {
         if (order.Side == OrderSide.Buy)
         {
         }
         else
         {
             return PositionSide.Long;
         }
     }
     return PositionSide.Short;
 }
开发者ID:vcfriend,项目名称:OpenQuant,代码行数:21,代码来源:OpenCloseHelper.cs


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