Beispiel #1
0
        public List <TaxLotDetail> GetOpenLots(PostingEngineEnvironment env, Transaction element, double workingQuantity)
        {
            Logger.Info($"Getting Open Tax Lots for {element.Symbol}::{element.Side}::{workingQuantity}::{element.TradeDate.ToString("MM-dd-yyyy")}");

            var minTaxLots = new List <TaxLotDetail>();

            var openlots = BaseTaxLotMethodology.OpenTaxLots(env, element, workingQuantity).ToList();

            var results = openlots.Select(i => new {
                trade        = i.Trade,
                taxRate      = i.TaxRate,
                taxLotStatus = i.TaxLotStatus,
                potentialPnl = CalculateUnrealizedPnl(env, i, element, workingQuantity),
                taxAmount    = CalculateTaxImplication(env, i, element, workingQuantity)
            }).ToList();

            minTaxLots = results.Where(i => i.taxLotStatus.Quantity != 0).OrderBy(i => Math.Abs(i.taxAmount)).Select(i => new TaxLotDetail {
                TaxRate      = i.taxRate,
                Trade        = i.trade,
                TaxLotStatus = i.taxLotStatus,
                PotentialPnl = i.potentialPnl,
                TaxLiability = i.taxAmount
            }).ToList();

            BaseTaxLotMethodology.Log(Logger, minTaxLots);

            return(minTaxLots);
        }
        public List <TaxLotDetail> GetOpenLots(PostingEngineEnvironment env, Transaction element, double workingQuantity)
        {
            var openlots = BaseTaxLotMethodology.OpenTaxLots(env, element, workingQuantity).OrderBy(i => i.Trade.TradeTime).ToList();

            return(openlots);
        }