Esempio n. 1
0
 public static List<IFundPosition> GetPositions(IDalSession session, int accountId, PositionsView view)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Account.Key", accountId));
     addPositionsViewCriterion(expressions, view);
     return session.GetTypedList<FundPosition, IFundPosition>(expressions);
 }
Esempio n. 2
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. 3
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. 4
0
 public static List<IFundPosition> GetPositions(IDalSession session, IInstrument instrument, PositionsView view)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Size.Underlying.Key", instrument.Key));
     addPositionsViewCriterion(expressions, view);
     LoginMapper.GetSecurityInfo(session, expressions, SecurityInfoOptions.NoFilter);
     return session.GetTypedList<FundPosition, IFundPosition>(expressions);
 }
Esempio n. 5
0
        private static void addPositionsViewCriterion(List<ICriterion> expressions, PositionsView view)
        {
            ICriterion quantityZero = Expression.Eq("SettledSize.Quantity", 0m);

            if (view == PositionsView.Zero)
                expressions.Add(quantityZero);
            else if (view == PositionsView.NotZero)
                expressions.Add(Expression.Not(quantityZero));
        }
Esempio n. 6
0
        public static List<IFundPosition> GetPositionsByParentInstrument(IDalSession session, int accountId, int[] parentInstrumentIds, 
                                                                         PositionsView view)
        {
            Hashtable parameters = new Hashtable();
            Hashtable listParameters = new Hashtable();

            parameters.Add("accountId", accountId);

            parameters.Add("positionsViewZero", view == PositionsView.Zero ? 1 : 0);
            parameters.Add("positionsViewNotZero", view == PositionsView.NotZero ? 1 : 0);
            parameters.Add("positionsViewAll", view == PositionsView.All ? 1 : 0);

            listParameters.Add("parentInstrumentIds", parentInstrumentIds);
            return session.GetTypedListByNamedQuery<IFundPosition>(
                "B4F.TotalGiro.Accounts.Portfolios.FundPositions.GetFundPositions",
                parameters,
                listParameters);
        }
Esempio n. 7
0
 public static List<IFundPosition> GetOwnedFundPositionsByParentInstrument(IDalSession session, 
                                         int accountId, int[] parentInstrumentIds, PositionsView view)
 {
     AssertActiveAccountIsOwned(session, accountId);
     return FundPositionMapper.GetPositionsByParentInstrument(session, accountId, parentInstrumentIds, view);
 }
Esempio n. 8
0
 public static List<IFundPosition> GetOwnedFundPositions(IDalSession session, int accountId, PositionsView view)
 {
     AssertActiveAccountIsOwned(session, accountId);
     return FundPositionMapper.GetPositions(session, accountId, view);
 }