public FundDepot GetFundDepot(string fundId, string exchangeId) { FundDepot result = new FundDepot(); data.Exchanges[exchangeId].FundDepots.TryGetValue(fundId, out result); return(result); }
public void OnNewFundDepotAvailable(FundDepot depot) { if (fundid != null && depot != null && depot.Id.Equals(fundid)) { ExecuteOnGUIThread(fundAddedCallbacks, depot); } }
private void UpdateFundInformation(FundDepot d) { var tmp = new ObservableCollection <FundDepot>(Depots.Where(x => x.ExchangeName != d.ExchangeName)); tmp.Add(d); Depots = tmp; UpdateOwnedShares(); }
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 void OnNewFundDepotAvailable(FundDepot depot) { if (locator.Funds == null) { locator.Funds = new List <FundDepot>(); } locator.Funds.Add(depot); confirmedCounter++; if (confirmedCounter == Registrations.Where(x => x.Register).Count()) { Messenger.Default.Send <NotificationMessage>(new NotificationMessage(this, "Close")); var MainWindow = new MainWindow(); MainWindow.Show(); this.Cleanup(); } }
public FundDepot GetOverallFundInformation(string fundId) { FundDepot result = new FundDepot(); foreach (string e in data.Exchanges.Keys) { var d = data.Exchanges[e].FundDepots[fundId]; if (result.Id == null) { result.Id = d.Id; result.Budget = 0; result.Shares = new Dictionary <string, int>(); } result.Budget += d.Budget; foreach (string s in d.Shares.Keys) { result.Shares.Add(s, d.Shares[s]); } } return(result); }
public void OnNewFundDepotAvailable(FundDepot depot) { }