private string GetTickAsFormattedString(int tickType, Func <double, string> messageFormatter) { double?tick = service.GetTick(tickType); return(tick.HasValue && tick.Value >= 0 ? messageFormatter(tick.Value) : Messages.TitleUnavailable); }
private async Task SetSharesFromCashAsync() { await Timeout(service.HasTicksAsync(COMMON_TICKS)); int tickType = TickType.LAST; if (Validation.TickDataAvailable(service, tickType)) { double sharePrice = service.GetTick(tickType).Value; if (sharePrice > 0) { Shares = (int)Math.Floor(Cash / sharePrice); } } }