Ejemplo n.º 1
0
        // 买入股票
        private void BuyStocks(StockOper oper)
        {
            BuyTransactionCount_++;
            double charge = Transaction.GetTotalCharge(oper.UnitPrice * oper.HandCount);

            if (bankRoll_ >= charge)
            {
                bankRoll_ -= charge;
                Holder.BuyStock(oper.HandCount, oper.UnitPrice);

                LogMgr.Logger.LogInfo("Action: Buy Stock Count: {0}, Unit Price: {1}",
                                      oper.HandCount,
                                      oper.UnitPrice);
            }
            else
            {
                throw new InvalidOperationException("Bank Roll is smaller than total price!");
            }
        }