public async ValueTask <OvershootResponseContract> Overshoot(string assetPair) { var dict = (await _bidAskHistoryRepository.GetAllAsync()).ToDictionary(itm => itm.Id); var indicators = await _overshootIndicatorsDataRepository.GetAsync(); var indexInfo = await _indexInformationRepository.GetAsync(AssetLci); var result = OvershootResponseContract.Create(indexInfo.AssetsInfo, id => dict.ContainsKey(id) ? dict[id].History : Array.Empty <double>()); if (indicators.ContainsKey(AssetPairLci)) { result.Index.Thresholds = indicators[AssetPairLci].Select(OvershootThresholdContract.Create).ToArray(); } foreach (var part in result.Parts) { var id = part.AssetId + "USD"; if (indicators.ContainsKey(id)) { part.Thresholds = indicators[id].Select(OvershootThresholdContract.Create).ToArray(); } } return(result); }