public void UpdatePriceHistory(float price)
 {
     PriceHistory.Add(price);
     if (PriceHistory.Count > _priceHistoryLimit)
     {
         PriceHistory.RemoveAt(0);
     }
 }
 public System.Object ClientCommunication(Version serverversion, ICommunicateable communicator, bool full, System.Object obj)
 {
     try
     {
         if (serverversion.Major > 0)
         {
             if (full)
             {
                 Id = communicator.ReceiveString();
                 Name = communicator.ReceiveString();
                 int c = communicator.ReceiveInt();
                 if (c > 0)
                 {
                     StockIndexes stockindexes = (StockIndexes) obj;
                     for (int i = 0; i < c; i++)
                     {
                         string id = communicator.ReceiveString();
                         StockIndex stockindex = null;
                         if (stockindexes.TryGetValue(id, out stockindex))
                         {
                             stockindex.Stocks.Add(Id, this);
                             StockIndexes.Add(stockindex.Id, stockindex);
                         }
                     }
                 }
                 PriceHistory.ClientCommunication(serverversion, communicator, full, obj);
             }
             if (serverversion.Major > 0 && serverversion.Minor >= 1)
             {
                 MinPrice = communicator.ReceiveDouble();
                 MaxPrice = communicator.ReceiveDouble();
             }
             else
             {
                 MinPrice = MIN_PRICE;
                 MaxPrice = MAX_PRICE;
             }
             Price = communicator.ReceiveDouble();
             if (full && PriceHistory.Count > 0)
                 PriceHistory.RemoveAt(PriceHistory.Count - 1);
             Available = communicator.ReceiveInt();
             OwnedByPlayers = communicator.ReceiveInt();
         }
         return this;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
 public System.Object Load(Version fv, WsgFileStream fs, System.Object obj)
 {
     try
     {
         if (fv.Major > 0)
         {
             Id = fs.ReadString();
             Name = fs.ReadString();
             int c = fs.ReadInt();
             if (c > 0)
             {
                 StockIndexes stockindexes = (StockIndexes) obj;
                 for (int i = 0; i < c; i++)
                 {
                     string id = fs.ReadString();
                     StockIndex stockindex = null;
                     if (stockindexes.TryGetValue(id, out stockindex))
                     {
                         stockindex.Stocks.Add(Id, this);
                         StockIndexes.Add(stockindex.Id, stockindex);
                     }
                 }
             }
             PriceHistory.Load(fv, fs, obj);
             if (fv.Major > 0 && fv.Minor >= 1)
             {
                 MinPrice = fs.ReadDouble();
                 MaxPrice = fs.ReadDouble();
             }
             else
             {
                 MinPrice = MIN_PRICE;
                 MaxPrice = MAX_PRICE;
             }
             Price = fs.ReadDouble();
             if (PriceHistory.Count > 0)
                 PriceHistory.RemoveAt(PriceHistory.Count - 1);
             Available = fs.ReadInt();
             OwnedByPlayers = fs.ReadInt();
         }
         return this;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }