/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace QuantConnect.Securities.Positions { /// /// Represents a position group's model of buying power /// public interface IPositionGroupBuyingPowerModel : IEquatable { /// /// Gets the margin currently allocated to the specified holding /// /// An object containing the security /// The maintenance margin required for the MaintenanceMargin GetMaintenanceMargin(PositionGroupMaintenanceMarginParameters parameters); /// /// The margin that must be held in order to increase the position by the provided quantity /// /// An object containing the security and quantity InitialMargin GetInitialMarginRequirement(PositionGroupInitialMarginParameters parameters); /// /// Gets the total margin required to execute the specified order in units of the account currency including fees /// /// An object containing the portfolio, the security and the order /// The total margin in terms of the currency quoted in the order InitialMargin GetInitialMarginRequiredForOrder(PositionGroupInitialMarginForOrderParameters parameters); /// /// Computes the impact on the portfolio's buying power from adding the position group to the portfolio. This is /// a 'what if' analysis to determine what the state of the portfolio would be if these changes were applied. The /// delta (before - after) is the margin requirement for adding the positions and if the margin used after the changes /// are applied is less than the total portfolio value, this indicates sufficient capital. /// /// An object containing the portfolio and a position group containing the contemplated /// changes to the portfolio /// Returns the portfolio's total portfolio value and margin used before and after the position changes are applied ReservedBuyingPowerImpact GetReservedBuyingPowerImpact( ReservedBuyingPowerImpactParameters parameters ); /// /// Check if there is sufficient buying power for the position group to execute this order. /// /// An object containing the portfolio, the position group and the order /// Returns buying power information for an order against a position group HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder( HasSufficientPositionGroupBuyingPowerForOrderParameters parameters ); /// /// Computes the amount of buying power reserved by the provided position group /// ReservedBuyingPowerForPositionGroup GetReservedBuyingPowerForPositionGroup( ReservedBuyingPowerForPositionGroupParameters parameters ); /// /// Get the maximum position group order quantity to obtain a position with a given buying power /// percentage. Will not take into account free buying power. /// /// An object containing the portfolio, the position group and the target /// signed buying power percentage /// Returns the maximum allowed market order quantity and if zero, also the reason GetMaximumLotsResult GetMaximumLotsForTargetBuyingPower( GetMaximumLotsForTargetBuyingPowerParameters parameters ); /// /// Get the maximum market position group order quantity to obtain a delta in the buying power used by a position group. /// The deltas sign defines the position side to apply it to, positive long, negative short. /// /// An object containing the portfolio, the position group and the delta buying power /// Returns the maximum allowed market order quantity and if zero, also the reason /// Used by the margin call model to reduce the position by a delta percent. GetMaximumLotsResult GetMaximumLotsForDeltaBuyingPower( GetMaximumLotsForDeltaBuyingPowerParameters parameters ); /// /// Gets the buying power available for a position group trade /// /// A parameters object containing the algorithm's portfolio, security, and order direction /// The buying power available for the trade PositionGroupBuyingPower GetPositionGroupBuyingPower(PositionGroupBuyingPowerParameters parameters); } }