Exemple #1
0
        public void ProcessAccountOrders(int accountId)
        {
            List <TradeOrder> toList = toBll.GetListByAccountStatus(accountId, "Open");
            Account           acc    = aBll.GetByID(accountId);

            int dateToProcess = this.GetDateToProcess(acc);

            foreach (TradeOrder o in toList)
            {
                try
                {
                    ProcessOrder(o, dateToProcess);
                }
                catch (Exception ex)
                {
                    LogHelper.Error(_log, ex.ToString());
                }
            }
        }
Exemple #2
0
        public AccountSummary GetAccountSummary(int accountId)
        {
            AccountBLL        aBLL        = new AccountBLL(_unit);
            AccountBalanceBLL abBll       = new AccountBalanceBLL(_unit);
            TradeOrderBLL     orderBLL    = new TradeOrderBLL(_unit);
            TradePositionBLL  positionBLL = new TradePositionBLL(_unit);

            AccountSummary aSummary = new AccountSummary();

            aSummary.Account          = aBLL.GetByID(accountId);
            aSummary.Balance          = abBll.GetAccountBalanceByAccount(accountId);
            aSummary.OpenOrders       = orderBLL.GetListByAccountStatus(accountId, "open");
            aSummary.CurrentPositions = positionBLL.GetOutstandingPositions(accountId);

            aSummary.Balance.Margin        = aSummary.PositionMarginSum;
            aSummary.Balance.Reserve       = aSummary.OrderReserveSum;
            aSummary.Balance.PositionValue = aSummary.PositionValueSum;

            return(aSummary);
        }