public void AddStockPriceTest()
 {
     using (var transaction = new TransactionScope())
     {
         var repo = GetFinanceRepositoire();
         //Get a stock
         var stock = repo.GetStockList().First();
         var price = new StockPrice { Price = 90.123, Time = DateTime.Today.Date };
         repo.SavePrices(stock.StockId, new[] { price });
     }
 }
Esempio n. 2
0
        private StockPrice GetPrice(Stock stock, DateTime date)
        {
            StockPrice returnValue = null;

            var datum = date.ToString("yyyyMMdd");
            var url = string.Format("http://www.tijd.be/ajax/historyDay?issueId={0}&date={1}", stock.ScraperMetaData1, datum);
            var pagina = Download(url);
            var pageResult = GetPageResult(pagina);

            if (pageResult.Date == datum)
            {
                returnValue = new StockPrice();
                returnValue.Price = Double.Parse(pageResult.Price, CultureInfo.GetCultureInfo("BE"));
                returnValue.Time = date;
            }

            return returnValue;
        }