feat: 添加K线图功能 - interactive_chart + 多币种切换 + 技术指标(MA/EMA/BOLL/VOL)

This commit is contained in:
2026-04-07 16:43:48 +08:00
parent 4b6eb009a9
commit e4d20d5261
90 changed files with 73171 additions and 69980 deletions

View File

@@ -0,0 +1,38 @@
/// K 线数据模型
class Candle {
final int timestamp; // 毫秒时间戳
final double open;
final double high;
final double low;
final double close;
final double volume;
const Candle({
required this.timestamp,
required this.open,
required this.high,
required this.low,
required this.close,
required this.volume,
});
factory Candle.fromJson(Map<String, dynamic> json) {
return Candle(
timestamp: json['timestamp'] as int? ?? json['time'] as int? ?? 0,
open: (json['open'] as num?)?.toDouble() ?? 0,
high: (json['high'] as num?)?.toDouble() ?? 0,
low: (json['low'] as num?)?.toDouble() ?? 0,
close: (json['close'] as num?)?.toDouble() ?? 0,
volume: (json['volume'] as num?)?.toDouble() ?? 0,
);
}
Map<String, dynamic> toJson() => {
'timestamp': timestamp,
'open': open,
'high': high,
'low': low,
'close': close,
'volume': volume,
};
}