public FundViewModel GetFundInformation(string accountCode, string customerCode = null, Currency currency = null) { List <FundInformation> results = _portfolioManager.GetFundInformation(customerCode, accountCode, currency); FundInformation fund = results.First(); FundViewModel result = Mapper.Map <FundInformation, FundViewModel>(fund); List <OptionPositionViewModel> positions = GetOptionPositions(customerCode, accountCode); decimal floatingPL = 0; foreach (OptionPositionViewModel position in positions) { floatingPL += position.OptionFloatingPL; } result.FloatingPL = floatingPL; RiskLevelInformation riskLevel = _portfolioManager.GetAccountRiskLevelInformation(accountCode, currency); result.UsedMargin = riskLevel.UsedMargin; result.MarginRate = 0; if (fund.AvailableFund != 0) { result.MarginRate = riskLevel.UsedMargin / fund.AvailableFund; } return(result); }