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


C# Order.GetValue方法代码示例

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


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

示例1: GetInitialMarginRequiredForOrder

 /// <summary>
 /// Gets the total margin required to execute the specified order in units of the account currency including fees
 /// </summary>
 /// <param name="security">The security to compute initial margin for</param>
 /// <param name="order">The order to be executed</param>
 /// <returns>The total margin in terms of the currency quoted in the order</returns>
 public override decimal GetInitialMarginRequiredForOrder(Security security, Order order)
 {
     //Get the order value from the non-abstract order classes (MarketOrder, LimitOrder, StopMarketOrder)
     //Market order is approximated from the current security price and set in the MarketOrder Method in QCAlgorithm.
     var orderFees = security.FeeModel.GetOrderFee(security, order);
     
     var orderCostInAccountCurrency = order.GetValue(security);
     return orderCostInAccountCurrency*InitialMarginRequirement + orderFees;
 }
开发者ID:pmerrill,项目名称:Lean,代码行数:15,代码来源:ForexMarginModel.cs

示例2: GetInitialMarginRequiredForOrder

        /// <summary>
        /// Gets the total margin required to execute the specified order in units of the account currency including fees
        /// </summary>
        /// <param name="security">The security to compute initial margin for</param>
        /// <param name="order">The order to be executed</param>
        /// <returns>The total margin in terms of the currency quoted in the order</returns>
        public override decimal GetInitialMarginRequiredForOrder(Security security, Order order)
        {
            var forex = (Forex)security;

            //Get the order value from the non-abstract order classes (MarketOrder, LimitOrder, StopMarketOrder)
            //Market order is approximated from the current security price and set in the MarketOrder Method in QCAlgorithm.
            var orderFees = security.TransactionModel.GetOrderFee(security, order);

            var price = order.Status.IsFill() ? order.Price : security.Price;
            var orderCostInAccountCurrency = order.GetValue(price)*forex.QuoteCurrency.ConversionRate;
            return orderCostInAccountCurrency*InitialMarginRequirement + orderFees;
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:18,代码来源:ForexMarginModel.cs

示例3: GetOrderFee

        /// <summary>
        /// Uses the Interactive Brokers equities fixes fee schedule.
        /// </summary>
        /// <remarks>
        /// Default implementation uses the Interactive Brokers fee model of 0.5c per share with a maximum of 0.5% per order
        /// and minimum of $1.00.
        /// </remarks>
        /// <param name="security">The security matching the order</param>
        /// <param name="order">The order to compute fees for</param>
        /// <returns>The cost of the order in units of the account currency</returns>
        public override decimal GetOrderFee(Security security, Order order)
        {
            var price = order.Status.IsFill() ? order.Price : security.Price;
            var tradeValue = Math.Abs(order.GetValue(price));

            //Per share fees
            var tradeFee = 0.005m*order.AbsoluteQuantity;

            //Maximum Per Order: 0.5%
            //Minimum per order. $1.0
            var maximumPerOrder = 0.005m*tradeValue;
            if (tradeFee < 1)
            {
                tradeFee = 1;
            }
            else if (tradeFee > maximumPerOrder)
            {
                tradeFee = maximumPerOrder;
            }

            //Always return a positive fee.
            return Math.Abs(tradeFee);
        }
开发者ID:tremblayEric,项目名称:LeanHistory,代码行数:33,代码来源:EquityTransactionModel.cs

示例4: CanSubmitOrder

 /// <summary>
 /// Prevent orders which would bring the account below a minimum cash balance
 /// </summary>
 public override bool CanSubmitOrder(Security security, Order order, out BrokerageMessageEvent message)
 {
     message = null;
     
     // we want to model brokerage requirement of _minimumAccountBalance cash value in account
     
     var orderCost = order.GetValue(security);
     var cash = _algorithm.Portfolio.Cash;
     var cashAfterOrder = cash - orderCost;
     if (cashAfterOrder < _minimumAccountBalance)
     {
         // return a message describing why we're not allowing this order
         message = new BrokerageMessageEvent(BrokerageMessageType.Warning, "InsufficientRemainingCapital", 
             string.Format("Account must maintain a minimum of ${0} USD at all times. Order ID: {1}", _minimumAccountBalance, order.Id)
             );
         return false;
     }
     return true;
 }
开发者ID:pmerrill,项目名称:Lean,代码行数:22,代码来源:BrokerageModelAlgorithm.cs

示例5: GetInitialMarginRequiredForOrder

        /// <summary>
        /// Gets the total margin required to execute the specified order in units of the account currency including fees
        /// </summary>
        /// <param name="security">The security to compute initial margin for</param>
        /// <param name="order">The order to be executed</param>
        /// <returns>The total margin in terms of the currency quoted in the order</returns>
        public virtual decimal GetInitialMarginRequiredForOrder(Security security, Order order)
        {
            //Get the order value from the non-abstract order classes (MarketOrder, LimitOrder, StopMarketOrder)
            //Market order is approximated from the current security price and set in the MarketOrder Method in QCAlgorithm.
            var orderFees = security.TransactionModel.GetOrderFee(security, order);

            var price = order.Status.IsFill() ? order.Price : security.Price;
            return order.GetValue(price)*InitialMarginRequirement + orderFees;
        }
开发者ID:tremblayEric,项目名称:LeanHistory,代码行数:15,代码来源:SecurityMarginModel.cs

示例6: GetOrderFee

        /// <summary>
        /// Default implementation returns 0 for fees.
        /// </summary>
        /// <param name="security">The security matching the order</param>
        /// <param name="order">The order to compute fees for</param>
        /// <returns>The cost of the order in units of the account currency</returns>
        public override decimal GetOrderFee(Security security, Order order)
        {
            var forex = (Forex) security;

            // get the total order value in the account currency
            var price = order.Status.IsFill() ? order.Price : security.Price;
            var totalOrderValue = order.GetValue(price)*forex.QuoteCurrency.ConversionRate;
            var fee = _commissionRate*totalOrderValue;
            return Math.Max(_minimumOrderFee, fee);
        }
开发者ID:rchien,项目名称:Lean,代码行数:16,代码来源:ForexTransactionModel.cs

示例7: GetOrderFee

        /// <summary>
        /// Default implementation returns 0 for fees.
        /// </summary>
        /// <param name="security">The security matching the order</param>
        /// <param name="order">The order to compute fees for</param>
        /// <returns>The cost of the order in units of the account currency</returns>
        public virtual decimal GetOrderFee(Security security, Order order)
        {
            if (order.Quantity == 0)
            {
                return 0m;
            }

            var price = order.Status.IsFill() ? order.Price : security.Price;
            return GetOrderFee(order.Quantity, order.GetValue(price) / order.Quantity);
        }
开发者ID:tremblayEric,项目名称:LeanHistory,代码行数:16,代码来源:SecurityTransactionModel.cs


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