public List<StrategyResponse> GetStratResults(List<Company> companies) { List<Quote> ListOfQuotes = new List<Quote>(); StrategyResponse companyStrategyValue = null; ListOfQuotes = GetQoutes(companies); List<StrategyResponse> finalCompanyListAsPerStrategy = new List<StrategyResponse>(); foreach (var quote in ListOfQuotes) { companyStrategyValue = new StrategyResponse(); companyStrategyValue.symbol = quote.symbol; if ((quote.week52High - quote.week52Low) != 0) { companyStrategyValue.StrategyValue = ((quote.close - quote.week52Low) / (quote.week52High - quote.week52Low)); companyStrategyValue.companyName = quote.companyName; } finalCompanyListAsPerStrategy.Add(companyStrategyValue); } return finalCompanyListAsPerStrategy.OrderByDescending(a => a.StrategyValue).Take(5).ToList(); }
public void Handle(StrategyResponse message) { switch (message.Type) { case StrategyResponse.ResponseType.TICK_ARRIVED: onTickData((TickData)message.Body); break; case StrategyResponse.ResponseType.BAR_ARRIVED: onBarData((BarData)message.Body); break; case StrategyResponse.ResponseType.QUOTE_ARRIVED: onQuoteData((QuoteData)message.Body); break; case StrategyResponse.ResponseType.RUN_ARRIVED: run(message.Body); break; } }
public async Task PutStrategyAsync(StrategyResponse strategy) { var response = await _httpClient.PutAsJsonAsync($"/api/strategies/{strategy.Id}", strategy); response.EnsureSuccessStatusCode(); }