Esempio n. 1
0
        public void Run()
        {
            GetPrices priceDownloader = new GetPrices();

            SQL sql = new SQL();

            while (Program.ShouldRun)
            {
                sql.OpenDataBase();

                if ((DateTime.Now - LastRun).TotalHours > 24)
                {
                    // Gather the available currencies and available markets one per day
                    // as it is very unlikely that they change too often

                    MarketPackage     availableMarkets    = priceDownloader.GetAvailableMarkets();
                    CurrenciesPackage availableCurrencies = priceDownloader.GetCurrencies();

                    if (availableMarkets.success)
                    {
                        sql.AddDailyMarket(availableMarkets.result);
                    }

                    if (availableCurrencies.success)
                    {
                        sql.AddDailyCurrencyInfo(availableCurrencies.result);
                    }


                    LastRun = DateTime.Now;

                    DailyCollectionRan++;
                }

                Market[] markets = sql.GetActiveMarkets();

                foreach (Market market in markets)
                {
                    MarketPricePackage marketPrice = priceDownloader.GetMarketPrice(market.MarketName);

                    if (marketPrice.success)
                    {
                        sql.AddNewCurrencyPrice(marketPrice.result, market);
                    }
                }

                sql.CloseDataBase();

                CrawlerRan++;

                Thread.Sleep(30 * 1000);
            }
        }
Esempio n. 2
0
        public void CanGetPrices()
        {
            var request = new GetPrices
            {
                identifier      = "AAPL",
                StartDate_IaYoS = new DateTime(1999, 12, 31),
                page_size       = 260 * 30,
                sort_order      = Direction.asc
            };

            Assert.True(request.start_date == "1999-12-31");
            var response = ApiClient.GetPrices(request);
        }
        public List <Price> GetPrices(GetPrices request)
        {
            /*
             * This does not work
             *
             * var req = Api.Get(new LatestPricesRequest());
             * var response = req.ConvertAll(p => new Price
             * {
             *  ProductName = p.Description,
             *  ProductPrice = p.CashPrice.ConvertTo<decimal>()
             * });
             * return response;
             */

            // I can manually return things with no problem.
            // Issues seem to happen when I call 'Api' from here.
            return(new List <Price>
            {
                new Price {
                    ProductName = "A", ProductPrice = 1.0M
                }
            });
        }
Esempio n. 4
0
 /// <summary>
 /// http://docs.intrinio.com/#prices
 /// Returns professional-grade historical stock prices for a security or stock market index. New EOD prices
 /// are available at 5p.m. EST and intraday prices are updated every minute during the trading day from
 /// IEX. Historical prices are available back to 1996 or the IPO data in most cases, with some companies
 /// with data back to the 1970s. Stock market index historical price data is available back to the 1950s at
 /// the earliest. Data from Quandl, QuoteMedia and the Federal Reserve Economic Data.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public GetPricesResponse GetPrices(GetPrices request)
 {
     return(GetMetaList <GetPrices, GetPricesResponse>(request));
 }
 public List <Price> GetPrices(GetPrices request)
 {
     return(PricingClient.GetPrices(request));
 }
 public object Get(GetPrices request)
 {
     return(PricingRepository.GetPrices(request));
 }