private async Task LoadTradeviewRefTable(List <TradeViewBseCm> tradeViewBseCms) { if (tradeViewBseCms?.Count > 0) { var output = new List <TradeViewRef>(); foreach (var item in tradeViewBseCms) { output.Add(_mapper.Map <TradeViewRef>(item)); } var guid = Guid.NewGuid().ToString(); output = output.Select(i => { i.LotSize = LotSize; i.BrokerId = BrokerId; i.StockName = i.SymbolName; i.ProClient = i.ClientCode == ClientCode ? "PRO" : "CLI"; i.ExchangeName = Constants.BseCmExchangeName; i.BuySell = i.BuySell == "B" ? "Buy" : "Sell"; if (i.OrderType == "L") { i.OrderType = "LMT"; } else if (i.OrderType == "M") { i.OrderType = "MKT"; } else if (i.OrderType == "SL") { i.OrderType = "SL"; } else if (i.OrderType == "SL-M") { i.OrderType = "SL-MKT"; } i.Guid = guid; i.ComputeTotalPriceValue(); return(i); } ).ToList(); //await _tradeViewRepositoryEf.AddTradeView(output.ToCollection<TradeView>()); //_tradeViewRepositoryEf.MergeTradeView(output.ToCollection<TradeView>()); //Insert into Ref Table _log.Info($"TradeViewBseCmRepository: LoadTradeviewRefTable Ref table Insertion Starting - {output.Count}"); await _tradeViewRefRepository.AddTradeView(output.ToCollection <TradeViewRef>()); _log.Info($"TradeViewBseCmRepository: LoadTradeviewRefTable Ref table Finished Starting - {output.Count}"); //Sync with main table await _tradeViewRepo.SyncWithTradeViewRefTable(guid); _log.Info($"TradeViewBseCmRepository: LoadTradeviewRefTable - Bse CM Syncing Completed - {output.Count}"); } }
private async Task LoadTradeViewRefTable(List <TradeViewNseFo> tradeViewNseFos) { CultureInfo provider = CultureInfo.InvariantCulture; if (tradeViewNseFos?.Count > 0) { var output = new List <TradeViewRef>(); foreach (var item in tradeViewNseFos) { output.Add(_mapper.Map <TradeViewRef>(item)); } var guid = Guid.NewGuid().ToString(); output = output.Select(i => { i.BrokerId = BrokerId; i.ProClient = i.ClientCode == ClientCode ? "PRO" : "CLI"; i.ExchangeName = Constants.NseFoExchangeName; i.Source = Source; i.TradeDate = !string.IsNullOrWhiteSpace(i.TradeDateTime) ? DateTime.ParseExact(i.TradeDateTime, Constants.StrDateTimeFormat, provider).ToString(Constants.StrDateFormat) : null; i.TradeTime = !string.IsNullOrWhiteSpace(i.TradeDateTime) ? DateTime.ParseExact(i.TradeDateTime, Constants.StrDateTimeFormat, provider).ToString(Constants.TimeFormat) : null;; i.Guid = guid; i.BuySell = i.BuySell == "1" ? "Buy" : "Sell"; i.ComputeTotalPriceValue(); return(i); }).ToList(); //await _tradeViewRepositoryEf.AddTradeView(output.ToCollection<TradeView>()); //_log.Info($"Nse FO to be Processed Records - {output.Count}"); //_tradeViewRepositoryEf.MergeTradeView(output.ToCollection<TradeView>()); //Insert into Ref Table _log.Info($"TradeViewNseFoRepository: LoadTradeViewFromSource Ref table Insertion Starting - {output.Count}"); await _tradeViewRefRepository.AddTradeView(output.ToCollection <TradeViewRef>()); _log.Info($"TradeViewNseFoRepository: LoadTradeViewFromSource Ref table Finished Starting - {output.Count}"); //Sync with main table await _tradeViewRepo.SyncWithTradeViewRefTable(guid); _log.Info($"TradeViewNseFoRepository: LoadTradeviewRefTable - NSE FO Synching Completed - {output.Count}"); } }
private async Task LoadTradeViewRefTable(List <TradeViewGreekNseFo> tradeViewGreekNseFos) { if (tradeViewGreekNseFos?.Count > 0) { var output = new List <TradeViewRef>(); foreach (var item in tradeViewGreekNseFos) { output.Add(_mapper.Map <TradeViewRef>(item)); } var guid = Guid.NewGuid().ToString(); output = output.Select(i => { i.BrokerId = BrokerId; i.StockName = i.SymbolName; i.ProClient = i.ParticipantId != ClientCodeConst ? "CLI" : "PRO"; i.ExchangeName = Constants.GreekNseFoExchangeName; i.TradeDate = i.TradeDateTime; i.TradeTime = i.TradeDateTime; i.BuySell = i.BuySell == "1" ? "Buy" : "Sell"; i.Source = Source; i.Guid = guid; i.ComputeTotalPriceValue(); i.StrikePrice = i.StrikePrice ?? null; return(i); } ).ToList(); _log.Info($"GreekNseFoRepository: LoadTradeviewRefTable Ref table Insertion Starting - {output.Count}"); await _tradeViewRefRepository.AddTradeView(output.ToCollection <TradeViewRef>()); _log.Info($"GreekNseFoRepository: LoadTradeviewRefTable Ref table Finished Starting - {output.Count}"); await _tradeViewRepo.SyncWithTradeViewRefTable(guid); _log.Info($"GreekNseFoRepository: LoadTradeviewRefTable - Greek Nse FO Syncing Completed - {output.Count}"); } }