| 1234567891011121314151617181920212223242526272829303132333435 |
- /// K 线单根蜡烛数据(不可变)
- /// 实现 == / hashCode 让 Riverpod .select() 能正确判断列表数据是否变化。
- class KlineBar {
- final DateTime time;
- final double open;
- final double high;
- final double low;
- final double close;
- final double volume;
- const KlineBar({
- required this.time,
- required this.open,
- required this.high,
- required this.low,
- required this.close,
- required this.volume,
- });
- bool get isBull => close >= open;
- @override
- bool operator ==(Object other) =>
- identical(this, other) ||
- other is KlineBar &&
- time == other.time &&
- open == other.open &&
- high == other.high &&
- low == other.low &&
- close == other.close &&
- volume == other.volume;
- @override
- int get hashCode => Object.hash(time, open, high, low, close, volume);
- }
|