Exemple #1
0
 public void UpdateHousebreaks(List <Housebreak> housebreakList)
 {
     using (var bhavDBContext = new BhavCopiesDbEntities())
     {
         bhavDBContext.Housebreaks.AddRange(housebreakList);
         bhavDBContext.SaveChanges();
     }
 }
Exemple #2
0
 public void PopulateHousebreaks(Ticker ticker, List <HouseBreakReport> housebreakReport)
 {
     using (var bhavDBContext = new BhavCopiesDbEntities())
     {
         foreach (HouseBreakReport hbr in housebreakReport)
         {
             Housebreak hb = CreateHousebreakObjectFromHBR(hbr, ticker);
             bhavDBContext.Housebreaks.Add(hb);
         }
         bhavDBContext.SaveChanges();
     }
 }
Exemple #3
0
        public void AddBhavCopyUpdateLog(DateTime date, int stocksUpdated, string Status)
        {
            using (var bhavDBContext = new BhavCopiesDbEntities())
            {
                BhavCopyUploadLog logObject = new BhavCopyUploadLog();
                logObject.Date = date;
                logObject.NumberOfStocksUpdated = stocksUpdated;
                logObject.Status = Status;

                bhavDBContext.BhavCopyUploadLogs.Add(logObject);
                bhavDBContext.SaveChanges();
            }
        }
Exemple #4
0
 public void UploadBhavCopys(List <BhavCopy> bhavCopyObjectList)
 {
     using (var bhavDBContext = new BhavCopiesDbEntities())
     {
         foreach (BhavCopy bc in bhavCopyObjectList)
         {
             //var bhavCopyfromDB = (from s in bhavDBContext.BhavCopies
             //                      where s.Date == bc.Date && s.Ticker == bc.Ticker
             //                      select s).ToList();
             //if (bhavCopyfromDB.Count == 0)
             {
                 // Bhav copy of date is not uploaded yet
                 bhavDBContext.BhavCopies.Add(bc);
                 //bhavDBContext.SaveChanges();
             }
         }
         bhavDBContext.SaveChanges();
     }
 }
Exemple #5
0
 public void UploadBhavCopy(BhavCopy bhavCopyObject)
 {
     using (var bhavDBContext = new BhavCopiesDbEntities())
     {
         var bhavCopyfromDB = (from s in bhavDBContext.BhavCopies
                               where s.Date == bhavCopyObject.Date && s.Ticker == bhavCopyObject.Ticker
                               select s).ToList();
         if (bhavCopyfromDB.Count == 0)
         {
             // Bhav copy of date is not uploaded yet
             bhavDBContext.BhavCopies.Add(bhavCopyObject);
             bhavDBContext.SaveChanges();
         }
         else
         {
             throw new Exception($"BhavCopy of {bhavCopyObject.Date.ToShortDateString()} , {bhavCopyObject.Ticker} already exists");
         }
     }
 }
Exemple #6
0
        public void UpdateIndicator(string Indicator, List <Indicator> IndicatorValues)
        {
            using (var bhavDBContext = new BhavCopiesDbEntities())
            {
                if (Indicator == "MAVolume")
                {
                    foreach (Indicator i in IndicatorValues)
                    {
                        long     ticker_Id = i.FK_Ticker_Id;
                        DateTime t         = i.Date;

                        var indValueRow = (from indRow in bhavDBContext.Indicators
                                           where indRow.FK_Ticker_Id == ticker_Id && indRow.Date == t
                                           select indRow)?.First();
                        indValueRow.Indicator_1 = i.Indicator_1;
                    }
                    bhavDBContext.SaveChanges();
                }
            }
        }