public FundRequestResult ProcessFundRegistration(FundRegistration request) { var fundName = request.Id; var depot = new FundDepot { Id = fundName, ExchangeName = exchangeId, Budget = request.FundAssets, Shares = new Dictionary <string, int>() }; ShareInformation info = null; Order order = null; if (request.Shares > 0) { var exchanges = wallstreetClient.GetExchanges(); var list = new List <FundDepot>(); foreach (string e in exchanges) { var fund = wallstreetClient.GetFundDepot(fundName, e); if (fund != null) { list.Add(fund); } } var assets = list.Sum(x => x.Budget); assets += request.FundAssets; depot.Shares.Add(fundName, request.Shares); info = new ShareInformation { FirmName = fundName, NoOfShares = request.Shares, PricePerShare = assets / request.Shares, PurchasingVolume = 0, SalesVolume = request.Shares, IsFund = true, ExchangeName = exchangeId }; order = new Order { Id = fundName + DateTime.Now.Ticks, ShareName = fundName, InvestorId = fundName, Type = OrderType.SELL, TotalNoOfShares = request.Shares, NoOfOpenShares = request.Shares, NoOfProcessedShares = 0, Status = OrderStatus.OPEN, Limit = 0, Prioritize = false, IsFundShare = true }; } return(new FundRequestResult { FundDepot = depot, ShareInformation = info, Order = order }); }
public FundDepot LoadFundInformation(string exchangeId) { if (fundid != null) { return(client.GetFundDepot(fundid, exchangeId)); } else { return(null); } }