From a389dfa1e271e8ac986824e7a9164bf60d688b15 Mon Sep 17 00:00:00 2001 From: wangyiqian Date: Sat, 10 Apr 2021 02:30:58 +0800 Subject: [PATCH] Add kchart period of DAY_TIME --- README.md | 3 + .../github/wangyiqian/stockchart/Default.kt | 2 + .../stockchart/childchart/kchart/KChart.kt | 53 +- .../childchart/kchart/KChartConfig.kt | 9 +- .../stockchart/childchart/timebar/TimeBar.kt | 37 + .../childchart/timebar/TimeBarConfig.kt | 5 + .../stockchart/entities/IKEntity.kt | 5 + .../wangyiqian/stockchart/entities/KEntity.kt | 5 +- .../entities/KEntityOfLineStarter.kt | 4 +- samples/build.gradle | 4 +- .../src/main/assets/mock_time_data_day.txt | 1651 +++++++++++++++++ .../wangyiqian/stockchart/sample/Data.kt | 13 +- .../sample/sample2/Sample2Activity.kt | 25 +- .../layout/layout_sample2_option_buttons.xml | 7 + 14 files changed, 1808 insertions(+), 15 deletions(-) create mode 100644 samples/src/main/assets/mock_time_data_day.txt diff --git a/README.md b/README.md index 2a765b5..1205252 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,9 @@ Data.loadDayData(this, 0) { kEntities: List -> |indexColors|指标线的颜色| |leftLabelConfig|左侧标签配置| |rightLabelConfig|右侧标签配置| +|showAvgLine|是否显示分时均线。若需要显示,K线数据需带有分时均线价格。| +|avgLineColor|分时均线颜色| +|avgLineStrokeWidth|分时均线宽度| ##### 时间条图配置`TimeBarConfig` |字段|描述| diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/Default.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/Default.kt index dc8adf1..8fa3eb3 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/Default.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/Default.kt @@ -86,6 +86,8 @@ val DEFAULT_K_CHART_LEFT_LABEL_CONFIG = 15f ) val DEFAULT_K_CHART_HIGHLIGHT_LABEL_LEFT = HighlightLabelConfig() +const val DEFAULT_AVG_LINE_WIDTH = 2f +val DEFAULT_AVG_LINE_COLOR = Color.parseColor("#FF7B11") // Volume图 diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChart.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChart.kt index b01b2ea..7554876 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChart.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChart.kt @@ -60,6 +60,9 @@ open class KChart( private val indexTextPaint = Paint(Paint.ANTI_ALIAS_FLAG) private val highestAndLowestLabelPaint = Paint(Paint.ANTI_ALIAS_FLAG) private val labelPaint = Paint(Paint.ANTI_ALIAS_FLAG) + private val avgPriceLinePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + strokeCap = Paint.Cap.ROUND + } private var indexList: List>? = null private var lastCalculateIndexType: Index? = null @@ -119,8 +122,21 @@ open class KChart( yMax = maxBy { it.getHighPrice() }?.getHighPrice() ?: 0f } else -> { - yMin = minBy { it.getClosePrice() }?.getClosePrice() ?: 0f - yMax = maxBy { it.getClosePrice() }?.getClosePrice() ?: 0f + forEachIndexed { index, kEntity -> + if (index == 0) { + yMin = kEntity.getClosePrice() + yMax = kEntity.getClosePrice() + } else { + yMin = min(yMin, kEntity.getClosePrice()) + yMax = max(yMax, kEntity.getClosePrice()) + } + kEntity.getAvgPrice()?.let { avgPrice -> + if (chartConfig.showAvgLine) { + yMin = min(yMin, avgPrice) + yMax = max(yMax, avgPrice) + } + } + } } } } @@ -528,7 +544,8 @@ open class KChart( chartConfig.index?.let { index -> indexList?.let { indexList -> val highlight = getHighlight() - var indexIdx = highlight?.getIdx() ?: stockChart.findLastNotEmptyKEntityIdxInDisplayArea() + var indexIdx = + highlight?.getIdx() ?: stockChart.findLastNotEmptyKEntityIdxInDisplayArea() indexTextPaint.textSize = index.textSize var left = index.textMarginLeft val top = index.textMarginTop @@ -786,6 +803,36 @@ open class KChart( ) preIdx = idx } + if (chartConfig.showAvgLine) { + avgPriceLinePaint.strokeWidth = chartConfig.avgLineStrokeWidth + avgPriceLinePaint.color = chartConfig.avgLineColor + var preAvgIdx = -1 + for (idx in getKEntities().indices) { + if (getKEntities()[idx] is EmptyKEntity || getKEntities()[idx].getAvgPrice() == null) { + preAvgIdx = -1 + continue + } + + if (preAvgIdx == -1 || getKEntities()[idx] is KEntityOfLineStarter) { + preAvgIdx = idx + continue + } + + tmp4FloatArray[0] = preAvgIdx + 0.5f + tmp4FloatArray[1] = getKEntities()[preAvgIdx].getAvgPrice()!! + tmp4FloatArray[2] = idx + 0.5f + tmp4FloatArray[3] = getKEntities()[idx].getAvgPrice()!! + mapPointsValue2Real(tmp4FloatArray) + canvas.drawLine( + tmp4FloatArray[0], + tmp4FloatArray[1], + tmp4FloatArray[2], + tmp4FloatArray[3], + avgPriceLinePaint + ) + preAvgIdx = idx + } + } } private fun drawLabels(canvas: Canvas) { diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChartConfig.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChartConfig.kt index 9ce673a..43765cc 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChartConfig.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/kchart/KChartConfig.kt @@ -13,6 +13,7 @@ package com.github.wangyiqian.stockchart.childchart.kchart +import androidx.annotation.ColorInt import com.github.wangyiqian.stockchart.* import com.github.wangyiqian.stockchart.childchart.base.* import com.github.wangyiqian.stockchart.index.Index @@ -74,7 +75,13 @@ open class KChartConfig( // 左侧标签配置 var leftLabelConfig: LabelConfig? = DEFAULT_K_CHART_LEFT_LABEL_CONFIG, // 右侧标签配置 - var rightLabelConfig: LabelConfig? = null + var rightLabelConfig: LabelConfig? = null, + // 是否显示分时均线。若需要显示,K线数据需带有分时均线价格。 + var showAvgLine: Boolean = false, + // 分时均线颜色 + var avgLineColor: Int = DEFAULT_AVG_LINE_COLOR, + // 分时均线宽度 + var avgLineStrokeWidth: Float = DEFAULT_AVG_LINE_WIDTH ) : BaseChildChartConfig( height, marginTop, diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBar.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBar.kt index a6a78db..cbd92f2 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBar.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBar.kt @@ -69,6 +69,7 @@ class TimeBar(stockChart: IStockChart, chartConfig: TimeBarConfig) : is TimeBarConfig.Type.OneMinute -> drawLabelOfOneMinuteType(canvas) is TimeBarConfig.Type.FiveMinutes -> drawLabelOfFiveMinutesType(canvas) is TimeBarConfig.Type.SixtyMinutes -> drawLabelOfSixtyMinutesType(canvas) + is TimeBarConfig.Type.DayTime -> drawLabelOfDayTimeType(canvas) } } @@ -565,6 +566,42 @@ class TimeBar(stockChart: IStockChart, chartConfig: TimeBarConfig) : } } + private fun drawLabelOfDayTimeType(canvas: Canvas) { + val labelMinSpace = DimensionUtil.dp2px(context, 5f) + + fun drawLabel(idx: Int) { + val kEntity = getKEntities()[idx] + val time = kEntity.getTime() + tmpDate.time = time + val label = chartConfig.type.labelDateFormat.format(tmpDate) + + val labelWidth = labelPaint.measureText(label) + val labelHalfWidth = labelWidth / 2 + + tmp2FloatArray[0] = idx + 0.5f + tmp2FloatArray[1] = 0f + mapPointsValue2Real(tmp2FloatArray) + val centerRealX = tmp2FloatArray[0] + + var x = centerRealX - labelHalfWidth + if (x + labelWidth > getChartDisplayArea().right - labelMinSpace) x = + getChartDisplayArea().right - labelMinSpace - labelWidth + if (x < getChartDisplayArea().left + labelMinSpace) x = + getChartDisplayArea().left + labelMinSpace + val y = + getChartDisplayArea().top + getChartDisplayArea().height() / 2 + (tmpFontMetrics.bottom - tmpFontMetrics.top) / 2 - tmpFontMetrics.bottom + canvas.drawText(label, x, y, labelPaint) + } + + stockChart.findFirstNotEmptyKEntityIdxInDisplayArea()?.let { idx -> + drawLabel(idx) + } + + stockChart.findLastNotEmptyKEntityIdxInDisplayArea()?.let { idx -> + drawLabel(idx) + } + } + private fun drawHighlightLabel(canvas: Canvas) { getHighlight()?.let { highlight -> diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBarConfig.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBarConfig.kt index 2026765..aea939a 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBarConfig.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/childchart/timebar/TimeBarConfig.kt @@ -110,6 +110,11 @@ class TimeBarConfig( labelDateFormat: DateFormat = SimpleDateFormat("HH:mm"), highlightLabelDateFormat: DateFormat = SimpleDateFormat("yyyy/MM/dd HH:mm") ) : Type(labelDateFormat, highlightLabelDateFormat) + + class DayTime( + labelDateFormat: DateFormat = SimpleDateFormat("HH:mm"), + highlightLabelDateFormat: DateFormat = SimpleDateFormat("HH:mm") + ) : Type(labelDateFormat, highlightLabelDateFormat) } } \ No newline at end of file diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/entities/IKEntity.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/entities/IKEntity.kt index 80a61d2..4c9edbf 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/entities/IKEntity.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/entities/IKEntity.kt @@ -24,4 +24,9 @@ interface IKEntity { fun getClosePrice(): Float fun getVolume(): Long fun getTime(): Long + + /** + * 分时均线价格 + */ + fun getAvgPrice(): Float? } \ No newline at end of file diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntity.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntity.kt index b7e09b8..9afaf05 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntity.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntity.kt @@ -25,7 +25,8 @@ open class KEntity( private val openPrice: Float, private val closePrice: Float, private val volume: Long, - private val time: Long + private val time: Long, + private val avgPrice: Float? = null ) : IKEntity { override fun getHighPrice() = highPrice @@ -39,4 +40,6 @@ open class KEntity( override fun getVolume() = volume override fun getTime() = time + + override fun getAvgPrice() = avgPrice } \ No newline at end of file diff --git a/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntityOfLineStarter.kt b/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntityOfLineStarter.kt index 25ab88b..21570bf 100644 --- a/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntityOfLineStarter.kt +++ b/lib/src/main/java/com/github/wangyiqian/stockchart/entities/KEntityOfLineStarter.kt @@ -19,7 +19,7 @@ package com.github.wangyiqian.stockchart.entities * @author wangyiqian E-mail: wangyiqian9891@gmail.com * @version 创建时间: 2021/2/22 */ -class KEntityOfLineStarter(val kEntity: IKEntity) : IKEntity { +class KEntityOfLineStarter(private val kEntity: IKEntity) : IKEntity { override fun getHighPrice() = kEntity.getHighPrice() @@ -32,4 +32,6 @@ class KEntityOfLineStarter(val kEntity: IKEntity) : IKEntity { override fun getVolume() = kEntity.getVolume() override fun getTime() = kEntity.getTime() + + override fun getAvgPrice() = kEntity.getAvgPrice() } \ No newline at end of file diff --git a/samples/build.gradle b/samples/build.gradle index 2b12a44..e3c0100 100644 --- a/samples/build.gradle +++ b/samples/build.gradle @@ -70,6 +70,6 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' implementation 'com.google.android:flexbox:2.0.1' -// implementation project(':lib') - implementation 'com.github.wangyiqian:StockChart:1.0.1' + implementation project(':lib') +// implementation 'com.github.wangyiqian:StockChart:1.0.1' } \ No newline at end of file diff --git a/samples/src/main/assets/mock_time_data_day.txt b/samples/src/main/assets/mock_time_data_day.txt new file mode 100644 index 0000000..96caf8b --- /dev/null +++ b/samples/src/main/assets/mock_time_data_day.txt @@ -0,0 +1,1651 @@ +[{ + "volume": 391572, + "price": 625.5, + "avgPrice": 627.777, + "time": 1617931800000 +}, { + "volume": 219060, + "price": 626.0, + "avgPrice": 627.656, + "time": 1617931860000 +}, { + "volume": 210300, + "price": 625.5, + "avgPrice": 627.458, + "time": 1617931920000 +}, { + "volume": 116294, + "price": 626.5, + "avgPrice": 627.359, + "time": 1617931980000 +}, { + "volume": 185747, + "price": 625.5, + "avgPrice": 627.252, + "time": 1617932040000 +}, { + "volume": 165423, + "price": 623.5, + "avgPrice": 627.051, + "time": 1617932100000 +}, { + "volume": 145103, + "price": 623.0, + "avgPrice": 626.844, + "time": 1617932160000 +}, { + "volume": 202095, + "price": 621.5, + "avgPrice": 626.495, + "time": 1617932220000 +}, { + "volume": 181600, + "price": 623.0, + "avgPrice": 626.225, + "time": 1617932280000 +}, { + "volume": 173350, + "price": 624.0, + "avgPrice": 626.072, + "time": 1617932340000 +}, { + "volume": 172912, + "price": 623.5, + "avgPrice": 625.913, + "time": 1617932400000 +}, { + "volume": 197706, + "price": 625.5, + "avgPrice": 625.856, + "time": 1617932460000 +}, { + "volume": 128400, + "price": 624.0, + "avgPrice": 625.817, + "time": 1617932520000 +}, { + "volume": 185015, + "price": 623.0, + "avgPrice": 625.718, + "time": 1617932580000 +}, { + "volume": 125669, + "price": 621.5, + "avgPrice": 625.593, + "time": 1617932640000 +}, { + "volume": 233910, + "price": 621.0, + "avgPrice": 625.303, + "time": 1617932700000 +}, { + "volume": 88252, + "price": 622.0, + "avgPrice": 625.232, + "time": 1617932760000 +}, { + "volume": 387188, + "price": 619.0, + "avgPrice": 624.794, + "time": 1617932820000 +}, { + "volume": 169273, + "price": 620.5, + "avgPrice": 624.584, + "time": 1617932880000 +}, { + "volume": 93900, + "price": 621.5, + "avgPrice": 624.521, + "time": 1617932940000 +}, { + "volume": 72100, + "price": 620.0, + "avgPrice": 624.461, + "time": 1617933000000 +}, { + "volume": 161600, + "price": 619.5, + "avgPrice": 624.297, + "time": 1617933060000 +}, { + "volume": 26904, + "price": 620.5, + "avgPrice": 624.274, + "time": 1617933120000 +}, { + "volume": 67100, + "price": 620.5, + "avgPrice": 624.225, + "time": 1617933180000 +}, { + "volume": 85400, + "price": 620.5, + "avgPrice": 624.158, + "time": 1617933240000 +}, { + "volume": 67600, + "price": 620.5, + "avgPrice": 624.111, + "time": 1617933300000 +}, { + "volume": 64220, + "price": 620.5, + "avgPrice": 624.068, + "time": 1617933360000 +}, { + "volume": 124200, + "price": 622.0, + "avgPrice": 624.017, + "time": 1617933420000 +}, { + "volume": 38100, + "price": 621.0, + "avgPrice": 623.997, + "time": 1617933480000 +}, { + "volume": 47510, + "price": 621.5, + "avgPrice": 623.978, + "time": 1617933540000 +}, { + "volume": 76415, + "price": 620.5, + "avgPrice": 623.932, + "time": 1617933600000 +}, { + "volume": 56600, + "price": 620.5, + "avgPrice": 623.9, + "time": 1617933660000 +}, { + "volume": 55900, + "price": 620.5, + "avgPrice": 623.865, + "time": 1617933720000 +}, { + "volume": 15462, + "price": 620.0, + "avgPrice": 623.856, + "time": 1617933780000 +}, { + "volume": 89800, + "price": 620.5, + "avgPrice": 623.803, + "time": 1617933840000 +}, { + "volume": 39155, + "price": 620.5, + "avgPrice": 623.781, + "time": 1617933900000 +}, { + "volume": 32600, + "price": 620.0, + "avgPrice": 623.762, + "time": 1617933960000 +}, { + "volume": 231100, + "price": 620.5, + "avgPrice": 623.621, + "time": 1617934020000 +}, { + "volume": 39700, + "price": 620.5, + "avgPrice": 623.6, + "time": 1617934080000 +}, { + "volume": 80400, + "price": 621.0, + "avgPrice": 623.566, + "time": 1617934140000 +}, { + "volume": 35200, + "price": 621.0, + "avgPrice": 623.552, + "time": 1617934200000 +}, { + "volume": 36300, + "price": 621.0, + "avgPrice": 623.544, + "time": 1617934260000 +}, { + "volume": 73502, + "price": 621.5, + "avgPrice": 623.515, + "time": 1617934320000 +}, { + "volume": 73900, + "price": 621.0, + "avgPrice": 623.487, + "time": 1617934380000 +}, { + "volume": 106425, + "price": 622.0, + "avgPrice": 623.464, + "time": 1617934440000 +}, { + "volume": 76692, + "price": 622.0, + "avgPrice": 623.438, + "time": 1617934500000 +}, { + "volume": 31000, + "price": 621.0, + "avgPrice": 623.43, + "time": 1617934560000 +}, { + "volume": 48200, + "price": 621.0, + "avgPrice": 623.414, + "time": 1617934620000 +}, { + "volume": 169000, + "price": 620.5, + "avgPrice": 623.335, + "time": 1617934680000 +}, { + "volume": 114400, + "price": 621.0, + "avgPrice": 623.291, + "time": 1617934740000 +}, { + "volume": 44341, + "price": 620.5, + "avgPrice": 623.274, + "time": 1617934800000 +}, { + "volume": 44250, + "price": 621.0, + "avgPrice": 623.26, + "time": 1617934860000 +}, { + "volume": 78200, + "price": 622.0, + "avgPrice": 623.244, + "time": 1617934920000 +}, { + "volume": 56800, + "price": 622.0, + "avgPrice": 623.235, + "time": 1617934980000 +}, { + "volume": 72900, + "price": 622.5, + "avgPrice": 623.223, + "time": 1617935040000 +}, { + "volume": 86300, + "price": 622.0, + "avgPrice": 623.208, + "time": 1617935100000 +}, { + "volume": 17600, + "price": 622.0, + "avgPrice": 623.206, + "time": 1617935160000 +}, { + "volume": 51400, + "price": 621.5, + "avgPrice": 623.197, + "time": 1617935220000 +}, { + "volume": 149600, + "price": 622.0, + "avgPrice": 623.167, + "time": 1617935280000 +}, { + "volume": 65600, + "price": 621.5, + "avgPrice": 623.154, + "time": 1617935340000 +}, { + "volume": 38900, + "price": 621.0, + "avgPrice": 623.145, + "time": 1617935400000 +}, { + "volume": 52900, + "price": 620.5, + "avgPrice": 623.128, + "time": 1617935460000 +}, { + "volume": 47300, + "price": 621.0, + "avgPrice": 623.115, + "time": 1617935520000 +}, { + "volume": 10400, + "price": 620.5, + "avgPrice": 623.113, + "time": 1617935580000 +}, { + "volume": 34500, + "price": 621.0, + "avgPrice": 623.103, + "time": 1617935640000 +}, { + "volume": 61302, + "price": 621.0, + "avgPrice": 623.086, + "time": 1617935700000 +}, { + "volume": 95100, + "price": 621.0, + "avgPrice": 623.061, + "time": 1617935760000 +}, { + "volume": 76500, + "price": 621.5, + "avgPrice": 623.046, + "time": 1617935820000 +}, { + "volume": 42825, + "price": 620.5, + "avgPrice": 623.035, + "time": 1617935880000 +}, { + "volume": 20000, + "price": 621.0, + "avgPrice": 623.03, + "time": 1617935940000 +}, { + "volume": 45600, + "price": 621.0, + "avgPrice": 623.02, + "time": 1617936000000 +}, { + "volume": 104800, + "price": 621.5, + "avgPrice": 622.998, + "time": 1617936060000 +}, { + "volume": 63500, + "price": 621.0, + "avgPrice": 622.987, + "time": 1617936120000 +}, { + "volume": 53900, + "price": 621.0, + "avgPrice": 622.974, + "time": 1617936180000 +}, { + "volume": 21900, + "price": 621.0, + "avgPrice": 622.969, + "time": 1617936240000 +}, { + "volume": 32413, + "price": 621.5, + "avgPrice": 622.962, + "time": 1617936300000 +}, { + "volume": 99502, + "price": 620.5, + "avgPrice": 622.936, + "time": 1617936360000 +}, { + "volume": 10600, + "price": 620.5, + "avgPrice": 622.933, + "time": 1617936420000 +}, { + "volume": 75500, + "price": 620.5, + "avgPrice": 622.913, + "time": 1617936480000 +}, { + "volume": 59700, + "price": 620.5, + "avgPrice": 622.896, + "time": 1617936540000 +}, { + "volume": 21300, + "price": 620.5, + "avgPrice": 622.891, + "time": 1617936600000 +}, { + "volume": 12000, + "price": 620.5, + "avgPrice": 622.889, + "time": 1617936660000 +}, { + "volume": 15000, + "price": 620.5, + "avgPrice": 622.886, + "time": 1617936720000 +}, { + "volume": 55200, + "price": 620.0, + "avgPrice": 622.87, + "time": 1617936780000 +}, { + "volume": 21100, + "price": 620.0, + "avgPrice": 622.865, + "time": 1617936840000 +}, { + "volume": 21300, + "price": 620.5, + "avgPrice": 622.858, + "time": 1617936900000 +}, { + "volume": 109200, + "price": 619.5, + "avgPrice": 622.823, + "time": 1617936960000 +}, { + "volume": 270326, + "price": 619.5, + "avgPrice": 622.719, + "time": 1617937020000 +}, { + "volume": 49610, + "price": 620.0, + "avgPrice": 622.705, + "time": 1617937080000 +}, { + "volume": 114810, + "price": 619.5, + "avgPrice": 622.674, + "time": 1617937140000 +}, { + "volume": 64200, + "price": 620.0, + "avgPrice": 622.656, + "time": 1617937200000 +}, { + "volume": 70310, + "price": 619.5, + "avgPrice": 622.636, + "time": 1617937260000 +}, { + "volume": 58100, + "price": 620.5, + "avgPrice": 622.62, + "time": 1617937320000 +}, { + "volume": 13400, + "price": 620.0, + "avgPrice": 622.618, + "time": 1617937380000 +}, { + "volume": 99700, + "price": 619.5, + "avgPrice": 622.589, + "time": 1617937440000 +}, { + "volume": 58900, + "price": 620.0, + "avgPrice": 622.573, + "time": 1617937500000 +}, { + "volume": 45200, + "price": 620.0, + "avgPrice": 622.562, + "time": 1617937560000 +}, { + "volume": 9307, + "price": 620.5, + "avgPrice": 622.56, + "time": 1617937620000 +}, { + "volume": 41900, + "price": 620.5, + "avgPrice": 622.552, + "time": 1617937680000 +}, { + "volume": 14600, + "price": 621.0, + "avgPrice": 622.549, + "time": 1617937740000 +}, { + "volume": 11400, + "price": 621.0, + "avgPrice": 622.548, + "time": 1617937800000 +}, { + "volume": 66602, + "price": 620.0, + "avgPrice": 622.534, + "time": 1617937860000 +}, { + "volume": 47700, + "price": 620.0, + "avgPrice": 622.523, + "time": 1617937920000 +}, { + "volume": 18400, + "price": 620.0, + "avgPrice": 622.519, + "time": 1617937980000 +}, { + "volume": 74330, + "price": 620.0, + "avgPrice": 622.5, + "time": 1617938040000 +}, { + "volume": 32900, + "price": 619.5, + "avgPrice": 622.492, + "time": 1617938100000 +}, { + "volume": 73100, + "price": 620.0, + "avgPrice": 622.472, + "time": 1617938160000 +}, { + "volume": 35686, + "price": 619.5, + "avgPrice": 622.464, + "time": 1617938220000 +}, { + "volume": 41500, + "price": 619.5, + "avgPrice": 622.453, + "time": 1617938280000 +}, { + "volume": 154900, + "price": 620.5, + "avgPrice": 622.421, + "time": 1617938340000 +}, { + "volume": 45000, + "price": 620.0, + "avgPrice": 622.413, + "time": 1617938400000 +}, { + "volume": 34900, + "price": 620.0, + "avgPrice": 622.405, + "time": 1617938460000 +}, { + "volume": 17600, + "price": 620.0, + "avgPrice": 622.401, + "time": 1617938520000 +}, { + "volume": 30400, + "price": 619.5, + "avgPrice": 622.394, + "time": 1617938580000 +}, { + "volume": 33600, + "price": 620.0, + "avgPrice": 622.387, + "time": 1617938640000 +}, { + "volume": 117200, + "price": 620.0, + "avgPrice": 622.362, + "time": 1617938700000 +}, { + "volume": 5200, + "price": 620.0, + "avgPrice": 622.361, + "time": 1617938760000 +}, { + "volume": 7300, + "price": 620.5, + "avgPrice": 622.36, + "time": 1617938820000 +}, { + "volume": 87500, + "price": 620.5, + "avgPrice": 622.345, + "time": 1617938880000 +}, { + "volume": 5000, + "price": 620.5, + "avgPrice": 622.344, + "time": 1617938940000 +}, { + "volume": 13700, + "price": 620.5, + "avgPrice": 622.342, + "time": 1617939000000 +}, { + "volume": 18900, + "price": 620.5, + "avgPrice": 622.338, + "time": 1617939060000 +}, { + "volume": 25300, + "price": 620.0, + "avgPrice": 622.333, + "time": 1617939120000 +}, { + "volume": 27200, + "price": 620.0, + "avgPrice": 622.328, + "time": 1617939180000 +}, { + "volume": 14000, + "price": 620.5, + "avgPrice": 622.325, + "time": 1617939240000 +}, { + "volume": 54100, + "price": 620.0, + "avgPrice": 622.314, + "time": 1617939300000 +}, { + "volume": 175900, + "price": 619.0, + "avgPrice": 622.273, + "time": 1617939360000 +}, { + "volume": 6524, + "price": 619.5, + "avgPrice": 622.272, + "time": 1617939420000 +}, { + "volume": 57700, + "price": 619.5, + "avgPrice": 622.257, + "time": 1617939480000 +}, { + "volume": 72800, + "price": 619.0, + "avgPrice": 622.238, + "time": 1617939540000 +}, { + "volume": 37800, + "price": 619.0, + "avgPrice": 622.228, + "time": 1617939600000 +}, { + "volume": 16402, + "price": 619.0, + "avgPrice": 622.223, + "time": 1617939660000 +}, { + "volume": 25200, + "price": 619.0, + "avgPrice": 622.216, + "time": 1617939720000 +}, { + "volume": 9606, + "price": 618.5, + "avgPrice": 622.214, + "time": 1617939780000 +}, { + "volume": 13100, + "price": 619.0, + "avgPrice": 622.21, + "time": 1617939840000 +}, { + "volume": 22400, + "price": 618.5, + "avgPrice": 622.203, + "time": 1617939900000 +}, { + "volume": 74219, + "price": 618.5, + "avgPrice": 622.179, + "time": 1617939960000 +}, { + "volume": 53303, + "price": 618.5, + "avgPrice": 622.16, + "time": 1617940020000 +}, { + "volume": 20000, + "price": 618.0, + "avgPrice": 622.154, + "time": 1617940080000 +}, { + "volume": 14200, + "price": 618.5, + "avgPrice": 622.15, + "time": 1617940140000 +}, { + "volume": 45900, + "price": 618.5, + "avgPrice": 622.135, + "time": 1617940200000 +}, { + "volume": 9300, + "price": 618.5, + "avgPrice": 622.132, + "time": 1617940260000 +}, { + "volume": 89800, + "price": 619.0, + "avgPrice": 622.109, + "time": 1617940320000 +}, { + "volume": 58249, + "price": 619.5, + "avgPrice": 622.099, + "time": 1617940380000 +}, { + "volume": 13000, + "price": 620.0, + "avgPrice": 622.092, + "time": 1617940440000 +}, { + "volume": 26700, + "price": 620.5, + "avgPrice": 622.087, + "time": 1617940500000 +}, { + "volume": 83500, + "price": 620.5, + "avgPrice": 622.074, + "time": 1617940560000 +}, { + "volume": 34600, + "price": 620.0, + "avgPrice": 622.068, + "time": 1617940620000 +}, { + "volume": 14000, + "price": 620.5, + "avgPrice": 622.066, + "time": 1617940680000 +}, { + "volume": 53000, + "price": 620.0, + "avgPrice": 622.057, + "time": 1617940740000 +}, { + "volume": 151300, + "price": 620.5, + "avgPrice": 622.04, + "time": 1617944400000 +}, { + "volume": 32800, + "price": 621.0, + "avgPrice": 622.037, + "time": 1617944460000 +}, { + "volume": 59500, + "price": 620.5, + "avgPrice": 622.032, + "time": 1617944520000 +}, { + "volume": 69100, + "price": 620.0, + "avgPrice": 622.023, + "time": 1617944580000 +}, { + "volume": 22900, + "price": 620.0, + "avgPrice": 622.022, + "time": 1617944640000 +}, { + "volume": 19600, + "price": 620.0, + "avgPrice": 622.019, + "time": 1617944700000 +}, { + "volume": 9600, + "price": 620.0, + "avgPrice": 622.018, + "time": 1617944760000 +}, { + "volume": 56300, + "price": 620.0, + "avgPrice": 622.015, + "time": 1617944820000 +}, { + "volume": 92402, + "price": 619.5, + "avgPrice": 621.997, + "time": 1617944880000 +}, { + "volume": 20000, + "price": 619.0, + "avgPrice": 621.993, + "time": 1617944940000 +}, { + "volume": 21100, + "price": 619.0, + "avgPrice": 621.989, + "time": 1617945000000 +}, { + "volume": 45700, + "price": 620.0, + "avgPrice": 621.98, + "time": 1617945060000 +}, { + "volume": 7070, + "price": 619.5, + "avgPrice": 621.979, + "time": 1617945120000 +}, { + "volume": 26800, + "price": 620.0, + "avgPrice": 621.975, + "time": 1617945180000 +}, { + "volume": 144900, + "price": 620.5, + "avgPrice": 621.96, + "time": 1617945240000 +}, { + "volume": 5200, + "price": 620.5, + "avgPrice": 621.96, + "time": 1617945300000 +}, { + "volume": 46200, + "price": 621.0, + "avgPrice": 621.956, + "time": 1617945360000 +}, { + "volume": 124000, + "price": 621.5, + "avgPrice": 621.955, + "time": 1617945420000 +}, { + "volume": 30400, + "price": 622.0, + "avgPrice": 621.954, + "time": 1617945480000 +}, { + "volume": 71700, + "price": 621.0, + "avgPrice": 621.95, + "time": 1617945540000 +}, { + "volume": 6400, + "price": 620.5, + "avgPrice": 621.95, + "time": 1617945600000 +}, { + "volume": 69600, + "price": 621.5, + "avgPrice": 621.946, + "time": 1617945660000 +}, { + "volume": 23600, + "price": 621.0, + "avgPrice": 621.945, + "time": 1617945720000 +}, { + "volume": 27000, + "price": 621.0, + "avgPrice": 621.943, + "time": 1617945780000 +}, { + "volume": 6103, + "price": 621.5, + "avgPrice": 621.943, + "time": 1617945840000 +}, { + "volume": 12000, + "price": 621.0, + "avgPrice": 621.942, + "time": 1617945900000 +}, { + "volume": 19300, + "price": 621.0, + "avgPrice": 621.941, + "time": 1617945960000 +}, { + "volume": 38800, + "price": 620.5, + "avgPrice": 621.938, + "time": 1617946020000 +}, { + "volume": 16200, + "price": 620.5, + "avgPrice": 621.936, + "time": 1617946080000 +}, { + "volume": 11400, + "price": 620.5, + "avgPrice": 621.935, + "time": 1617946140000 +}, { + "volume": 10000, + "price": 621.0, + "avgPrice": 621.934, + "time": 1617946200000 +}, { + "volume": 23900, + "price": 621.0, + "avgPrice": 621.932, + "time": 1617946260000 +}, { + "volume": 34500, + "price": 620.5, + "avgPrice": 621.928, + "time": 1617946320000 +}, { + "volume": 97802, + "price": 619.5, + "avgPrice": 621.913, + "time": 1617946380000 +}, { + "volume": 11100, + "price": 620.0, + "avgPrice": 621.911, + "time": 1617946440000 +}, { + "volume": 12100, + "price": 619.5, + "avgPrice": 621.909, + "time": 1617946500000 +}, { + "volume": 43400, + "price": 619.5, + "avgPrice": 621.901, + "time": 1617946560000 +}, { + "volume": 60700, + "price": 619.5, + "avgPrice": 621.89, + "time": 1617946620000 +}, { + "volume": 22200, + "price": 619.0, + "avgPrice": 621.886, + "time": 1617946680000 +}, { + "volume": 22702, + "price": 619.0, + "avgPrice": 621.882, + "time": 1617946740000 +}, { + "volume": 96300, + "price": 619.0, + "avgPrice": 621.862, + "time": 1617946800000 +}, { + "volume": 32631, + "price": 619.0, + "avgPrice": 621.854, + "time": 1617946860000 +}, { + "volume": 7993, + "price": 619.0, + "avgPrice": 621.852, + "time": 1617946920000 +}, { + "volume": 17101, + "price": 618.5, + "avgPrice": 621.848, + "time": 1617946980000 +}, { + "volume": 10900, + "price": 618.5, + "avgPrice": 621.846, + "time": 1617947040000 +}, { + "volume": 50900, + "price": 618.0, + "avgPrice": 621.834, + "time": 1617947100000 +}, { + "volume": 45100, + "price": 618.0, + "avgPrice": 621.822, + "time": 1617947160000 +}, { + "volume": 26000, + "price": 618.0, + "avgPrice": 621.815, + "time": 1617947220000 +}, { + "volume": 36000, + "price": 618.0, + "avgPrice": 621.807, + "time": 1617947280000 +}, { + "volume": 390592, + "price": 616.0, + "avgPrice": 621.684, + "time": 1617947340000 +}, { + "volume": 71007, + "price": 616.0, + "avgPrice": 621.657, + "time": 1617947400000 +}, { + "volume": 82001, + "price": 617.0, + "avgPrice": 621.627, + "time": 1617947460000 +}, { + "volume": 105400, + "price": 616.5, + "avgPrice": 621.589, + "time": 1617947520000 +}, { + "volume": 131802, + "price": 617.0, + "avgPrice": 621.543, + "time": 1617947580000 +}, { + "volume": 42400, + "price": 616.5, + "avgPrice": 621.529, + "time": 1617947640000 +}, { + "volume": 111000, + "price": 615.5, + "avgPrice": 621.485, + "time": 1617947700000 +}, { + "volume": 76900, + "price": 616.5, + "avgPrice": 621.455, + "time": 1617947760000 +}, { + "volume": 14600, + "price": 616.0, + "avgPrice": 621.45, + "time": 1617947820000 +}, { + "volume": 20002, + "price": 616.5, + "avgPrice": 621.443, + "time": 1617947880000 +}, { + "volume": 51300, + "price": 616.0, + "avgPrice": 621.424, + "time": 1617947940000 +}, { + "volume": 49200, + "price": 616.0, + "avgPrice": 621.406, + "time": 1617948000000 +}, { + "volume": 56600, + "price": 616.0, + "avgPrice": 621.386, + "time": 1617948060000 +}, { + "volume": 61800, + "price": 616.0, + "avgPrice": 621.367, + "time": 1617948120000 +}, { + "volume": 5907, + "price": 616.5, + "avgPrice": 621.362, + "time": 1617948180000 +}, { + "volume": 86900, + "price": 616.5, + "avgPrice": 621.333, + "time": 1617948240000 +}, { + "volume": 28653, + "price": 616.0, + "avgPrice": 621.324, + "time": 1617948300000 +}, { + "volume": 9602, + "price": 616.5, + "avgPrice": 621.32, + "time": 1617948360000 +}, { + "volume": 161100, + "price": 617.5, + "avgPrice": 621.274, + "time": 1617948420000 +}, { + "volume": 9900, + "price": 617.0, + "avgPrice": 621.272, + "time": 1617948480000 +}, { + "volume": 33100, + "price": 618.0, + "avgPrice": 621.264, + "time": 1617948540000 +}, { + "volume": 78200, + "price": 616.5, + "avgPrice": 621.241, + "time": 1617948600000 +}, { + "volume": 8401, + "price": 617.0, + "avgPrice": 621.239, + "time": 1617948660000 +}, { + "volume": 4500, + "price": 617.0, + "avgPrice": 621.237, + "time": 1617948720000 +}, { + "volume": 12900, + "price": 617.0, + "avgPrice": 621.234, + "time": 1617948780000 +}, { + "volume": 26756, + "price": 617.5, + "avgPrice": 621.227, + "time": 1617948840000 +}, { + "volume": 42600, + "price": 617.0, + "avgPrice": 621.215, + "time": 1617948900000 +}, { + "volume": 21000, + "price": 616.5, + "avgPrice": 621.21, + "time": 1617948960000 +}, { + "volume": 6300, + "price": 617.0, + "avgPrice": 621.208, + "time": 1617949020000 +}, { + "volume": 7200, + "price": 616.5, + "avgPrice": 621.206, + "time": 1617949080000 +}, { + "volume": 61512, + "price": 617.0, + "avgPrice": 621.189, + "time": 1617949140000 +}, { + "volume": 63200, + "price": 618.0, + "avgPrice": 621.174, + "time": 1617949200000 +}, { + "volume": 14200, + "price": 618.0, + "avgPrice": 621.171, + "time": 1617949260000 +}, { + "volume": 10900, + "price": 617.5, + "avgPrice": 621.169, + "time": 1617949320000 +}, { + "volume": 79873, + "price": 618.0, + "avgPrice": 621.152, + "time": 1617949380000 +}, { + "volume": 47400, + "price": 617.5, + "avgPrice": 621.143, + "time": 1617949440000 +}, { + "volume": 8600, + "price": 618.0, + "avgPrice": 621.141, + "time": 1617949500000 +}, { + "volume": 57881, + "price": 617.5, + "avgPrice": 621.128, + "time": 1617949560000 +}, { + "volume": 55900, + "price": 616.5, + "avgPrice": 621.113, + "time": 1617949620000 +}, { + "volume": 8410, + "price": 617.0, + "avgPrice": 621.111, + "time": 1617949680000 +}, { + "volume": 45700, + "price": 616.5, + "avgPrice": 621.099, + "time": 1617949740000 +}, { + "volume": 23600, + "price": 616.5, + "avgPrice": 621.092, + "time": 1617949800000 +}, { + "volume": 17400, + "price": 617.0, + "avgPrice": 621.087, + "time": 1617949860000 +}, { + "volume": 13200, + "price": 617.0, + "avgPrice": 621.084, + "time": 1617949920000 +}, { + "volume": 25800, + "price": 617.0, + "avgPrice": 621.077, + "time": 1617949980000 +}, { + "volume": 11800, + "price": 617.0, + "avgPrice": 621.075, + "time": 1617950040000 +}, { + "volume": 16500, + "price": 617.0, + "avgPrice": 621.07, + "time": 1617950100000 +}, { + "volume": 18875, + "price": 616.5, + "avgPrice": 621.066, + "time": 1617950160000 +}, { + "volume": 13500, + "price": 616.5, + "avgPrice": 621.063, + "time": 1617950220000 +}, { + "volume": 20700, + "price": 616.5, + "avgPrice": 621.057, + "time": 1617950280000 +}, { + "volume": 30900, + "price": 617.0, + "avgPrice": 621.048, + "time": 1617950340000 +}, { + "volume": 40800, + "price": 616.5, + "avgPrice": 621.037, + "time": 1617950400000 +}, { + "volume": 84158, + "price": 616.5, + "avgPrice": 621.014, + "time": 1617950460000 +}, { + "volume": 28276, + "price": 616.5, + "avgPrice": 621.006, + "time": 1617950520000 +}, { + "volume": 75100, + "price": 616.0, + "avgPrice": 620.986, + "time": 1617950580000 +}, { + "volume": 171000, + "price": 616.0, + "avgPrice": 620.931, + "time": 1617950640000 +}, { + "volume": 10600, + "price": 616.5, + "avgPrice": 620.929, + "time": 1617950700000 +}, { + "volume": 52900, + "price": 616.0, + "avgPrice": 620.913, + "time": 1617950760000 +}, { + "volume": 26700, + "price": 615.5, + "avgPrice": 620.905, + "time": 1617950820000 +}, { + "volume": 27500, + "price": 616.0, + "avgPrice": 620.897, + "time": 1617950880000 +}, { + "volume": 13400, + "price": 615.5, + "avgPrice": 620.893, + "time": 1617950940000 +}, { + "volume": 31300, + "price": 616.0, + "avgPrice": 620.884, + "time": 1617951000000 +}, { + "volume": 36200, + "price": 616.0, + "avgPrice": 620.875, + "time": 1617951060000 +}, { + "volume": 23900, + "price": 615.5, + "avgPrice": 620.868, + "time": 1617951120000 +}, { + "volume": 22420, + "price": 615.5, + "avgPrice": 620.861, + "time": 1617951180000 +}, { + "volume": 29831, + "price": 615.5, + "avgPrice": 620.852, + "time": 1617951240000 +}, { + "volume": 134400, + "price": 616.5, + "avgPrice": 620.813, + "time": 1617951300000 +}, { + "volume": 30500, + "price": 617.0, + "avgPrice": 620.806, + "time": 1617951360000 +}, { + "volume": 27800, + "price": 616.5, + "avgPrice": 620.8, + "time": 1617951420000 +}, { + "volume": 51700, + "price": 616.5, + "avgPrice": 620.787, + "time": 1617951480000 +}, { + "volume": 46600, + "price": 617.5, + "avgPrice": 620.776, + "time": 1617951540000 +}, { + "volume": 79802, + "price": 617.0, + "avgPrice": 620.759, + "time": 1617951600000 +}, { + "volume": 30400, + "price": 617.0, + "avgPrice": 620.752, + "time": 1617951660000 +}, { + "volume": 15512, + "price": 616.5, + "avgPrice": 620.749, + "time": 1617951720000 +}, { + "volume": 9200, + "price": 616.5, + "avgPrice": 620.746, + "time": 1617951780000 +}, { + "volume": 46020, + "price": 617.0, + "avgPrice": 620.737, + "time": 1617951840000 +}, { + "volume": 115000, + "price": 617.5, + "avgPrice": 620.717, + "time": 1617951900000 +}, { + "volume": 47800, + "price": 617.5, + "avgPrice": 620.71, + "time": 1617951960000 +}, { + "volume": 41500, + "price": 618.0, + "avgPrice": 620.704, + "time": 1617952020000 +}, { + "volume": 38800, + "price": 618.0, + "avgPrice": 620.699, + "time": 1617952080000 +}, { + "volume": 9500, + "price": 618.0, + "avgPrice": 620.698, + "time": 1617952140000 +}, { + "volume": 16400, + "price": 618.5, + "avgPrice": 620.695, + "time": 1617952200000 +}, { + "volume": 85300, + "price": 618.5, + "avgPrice": 620.694, + "time": 1617952260000 +}, { + "volume": 35700, + "price": 618.5, + "avgPrice": 620.69, + "time": 1617952320000 +}, { + "volume": 87200, + "price": 619.5, + "avgPrice": 620.682, + "time": 1617952380000 +}, { + "volume": 67650, + "price": 618.5, + "avgPrice": 620.674, + "time": 1617952440000 +}, { + "volume": 17000, + "price": 619.0, + "avgPrice": 620.672, + "time": 1617952500000 +}, { + "volume": 46864, + "price": 619.5, + "avgPrice": 620.668, + "time": 1617952560000 +}, { + "volume": 15249, + "price": 619.0, + "avgPrice": 620.667, + "time": 1617952620000 +}, { + "volume": 73200, + "price": 619.0, + "avgPrice": 620.66, + "time": 1617952680000 +}, { + "volume": 58400, + "price": 619.0, + "avgPrice": 620.655, + "time": 1617952740000 +}, { + "volume": 13500, + "price": 619.0, + "avgPrice": 620.654, + "time": 1617952800000 +}, { + "volume": 57450, + "price": 619.5, + "avgPrice": 620.65, + "time": 1617952860000 +}, { + "volume": 40630, + "price": 620.0, + "avgPrice": 620.648, + "time": 1617952920000 +}, { + "volume": 17400, + "price": 620.0, + "avgPrice": 620.647, + "time": 1617952980000 +}, { + "volume": 84319, + "price": 619.5, + "avgPrice": 620.642, + "time": 1617953040000 +}, { + "volume": 15621, + "price": 619.5, + "avgPrice": 620.641, + "time": 1617953100000 +}, { + "volume": 70900, + "price": 620.0, + "avgPrice": 620.636, + "time": 1617953160000 +}, { + "volume": 19900, + "price": 620.0, + "avgPrice": 620.635, + "time": 1617953220000 +}, { + "volume": 62710, + "price": 619.5, + "avgPrice": 620.632, + "time": 1617953280000 +}, { + "volume": 72205, + "price": 619.0, + "avgPrice": 620.625, + "time": 1617953340000 +}, { + "volume": 47600, + "price": 619.0, + "avgPrice": 620.621, + "time": 1617953400000 +}, { + "volume": 61300, + "price": 619.0, + "avgPrice": 620.615, + "time": 1617953460000 +}, { + "volume": 33821, + "price": 619.5, + "avgPrice": 620.613, + "time": 1617953520000 +}, { + "volume": 49618, + "price": 618.5, + "avgPrice": 620.608, + "time": 1617953580000 +}, { + "volume": 75600, + "price": 618.5, + "avgPrice": 620.599, + "time": 1617953640000 +}, { + "volume": 27800, + "price": 618.5, + "avgPrice": 620.596, + "time": 1617953700000 +}, { + "volume": 51200, + "price": 618.5, + "avgPrice": 620.589, + "time": 1617953760000 +}, { + "volume": 194801, + "price": 618.0, + "avgPrice": 620.562, + "time": 1617953820000 +}, { + "volume": 77900, + "price": 618.5, + "avgPrice": 620.554, + "time": 1617953880000 +}, { + "volume": 65501, + "price": 618.5, + "avgPrice": 620.548, + "time": 1617953940000 +}, { + "volume": 44519, + "price": 619.0, + "avgPrice": 620.544, + "time": 1617954000000 +}, { + "volume": 21940, + "price": 618.5, + "avgPrice": 620.542, + "time": 1617954060000 +}, { + "volume": 55600, + "price": 618.5, + "avgPrice": 620.537, + "time": 1617954120000 +}, { + "volume": 27302, + "price": 619.0, + "avgPrice": 620.535, + "time": 1617954180000 +}, { + "volume": 19600, + "price": 619.0, + "avgPrice": 620.533, + "time": 1617954240000 +}, { + "volume": 47310, + "price": 619.0, + "avgPrice": 620.529, + "time": 1617954300000 +}, { + "volume": 159774, + "price": 618.0, + "avgPrice": 620.511, + "time": 1617954360000 +}, { + "volume": 41700, + "price": 618.5, + "avgPrice": 620.506, + "time": 1617954420000 +}, { + "volume": 25005, + "price": 618.5, + "avgPrice": 620.503, + "time": 1617954480000 +}, { + "volume": 37832, + "price": 618.0, + "avgPrice": 620.5, + "time": 1617954540000 +}, { + "volume": 43686, + "price": 618.0, + "avgPrice": 620.496, + "time": 1617954600000 +}, { + "volume": 125304, + "price": 619.5, + "avgPrice": 620.485, + "time": 1617954660000 +}, { + "volume": 38800, + "price": 619.5, + "avgPrice": 620.483, + "time": 1617954720000 +}, { + "volume": 103726, + "price": 619.5, + "avgPrice": 620.478, + "time": 1617954780000 +}, { + "volume": 59910, + "price": 620.0, + "avgPrice": 620.477, + "time": 1617954840000 +}, { + "volume": 169200, + "price": 620.5, + "avgPrice": 620.473, + "time": 1617954900000 +}, { + "volume": 121401, + "price": 621.5, + "avgPrice": 620.477, + "time": 1617954960000 +}, { + "volume": 139615, + "price": 620.5, + "avgPrice": 620.48, + "time": 1617955020000 +}, { + "volume": 95800, + "price": 620.5, + "avgPrice": 620.482, + "time": 1617955080000 +}, { + "volume": 1427303, + "price": 620.5, + "avgPrice": 620.483, + "time": 1617955140000 +}] \ No newline at end of file diff --git a/samples/src/main/java/com/github/wangyiqian/stockchart/sample/Data.kt b/samples/src/main/java/com/github/wangyiqian/stockchart/sample/Data.kt index 378ff03..a5e9c8e 100644 --- a/samples/src/main/java/com/github/wangyiqian/stockchart/sample/Data.kt +++ b/samples/src/main/java/com/github/wangyiqian/stockchart/sample/Data.kt @@ -33,6 +33,16 @@ object Data { private const val MOCK_DELAY = 0L // 模拟耗时 + fun loadDayTimeData(context: Context, callback: (List) -> Unit) { + MainScope().launch { + val deferred = async { + delay(MOCK_DELAY) + loadDataFromTimeDataAsserts(context, "mock_time_data_day.txt") + } + callback.invoke(deferred.await()) + } + } + fun loadDayData(context: Context, page: Int, callback: (List) -> Unit) { if (page > 2 || page < 0) { @@ -194,7 +204,8 @@ object Data { item.getString("price").toFloat(), item.getString("price").toFloat(), item.getLong("volume"), - item.getLong("time") + item.getLong("time"), + item.getString("avgPrice").toFloat() ) result.add(kEntity) } diff --git a/samples/src/main/java/com/github/wangyiqian/stockchart/sample/sample2/Sample2Activity.kt b/samples/src/main/java/com/github/wangyiqian/stockchart/sample/sample2/Sample2Activity.kt index d9df1bb..d387ede 100644 --- a/samples/src/main/java/com/github/wangyiqian/stockchart/sample/sample2/Sample2Activity.kt +++ b/samples/src/main/java/com/github/wangyiqian/stockchart/sample/sample2/Sample2Activity.kt @@ -15,7 +15,6 @@ package com.github.wangyiqian.stockchart.sample.sample2 import android.graphics.Color import android.os.Bundle -import android.text.style.ForegroundColorSpan import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity @@ -64,7 +63,8 @@ class Sample2Activity : AppCompatActivity() { YTD, // 年初至今 ONE_MINUTE, // 一分 FIVE_MINUTES, // 5分 - SIXTY_MINUTES // 60分 + SIXTY_MINUTES, // 60分 + DAY_TIME, // 分时 } private var periodOptionButtons = mutableMapOf() @@ -437,12 +437,18 @@ class Sample2Activity : AppCompatActivity() { doAfterLoad(list, 60, TimeBarConfig.Type.SixtyMinutes()) } } + Period.DAY_TIME -> { + Data.loadDayTimeData(this) { list -> + doAfterLoad(list, null, TimeBarConfig.Type.DayTime()) + } + } } } private fun changePeriod(period: Period) { when (period) { - Period.FIVE_DAYS -> { + Period.DAY_TIME, Period.FIVE_DAYS -> { + kChartConfig.showAvgLine = true // 显示分时均线 stockChartConfig.scaleAble = false stockChartConfig.scrollAble = false stockChartConfig.overScrollAble = false @@ -450,6 +456,7 @@ class Sample2Activity : AppCompatActivity() { kChartConfig.kChartType = KChartConfig.KChartType.LINE() } Period.YEAR, Period.QUARTER, Period.FIVE_YEARS -> { + kChartConfig.showAvgLine = false stockChartConfig.scaleAble = true stockChartConfig.scrollAble = true stockChartConfig.overScrollAble = false @@ -457,13 +464,16 @@ class Sample2Activity : AppCompatActivity() { kChartConfig.kChartType = kChartType } Period.YTD -> { + kChartConfig.showAvgLine = false stockChartConfig.scaleAble = false stockChartConfig.scrollAble = false stockChartConfig.overScrollAble = false kChartConfig.index = kChartIndex kChartConfig.kChartType = kChartType + } else -> { + kChartConfig.showAvgLine = false stockChartConfig.scaleAble = true stockChartConfig.scrollAble = true stockChartConfig.overScrollAble = true @@ -478,8 +488,7 @@ class Sample2Activity : AppCompatActivity() { private fun changeKChartType(kChartType: KChartConfig.KChartType) { - if (period == Period.FIVE_DAYS && kChartType !is KChartConfig.KChartType.LINE) { - // 这个period只支持折线图 + if (period == Period.DAY_TIME || period == Period.FIVE_DAYS) { return } @@ -502,7 +511,8 @@ class Sample2Activity : AppCompatActivity() { Pair(period_ytd, Period.YTD), Pair(period_one_minute, Period.ONE_MINUTE), Pair(period_five_minutes, Period.FIVE_MINUTES), - Pair(period_sixty_minutes, Period.SIXTY_MINUTES) + Pair(period_sixty_minutes, Period.SIXTY_MINUTES), + Pair(period_day_time, Period.DAY_TIME) ) ) @@ -541,6 +551,9 @@ class Sample2Activity : AppCompatActivity() { button.setOnClickListener { when (index::class) { Index.MA::class, Index.EMA::class, Index.BOLL::class -> { // 这三个是K线图中的指标 + + if (period == Period.DAY_TIME || period == Period.FIVE_DAYS) return@setOnClickListener + kChartIndex = if (kChartIndex != null && kChartIndex!!::class == index::class) { null diff --git a/samples/src/main/res/layout/layout_sample2_option_buttons.xml b/samples/src/main/res/layout/layout_sample2_option_buttons.xml index f90eaac..163ee31 100644 --- a/samples/src/main/res/layout/layout_sample2_option_buttons.xml +++ b/samples/src/main/res/layout/layout_sample2_option_buttons.xml @@ -100,6 +100,13 @@ android:layout_height="match_parent" android:text="60分" /> + +