public async Task<bool> Validate(QuoteManager manager) { if (!String.IsNullOrWhiteSpace(Symbol)) { QuoteCollection quotes = await manager.GetQuotes(Symbol); if (quotes.ContainsKey(Symbol) && (Target > 0)) { // Optionally set the Target price of the tracker, if it is a percent Tracker. if (TrackerType == TrackerKind.BuyPercent || TrackerType == TrackerKind.SellPercent) { Target = Target * quotes[Symbol]; // Now that target has been set to a value, change type to just plain old Buy/Sell. TrackerType = TrackerType == TrackerKind.BuyPercent ? TrackerKind.Buy : TrackerKind.Sell; } return true; } } return false; }
public TrackerManager(StockTrackerContext context) { _repo = new Repository(context); _quoteManager = new QuoteManager(); }