public static CalculateNecessaryResult CalculateNecessary(this Instrument instrument, MarginAndQuantityResult necessaryParams)
        {
            var result = new CalculateNecessaryResult();

            if (necessaryParams.PartialQuantity.Sell > 0)
            {
                result.PartialPaymentPhysicalNecessary = necessaryParams.PartialMargin.Sell;
            }
            else if (necessaryParams.PartialQuantity.Buy > 0)
            {
                result.PartialPaymentPhysicalNecessary = necessaryParams.PartialMargin.Buy;
            }
            instrument.CalculateNecessaryHelper(necessaryParams.Margin.Buy, necessaryParams.Quantity.Buy,
                                                necessaryParams.Margin.Sell, necessaryParams.Quantity.Sell, ref result.PartialPaymentPhysicalNecessary,
                                                out result.NetNecessary, out result.HedgeNecessary);
            return(result);
        }