candleInfo method

List<String> candleInfo()

Implementation

List<String> candleInfo() {
  double limitUpDownAmount = (close ?? 0) - (open ?? 0);
  double limitUpDownPercent = (limitUpDownAmount / (open ?? 0)) * 100;
  String pre = '';
  if (limitUpDownAmount < 0) {
    pre = '';
  } else if (limitUpDownAmount > 0) {
    pre = '+';
  }
  String limitUpDownAmountStr =
      '$pre${limitUpDownAmount.toStringAsFixed(2)}';
  String limitPercentStr = '$pre${limitUpDownPercent.toStringAsFixed(2)}%';
  return [
    readTimestamp(id),
    (open ?? 0).toStringAsPrecision(kGridPricePrecision),
    (high ?? 0).toStringAsPrecision(kGridPricePrecision),
    (low ?? 0).toStringAsPrecision(kGridPricePrecision),
    (close ?? 0).toStringAsPrecision(kGridPricePrecision),
    limitUpDownAmountStr,
    limitPercentStr,
    (vol ?? 0).toStringAsPrecision(kGridPricePrecision)
  ];
}