Example #1
0
 public void Set6m(Label label, Stock.Type type)
 {
     float final = 1.0f;
     for (int i = Month - 6; i < Month; ++i)
     {
         final *= History[type].History[i] + 1;
     }
     final -= 1.0f;
     label.Content = (final*100).ToString("F1") + "%";
     if (final >= 0)
     {
         label.Foreground = Brushes.Black;
     }
     else
     {
         label.Foreground = Brushes.Red;
     }
 }
Example #2
0
        public float GetValue(Stock.Type type, int month)
        {
            if (month > Month)
            {
                month = Month;
            }

            float value = 1.0f;
            for (int i = 0; i < month; ++i)
            {
                value *= 1.0f + History[type].History[i];
            }

            return value;
        }
Example #3
0
 public void Set1m(Label label, Stock.Type type)
 {
     float value = History[type].History[Month - 1];
     label.Content = (value*100).ToString("F1") + "%";
     if (value >= 0)
     {
         label.Foreground = Brushes.Black;
     }
     else
     {
         label.Foreground = Brushes.Red;
     }
 }
Example #4
0
 public void Plot(LineGraph graph, Stock.Type type, int min, int max)
 {
     graph.Data.Clear();
     for (int i = min; i <= max; ++i)
     {
         float value = GetValue(type, i);
         graph.Data.Add(value);
     }
     graph.SetColor(0, 0, 0);
     graph.SetBaseline(1);
     graph.SetBaselineColor(128, 0, 0);
     graph.SetBackgroundColor(232, 255, 240);
     graph.ShowBaseline(false);
     graph.HideLegendMinMax();
     graph.SetLabel("24m");
     graph.Refresh();
 }
Example #5
0
 public Stock(Stock.Type stock)
 {
     Sector = stock;
 }
Example #6
0
 public void SellStock(Stock.Type stock, int sell)
 {
     float actualSell = Math.Min(Stocks[stock].Amount, sell);
     Cash += actualSell;
     Stocks[stock].Amount -= actualSell;
 }
Example #7
0
 public void BuyStock(Stock.Type stock, int buy)
 {
     float actualBuy = Math.Min(buy, Cash);
     Cash -= actualBuy;
     Stocks[stock].Amount += actualBuy;
 }