private async Task ProcessMessageAsync(IndexTickPrice message) { try { if (!message.Ask.HasValue) { throw new InvalidOperationException($"IndexTickPrice doesn't have 'ask' price: {message.ToJson()}"); } var index = CreateIndex(message, message.AssetPair); Index shortIndex = null; bool isShort = !string.IsNullOrWhiteSpace(message.ShortIndexName); if (isShort) { shortIndex = CreateIndex(message, message.ShortIndexName); } await _indexHandler.HandleIndexAsync(index, shortIndex); _log.InfoWithDetails("Index price handled", message); } catch (Exception exception) { _log.ErrorWithDetails(exception, "An error occurred while processing index tick price", message); throw; } }
private async Task ProcessMessageAsync(IndexTickPrice message) { try { var index = new Index(message.AssetPair, message.Ask, message.Source, message.Timestamp, message.AssetsInfo .Select(o => new AssetWeight(o.AssetId, o.Weight, o.Price, o.IsDisabled)) .ToArray()); await _indexHandler.HandleIndexAsync(index); _log.InfoWithDetails("Index price handled", message); } catch (Exception exception) { _log.ErrorWithDetails(exception, "An error occurred while processing index tick price", message); throw; } }