Beispiel #1
0
        public Analysation Analyse(OfferPage page)
        {
            Analysation ana = new Analysation();

            ana.buyOffers.Add(page.buyOffers[0]);
            ana.sellOffers.Add(page.sellOffers[0]);


            //buy: 0.2 - 0.4
            //sell: 0.1 - 0.5
            // -> 0.2 - 0.3
            //   s_min <= b_min <= s_max
            //|| b_min <= s_min <= b_max

            Record buy  = page.buyOffers[0];
            Record sell = page.sellOffers[0];

            //dows buy or sell offer limit?
            bool lowerBuy  = sell.min <= buy.min && buy.min <= sell.max;
            bool lowerSell = buy.min <= sell.min && sell.min <= buy.max;

            bool upperBuy  = sell.min <= buy.max && buy.max <= sell.max;
            bool upperSell = buy.min <= sell.max && sell.max <= buy.max;

            ana.possible = lowerBuy || lowerSell;

            float lowerLimit = lowerBuy ? buy.min : sell.min;
            float upperLimit = upperBuy ? buy.max : sell.max;

            ana.possible = page.buyOffers[0].min <= page.sellOffers[0].max && page.buyOffers[0].max >= page.sellOffers[0].min;
            ana.min      = lowerLimit;
            ana.max      = upperLimit;

            foreach (var rec in ana.buyOffers)
            {
                ana.express &= rec.express;
            }
            foreach (var rec in ana.sellOffers)
            {
                ana.express &= rec.express;
            }

            return(ana);
        }
Beispiel #2
0
 public void LoadPage(OfferPage page)
 {
     Analysation ana = Analyse(page);
 }