Beispiel #1
0
        public static MarketHistoryEntry Create(EveData.MarketData.MarketHistoryEntry source)
        {
            var entry = new MarketHistoryEntry();

            entry.TypeId     = source.TypeId;
            entry.RegionId   = source.RegionId;
            entry.AvgPrice   = source.AvgPrice;
            entry.Date       = source.Date;
            entry.HighPrice  = source.HighPrice;
            entry.LowPrice   = source.LowPrice;
            entry.OrderCount = source.OrderCount;
            entry.Volume     = source.Volume;
            return(entry);
        }
        private static EveData.MarketData.MarketHistoryEntry map(int typeId, int regionId, CrestMarketHistory.MarketHistoryEntry source)
        {
            var target = new EveData.MarketData.MarketHistoryEntry();

            target.TypeId     = typeId;
            target.RegionId   = regionId;
            target.AvgPrice   = source.AvgPrice;
            target.HighPrice  = source.HighPrice;
            target.LowPrice   = source.LowPrice;
            target.Volume     = source.Volume;
            target.OrderCount = source.OrderCount;
            target.Date       = source.Date;
            return(target);
        }
        private async Task produce(int region, int typeId, EveData.MarketData.MarketHistoryEntry latest)
        {
            CrestMarketHistory result;

            while (true)
            {
                try {
                    result = await EveCrest.GetMarketHistoryAsync(region, typeId).ConfigureAwait(false);

                    break;
                } catch (Exception) {
                    Console.WriteLine("Something went wrong, waiting...");
                    Thread.Sleep(30000);
                }
            }
            var limit   = DateTime.UtcNow.AddMonths(-3);
            var history = result.Entries.Where(e => e.Date > limit).ToList();

            if (latest != null)
            {
                history = history.Where(e => e.Date > latest.Date).ToList();
            }
            Queue.Add(new ConsumerTask(typeId, region, history));
        }