예제 #1
0
 public bool CanBuy(int Amount, int UnderStock)
 {
     if (Amount > 0 && UnderStock > 0 && UnderStock <= Amount && Amount <= Stock)
     {
         PriceMap PM = new PriceMap(Prices);
         if (!double.IsNaN(PM.getValue(Amount, 0)))
         {
             return(true);
         }
         return(!double.IsNaN(PM.getValue(UnderStock, 0)));
     }
     return(false);
 }
예제 #2
0
        public BitTransaction Buy(int amount, int understock)
        {
            BitTransaction BT = null;
            PriceMap       PM = new PriceMap(Prices);

            if (CanBuy(amount, understock))
            {
                if (!double.IsNaN(PM.getValue(amount, 0)))
                {
                    BT        = new BitTransaction(this);
                    BT.Amount = amount;
                }
                if (!double.IsNaN(PM.getValue(understock, 0)))
                {
                    BT        = new BitTransaction(this);
                    BT.Amount = understock;
                }
            }
            return(BT);
        }