Ejemplo n.º 1
0
 public Quote Clone() {
     Quote result = new Quote();
     result.Name = this.Name;
     result.CurrentValue = this.CurrentValue;
     result.PreviousValue = this.PreviousValue;
     return result;
 }
Ejemplo n.º 2
0
        void UpdateQuote(Quote quote) {
            double value = quote.CurrentValue;

            quote.PreviousValue = value;

            int percentChange = random.Next(0, 201) - 100;
            double newValue = value + value * (5 * percentChange / 10000.0); // single change should be change less than 5%
            if (newValue < 0)
                newValue = value - value * (5 * percentChange / 10000.0); // single change should be change less than 5%

            quote.CurrentValue = newValue;
        }