Exemple #1
0
        public void ProcessTransfers()
        {
            foreach (var playerBidList in Bids.Values)
            {
                var highestBid = playerBidList.
                                 Where(b => b.PurchasingTeam.Players.Count < Configuration.MaxSquadSize).
                                 OrderByDescending(b => b.BidAmount).
                                 FirstOrDefault();

                if (highestBid == null)
                {
                    continue;
                }

                var player = highestBid.Player;

                if (highestBid.BidAmount < player.ReleaseValue)
                {
                    continue;                           //	Winning bid isn't high enough
                }
                //	TODO: purchased players still existing in other team's match days.
                highestBid.PurchasingTeam.Balance -= highestBid.BidAmount;
                highestBid.SellingTeam.Balance    += highestBid.BidAmount;

                highestBid.SellingTeam.Players.Remove(player);
                highestBid.PurchasingTeam.Players.Add(player);

                player.TeamName = highestBid.PurchasingTeam.TeamName;
                player.Number   = highestBid.PlayerNumber;
                player.ResetPlayerIndex();
            }

            Bids.Clear();
        }
        private void Dispatch(OrderBookModel orderBookModel)
        {
            Asks.Clear();
            Bids.Clear();
            int count     = orderBookModel.Asks.Count;
            int takeCount = 100;

            orderBookModel.Asks.Skip(count - takeCount).Take(takeCount).ToList().ForEach(x => Asks.Add(new OrderBookEntry
            {
                Amount        = x.Amount,
                DateTime      = x.DateTime,
                Price         = x.Price,
                GroupedPrice  = x.GroupedPrice,
                GroupedVolume = x.GroupedVolume
            }));

            orderBookModel.Bids.Take(100).ToList().ForEach(x => Bids.Add(new OrderBookEntry
            {
                Amount        = x.Amount,
                DateTime      = x.DateTime,
                Price         = x.Price,
                GroupedPrice  = x.GroupedPrice,
                GroupedVolume = x.GroupedVolume
            }));
        }
 public void StartAuction(int auctionTime)
 {
     Bids.Clear();
     AuctionTime = auctionTime;
     Running     = true;
     StartTime   = DateTime.Now;
 }
Exemple #4
0
 public void Clear()
 {
     Bids.Clear();
     Asks.Clear();
     if (AllowInvertedAsks)
     {
         AsksInverted.Clear();
     }
 }
Exemple #5
0
 public void Clear()
 {
     ChartAsks.Clear();
     ChartBids.Clear();
     ChartAggregatedAsks.Clear();
     ChartAggregatedBids.Clear();
     Asks.Clear();
     Bids.Clear();
     TopAsks.Clear();
     TopBids.Clear();
 }
 private void setBidsSnap(MarketQueryResponse snap)
 {
     Bids.Clear();
     foreach (Buy bid in snap.Buys)
     {
         bool added = false;
         while (!added)
         {
             added = Bids.TryAdd(bid.Rate, bid.Quantity);
         }
     }
 }
Exemple #7
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     Bids.Clear();
     Asks.Clear();
     foreach (var b in l2s.Bids)
     {
         Bids.Add(new Tick(b));
     }
     foreach (var a in l2s.Asks)
     {
         Asks.Add(new Tick(a));
     }
 }
Exemple #8
0
 public void GetNewBidAsks()
 {
     if (!AllowOrderBookHistory)
     {
         Bids.Clear();
         Asks.Clear();
         return;
     }
     lock (OrderBookAllocator.Pool) {
         Save();
         Bids = CreateOrderBookEntries();
         Asks = CreateOrderBookEntries();
         if (AllowInvertedAsks)
         {
             AsksInverted = CreateOrderBookEntries();
         }
     }
 }
Exemple #9
0
        /// <summary>
        /// Read from a binary reader
        /// </summary>
        /// <param name="reader">Binary reader</param>
        public void FromBinary(BinaryReader reader)
        {
            Asks.Clear();
            Bids.Clear();
            int askCount = reader.ReadInt32();
            int bidCount = reader.ReadInt32();

            while (askCount-- > 0)
            {
                var exchangeOrderPrice = new ExchangeOrderPrice(reader);
                Asks.Add(exchangeOrderPrice.Price, exchangeOrderPrice);
            }
            while (bidCount-- > 0)
            {
                var exchangeOrderPrice = new ExchangeOrderPrice(reader);
                Bids.Add(exchangeOrderPrice.Price, exchangeOrderPrice);
            }
        }
 public bool GetBids()
 {
     if (null != Bids)
     {
         Bids.Clear();
     }
     else
     {
         Bids = new List <BidVieModel>();
     }
     try
     {
         RealEntities db   = new RealEntities();
         var          bids = db.bids.Where(b => b.property_id == PropertyId);
         if (null != bids)
         {
             foreach (var b in bids)
             {
                 BidVieModel bid = new BidVieModel();
                 bid.BidId      = b.bid_id;
                 bid.PropertyId = b.property_id;
                 bid.BuyerId    = b.buyer_id;
                 bid.Status     = ( BidStatus )b.status;
                 //bid.LandPrice = ( double )b.bid_price.plot_price;
                 //bid.HousePrice = ( double )b.bid_price.apartment_price;
                 //bid.BuyerName = b.buyer.user.first_name + " " + b.buyer.user.last_name;
                 //bid.BuyerAddress = b.buyer.user.address;
                 Bids.Add(bid);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
     }
     return(false);
 }
Exemple #11
0
 public void ClearBids()
 {
     Bids.Clear();
 }
Exemple #12
0
 public void Clear()
 {
     Bids.Clear();
     Asks.Clear();
     AsksInverted.Clear();
 }
Exemple #13
0
 public void Clear()
 {
     Asks.Clear();
     Bids.Clear();
 }