calcStockPriceRatio static method

String calcStockPriceRatio(
  1. double lastClosePrice,
  2. double currentPrice
)

计算股票涨跌比率

Implementation

static String calcStockPriceRatio(
    double lastClosePrice, double currentPrice) {
  String increase = '0.00';
  double diff = currentPrice - lastClosePrice;
  if (diff != 0) {
    increase = toStringAsFixed(diff / lastClosePrice * 100, 2);
  }

  return '$increase%';
}