Esempio n. 1
0
 public static List<ICashPosition> GetPositions(IDalSession session, IAccountTypeInternal account, PositionsView view)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Account.Key", account.Key));
     addPositionsViewCriterion(expressions, view);
     return session.GetTypedList<CashPosition, ICashPosition>(expressions);
 }
Esempio n. 2
0
 /// <summary>
 /// This method retrieves a list of Position instances that belong to a specific account and meet the PositionsView criterium. 
 /// </summary>
 /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
 /// <param name="account">The account the positions belong to</param>
 /// <param name="view">Determines which positions to show (zero side, non zero sized or all)</param>
 /// <returns>A list of position instances</returns>
 public static List<IFundPosition> GetPositions(IDalSession session, IAccountTypeInternal account, PositionsView view)
 {
     if (account != null)
         return GetPositions(session, account.Key, view);
     else
         return new List<IFundPosition>();
 }
Esempio n. 3
0
 public EndTermValue(IAccountTypeInternal Account, IPeriodicReporting reportingPeriod, Money ClosingValue, Money GreenFundValue, Money CultureFundValue)
     : this(Account, reportingPeriod)
 {
     this.ClosingValue = ClosingValue;
     this.GreenFundValue = GreenFundValue;
     this.CultureFundValue = CultureFundValue;
 }
Esempio n. 4
0
 public EndTermValue(IAccountTypeInternal Account, IPeriodicReporting reportingPeriod)
 {
     this.Account = Account;
     this.ReportingPeriod = reportingPeriod;
     //this.EndTermDate = EndTermDate;
     //this.TermType = termType;
 }
Esempio n. 5
0
        public static IList GetAverageHoldings(IDalSession session, IAccountTypeInternal account, DateTime startDate, DateTime endDate, ValuationTypesFilterOptions filterOption)
        {
            Hashtable parameters = new Hashtable(1);
            parameters.Add("account", account);
            parameters.Add("startDate", startDate);
            parameters.Add("endDate", endDate);
            string instrumentFilter = "";

            switch (filterOption)
            {
                case ValuationTypesFilterOptions.Security:
                    instrumentFilter = "and I.Key in (select S.Key from TradeableInstrument S) ";
                    break;
                case ValuationTypesFilterOptions.Monetary:
                    instrumentFilter = "and I.Key in (select C.Key from Currency C) ";
                    break;
            }

            string hql = string.Format(@"from AverageHolding A
                left join fetch A.Instrument I
                where A.Account = :account
                and (A.BeginDate between :startDate
                and :endDate ) {0}
                order by I.Key, A.BeginDate", instrumentFilter);
            return session.GetListByHQL(hql, parameters);
        }
Esempio n. 6
0
 public PositionTransferPortfolio(IAccountTypeInternal account, DateTime positionDate, IPositionTransfer parentTransfer)
     : this()
 {
     this.Account = account;
     this.PositionDate = positionDate;
     this.ParentTransfer = parentTransfer;
 }
Esempio n. 7
0
 public GeneralOperationsBooking(IAccountTypeInternal account, IJournalEntry journalEntry, string description)
     : this()
 {
     this.Account = account;
     this.GeneralOpsJournalEntry = journalEntry;
     this.Description = description;
 }
Esempio n. 8
0
        /// <summary>
        /// Constructor for creating a test FeeClient object
        /// </summary>
        /// <param name="account"></param>
        /// <param name="instrument"></param>
        /// <param name="side"></param>
        /// <param name="actiontype"></param>
        /// <param name="transactionDate"></param>
        /// <param name="issizebased"></param>
        /// <param name="orderValue"></param>
        /// <param name="amount"></param>
        /// <param name="price"></param>
        /// <param name="ordercurrency"></param>
        /// <param name="isValueInclComm"></param>
        public CommClient(IAccountTypeInternal account,IInstrument instrument, Side side, OrderActionTypes actiontype, 
                         DateTime transactionDate, bool issizebased, InstrumentSize orderValue, Money amount, Price price,
                         ICurrency ordercurrency, bool isValueInclComm)
        {
            if (account == null)
                throw new ApplicationException("It is not possible to calculate the commission when the account is unknown.");

            if (instrument == null)
                throw new ApplicationException("It is not possible to calculate the commission when the instrument value is unknown.");

            this.account = account;
            this.instrument = instrument;
            this.Side = side;
            this.ActionType = actiontype;
            this.TransactionDate = transactionDate;
            this.IsSizeBased = issizebased;
            this.OriginalOrderType = issizebased ? BaseOrderTypes.SizeBased : BaseOrderTypes.AmountBased;
            this.Value = orderValue;
            this.amount = amount;
            this.Price = price;
            this.OrderCurrency = ordercurrency;
            this.IsValueInclComm = isValueInclComm;

            type = CommClientType.Test;
        }
Esempio n. 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="account">User account</param>
 /// <param name="value">Initial value for this order</param>
 /// <param name="requestedCurrency">Currency that is requested</param>
 /// <param name="feeFactory">Fee factory to use for calculating transaction costs</param>
 public MonetaryOrder(IAccountTypeInternal account, Money value, ICurrency requestedCurrency, IFeeFactory feeFactory)
     : base(account, value)
 {
     this.requestedCurrency = requestedCurrency;
     checkInitialValues();
     setCommission(feeFactory);
 }
Esempio n. 10
0
 public override ITransaction Storno(IAccountTypeInternal stornoAccount, B4F.TotalGiro.Stichting.Login.IInternalEmployeeLogin employee, string reason, ITradingJournalEntry tradingJournalEntry)
 {
     ICrumbleTransaction newStorno = new CrumbleTransaction();
     newStorno.Order = Order;
     this.storno(stornoAccount, employee, reason, tradingJournalEntry, newStorno);
     return newStorno;
 }
Esempio n. 11
0
 public static IPortfolioHistorical GetHistoricalPortfolio(IDalSession session, IAccountTypeInternal account,
     DateTime positionDate, IList<IHistoricalPrice> prices, IList<IHistoricalExRate> rates)
 {
     IList<IFundPositionTx> posTx = FundPositionMapper.GetPositionTransactionsByDate(session, account, positionDate);
     IList<IJournalEntryLine> lines = JournalEntryMapper.GetSettledBookingsForAccountUntilDate(session, positionDate, account.Key);
     IPortfolioHistorical portfolio = new PortfolioHistorical(account, positionDate, posTx, prices, rates, lines);
     return portfolio;
 }
Esempio n. 12
0
 public HistoricalPosition(int key, IInstrumentsWithPrices instrument, decimal valueSize,
     DateTime positionDate, IAccountTypeInternal account)
 {
     this.Key = key;
     this.ValueSize = new InstrumentSize(valueSize, instrument);
     this.PositionDate = positionDate;
     this.Account = account;
 }
Esempio n. 13
0
 public InstrumentConversion(IAccountTypeInternal acctA, IAccount acctB,
         InstrumentSize valueSize, InstrumentSize convertedInstrumentSize,
         decimal exRate, IInstrumentHistory instrumentTransformation, 
         ITradingJournalEntry tradingJournalEntry)
     : this(acctA, acctB, valueSize, convertedInstrumentSize, null,
         exRate, instrumentTransformation, tradingJournalEntry, null)
 {
 }
Esempio n. 14
0
 public OrderAllocation(IOrder order, IAccountTypeInternal acctA, IAccount acctB,
         InstrumentSize valueSize, Price price, decimal exRate, DateTime transactionDate,
         DateTime transactionDateTime, Decimal ServiceChargePercentage, Side txSide, IFeeFactory feeFactory, ITradingJournalEntry tradingJournalEntry,
         IGLLookupRecords lookups, ListOfTransactionComponents[] components)
     : base(order, acctA, acctB, valueSize, price, exRate, transactionDate, transactionDateTime,
            ServiceChargePercentage, txSide,
            tradingJournalEntry, lookups, components)
 {
 }
Esempio n. 15
0
        public static BuyingPowerDisplayCollection GetBuyingPowerDisplay(
            IDalSession session,IAccountTypeInternal account,
            bool showForeignCurrency, bool showUnSettledCash)
        {
            BuyingPowerDisplayCollection newColl = new BuyingPowerDisplayCollection(account);
            IList<ICashPosition> positions = account.Portfolio.PortfolioCashGL.ToList();

            foreach (ICashPosition pos in positions.Where(x => (x.PositionCurrency.IsBase && !showForeignCurrency) || showForeignCurrency))
            {
                bool repeat = true;
                ICashSubPosition subPos = pos.SettledPosition;
                if (subPos != null)
                {
                    BuyingPowerDisplay sett = new BuyingPowerDisplay(subPos, repeat, account);
                    repeat = false;
                    newColl.Add(sett);
                }
                if (showUnSettledCash)
                {
                    subPos = pos.UnSettledPositions.DefaultSubPosition;
                    if (subPos != null)
                    {
                        BuyingPowerDisplay unsett = new BuyingPowerDisplay(subPos, repeat, account);
                        newColl.Add(unsett);
                    }
                }
            }

            //if (newColl.Count > 0)
            //    newColl.AddBlankLine();

            newColl.AddCashSummaryLine();
            //newColl.AddBlankLine();

            newColl.AddCashFundLine(account.Portfolio.PortfolioInstrument.CashFundValueInBaseCurrency);
            //newColl.AddBlankLine();

            // include unsettled with IncludeBuyingPower flag
            bool showAI = false;
            foreach (ICashSubPositionUnSettled subPos in positions.SelectMany(x => x.UnSettledPositions).Where(x => x.UnSettledType != null && x.UnSettledType.IncludeBuyingPower).OrderBy(x => x.UnSettledType.Key))
            {
                BuyingPowerDisplay sett = new BuyingPowerDisplay(subPos, true, account);
                newColl.Add(sett);
                showAI = true;
            }
            if (showAI && !showUnSettledCash)
            {
                Money ai = newColl.Where(x => x.IsUnSettledIncludeBuyingPower).Select(x => x.BaseValue).Sum();
                if (ai.IsZero)
                    newColl.RemoveAt(newColl.Count - 1);
            }

            newColl.AddBuyingPowerLine();

            return newColl;
        }
Esempio n. 16
0
 public static PortfolioDevelopment GetPortfolioDevelopment(IDalSession session, IAccountTypeInternal account, DateTime startDate, DateTime endDate, int modelID)
 {
     IList<IValuation> valuations = GetValuations(session, account.Key, new DateTime[] { startDate.AddDays(-1), endDate }, true, ValuationTypesFilterOptions.All);
     IList<ISecurityValuationMutation> securityMutations = GetSecurityValuationMutations(session, account.Key, startDate, endDate);
     IList<IValuationCashMutation> cashMutations = GetValuationCashMutations(session, account.Key, startDate, endDate);
     IList<IDepositWithdrawal> depositsWithdrawals = GetDepositsWithdrawals(session, account.Key, startDate, endDate);
     IList<ValuationCashType> valuationCashTypes = GetValuationCashTypes(session);
     PortfolioDevelopment portDev = new PortfolioDevelopment(account, valuations, securityMutations, cashMutations, depositsWithdrawals, valuationCashTypes, startDate, endDate, modelID);
     return portDev;
 }
Esempio n. 17
0
 public PortfolioHistorical(IAccountTypeInternal parentAccount, DateTime positionDate, IList<IFundPositionTx> posTx,
     IList<IHistoricalPrice> prices, IList<IHistoricalExRate> rates, IList<IJournalEntryLine> lines)
 {
     this.ParentAccount = parentAccount;
     this.PositionDate = positionDate;
     this.Rates = rates;
     this.Prices = prices;
     this.FundPortfolio = new FundPortfolioHistorical(this, posTx);
     this.CashPortfolio = new CashPortfolioHistorical(this, lines);
 }
Esempio n. 18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="account">User account</param>
 /// <param name="value">Initial value</param>
 /// <param name="tradedInstrument">Traded instrument</param>
 /// <param name="isValueInclComm">Is in the value the commission included?</param>
 /// <param name="feeFactory">Fee factory to use for calculating transaction costs</param>
 /// <param name="doNotChargeCommission">parameter that decides whether commission should be charged</param>
 /// <param name="actionType">The action type that created this order.</param>
 public OrderAmountBased(IAccountTypeInternal account, Money value, IInstrument tradedInstrument, bool isValueInclComm, IFeeFactory feeFactory, bool doNotChargeCommission, OrderActionTypes actionType)
     : base(account, value, (ITradeableInstrument)tradedInstrument, doNotChargeCommission)
 {
     this.ActionType = actionType;
     this.IsValueInclComm = isValueInclComm;
     checkInitialValues();
     setCommission(feeFactory);
     // If same currency -> ExRate = 1
     exRate = ((ICurrency)Value.Underlying).GetExRate(TradedInstrument.CurrencyNominal, this.Side);
 }
Esempio n. 19
0
 public TransactionNTM(IAccountTypeInternal acctA, IAccount acctB,
 InstrumentSize valueSize,
 Price price, decimal exRate, DateTime transactionDate, DateTime transactionDateTime,
 Decimal ServiceChargePercentage, Side txSide,
 ITradingJournalEntry tradingJournalEntry,
 IGLLookupRecords lookups, ListOfTransactionComponents[] components, string description)
     : base(acctA, acctB, valueSize, price, exRate, transactionDate,
             transactionDateTime, ServiceChargePercentage, txSide,
             tradingJournalEntry, lookups, components)
 {
     this.Description = description;
 }
 public PositionTransferReportPortfolio(IAccountTypeInternal account, DateTime positionDate,
     IPositionTransfer parentTransfer, IPositionTransferPortfolio beforePortfolio,
     IPositionTransferPortfolio afterPortfolio)
     : this()
 {
     this.Account = account;
     this.PositionDate = positionDate;
     this.ParentTransfer = parentTransfer;
     this.BeforePortfolio = beforePortfolio;
     this.AfterPortfolio = afterPortfolio;
     assembleReportPositions(parentTransfer);
 }
Esempio n. 21
0
 protected SecurityOrder(IAccountTypeInternal account, InstrumentSize value, ITradeableInstrument tradedInstrument, bool doNotChargeCommission)
     : base(account, value)
 {
     if (tradedInstrument == null)
     {
         throw new ApplicationException("TradedInstrument is mandatory on an order.");
     }
     this.tradedInstrument = tradedInstrument;
     this.DoNotChargeCommission = doNotChargeCommission;
     if (DoNotChargeCommission)
         this.OrderInfo = "No commission charged";
 }
Esempio n. 22
0
 public override ITransaction Storno(IAccountTypeInternal stornoAccount, B4F.TotalGiro.Stichting.Login.IInternalEmployeeLogin employee, string reason, ITradingJournalEntry tradingJournalEntry)
 {
     IOrderAllocation newStorno = new OrderAllocation();
     newStorno.Order = Order;
     this.storno(stornoAccount, employee, reason, tradingJournalEntry, newStorno);
     if (this.IsClientSettled)
     {
         newStorno.IsClientSettled = true;
         newStorno.ClientSettlementDate = this.ClientSettlementDate;
     }
     return newStorno;
 }
Esempio n. 23
0
        public static DataSet PortfolioTransferReport(IAccountTypeInternal account, DateTime positionDate,
            IPositionTransfer parentTransfer, IPositionTransferPortfolio beforePortfolio,
            IPositionTransferPortfolio afterPortfolio)
        {
            DataSet ds = new DataSet();
            IPositionTransferReportPortfolio returnValue = new PositionTransferReportPortfolio(account,
                positionDate,
                parentTransfer,
                beforePortfolio,
                afterPortfolio);

            return ds;
        }
Esempio n. 24
0
 public PositionTransfer(bool aIsInternal, IAccountTypeInternal accountA, bool bIsInternal,
     IAccountTypeInternal accountB, TransferType typeOfTransfer, Money transferAmount,
     DateTime transferDate)
     : this()
 {
     this.AIsInternal = aIsInternal;
     if (aIsInternal) this.AccountA = accountA;
     this.BIsInternal = bIsInternal;
     if (bIsInternal) this.AccountB = accountB;
     this.TypeOfTransfer = typeOfTransfer;
     this.TransferAmount = transferAmount;
     this.TransferDate = transferDate;
     this.TransferStatus = TransferStatus.New;
 }
Esempio n. 25
0
 public BonusDistribution(IAccountTypeInternal acctA, IAccount acctB,
 InstrumentSize valueSize,
 Price price, decimal exRate, DateTime transactionDate, DateTime transactionDateTime,
 Decimal ServiceChargePercentage, Side txSide,
 ICorporateActionBonusDistribution bonusDistributionDetails, ITradingJournalEntry tradingJournalEntry,
 IGLLookupRecords lookups, ListOfTransactionComponents[] components)
     : base(acctA, acctB, valueSize,
          price, exRate, transactionDate, transactionDateTime,
          ServiceChargePercentage, txSide,
          tradingJournalEntry,
          lookups, components)
 {
     this.CorporateActionType = CorporateActionTypes.BonusDistribution;
     this.CorporateActionDetails = bonusDistributionDetails;
 }
Esempio n. 26
0
 public static DataSet GetClosedSecurityPositions(IDalSession session, IAccountTypeInternal account)
 {
     return FundPositionMapper.GetPositions(session, account, PositionsView.Zero)
                              .Select(p => new PositionRowView(p))
                              .Select(pv => new
                              {
                                  pv.Key,
                                  pv.Isin,
                                  pv.InstrumentName,
                                  pv.Price,
                                  PriceShortDisplayString =
                                     pv.Price.ShortDisplayString,
                                  pv.ExchangeRate
                              })
                              .ToDataSet();
 }
Esempio n. 27
0
        /// <summary>
        /// The constructor
        /// </summary>
        /// <param name="valuations"></param>
        /// <param name="cashValuations"></param>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        internal PortfolioDevelopment(IAccountTypeInternal account, 
            IList<IValuation> valuations, IList<ISecurityValuationMutation> securityMutations, 
            IList<IValuationCashMutation> cashMutations, IList<IDepositWithdrawal> depositsWithdrawals, 
            IList<ValuationCashType> valuationCashTypes, DateTime beginDate, DateTime endDate, int modelID)
        {
            IDalSession session = NHSessionFactory.CreateSession();
            // check dates
            if (Util.IsNullDate(beginDate) || Util.IsNullDate(endDate))
                throw new ApplicationException(errSuffix + "The Start date and End date are mandatory.");
            else if (beginDate >= endDate)
                throw new ApplicationException(errSuffix + "The Start date must be before the End date.");

            this.account = account;
            if (account.FirstTransactionDate > beginDate)
                this.beginDate = account.FirstTransactionDate;
            else
                this.beginDate = beginDate;

            if (Util.IsNotNullDate(account.ValuationsEndDate) && account.ValuationsEndDate.Value < endDate && account.ValuationsEndDate.Value >= beginDate)
                this.endDate = account.ValuationsEndDate.Value;
            else
                this.endDate = endDate;

            fillValuationData(valuations);
            fillRealisedAmountData(securityMutations);
            fillDepositWithdrawalData(depositsWithdrawals);
            fillCashMutationData(cashMutations, valuationCashTypes);

            // old stuff. Replace to fillModelBenchMarkPerformance. These fileds are move to table ModelPerformance.
            //if (((IAccountTypeCustomer)account).ModelPortfolio != null) this.benchMarkPerformance = ((IAccountTypeCustomer)account).ModelPortfolio.TempBenchMark;
            //if (((IAccountTypeCustomer)account).ModelPortfolio != null) this.benchmarkValue = ((IAccountTypeCustomer)account).ModelPortfolio.BenchMarkValue;
            //if (((IAccountTypeCustomer)account).ModelPortfolio != null) this.iboxxTarget = ((IAccountTypeCustomer)account).ModelPortfolio.IBoxxTarget;
            //if (((IAccountTypeCustomer)account).ModelPortfolio != null) this.msciworldTarget = ((IAccountTypeCustomer)account).ModelPortfolio.MSCIWorldTarget;
            //if (((IAccountTypeCustomer)account).ModelPortfolio != null) this.compositeTarget = ((IAccountTypeCustomer)account).ModelPortfolio.CompositeTarget;

            fillModelBenchMarkPerformance(GetModelBenchMarkPerformance(session, modelID, endDate));

            session.Close();
            if (valuations != null && valuations.Count > 0)
            {
                ModDietzCalculator calculator = new ModDietzCalculator(TotalValueBegin, TotalValueEnd, this.beginDate, this.endDate, depositsWithdrawals);
                this.investmentReturn = calculator.GetInvestmentReturn();
            }
        }
Esempio n. 28
0
 internal AggregatedCashValuation(ValuationCollection cashValuations, bool aggregateToBase)
 {
     bool hasInitialized = false;
     if (aggregateToBase)
     {
         foreach (IValuation valuation in cashValuations)
         {
             if (valuation.Instrument.IsCash)
             {
                 if (this.account == null)
                 {
                     this.account = valuation.Account;
                     this.date = valuation.Date;
                     this.key = valuation.Key;
                     this.marketRate = 1M;
                     this.avgOpenExRate = 1M;
                     baseCurrency = ((ICurrency)valuation.Instrument).BaseCurrency;
                     price = new Price(1M, baseCurrency, baseCurrency);
                     this.bookPrice = price;
                     this.costPrice = price;
                     this.marketPrice = price;
                     this.displayInstrumentsCategory = valuation.DisplayInstrumentsCategory;
                     this.AssetClass = valuation.ValuationMutation.AssetClass;
                     this.ValuationMutation = valuation.ValuationMutation;
                 }
                 this.size += valuation.BaseMarketValue;
                 this.bookValue += valuation.BookValue;
                 this.bookChange += valuation.BookChange;
                 this.deposit += valuation.Deposit;
                 this.withDrawal += valuation.WithDrawal;
                 if (!valuation.ValuationMutation.IsSecurityValuationMutation)
                 {
                     this.depositToDate += ((IMonetaryValuationMutation)valuation.ValuationMutation).DepositToDate;
                     this.withDrawalToDate += ((IMonetaryValuationMutation)valuation.ValuationMutation).WithDrawalToDate;
                 }
                 hasInitialized = true;
             }
         }
     }
     if (!hasInitialized)
         throw new ApplicationException("Class AggregatedCashValuation could not be initialized");
 }
Esempio n. 29
0
        public InstrumentConversion(IAccountTypeInternal acctA, IAccount acctB,
                InstrumentSize valueSize, InstrumentSize convertedInstrumentSize, Money additionalCash,
                decimal exRate, IInstrumentHistory instrumentTransformation,
                ITradingJournalEntry tradingJournalEntry, IGLLookupRecords lookups)
            : base(acctA, acctB, valueSize, valueSize.GetPrice(0M), exRate,
                instrumentTransformation.ChangeDate, instrumentTransformation.ChangeDate, 0M,
                (valueSize.Sign ? Side.XI : Side.XO), tradingJournalEntry, lookups, null)
        {
            if (instrumentTransformation == null)
                throw new ApplicationException("Corporate action information is missing");

            if (!(valueSize != null && valueSize.IsNotZero && convertedInstrumentSize != null && convertedInstrumentSize.IsNotZero))
                throw new ApplicationException("Not all instrument information for this corporate action is available, both instruments have to be supplied");

            if (valueSize.Underlying.Equals(convertedInstrumentSize.Underlying))
                throw new ApplicationException("Both instruments can not be the same in a corporate action");

            if (valueSize.Sign.Equals(convertedInstrumentSize.Sign))
                throw new ApplicationException("Both instruments can not have the same side in a corporate action");

            IInstrumentsHistoryConversion conversion = (IInstrumentsHistoryConversion)instrumentTransformation;
            if (!(conversion.Instrument.Equals(valueSize.Underlying) && conversion.NewInstrument.Equals(convertedInstrumentSize.Underlying)))
                throw new ApplicationException("Corporate action does not equal the instrument history data");

            decimal diff = (convertedInstrumentSize.Abs().Quantity / valueSize.Abs().Quantity) - conversion.ConversionRate;
            if (diff != 0)
                throw new ApplicationException("Sizes do not correspond with conversion rate of the Corporate action");

            if (additionalCash != null && additionalCash.IsNotZero)
            {
                ListOfTransactionComponents[] components = new ListOfTransactionComponents[1];
                components[0] = new ListOfTransactionComponents() { ComponentType = BookingComponentTypes.Conversion, ComponentValue = additionalCash };
                createComponents(lookups, components);

            }

            this.CorporateActionType = CorporateActionTypes.Conversion;

            ConvertedInstrumentSize = convertedInstrumentSize;
            CorporateActionType = instrumentTransformation.CorporateActionType;
            InstrumentTransformation = instrumentTransformation;
        }
Esempio n. 30
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="account">User account</param>
        /// <param name="value">Instrument size</param>
        /// <param name="isClosure">Is this order closing a position.</param>
        /// <param name="feeFactory">The set of rules to use for calculating transaction costs.</param>
        /// <param name="doNotChargeCommission">parameter that decides whether commission should be charged</param>
        /// <param name="actionType">The action type that created this order.</param>
        public OrderSizeBased(IAccountTypeInternal account, InstrumentSize value, bool isClosure, IFeeFactory feeFactory, bool doNotChargeCommission, OrderActionTypes actionType)
            : base(account, value, (ITradeableInstrument)value.Underlying, doNotChargeCommission)
        {
            this.ActionType = actionType;
            this.isClosure = isClosure;
            setCommission(feeFactory);

            // Accrued Interest for Client Orders
            if (account.IsAccountTypeCustomer && TradedInstrument.SecCategory.Key == SecCategories.Bond)
            {
                IBond bond = (IBond)TradedInstrument;
                if (bond.DoesPayInterest)
                {
                    IExchange exchange = bond.DefaultExchange ?? bond.HomeExchange;
                    AccruedInterestDetails calc = bond.AccruedInterest(value, bond.GetSettlementDate(DateTime.Today, exchange), exchange);
                    if (calc.IsRelevant)
                        this.AccruedInterest = calc.AccruedInterest.Abs() * (decimal)this.Side * -1M;
                }
            }
        }