Exemplo n.º 1
0
        public static GpusInsightsReport GenerateReport()
        {
            GpusInsightsReport gpusInsightsReport = null;

            gpusInsightsReport = new GpusInsightsReport();

            /*
             * Requirements:
             * GpuPriceSourceItems > 0
             * ASIN Number
             *
             */
            List <Gpu> gpus = GpuService.Instance.GetAll();

            foreach (Gpu gpu in gpus)
            {
                List <PriceSourceItem> gpuPriceSourceItems = GetPrices(gpu);
                if (!gpuPriceSourceItems.Any())
                {
                    continue;
                }

                GpuInsightReport gpuInsightReport = new GpuInsightReport();
                gpuInsightReport.GpuId            = gpu.Id;
                gpuInsightReport.PriceSourceItems = gpuPriceSourceItems;

                gpusInsightsReport.GpuInsightReports.Add(gpuInsightReport);
            }

            return(gpusInsightsReport);
        }
Exemplo n.º 2
0
        private GpusInsightsReport LoadReport(bool?ignoreCache = null)
        {
            bool isIgnoreCache = ignoreCache ?? false;

            isIgnoreCache = isIgnoreCache || Request.IsLocal;
            GpusInsightsReport report = Caching.LoadChache <GpusInsightsReport>(Constants.GPU_INSIGHTS_REPORT);

            if (report == null || isIgnoreCache == true)
            {
                report = GpusInsightsReportService.Instance.GetLatestReport();
                Caching.SetCache(Constants.GPU_INSIGHTS_REPORT, report, new TimeSpan(0, 20, 0));
            }

            return(report);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            GmiApp.Initialize();
            //Update Fiat Currencies Exchange Rate
            TryHelper.Try(FiatCurrencyService.Instance.AddOrUpdate, Log);

            //Update Crypto Currencies info, and update Algorithms
            TryHelper.Try(CoinService.Instance.AddOrUpdate, Log);
            //Update USD Exchange Rates;
            TryHelper.Try(CoinService.Instance.UpdateUsdExchangeRates, Log);

            //Generate Profitability Report
            GpusInsightsReport report = TryHelper.Try(GpuInsightsService.GenerateReport, Log);

            //Save the Report To DB
            TryHelper.Try(() => GpusInsightsReportService.Instance.Add(report), Log);
        }