@oanda/labs-crowd-view-widget 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +444 -0
- package/dist/main/CrowdViewWidget/Main.js +4 -2
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +41 -83
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +23 -17
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +24 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +30 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +30 -49
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +159 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +47 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +83 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +68 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +60 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +31 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +57 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +66 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +127 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +14 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +23 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +14 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +120 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +59 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +34 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +116 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +15 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
- package/dist/main/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +19 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.js +19 -8
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +115 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/index.js +11 -11
- package/dist/main/CrowdViewWidget/components/Chart/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +15 -12
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +15 -12
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +15 -16
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +20 -14
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/CrowdViewWidget/selectConfig.js +0 -6
- package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/main/translations/sources/en.json +3 -1
- package/dist/module/CrowdViewWidget/Main.js +4 -2
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +43 -84
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +22 -16
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +17 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +23 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +30 -49
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +151 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +39 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +76 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +61 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +53 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +24 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +50 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +59 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +12 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +6 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +16 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +7 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +113 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +52 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +27 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +8 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
- package/dist/module/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +12 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +8 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +108 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/index.js +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +8 -5
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js +15 -12
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +15 -16
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +18 -13
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/CrowdViewWidget/selectConfig.js +0 -6
- package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/module/translations/sources/en.json +3 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +12 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +18 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +11 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.d.ts +2 -2
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getRectColor.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +12 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.d.ts +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.d.ts +3 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +10 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.d.ts +1 -0
- package/dist/types/CrowdViewWidget/{utils/instrumentUtils.d.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.d.ts} +2 -2
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.d.ts +3 -2
- package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +5 -0
- package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +1 -4
- package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -3
- package/dist/types/CrowdViewWidget/constants.d.ts +13 -9
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +3 -2
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +76 -109
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +33 -28
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +22 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +29 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +126 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +191 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +44 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +103 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +72 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +74 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts +32 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +68 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +60 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +11 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.ts +16 -0
- package/src/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.ts +9 -6
- package/src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts +16 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +18 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts +27 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +212 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts +75 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts +37 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +10 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.ts +13 -0
- package/src/CrowdViewWidget/{utils/instrumentUtils.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.ts} +2 -2
- package/src/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.ts +14 -0
- package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.ts +3 -2
- package/src/CrowdViewWidget/components/Chart/getOption.ts +138 -0
- package/src/CrowdViewWidget/components/Chart/index.ts +1 -1
- package/src/CrowdViewWidget/components/Chart/types.ts +5 -0
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +14 -7
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +24 -22
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +29 -26
- package/src/CrowdViewWidget/constants.ts +30 -19
- package/src/CrowdViewWidget/selectConfig.ts +0 -8
- package/src/translations/sources/en.json +3 -1
- package/test/components/Chart/utils/chartUtils.test.ts +20 -9
- package/test/components/Chart/utils/getChartStyles.test.ts +10 -10
- package/test/components/Chart/utils/handleLabelUpdate.test.ts +419 -0
- package/test/components/Chart/utils/handleTooltipUpdate.test.ts +140 -0
- package/test/components/Chart/utils/processSentiments.test.ts +1 -1
- package/test/components/Legend.test.tsx +15 -23
- package/test/components/LegendBar.test.tsx +45 -63
- package/test/utils/instrumentUtils.test.ts +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +0 -399
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -126
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
- package/dist/main/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js +0 -391
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -113
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +0 -7
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
- package/dist/module/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
- package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +0 -30
- package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +0 -97
- package/src/CrowdViewWidget/components/Chart/chartOptions.ts +0 -449
- package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +0 -228
- package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +0 -148
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{chartOptions.d.ts → getOption.d.ts} +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.ts +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.ts +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.ts +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.ts +0 -0
|
@@ -3,25 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var
|
|
7
|
-
Object.keys(
|
|
6
|
+
var _getInstrumentConfigForDivision = require("./getInstrumentConfigForDivision");
|
|
7
|
+
Object.keys(_getInstrumentConfigForDivision).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] ===
|
|
9
|
+
if (key in exports && exports[key] === _getInstrumentConfigForDivision[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
12
|
get: function () {
|
|
13
|
-
return
|
|
13
|
+
return _getInstrumentConfigForDivision[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var
|
|
18
|
-
Object.keys(
|
|
17
|
+
var _getMultiplayerForTimeSpan = require("./getMultiplayerForTimeSpan");
|
|
18
|
+
Object.keys(_getMultiplayerForTimeSpan).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] ===
|
|
20
|
+
if (key in exports && exports[key] === _getMultiplayerForTimeSpan[key]) return;
|
|
21
21
|
Object.defineProperty(exports, key, {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
get: function () {
|
|
24
|
-
return
|
|
24
|
+
return _getMultiplayerForTimeSpan[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _getTimeSpanForGranularity = require("./getTimeSpanForGranularity");
|
|
29
|
+
Object.keys(_getTimeSpanForGranularity).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _getTimeSpanForGranularity[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _getTimeSpanForGranularity[key];
|
|
25
36
|
}
|
|
26
37
|
});
|
|
27
38
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_getInstrumentConfigForDivision","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getMultiplayerForTimeSpan","_getTimeSpanForGranularity","_processOrderPositionBooks","_processPriceCandles","_processSentiments","_validateData"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/index.ts"],"sourcesContent":["export * from './getInstrumentConfigForDivision';\nexport * from './getMultiplayerForTimeSpan';\nexport * from './getTimeSpanForGranularity';\nexport * from './processOrderPositionBooks';\nexport * from './processPriceCandles';\nexport * from './processSentiments';\nexport * from './validateData';\n"],"mappings":";;;;;AAAA,IAAAA,+BAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,+BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,+BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,G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,MAAA,CAAAC,IAAA,CAAAU,oBAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,oBAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,oBAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,kBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,kBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,kBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,kBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,aAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,aAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,aAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,aAAA,CAAAV,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processOrderPositionBooks.js","names":["processOrderPositionBooks","orderPositionData","dates","_orderPositionData$or","_orderPositionData$or2","_orderPositionData$or3","_orderPositionData$or4","Array","isArray","length","bookPrices","bookIndexes","buckets","bucketWidth","sentimentThresholdMin","sentimentThresholdMax","hasValidBooks","orderPositionBooks","books","booksDataMap","Map","map","item","time","price","forEach","date","index","_book$price","book","get","currentBuckets","filter","bucket","sentiment","Math","abs","push","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.ts"],"sourcesContent":["import type { GetOrderPositionBooksQuery } from '../../../../gql/types/graphql';\nimport type { Bucket } from '../types';\n\nexport const processOrderPositionBooks = (\n orderPositionData: GetOrderPositionBooksQuery | undefined,\n dates: string[]\n) => {\n // Input validation\n if (!Array.isArray(dates) || dates.length === 0) {\n return {\n bookPrices: [],\n bookIndexes: [],\n buckets: [],\n bucketWidth: 0,\n sentimentThresholdMin: 0,\n sentimentThresholdMax: 0,\n hasValidBooks: false,\n };\n }\n\n if (\n !orderPositionData?.orderPositionBooks?.books?.length ||\n !orderPositionData?.orderPositionBooks?.sentimentThresholdMin ||\n !orderPositionData?.orderPositionBooks?.sentimentThresholdMax ||\n !orderPositionData?.orderPositionBooks?.bucketWidth\n ) {\n return {\n bookPrices: [],\n bookIndexes: [],\n buckets: [],\n bucketWidth: 0,\n sentimentThresholdMin: 0,\n sentimentThresholdMax: 0,\n hasValidBooks: false,\n };\n }\n\n const { bucketWidth, sentimentThresholdMin, sentimentThresholdMax } =\n orderPositionData.orderPositionBooks;\n\n const booksDataMap = new Map(\n orderPositionData.orderPositionBooks.books.map((item) => [\n item.time,\n {\n price: item.price,\n buckets: item.buckets,\n },\n ])\n );\n\n // Use forEach + push for O(n) performance instead of reduce with spreads (O(n²))\n const bookPrices: (number | null)[] = [];\n const bookIndexes: number[] = [];\n const buckets: Bucket[][] = [];\n\n dates.forEach((date, index) => {\n const book = booksDataMap.get(date);\n\n const currentBuckets =\n book?.buckets\n .filter(\n (\n bucket\n ): bucket is {\n price: number;\n sentiment: number;\n } =>\n bucket !== null &&\n typeof bucket.price === 'number' &&\n typeof bucket.sentiment === 'number' &&\n Math.abs(bucket.sentiment) >= sentimentThresholdMin\n )\n .map((bucket) => ({\n price: bucket.price,\n sentiment: bucket.sentiment,\n })) || [];\n\n bookPrices.push(book?.price ?? null);\n bookIndexes.push(index);\n buckets.push(currentBuckets);\n });\n\n return {\n bookPrices,\n bookIndexes,\n buckets,\n bucketWidth,\n sentimentThresholdMin,\n sentimentThresholdMax,\n hasValidBooks: true,\n };\n};\n"],"mappings":";;;;;;AAGO,MAAMA,yBAAyB,GAAGA,CACvCC,iBAAyD,EACzDC,KAAe,KACZ;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EAEH,IAAI,CAACC,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,IAAIA,KAAK,CAACO,MAAM,KAAK,CAAC,EAAE;IAC/C,OAAO;MACLC,UAAU,EAAE,EAAE;MACdC,WAAW,EAAE,EAAE;MACfC,OAAO,EAAE,EAAE;MACXC,WAAW,EAAE,CAAC;MACdC,qBAAqB,EAAE,CAAC;MACxBC,qBAAqB,EAAE,CAAC;MACxBC,aAAa,EAAE;IACjB,CAAC;EACH;EAEA,IACE,EAACf,iBAAiB,aAAjBA,iBAAiB,gBAAAE,qBAAA,GAAjBF,iBAAiB,CAAEgB,kBAAkB,cAAAd,qBAAA,gBAAAA,qBAAA,GAArCA,qBAAA,CAAuCe,KAAK,cAAAf,qBAAA,eAA5CA,qBAAA,CAA8CM,MAAM,KACrD,EAACR,iBAAiB,aAAjBA,iBAAiB,gBAAAG,sBAAA,GAAjBH,iBAAiB,CAAEgB,kBAAkB,cAAAb,sBAAA,eAArCA,sBAAA,CAAuCU,qBAAqB,KAC7D,EAACb,iBAAiB,aAAjBA,iBAAiB,gBAAAI,sBAAA,GAAjBJ,iBAAiB,CAAEgB,kBAAkB,cAAAZ,sBAAA,eAArCA,sBAAA,CAAuCU,qBAAqB,KAC7D,EAACd,iBAAiB,aAAjBA,iBAAiB,gBAAAK,sBAAA,GAAjBL,iBAAiB,CAAEgB,kBAAkB,cAAAX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C,CAAC,CAAC,KAAI,EAAE;IAEbxB,UAAU,CAAC2B,IAAI,EAAAT,WAAA,GAACC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEL,KAAK,cAAAI,WAAA,cAAAA,WAAA,GAAI,IAAI,CAAC;IACpCjB,WAAW,CAAC0B,IAAI,CAACV,KAAK,CAAC;IACvBf,OAAO,CAACyB,IAAI,CAACN,cAAc,CAAC;EAC9B,CAAC,CAAC;EAEF,OAAO;IACLrB,UAAU;IACVC,WAAW;IACXC,OAAO;IACPC,WAAW;IACXC,qBAAqB;IACrBC,qBAAqB;IACrBC,aAAa,EAAE;EACjB,CAAC;AACH,CAAC;AAACsB,OAAA,CAAAtC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processPriceCandles.js","names":["processPriceCandles","priceCandlesData","_priceCandlesData$pri","_priceCandlesData$pri2","errorResult","minPrice","maxPrice","pipsLocation","hasValidCandles","candlesOpen","candlesClose","candlesLow","candlesHigh","dates","priceCandles","candle","length","reduce","acc","point","open","close","low","high","Math","min","max","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.ts"],"sourcesContent":["import type { GetPriceCandlesQuery } from '../../../../gql/types/graphql';\n\nexport const processPriceCandles = (\n priceCandlesData: GetPriceCandlesQuery | undefined\n) => {\n const errorResult = {\n minPrice: 0,\n maxPrice: 0,\n pipsLocation: 0,\n hasValidCandles: false,\n candlesOpen: [],\n candlesClose: [],\n candlesLow: [],\n candlesHigh: [],\n dates: [],\n };\n\n if (\n !priceCandlesData?.priceCandles?.candle?.length ||\n !priceCandlesData?.priceCandles?.pipsLocation\n ) {\n return errorResult;\n }\n\n const { dates, candlesOpen, candlesClose, candlesLow, candlesHigh } =\n priceCandlesData.priceCandles.candle.reduce(\n (acc, candle) => {\n if (!candle) {\n return acc;\n }\n\n return {\n dates: [...acc.dates, candle.point],\n candlesOpen: [...acc.candlesOpen, candle.open],\n candlesClose: [...acc.candlesClose, candle.close],\n candlesLow: [...acc.candlesLow, candle.low],\n candlesHigh: [...acc.candlesHigh, candle.high],\n };\n },\n {\n dates: [] as string[],\n candlesOpen: [] as number[],\n candlesClose: [] as number[],\n candlesLow: [] as number[],\n candlesHigh: [] as number[],\n }\n );\n\n if (dates.length === 0) {\n return errorResult;\n }\n\n const minPrice = Math.min(...candlesLow);\n const maxPrice = Math.max(...candlesHigh);\n\n return {\n minPrice,\n maxPrice,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n dates,\n hasValidCandles: true,\n pipsLocation: priceCandlesData.priceCandles.pipsLocation,\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,mBAAmB,GAC9BC,gBAAkD,IAC/C;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EACH,MAAMC,WAAW,GAAG;IAClBC,QAAQ,EAAE,CAAC;IACXC,QAAQ,EAAE,CAAC;IACXC,YAAY,EAAE,CAAC;IACfC,eAAe,EAAE,KAAK;IACtBC,WAAW,EAAE,EAAE;IACfC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE,EAAE;IACdC,WAAW,EAAE,EAAE;IACfC,KAAK,EAAE;EACT,CAAC;EAED,IACE,EAACZ,gBAAgB,aAAhBA,gBAAgB,gBAAAC,qBAAA,GAAhBD,gBAAgB,CAAEa,YAAY,cAAAZ,qBAAA,gBAAAA,qBAAA,GAA9BA,qBAAA,CAAgCa,MAAM,cAAAb,qBAAA,eAAtCA,qBAAA,CAAwCc,MAAM,KAC/C,EAACf,gBAAgB,aAAhBA,gBAAgB,gBAAAE,sBAAA,GAAhBF,gBAAgB,CAAEa,YAAY,cAAAX,sBAAA,eAA9BA,sBAAA,CAAgCI,YAAY,GAC7C;IACA,OAAOH,WAAW;EACpB;EAEA,MAAM;IAAES,KAAK;IAAEJ,WAAW;IAAEC,YAAY;IAAEC,UAAU;IAAEC;EAAY,CAAC,GACjEX,gBAAgB,CAACa,YAAY,CAAC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iments","sentimentsData","dates","_sentimentsData$senti","Array","isArray","length","sentiments","sentimentLongs","sentimentShorts","hasValidSentiments","sentimentMap","Map","map","item","_item$sentiment$short","_item$sentiment","_item$sentiment$longP","_item$sentiment2","time","sentiment","shortPercent","longPercent","reduce","acc","date","get","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/processSentiments.ts"],"sourcesContent":["import type { GetSentimentsQuery } from '../../../../gql/types/graphql';\n\nexport const processSentiments = (\n sentimentsData: GetSentimentsQuery | undefined,\n dates: string[]\n) => {\n if (\n !Array.isArray(dates) ||\n dates.length === 0 ||\n !sentimentsData?.sentiments?.sentiments?.length\n ) {\n return {\n sentimentLongs: [],\n sentimentShorts: [],\n hasValidSentiments: false,\n };\n }\n\n const sentimentMap = new Map(\n sentimentsData.sentiments.sentiments.map((item) => [\n item?.time,\n {\n sentimentShorts: item?.sentiment?.shortPercent ?? null,\n sentimentLongs: item?.sentiment?.longPercent ?? null,\n },\n ])\n );\n\n const { sentimentLongs, sentimentShorts } = dates.reduce(\n (acc, date) => {\n const sentiment = sentimentMap.get(date);\n\n return {\n sentimentLongs: [\n ...acc.sentimentLongs,\n sentiment?.sentimentLongs || null,\n ],\n sentimentShorts: [\n ...acc.sentimentShorts,\n sentiment?.sentimentShorts || null,\n ],\n };\n },\n {\n sentimentLongs: [] as (number | null)[],\n sentimentShorts: [] as (number | null)[],\n }\n );\n\n return {\n sentimentLongs,\n sentimentShorts,\n hasValidSentiments: true,\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,iBAAiB,GAAGA,CAC/BC,cAA8C,EAC9CC,KAAe,KACZ;EAAA,IAAAC,qBAAA;EACH,IACE,CAACC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IACrBA,KAAK,CAACI,MAAM,KAAK,CAAC,IAClB,EAACL,cAAc,aAAdA,cAAc,gBAAAE,qBAAA,GAAdF,cAAc,CAAEM,UAAU,cAAAJ,qBAAA,gBAAAA,qBAAA,GAA1BA,qB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C;EACH,CAAC,EACD;IACED,cAAc,EAAE,EAAuB;IACvCC,eAAe,EAAE;EACnB,CACF,CAAC;EAED,OAAO;IACLD,cAAc;IACdC,eAAe;IACfC,kBAAkB,EAAE;EACtB,CAAC;AACH,CAAC;AAACiB,OAAA,CAAA3B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateData.js","names":["validateData","priceCandlesData","orderPositionData","hasValidCandles","hasValidBooks","hasValidSentiments","_priceCandlesData$pri","_priceCandlesData$pri2","_orderPositionData$or","_orderPositionData$or2","hasValidPriceData","priceCandles","candle","length","hasValidOrderData","orderPositionBooks","books","Error","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/validateData.ts"],"sourcesContent":["import type {\n GetOrderPositionBooksQuery,\n GetPriceCandlesQuery,\n} from '../../../../gql/types/graphql';\n\nexport const validateData = (\n priceCandlesData: GetPriceCandlesQuery | undefined,\n orderPositionData: GetOrderPositionBooksQuery | undefined,\n hasValidCandles: boolean,\n hasValidBooks: boolean,\n hasValidSentiments: boolean\n): Error | null => {\n const hasValidPriceData =\n (priceCandlesData?.priceCandles?.candle?.length ?? 0) >= 1;\n const hasValidOrderData =\n (orderPositionData?.orderPositionBooks?.books?.length ?? 0) >= 1;\n\n if (!hasValidPriceData) {\n return new Error('Insufficient price candle data');\n }\n if (!hasValidOrderData) {\n return new Error('Insufficient order position data');\n }\n if (!hasValidCandles) {\n return new Error('Invalid candle data');\n }\n if (!hasValidBooks) {\n return new Error('Invalid book data');\n }\n if (!hasValidSentiments) {\n return new Error('Invalid sentiment data');\n }\n\n return null;\n};\n"],"mappings":";;;;;;AAKO,MAAMA,YAAY,GAAGA,CAC1BC,gBAAkD,EAClDC,iBAAyD,EACzDC,eAAwB,EACxBC,aAAsB,EACtBC,kBAA2B,KACV;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,qBAAA,EAAAC,sBAAA;EACjB,MAAMC,iBAAiB,GACrB,EAAAJ,qBAAA,GAACL,gBAAgB,aAAhBA,gBAAgB,gBAAAM,sBAAA,GAAhBN,gBAAgB,CAAEU,YAAY,cAAAJ,sBAAA,gBAAAA,sBAAA,GAA9BA,sBAAA,CAAgCK,MAAM,cAAAL,sBAAA,uBAAtCA,sBAAA,CAAwCM,MAAM,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,KAAK,CAAC;EAC5D,MAAMQ,iBAAiB,GACrB,EAAAN,qBAAA,GAACN,iBAAiB,aAAjBA,iBAAiB,gBAAAO,sBAAA,GAAjBP,iBAAiB,CAAEa,kBAAkB,cAAAN,sBAAA,gBAAAA,sBAAA,GAArCA,sBAAA,CAAuCO,KAAK,cAAAP,sBAAA,uBAA5CA,sBAAA,CAA8CI,MAAM,cAAAL,qBAAA,cAAAA,qBAAA,GAAI,CAAC,KAAK,CAAC;EAElE,IAAI,CAACE,iBAAiB,EAAE;IACtB,OAAO,IAAIO,KAAK,CAAC,gCAAgC,CAAC;EACpD;EACA,IAAI,CAACH,iBAAiB,EAAE;IACtB,OAAO,IAAIG,KAAK,CAAC,kCAAkC,CAAC;EACtD;EACA,IAAI,CAACd,eAAe,EAAE;IACpB,OAAO,IAAIc,KAAK,CAAC,qBAAqB,CAAC;EACzC;EACA,IAAI,CAACb,aAAa,EAAE;IAClB,OAAO,IAAIa,KAAK,CAAC,mBAAmB,CAAC;EACvC;EACA,IAAI,CAACZ,kBAAkB,EAAE;IACvB,OAAO,IAAIY,KAAK,CAAC,wBAAwB,CAAC;EAC5C;EAEA,OAAO,IAAI;AACb,CAAC;AAACC,OAAA,CAAAlB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOption = void 0;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
var _chartOptions = require("./chartOptions");
|
|
9
|
+
var _chartUtils = require("./chartUtils");
|
|
10
|
+
var _getChartStyles = require("./chartUtils/getChartStyles");
|
|
11
|
+
const getOption = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
mainData: {
|
|
14
|
+
dates,
|
|
15
|
+
candlesOpen,
|
|
16
|
+
candlesClose,
|
|
17
|
+
candlesLow,
|
|
18
|
+
candlesHigh,
|
|
19
|
+
bookPrices,
|
|
20
|
+
bookIndexes,
|
|
21
|
+
sentimentShorts,
|
|
22
|
+
sentimentLongs
|
|
23
|
+
},
|
|
24
|
+
additionalData: {
|
|
25
|
+
bucketWidth,
|
|
26
|
+
buckets,
|
|
27
|
+
displayPrecision,
|
|
28
|
+
bookType,
|
|
29
|
+
sentimentThresholdMin,
|
|
30
|
+
sentimentThresholdMax
|
|
31
|
+
},
|
|
32
|
+
isLoading,
|
|
33
|
+
isDark,
|
|
34
|
+
isDesktop,
|
|
35
|
+
labelCallback
|
|
36
|
+
} = _ref;
|
|
37
|
+
const styles = (0, _getChartStyles.getChartStyles)(isDark);
|
|
38
|
+
const selectedPriceRef = {
|
|
39
|
+
current: 0
|
|
40
|
+
};
|
|
41
|
+
const initialStartZoom = isDesktop ? _constants.CHART_CONFIG.INITIAL_START_ZOOM_DESKTOP : _constants.CHART_CONFIG.INITIAL_START_ZOOM_MOBILE;
|
|
42
|
+
const visibleXAxisData = dates.slice(dates.length * initialStartZoom / 100, dates.length * _constants.CHART_CONFIG.INITIAL_END_ZOOM / 100);
|
|
43
|
+
const isGreaterThanTwoWeeks = (0, _chartUtils.isDifferenceGreaterThanTwoWeeks)(visibleXAxisData[0], visibleXAxisData[visibleXAxisData.length - 1]);
|
|
44
|
+
const heatmapChart = bookPrices && bookPrices.length > 0 ? [(0, _chartOptions.getSeriesHeatmapConfig)({
|
|
45
|
+
bucketWidth,
|
|
46
|
+
buckets,
|
|
47
|
+
isDark,
|
|
48
|
+
sentimentThresholdMax,
|
|
49
|
+
sentimentThresholdMin,
|
|
50
|
+
isLoading
|
|
51
|
+
})] : [];
|
|
52
|
+
const sentimentChart = sentimentLongs && sentimentLongs.length > 0 ? [(0, _chartOptions.getSeriesSentimentConfig)({
|
|
53
|
+
styles,
|
|
54
|
+
isLoading
|
|
55
|
+
})] : [];
|
|
56
|
+
return {
|
|
57
|
+
animation: false,
|
|
58
|
+
tooltip: (0, _chartOptions.getTooltipConfig)({
|
|
59
|
+
bookType,
|
|
60
|
+
bucketWidth,
|
|
61
|
+
buckets,
|
|
62
|
+
displayPrecision,
|
|
63
|
+
labelCallback,
|
|
64
|
+
selectedPriceRef,
|
|
65
|
+
tooltipLinesColor: styles.tooltipLinesColor,
|
|
66
|
+
sentimentLongs,
|
|
67
|
+
sentimentShorts
|
|
68
|
+
}),
|
|
69
|
+
grid: (0, _chartOptions.getGridConfig)({
|
|
70
|
+
isDesktop
|
|
71
|
+
}),
|
|
72
|
+
xAxis: (0, _chartOptions.getXAxisConfig)({
|
|
73
|
+
dates,
|
|
74
|
+
isGreaterThanTwoWeeks
|
|
75
|
+
}),
|
|
76
|
+
yAxis: (0, _chartOptions.getYAxisConfig)({
|
|
77
|
+
bucketWidth,
|
|
78
|
+
displayPrecision
|
|
79
|
+
}),
|
|
80
|
+
dataZoom: (0, _chartOptions.getDataZoomConfig)({
|
|
81
|
+
isDesktop
|
|
82
|
+
}),
|
|
83
|
+
visualMap: (0, _chartOptions.getVisualMapConfig)({
|
|
84
|
+
sentimentLongColor: styles.sentimentLongColor,
|
|
85
|
+
sentimentShortColor: styles.sentimentShortColor
|
|
86
|
+
}),
|
|
87
|
+
graphic: [...(0, _chartOptions.getGridLines)({
|
|
88
|
+
isDark,
|
|
89
|
+
isDesktop
|
|
90
|
+
}), ...(0, _chartOptions.getLabelsConfig)({
|
|
91
|
+
isDark,
|
|
92
|
+
isDesktop,
|
|
93
|
+
labelCallback
|
|
94
|
+
})],
|
|
95
|
+
dataset: {
|
|
96
|
+
source: {
|
|
97
|
+
dates,
|
|
98
|
+
candlesOpen,
|
|
99
|
+
candlesClose,
|
|
100
|
+
candlesLow,
|
|
101
|
+
candlesHigh,
|
|
102
|
+
bookPrices: bookPrices !== null && bookPrices !== void 0 ? bookPrices : [],
|
|
103
|
+
bookIndexes: bookIndexes !== null && bookIndexes !== void 0 ? bookIndexes : [],
|
|
104
|
+
sentimentShorts,
|
|
105
|
+
sentimentLongs
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
series: [(0, _chartOptions.getSeriesCandlestickConfig)({
|
|
109
|
+
styles,
|
|
110
|
+
isLoading
|
|
111
|
+
}), ...heatmapChart, ...sentimentChart]
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.getOption = getOption;
|
|
115
|
+
//# sourceMappingURL=getOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["_constants","require","_chartOptions","_chartUtils","_getChartStyles","getOption","_ref","mainData","dates","candlesOpen","candlesClose","candlesLow","candlesHigh","bookPrices","bookIndexes","sentimentShorts","sentimentLongs","additionalData","bucketWidth","buckets","displayPrecision","bookType","sentimentThresholdMin","sentimentThresholdMax","isLoading","isDark","isDesktop","labelCallback","styles","getChartStyles","selectedPriceRef","current","initialStartZoom","CHART_CONFIG","INITIAL_START_ZOOM_DESKTOP","INITIAL_START_ZOOM_MOBILE","visibleXAxisData","slice","length","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","isDifferenceGreaterThanTwoWeeks","heatmapChart","getSeriesHeatmapConfig","sentimentChart","getSeriesSentimentConfig","animation","tooltip","getTooltipConfig","tooltipLinesColor","grid","getGridConfig","xAxis","getXAxisConfig","yAxis","getYAxisConfig","dataZoom","getDataZoomConfig","visualMap","getVisualMapConfig","sentimentLongColor","sentimentShortColor","graphic","getGridLines","getLabelsConfig","dataset","source","series","getSeriesCandlestickConfig","exports"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/getOption.ts"],"sourcesContent":["import { CHART_CONFIG } from '../../constants';\nimport {\n getDataZoomConfig,\n getGridConfig,\n getGridLines,\n getLabelsConfig,\n getSeriesCandlestickConfig,\n getSeriesHeatmapConfig,\n getSeriesSentimentConfig,\n getTooltipConfig,\n getVisualMapConfig,\n getXAxisConfig,\n getYAxisConfig,\n} from './chartOptions';\nimport { isDifferenceGreaterThanTwoWeeks } from './chartUtils';\nimport { getChartStyles } from './chartUtils/getChartStyles';\nimport type { GetOptionType } from './types';\n\nexport const getOption: GetOptionType = ({\n mainData: {\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n },\n additionalData: {\n bucketWidth,\n buckets,\n displayPrecision,\n bookType,\n sentimentThresholdMin,\n sentimentThresholdMax,\n },\n isLoading,\n isDark,\n isDesktop,\n labelCallback,\n}) => {\n const styles = getChartStyles(isDark);\n const selectedPriceRef = { current: 0 };\n\n const initialStartZoom = isDesktop\n ? CHART_CONFIG.INITIAL_START_ZOOM_DESKTOP\n : CHART_CONFIG.INITIAL_START_ZOOM_MOBILE;\n\n const visibleXAxisData = dates.slice(\n (dates.length * initialStartZoom) / 100,\n (dates.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100\n );\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n visibleXAxisData[0],\n visibleXAxisData[visibleXAxisData.length - 1]\n );\n\n const heatmapChart =\n bookPrices && bookPrices.length > 0\n ? [\n getSeriesHeatmapConfig({\n bucketWidth,\n buckets,\n isDark,\n sentimentThresholdMax,\n sentimentThresholdMin,\n isLoading,\n }),\n ]\n : [];\n\n const sentimentChart =\n sentimentLongs && sentimentLongs.length > 0\n ? [\n getSeriesSentimentConfig({\n styles,\n isLoading,\n }),\n ]\n : [];\n\n return {\n animation: false,\n tooltip: getTooltipConfig({\n bookType,\n bucketWidth,\n buckets,\n displayPrecision,\n labelCallback,\n selectedPriceRef,\n tooltipLinesColor: styles.tooltipLinesColor,\n sentimentLongs,\n sentimentShorts,\n }),\n grid: getGridConfig({ isDesktop }),\n xAxis: getXAxisConfig({\n dates,\n isGreaterThanTwoWeeks,\n }),\n yAxis: getYAxisConfig({\n bucketWidth,\n displayPrecision,\n }),\n dataZoom: getDataZoomConfig({ isDesktop }),\n visualMap: getVisualMapConfig({\n sentimentLongColor: styles.sentimentLongColor,\n sentimentShortColor: styles.sentimentShortColor,\n }),\n graphic: [\n ...getGridLines({ isDark, isDesktop }),\n ...getLabelsConfig({ isDark, isDesktop, labelCallback }),\n ],\n dataset: {\n source: {\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices: bookPrices ?? [],\n bookIndexes: bookIndexes ?? [],\n sentimentShorts,\n sentimentLongs,\n },\n },\n series: [\n getSeriesCandlestickConfig({\n styles,\n isLoading,\n }),\n ...heatmapChart,\n ...sentimentChart,\n ],\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAaA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAGO,MAAMI,SAAwB,GAAGC,IAAA,IAwBlC;EAAA,IAxBmC;IACvCC,QAAQ,EAAE;MACRC,KAAK;MACLC,WAAW;MACXC,YAAY;MACZC,UAAU;MACVC,WAAW;MACXC,UAAU;MACVC,WAAW;MACXC,eAAe;MACfC;IACF,CAAC;IACDC,cAAc,EAAE;MACdC,WAAW;MACXC,OAAO;MACPC,gBAAgB;MAChBC,QAAQ;MACRC,qBAAqB;MACrBC;IACF,CAAC;IACDC,SAAS;IACTC,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,GAAArB,IAAA;EACC,MAAMsB,MAAM,GAAG,IAAAC,8BAAc,EAACJ,MAAM,CAAC;EACrC,MAAMK,gBAAgB,GAAG;IAAEC,OAAO,EAAE;EAAE,CAAC;EAEvC,MAAMC,gBAAgB,GAAGN,SAAS,GAC9BO,uBAAY,CAACC,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AAiB,EAAC;MAAE/B;IAAU,CAAC,CAAC;IAC1CgC,SAAS,EAAE,IAAAC,gCAAkB,EAAC;MAC5BC,kBAAkB,EAAEhC,MAAM,CAACgC,kBAAkB;MAC7CC,mBAAmB,EAAEjC,MAAM,CAACiC;IAC9B,CAAC,CAAC;IACFC,OAAO,EAAE,CACP,GAAG,IAAAC,0BAAY,EAAC;MAAEtC,MAAM;MAAEC;IAAU,CAAC,CAAC,EACtC,GAAG,IAAAsC,6BAAe,EAAC;MAAEvC,MAAM;MAAEC,SAAS;MAAEC;IAAc,CAAC,CAAC,CACzD;IACDsC,OAAO,EAAE;MACPC,MAAM,EAAE;QACN1D,KAAK;QACLC,WAAW;QACXC,YAAY;QACZC,UAAU;QACVC,WAAW;QACXC,UAAU,EAAEA,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,EAAE;QAC5BC,WAAW,EAAEA,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI,EAAE;QAC9BC,eAAe;QACfC;MACF;IACF,CAAC;IACDmD,MAAM,EAAE,CACN,IAAAC,wCAA0B,EAAC;MACzBxC,MAAM;MACNJ;IACF,CAAC,CAAC,EACF,GAAGkB,YAAY,EACf,GAAGE,cAAc;EAErB,CAAC;AACH,CAAC;AAACyB,OAAA,CAAAhE,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -36,6 +36,17 @@ Object.keys(_ChartWithData).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _dataUtils = require("./dataUtils");
|
|
40
|
+
Object.keys(_dataUtils).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _dataUtils[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _dataUtils[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
var _types = require("./types");
|
|
40
51
|
Object.keys(_types).forEach(function (key) {
|
|
41
52
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -58,15 +69,4 @@ Object.keys(_useCrowdViewData).forEach(function (key) {
|
|
|
58
69
|
}
|
|
59
70
|
});
|
|
60
71
|
});
|
|
61
|
-
var _utils = require("./utils");
|
|
62
|
-
Object.keys(_utils).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _utils[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _utils[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Chart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_chartOptions","_ChartWithData","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Chart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_chartOptions","_ChartWithData","_dataUtils","_types","_useCrowdViewData"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\nexport * from './chartOptions';\nexport * from './ChartWithData';\nexport * from './dataUtils';\nexport * from './types';\nexport * from './useCrowdViewData';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EA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AAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,MAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,MAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,iBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,iBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,iBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CrowdViewWidget/components/Chart/types.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\n\nimport type {\n BookType,\n Division,\n Granularity,\n} from '../../../gql/types/graphql';\nimport type { InstrumentId } from '../../types';\n\nexport interface Bucket {\n price: number;\n sentiment: number;\n}\n\nexport interface UseCrowdViewDataProps {\n instrument: InstrumentId;\n bookType: BookType;\n division: Division;\n granularity: Granularity;\n}\n\ninterface CrowdViewMainData {\n dates: string[];\n candlesOpen: number[];\n candlesClose: number[];\n candlesLow: number[];\n candlesHigh: number[];\n bookPrices?: (number | null)[];\n bookIndexes?: (number | null)[];\n sentimentShorts: (number | null)[];\n sentimentLongs: (number | null)[];\n}\n\ninterface CrowdViewAdditionalData {\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n bookType: BookType;\n sentimentThresholdMin: number;\n sentimentThresholdMax: number;\n}\n\nexport interface UseCrowdViewDataReturn {\n mainData?: CrowdViewMainData | null;\n additionalData?: CrowdViewAdditionalData | null;\n loading: boolean;\n error: boolean;\n}\n\ninterface GetOptionProps {\n mainData: CrowdViewMainData;\n additionalData: CrowdViewAdditionalData;\n isDark: boolean;\n isDesktop: boolean;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n}\n\nexport type GetOptionType = (props: GetOptionProps) => EChartsOption;\n\nexport interface ChartProps {\n mainData: CrowdViewMainData;\n additionalData: CrowdViewAdditionalData;\n isDesktop: boolean;\n}\n\nexport interface ChartWithDataProps {\n bookType: BookType;\n division: Division;\n instrument: InstrumentId;\n granularity: Granularity;\n}\n\nexport interface GetLabelsDataProps {\n dates: string[];\n isGreaterThanTwoWeeks: boolean;\n}\n\ninterface BaseTooltipParam {\n [key: string]: unknown;\n seriesId?: string;\n seriesName?: string;\n seriesType?: string;\n axisValue?: string | number;\n axisValueLabel?: string;\n axisDimension?: string;\n axisIndex?: number;\n value: unknown;\n}\n\nexport type TooltipParam =\n | (BaseTooltipParam & {\n seriesId: 'candlestick';\n value: [number, number, number, number, number]; // [0, open, close, low, high]\n })\n | (BaseTooltipParam & {\n seriesId: 'heatmap';\n value: [string, number, number]; // [time, price, index]\n })\n | (BaseTooltipParam & {\n seriesId: 'sentiment';\n value: [string, number, number]; // [time, shortPercent, longPercent]\n });\n\nexport interface DataZoomBatchItem {\n [key: string]: unknown;\n start: number;\n end: number;\n dataZoomId?: string;\n}\n\nexport interface DataZoomEvent {\n [key: string]: unknown;\n type: 'datazoom';\n batch?: DataZoomBatchItem[];\n}\n\nexport interface DataZoomItem {\n startValue: number;\n endValue: number;\n}\n\nexport type DataZoomArray = Array<DataZoomItem>;\n\nexport interface XAxisItem {\n name?: string;\n}\n\nexport type XAxisArray = Array<XAxisItem>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CrowdViewWidget/components/Chart/types.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\n\nimport type {\n BookType,\n Division,\n Granularity,\n} from '../../../gql/types/graphql';\nimport type { InstrumentId } from '../../types';\n\nexport interface Bucket {\n price: number;\n sentiment: number;\n}\n\nexport interface UseCrowdViewDataProps {\n instrument: InstrumentId;\n bookType: BookType;\n division: Division;\n granularity: Granularity;\n}\n\ninterface CrowdViewMainData {\n dates: string[];\n candlesOpen: number[];\n candlesClose: number[];\n candlesLow: number[];\n candlesHigh: number[];\n bookPrices?: (number | null)[];\n bookIndexes?: (number | null)[];\n sentimentShorts: (number | null)[];\n sentimentLongs: (number | null)[];\n}\n\ninterface CrowdViewAdditionalData {\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n bookType: BookType;\n sentimentThresholdMin: number;\n sentimentThresholdMax: number;\n}\n\nexport interface UseCrowdViewDataReturn {\n mainData?: CrowdViewMainData | null;\n additionalData?: CrowdViewAdditionalData | null;\n loading: boolean;\n priceCandlesLoading: boolean;\n orderPositionLoading: boolean;\n sentimentsLoading: boolean;\n error: boolean;\n}\n\ninterface GetOptionProps {\n mainData: CrowdViewMainData;\n additionalData: CrowdViewAdditionalData;\n isDark: boolean;\n isDesktop: boolean;\n isLoading: boolean;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n}\n\nexport type GetOptionType = (props: GetOptionProps) => EChartsOption;\n\nexport interface ChartProps {\n mainData: CrowdViewMainData;\n additionalData: CrowdViewAdditionalData;\n isDesktop: boolean;\n isLoading: boolean;\n}\n\nexport interface ChartWithDataProps {\n bookType: BookType;\n division: Division;\n instrument: InstrumentId;\n granularity: Granularity;\n}\n\nexport interface GetLabelsDataProps {\n dates: string[];\n isGreaterThanTwoWeeks: boolean;\n}\n\ninterface BaseTooltipParam {\n [key: string]: unknown;\n seriesId?: string;\n seriesName?: string;\n seriesType?: string;\n axisValue?: string | number;\n axisValueLabel?: string;\n axisDimension?: string;\n axisIndex?: number;\n value: unknown;\n}\n\nexport type TooltipParam =\n | (BaseTooltipParam & {\n seriesId: 'candlestick';\n value: [number, number, number, number, number]; // [0, open, close, low, high]\n })\n | (BaseTooltipParam & {\n seriesId: 'heatmap';\n value: [string, number, number]; // [time, price, index]\n })\n | (BaseTooltipParam & {\n seriesId: 'sentiment';\n value: [string, number, number]; // [time, shortPercent, longPercent]\n });\n\nexport interface DataZoomBatchItem {\n [key: string]: unknown;\n start: number;\n end: number;\n dataZoomId?: string;\n}\n\nexport interface DataZoomEvent {\n [key: string]: unknown;\n type: 'datazoom';\n batch?: DataZoomBatchItem[];\n}\n\nexport interface DataZoomItem {\n startValue: number;\n endValue: number;\n}\n\nexport type DataZoomArray = Array<DataZoomItem>;\n\nexport interface XAxisItem {\n name?: string;\n}\n\nexport type XAxisArray = Array<XAxisItem>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ var _getPriceCandles = require("../../../gql/getPriceCandles");
|
|
|
11
11
|
var _getSentiments = require("../../../gql/getSentiments");
|
|
12
12
|
var _graphql = require("../../../gql/types/graphql");
|
|
13
13
|
var _constants = require("../../constants");
|
|
14
|
-
var
|
|
14
|
+
var _dataUtils = require("./dataUtils");
|
|
15
15
|
const useCrowdViewData = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
instrument,
|
|
@@ -30,7 +30,7 @@ const useCrowdViewData = _ref => {
|
|
|
30
30
|
division,
|
|
31
31
|
instrument: dataSource === _graphql.DataSource.Mt5 ? _constants.INSTRUMENTS_CONFIG[instrument].mt5name : _constants.INSTRUMENTS_CONFIG[instrument].v20name,
|
|
32
32
|
granularity,
|
|
33
|
-
timeSpan: (0,
|
|
33
|
+
timeSpan: (0, _dataUtils.getTimeSpanForGranularity)(granularity)
|
|
34
34
|
},
|
|
35
35
|
fetchPolicy: 'no-cache'
|
|
36
36
|
});
|
|
@@ -44,7 +44,7 @@ const useCrowdViewData = _ref => {
|
|
|
44
44
|
candlesLow,
|
|
45
45
|
candlesHigh,
|
|
46
46
|
pipsLocation
|
|
47
|
-
} = (0, _react.useMemo)(() => (0,
|
|
47
|
+
} = (0, _react.useMemo)(() => (0, _dataUtils.processPriceCandles)(priceCandlesData), [priceCandlesData]);
|
|
48
48
|
const {
|
|
49
49
|
loading: orderPositionLoading,
|
|
50
50
|
data: orderPositionData,
|
|
@@ -53,11 +53,11 @@ const useCrowdViewData = _ref => {
|
|
|
53
53
|
variables: {
|
|
54
54
|
instrument: _constants.INSTRUMENTS_CONFIG[instrument].v20name,
|
|
55
55
|
bookType: bookType || _graphql.BookType.Order,
|
|
56
|
-
timeSpan: (0,
|
|
56
|
+
timeSpan: (0, _dataUtils.getTimeSpanForGranularity)(granularity),
|
|
57
57
|
granularity,
|
|
58
58
|
maxBookPrice: maxPrice,
|
|
59
59
|
minBookPrice: minPrice,
|
|
60
|
-
bucketMultiplier:
|
|
60
|
+
bucketMultiplier: (0, _dataUtils.getMultiplayerForTimeSpan)(granularity),
|
|
61
61
|
bucketMargin: _constants.BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER
|
|
62
62
|
},
|
|
63
63
|
fetchPolicy: 'no-cache',
|
|
@@ -71,7 +71,7 @@ const useCrowdViewData = _ref => {
|
|
|
71
71
|
sentimentThresholdMin,
|
|
72
72
|
sentimentThresholdMax,
|
|
73
73
|
hasValidBooks
|
|
74
|
-
} = (0, _react.useMemo)(() => (0,
|
|
74
|
+
} = (0, _react.useMemo)(() => (0, _dataUtils.processOrderPositionBooks)(orderPositionData, dates), [orderPositionData, dates]);
|
|
75
75
|
const {
|
|
76
76
|
loading: sentimentsLoading,
|
|
77
77
|
data: sentimentsData,
|
|
@@ -80,7 +80,7 @@ const useCrowdViewData = _ref => {
|
|
|
80
80
|
variables: {
|
|
81
81
|
instrument: _constants.INSTRUMENTS_CONFIG[instrument].v20name,
|
|
82
82
|
granularity,
|
|
83
|
-
timeSpan: (0,
|
|
83
|
+
timeSpan: (0, _dataUtils.getTimeSpanForGranularity)(granularity)
|
|
84
84
|
},
|
|
85
85
|
fetchPolicy: 'no-cache',
|
|
86
86
|
skip: priceCandlesLoading || !!priceCandlesError
|
|
@@ -89,7 +89,7 @@ const useCrowdViewData = _ref => {
|
|
|
89
89
|
sentimentLongs,
|
|
90
90
|
sentimentShorts,
|
|
91
91
|
hasValidSentiments
|
|
92
|
-
} = (0, _react.useMemo)(() => (0,
|
|
92
|
+
} = (0, _react.useMemo)(() => (0, _dataUtils.processSentiments)(sentimentsData, dates), [sentimentsData, dates]);
|
|
93
93
|
const loading = priceCandlesLoading || orderPositionLoading || sentimentsLoading;
|
|
94
94
|
const error = (0, _react.useMemo)(() => {
|
|
95
95
|
if (priceCandlesError) {
|
|
@@ -104,10 +104,10 @@ const useCrowdViewData = _ref => {
|
|
|
104
104
|
if (loading) {
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
|
-
return (0,
|
|
107
|
+
return (0, _dataUtils.validateData)(priceCandlesData, orderPositionData, hasValidCandles, hasValidBooks, hasValidSentiments);
|
|
108
108
|
}, [priceCandlesError, orderPositionError, sentimentsError, loading, priceCandlesData, orderPositionData, hasValidCandles, hasValidBooks, hasValidSentiments]);
|
|
109
109
|
const data = (0, _react.useMemo)(() => {
|
|
110
|
-
if (!priceCandlesData ||
|
|
110
|
+
if (!priceCandlesData || error) {
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
113
113
|
return {
|
|
@@ -123,7 +123,7 @@ const useCrowdViewData = _ref => {
|
|
|
123
123
|
sentimentLongs
|
|
124
124
|
},
|
|
125
125
|
additionalData: {
|
|
126
|
-
bucketWidth,
|
|
126
|
+
bucketWidth: bucketWidth || _constants.INSTRUMENTS_CONFIG[instrument].defaultBucketWidth * (0, _dataUtils.getMultiplayerForTimeSpan)(granularity),
|
|
127
127
|
buckets,
|
|
128
128
|
displayPrecision: pipsLocation,
|
|
129
129
|
bookType,
|
|
@@ -131,10 +131,13 @@ const useCrowdViewData = _ref => {
|
|
|
131
131
|
sentimentThresholdMax
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
}, [priceCandlesData,
|
|
134
|
+
}, [priceCandlesData, error, dates, candlesOpen, candlesClose, candlesLow, candlesHigh, bookPrices, bookIndexes, sentimentShorts, sentimentLongs, bucketWidth, granularity, instrument, buckets, pipsLocation, bookType, sentimentThresholdMin, sentimentThresholdMax]);
|
|
135
135
|
return {
|
|
136
136
|
mainData: data === null || data === void 0 ? void 0 : data.mainData,
|
|
137
137
|
additionalData: data === null || data === void 0 ? void 0 : data.additionalData,
|
|
138
|
+
priceCandlesLoading,
|
|
139
|
+
orderPositionLoading,
|
|
140
|
+
sentimentsLoading,
|
|
138
141
|
loading,
|
|
139
142
|
error: !!error
|
|
140
143
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrowdViewData.js","names":["_client","require","_react","_getOrderPositionBooks","_getPriceCandles","_getSentiments","_graphql","_constants","_utils","useCrowdViewData","_ref","instrument","bookType","division","granularity","dataSource","Division","Ogm","Oj","DataSource","Mt5","V20","loading","priceCandlesLoading","data","priceCandlesData","error","priceCandlesError","useQuery","getPriceCandles","variables","INSTRUMENTS_CONFIG","mt5name","v20name","timeSpan","getTimeSpanForGranularity","fetchPolicy","minPrice","maxPrice","hasValidCandles","dates","candlesOpen","candlesClose","candlesLow","candlesHigh","pipsLocation","useMemo","processPriceCandles","orderPositionLoading","orderPositionData","orderPositionError","getOrderPositionBooks","BookType","Order","maxBookPrice","minBookPrice","bucketMultiplier","bucketMargin","BUCKET_CONFIG","PRICE_MARGIN_MULTIPLIER","skip","bookPrices","bookIndexes","buckets","bucketWidth","sentimentThresholdMin","sentimentThresholdMax","hasValidBooks","processOrderPositionBooks","sentimentsLoading","sentimentsData","sentimentsError","getSentiments","sentimentLongs","sentimentShorts","hasValidSentiments","processSentiments","Error","concat","message","validateData","mainData","additionalData","displayPrecision","exports"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/useCrowdViewData.ts"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport { useMemo } from 'react';\n\nimport { getOrderPositionBooks } from '../../../gql/getOrderPositionBooks';\nimport { getPriceCandles } from '../../../gql/getPriceCandles';\nimport { getSentiments } from '../../../gql/getSentiments';\nimport type {\n GetOrderPositionBooksQuery,\n GetOrderPositionBooksQueryVariables,\n GetPriceCandlesQuery,\n GetPriceCandlesQueryVariables,\n GetSentimentsQuery,\n GetSentimentsQueryVariables,\n} from '../../../gql/types/graphql';\nimport { BookType, DataSource, Division } from '../../../gql/types/graphql';\nimport { BUCKET_CONFIG, INSTRUMENTS_CONFIG } from '../../constants';\nimport type { UseCrowdViewDataProps, UseCrowdViewDataReturn } from './types';\nimport {\n getTimeSpanForGranularity,\n processOrderPositionBooks,\n processPriceCandles,\n processSentiments,\n validateData,\n} from './utils';\n\nexport const useCrowdViewData = ({\n instrument,\n bookType,\n division,\n granularity,\n}: UseCrowdViewDataProps): UseCrowdViewDataReturn => {\n const dataSource =\n division === Division.Ogm || division === Division.Oj\n ? DataSource.Mt5\n : DataSource.V20;\n\n // Get price candles data\n const {\n loading: priceCandlesLoading,\n data: priceCandlesData,\n error: priceCandlesError,\n } = useQuery<GetPriceCandlesQuery, GetPriceCandlesQueryVariables>(\n getPriceCandles,\n {\n variables: {\n dataSource,\n division,\n instrument:\n dataSource === DataSource.Mt5\n ? INSTRUMENTS_CONFIG[instrument].mt5name\n : INSTRUMENTS_CONFIG[instrument].v20name,\n granularity,\n timeSpan: getTimeSpanForGranularity(granularity),\n },\n fetchPolicy: 'no-cache',\n }\n );\n\n const {\n minPrice,\n maxPrice,\n hasValidCandles,\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n pipsLocation,\n } = useMemo(() => processPriceCandles(priceCandlesData), [priceCandlesData]);\n\n // Get order position books data\n const {\n loading: orderPositionLoading,\n data: orderPositionData,\n error: orderPositionError,\n } = useQuery<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>(\n getOrderPositionBooks,\n {\n variables: {\n instrument: INSTRUMENTS_CONFIG[instrument].v20name,\n bookType: bookType || BookType.Order,\n timeSpan: getTimeSpanForGranularity(granularity),\n granularity,\n maxBookPrice: maxPrice,\n minBookPrice: minPrice,\n bucketMultiplier: 3,\n bucketMargin: BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n },\n fetchPolicy: 'no-cache',\n skip: priceCandlesLoading || !!priceCandlesError,\n }\n );\n\n const {\n bookPrices,\n bookIndexes,\n buckets,\n bucketWidth,\n sentimentThresholdMin,\n sentimentThresholdMax,\n hasValidBooks,\n } = useMemo(\n () => processOrderPositionBooks(orderPositionData, dates),\n [orderPositionData, dates]\n );\n\n // Get sentiments data\n const {\n loading: sentimentsLoading,\n data: sentimentsData,\n error: sentimentsError,\n } = useQuery<GetSentimentsQuery, GetSentimentsQueryVariables>(getSentiments, {\n variables: {\n instrument: INSTRUMENTS_CONFIG[instrument].v20name,\n granularity,\n timeSpan: getTimeSpanForGranularity(granularity),\n },\n fetchPolicy: 'no-cache',\n skip: priceCandlesLoading || !!priceCandlesError,\n });\n\n const { sentimentLongs, sentimentShorts, hasValidSentiments } = useMemo(\n () => processSentiments(sentimentsData, dates),\n [sentimentsData, dates]\n );\n\n // Gather all results\n const loading =\n priceCandlesLoading || orderPositionLoading || sentimentsLoading;\n\n const error = useMemo((): Error | null => {\n if (priceCandlesError) {\n return new Error(`Price candles error: ${priceCandlesError.message}`);\n }\n if (orderPositionError) {\n return new Error(`Order position error: ${orderPositionError.message}`);\n }\n if (sentimentsError) {\n return new Error(`Sentiments error: ${sentimentsError.message}`);\n }\n if (loading) {\n return null;\n }\n return validateData(\n priceCandlesData,\n orderPositionData,\n hasValidCandles,\n hasValidBooks,\n hasValidSentiments\n );\n }, [\n priceCandlesError,\n orderPositionError,\n sentimentsError,\n loading,\n priceCandlesData,\n orderPositionData,\n hasValidCandles,\n hasValidBooks,\n hasValidSentiments,\n ]);\n\n const data = useMemo(() => {\n if (!priceCandlesData || !orderPositionData || !sentimentsData || error) {\n return null;\n }\n\n return {\n mainData: {\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n },\n additionalData: {\n bucketWidth,\n buckets,\n displayPrecision: pipsLocation,\n bookType,\n sentimentThresholdMin,\n sentimentThresholdMax,\n },\n };\n }, [\n priceCandlesData,\n orderPositionData,\n sentimentsData,\n error,\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n bucketWidth,\n buckets,\n pipsLocation,\n bookType,\n sentimentThresholdMin,\n sentimentThresholdMax,\n ]);\n\n return {\n mainData: data?.mainData,\n additionalData: data?.additionalData,\n loading,\n error: !!error,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AASA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAQO,MAAMQ,gBAAgB,GAAGC,IAAA,IAKqB;EAAA,IALpB;IAC/BC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC;EACqB,CAAC,GAAAJ,IAAA;EACtB,MAAMK,UAAU,GACdF,QAAQ,KAAKG,iBAAQ,CAACC,GAAG,IAAIJ,QAAQ,KAAKG,iBAAQ,CAACE,EAAE,GACjDC,mBAAU,CAACC,GAAG,GACdD,mBAAU,CAACE,GAAG;EAGpB,MAAM;IACJC,OAAO,EAAEC,mBAAmB;IAC5BC,IAAI,EAAEC,gBAAgB;IACtBC,KAAK,EAAEC;EACT,CAAC,GAAG,IAAAC,gBAAQ,EACVC,gCAAe,EACf;IACEC,SAAS,EAAE;MACTf,UAAU;MACVF,QAAQ;MACRF,UAAU,EACRI,UAAU,KAAKI,mBAAU,CAACC,GAAG,GACzBW,6BAAkB,CAACpB,UAAU,C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,iBAAiB,EACjBuB,kBAAkB,EAClBqB,eAAe,EACfjD,OAAO,EACPG,gBAAgB,EAChBwB,iBAAiB,EACjBV,eAAe,EACf4B,aAAa,EACbQ,kBAAkB,CACnB,CAAC;EAEF,MAAMnD,IAAI,GAAG,IAAAsB,cAAO,EAAC,MAAM;IACzB,IAAI,CAACrB,gBAAgB,IAAI,CAACwB,iBAAiB,IAAI,CAACqB,cAAc,IAAI5C,KAAK,EAAE;MACvE,OAAO,IAAI;IACb;IAEA,OAAO;MACLuD,QAAQ,EAAE;QACRzC,KAAK;QACLC,WAAW;QACXC,YAAY;QACZC,UAAU;QACVC,WAAW;QACXiB,UAAU;QACVC,WAAW;QACXY,eAAe;QACfD;MACF,CAAC;MACDS,cAAc,EAAE;QACdlB,WAAW;QACXD,OAAO;QACPoB,gBAAgB,EAAEtC,YAAY;QAC9BjC,QAAQ;QACRqD,qBAAqB;QACrBC;MACF;IACF,CAAC;EACH,CAAC,EAAE,CACDzC,gBAAgB,EAChBwB,iBAAiB,EACjBqB,cAAc,EACd5C,KAAK,EACLc,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXiB,UAAU,EACVC,WAAW,EACXY,eAAe,EACfD,cAAc,EACdT,WAAW,EACXD,OAAO,EACPlB,YAAY,EACZjC,QAAQ,EACRqD,qBAAqB,EACrBC,qBAAqB,CACtB,CAAC;EAEF,OAAO;IACLe,QAAQ,EAAEzD,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEyD,QAAQ;IACxBC,cAAc,EAAE1D,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE0D,cAAc;IACpC5D,OAAO;IACPI,KAAK,EAAE,CAAC,CAACA;EACX,CAAC;AACH,CAAC;AAAC0D,OAAA,CAAA3E,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useCrowdViewData.js","names":["_client","require","_react","_getOrderPositionBooks","_getPriceCandles","_getSentiments","_graphql","_constants","_dataUtils","useCrowdViewData","_ref","instrument","bookType","division","granularity","dataSource","Division","Ogm","Oj","DataSource","Mt5","V20","loading","priceCandlesLoading","data","priceCandlesData","error","priceCandlesError","useQuery","getPriceCandles","variables","INSTRUMENTS_CONFIG","mt5name","v20name","timeSpan","getTimeSpanForGranularity","fetchPolicy","minPrice","maxPrice","hasValidCandles","dates","candlesOpen","candlesClose","candlesLow","candlesHigh","pipsLocation","useMemo","processPriceCandles","orderPositionLoading","orderPositionData","orderPositionError","getOrderPositionBooks","BookType","Order","maxBookPrice","minBookPrice","bucketMultiplier","getMultiplayerForTimeSpan","bucketMargin","BUCKET_CONFIG","PRICE_MARGIN_MULTIPLIER","skip","bookPrices","bookIndexes","buckets","bucketWidth","sentimentThresholdMin","sentimentThresholdMax","hasValidBooks","processOrderPositionBooks","sentimentsLoading","sentimentsData","sentimentsError","getSentiments","sentimentLongs","sentimentShorts","hasValidSentiments","processSentiments","Error","concat","message","validateData","mainData","additionalData","defaultBucketWidth","displayPrecision","exports"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/useCrowdViewData.ts"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport { useMemo } from 'react';\n\nimport { getOrderPositionBooks } from '../../../gql/getOrderPositionBooks';\nimport { getPriceCandles } from '../../../gql/getPriceCandles';\nimport { getSentiments } from '../../../gql/getSentiments';\nimport type {\n GetOrderPositionBooksQuery,\n GetOrderPositionBooksQueryVariables,\n GetPriceCandlesQuery,\n GetPriceCandlesQueryVariables,\n GetSentimentsQuery,\n GetSentimentsQueryVariables,\n} from '../../../gql/types/graphql';\nimport { BookType, DataSource, Division } from '../../../gql/types/graphql';\nimport { BUCKET_CONFIG, INSTRUMENTS_CONFIG } from '../../constants';\nimport {\n getMultiplayerForTimeSpan,\n getTimeSpanForGranularity,\n processOrderPositionBooks,\n processPriceCandles,\n processSentiments,\n validateData,\n} from './dataUtils';\nimport type { UseCrowdViewDataProps, UseCrowdViewDataReturn } from './types';\n\nexport const useCrowdViewData = ({\n instrument,\n bookType,\n division,\n granularity,\n}: UseCrowdViewDataProps): UseCrowdViewDataReturn => {\n const dataSource =\n division === Division.Ogm || division === Division.Oj\n ? DataSource.Mt5\n : DataSource.V20;\n\n // Get price candles data\n const {\n loading: priceCandlesLoading,\n data: priceCandlesData,\n error: priceCandlesError,\n } = useQuery<GetPriceCandlesQuery, GetPriceCandlesQueryVariables>(\n getPriceCandles,\n {\n variables: {\n dataSource,\n division,\n instrument:\n dataSource === DataSource.Mt5\n ? INSTRUMENTS_CONFIG[instrument].mt5name\n : INSTRUMENTS_CONFIG[instrument].v20name,\n granularity,\n timeSpan: getTimeSpanForGranularity(granularity),\n },\n fetchPolicy: 'no-cache',\n }\n );\n\n const {\n minPrice,\n maxPrice,\n hasValidCandles,\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n pipsLocation,\n } = useMemo(() => processPriceCandles(priceCandlesData), [priceCandlesData]);\n\n // Get order position books data\n const {\n loading: orderPositionLoading,\n data: orderPositionData,\n error: orderPositionError,\n } = useQuery<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>(\n getOrderPositionBooks,\n {\n variables: {\n instrument: INSTRUMENTS_CONFIG[instrument].v20name,\n bookType: bookType || BookType.Order,\n timeSpan: getTimeSpanForGranularity(granularity),\n granularity,\n maxBookPrice: maxPrice,\n minBookPrice: minPrice,\n bucketMultiplier: getMultiplayerForTimeSpan(granularity),\n bucketMargin: BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n },\n fetchPolicy: 'no-cache',\n skip: priceCandlesLoading || !!priceCandlesError,\n }\n );\n\n const {\n bookPrices,\n bookIndexes,\n buckets,\n bucketWidth,\n sentimentThresholdMin,\n sentimentThresholdMax,\n hasValidBooks,\n } = useMemo(\n () => processOrderPositionBooks(orderPositionData, dates),\n [orderPositionData, dates]\n );\n\n // Get sentiments data\n const {\n loading: sentimentsLoading,\n data: sentimentsData,\n error: sentimentsError,\n } = useQuery<GetSentimentsQuery, GetSentimentsQueryVariables>(getSentiments, {\n variables: {\n instrument: INSTRUMENTS_CONFIG[instrument].v20name,\n granularity,\n timeSpan: getTimeSpanForGranularity(granularity),\n },\n fetchPolicy: 'no-cache',\n skip: priceCandlesLoading || !!priceCandlesError,\n });\n\n const { sentimentLongs, sentimentShorts, hasValidSentiments } = useMemo(\n () => processSentiments(sentimentsData, dates),\n [sentimentsData, dates]\n );\n\n // Gather all results\n const loading =\n priceCandlesLoading || orderPositionLoading || sentimentsLoading;\n\n const error = useMemo((): Error | null => {\n if (priceCandlesError) {\n return new Error(`Price candles error: ${priceCandlesError.message}`);\n }\n if (orderPositionError) {\n return new Error(`Order position error: ${orderPositionError.message}`);\n }\n if (sentimentsError) {\n return new Error(`Sentiments error: ${sentimentsError.message}`);\n }\n if (loading) {\n return null;\n }\n return validateData(\n priceCandlesData,\n orderPositionData,\n hasValidCandles,\n hasValidBooks,\n hasValidSentiments\n );\n }, [\n priceCandlesError,\n orderPositionError,\n sentimentsError,\n loading,\n priceCandlesData,\n orderPositionData,\n hasValidCandles,\n hasValidBooks,\n hasValidSentiments,\n ]);\n\n const data = useMemo(() => {\n if (!priceCandlesData || error) {\n return null;\n }\n\n return {\n mainData: {\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n },\n additionalData: {\n bucketWidth:\n bucketWidth ||\n INSTRUMENTS_CONFIG[instrument].defaultBucketWidth *\n getMultiplayerForTimeSpan(granularity),\n buckets,\n displayPrecision: pipsLocation,\n bookType,\n sentimentThresholdMin,\n sentimentThresholdMax,\n },\n };\n }, [\n priceCandlesData,\n error,\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n bucketWidth,\n granularity,\n instrument,\n buckets,\n pipsLocation,\n bookType,\n sentimentThresholdMin,\n sentimentThresholdMax,\n ]);\n\n return {\n mainData: data?.mainData,\n additionalData: data?.additionalData,\n priceCandlesLoading,\n orderPositionLoading,\n sentimentsLoading,\n loading,\n error: !!error,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AASA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAUO,MAAMQ,gBAAgB,GAAGC,IAAA,IAKqB;EAAA,IALpB;IAC/BC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC;EACqB,CAAC,GAAAJ,IAAA;EACtB,MAAMK,UAAU,GACdF,QAAQ,KAAKG,iBAAQ,CAACC,GAAG,IAAIJ,QAAQ,KAAKG,iBAAQ,CAACE,EAAE,GACjDC,mBAAU,CAACC,GAAG,GACdD,mBAAU,CAACE,GAAG;EAGpB,MAAM;IACJC,OAAO,EAAEC,mBAAmB;IAC5BC,IAAI,EAAEC,gBAAgB;IACtBC,KAAK,EAAEC;EACT,CAAC,GAAG,IAAAC,gBAAQ,EACVC,gCAAe,EACf;IACEC,SAAS,EAAE;MACTf,UAAU;MACVF,QAAQ;MACRF,UAAU,EACRI,UAAU,KAAKI,mBAAU,CAACC,GAAG,GACzBW,6BAAkB,CAACpB,UAAU,CAAC,CAACqB,OAAO,GACtCD,6BAAkB,CAACpB,UAAU,CAAC,CAACsB,OAAO;MAC5CnB,WAAW;MACXoB,QAAQ,EAAE,IAAAC,oCAAyB,EAACrB,WAAW;IACjD,CAAC;IACDsB,WAAW,EAAE;EACf,CACF,CAAC;EAED,MAAM;IACJC,QAAQ;IACRC,QAAQ;IACRC,eAAe;IACfC,KAAK;IACLC,WAAW;IACXC,YAAY;IACZC,UAAU;IACVC,WAAW;IACXC;EACF,CAAC,GAAG,IAAAC,c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,EAAE;QACR1C,KAAK;QACLC,WAAW;QACXC,YAAY;QACZC,UAAU;QACVC,WAAW;QACXkB,UAAU;QACVC,WAAW;QACXY,eAAe;QACfD;MACF,CAAC;MACDS,cAAc,EAAE;QACdlB,WAAW,EACTA,WAAW,IACXlC,6BAAkB,CAACpB,UAAU,CAAC,CAACyE,kBAAkB,GAC/C,IAAA3B,oCAAyB,EAAC3C,WAAW,CAAC;QAC1CkD,OAAO;QACPqB,gBAAgB,EAAExC,YAAY;QAC9BjC,QAAQ;QACRsD,qBAAqB;QACrBC;MACF;IACF,CAAC;EACH,CAAC,EAAE,CACD1C,gBAAgB,EAChBC,KAAK,EACLc,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXkB,UAAU,EACVC,WAAW,EACXY,eAAe,EACfD,cAAc,EACdT,WAAW,EACXnD,WAAW,EACXH,UAAU,EACVqD,OAAO,EACPnB,YAAY,EACZjC,QAAQ,EACRsD,qBAAqB,EACrBC,qBAAqB,CACtB,CAAC;EAEF,OAAO;IACLe,QAAQ,EAAE1D,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE0D,QAAQ;IACxBC,cAAc,EAAE3D,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE2D,cAAc;IACpC5D,mBAAmB;IACnByB,oBAAoB;IACpBsB,iBAAiB;IACjBhD,OAAO;IACPI,KAAK,EAAE,CAAC,CAACA;EACX,CAAC;AACH,CAAC;AAAC4D,OAAA,CAAA7E,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Legend = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
7
8
|
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _graphql = require("../../../gql/types/graphql");
|
|
@@ -11,27 +12,29 @@ var _LegendBar = require("./LegendBar");
|
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
const Legend = _ref => {
|
|
13
14
|
let {
|
|
14
|
-
|
|
15
|
-
shortValues,
|
|
16
|
-
bookType,
|
|
17
|
-
isDark
|
|
15
|
+
bookType
|
|
18
16
|
} = _ref;
|
|
17
|
+
const {
|
|
18
|
+
isDark
|
|
19
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
19
20
|
const {
|
|
20
21
|
lang
|
|
21
22
|
} = (0, _monoI18n.useLocale)();
|
|
22
23
|
return _react.default.createElement("div", {
|
|
23
|
-
className: "lw-
|
|
24
|
+
className: "lw-my-4 lw-w-full"
|
|
25
|
+
}, _react.default.createElement("div", {
|
|
26
|
+
className: "lw-mb-1 lw-flex lw-w-full lw-flex-row lw-justify-between"
|
|
24
27
|
}, _react.default.createElement(_LegendBar.LegendBar, {
|
|
25
28
|
isDark: isDark,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
type: "long"
|
|
30
|
+
}), _react.default.createElement("div", {
|
|
31
|
+
className: "lw-w-[200px]"
|
|
29
32
|
}), _react.default.createElement(_LegendBar.LegendBar, {
|
|
30
33
|
isDark: isDark,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}));
|
|
34
|
+
type: "short"
|
|
35
|
+
})), _react.default.createElement("div", {
|
|
36
|
+
className: "lw-flex lw-w-full lw-flex-row lw-justify-between lw-pb-2 lw-font-sans lw-text-xs lw-text-text-primary"
|
|
37
|
+
}, _react.default.createElement("span", null, lang(bookType === _graphql.BookType.Order ? 'buy_overbalance' : 'long_overbalance')), _react.default.createElement("span", null, lang('even_market_demand')), _react.default.createElement("span", null, lang(bookType === _graphql.BookType.Order ? 'sell_overbalance' : 'short_overbalance'))));
|
|
35
38
|
};
|
|
36
39
|
exports.Legend = Legend;
|
|
37
40
|
//# sourceMappingURL=Legend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legend.js","names":["
|
|
1
|
+
{"version":3,"file":"Legend.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireDefault","_graphql","_LegendBar","e","__esModule","default","Legend","_ref","bookType","isDark","useLayoutProvider","lang","useLocale","createElement","className","LegendBar","type","BookType","Order","exports"],"sources":["../../../../../src/CrowdViewWidget/components/Legend/Legend.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { BookType } from '../../../gql/types/graphql';\nimport { LegendBar } from './LegendBar';\n\ninterface LegendProps {\n bookType: BookType;\n}\n\nexport const Legend = ({ bookType }: LegendProps) => {\n const { isDark } = useLayoutProvider();\n const { lang } = useLocale();\n\n return (\n <div className=\"lw-my-4 lw-w-full\">\n <div className=\"lw-mb-1 lw-flex lw-w-full lw-flex-row lw-justify-between\">\n <LegendBar isDark={isDark} type=\"long\" />\n <div className=\"lw-w-[200px]\" />\n <LegendBar isDark={isDark} type=\"short\" />\n </div>\n <div className=\"lw-flex lw-w-full lw-flex-row lw-justify-between lw-pb-2 lw-font-sans lw-text-xs lw-text-text-primary\">\n <span>\n {lang(\n bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance'\n )}\n </span>\n <span>{lang('even_market_demand')}</span>\n <span>\n {lang(\n bookType === BookType.Order\n ? 'sell_overbalance'\n : 'short_overbalance'\n )}\n </span>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAAwC,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAA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object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LegendBar = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _constants = require("../../constants");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
const LegendBar = _ref => {
|
|
11
12
|
let {
|
|
12
|
-
values,
|
|
13
13
|
type,
|
|
14
|
-
label,
|
|
15
14
|
isDark
|
|
16
15
|
} = _ref;
|
|
17
16
|
const colorPalette = isDark ? _constants.COLOR_MAP.dark : _constants.COLOR_MAP.light;
|
|
18
|
-
const
|
|
17
|
+
const startColor = type === 'long' ? colorPalette.long[1] : colorPalette.short[0];
|
|
18
|
+
const endColor = type === 'long' ? colorPalette.long[0] : colorPalette.short[1];
|
|
19
|
+
const endGradient = type === 'long' ? "linear-gradient(90deg,".concat(endColor, " 0%, transparent 100%)") : "linear-gradient(270deg,".concat(startColor, " 0%, transparent 100%)");
|
|
19
20
|
return _react.default.createElement("div", {
|
|
20
|
-
className:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, label), _react.default.createElement("div", {
|
|
24
|
-
className: "lw-flex lw-h-2 lw-w-full lw-overflow-hidden lw-border lw-border-border-primary"
|
|
21
|
+
className: (0, _labsWidgetCommon.cn)('lw-flex lw-h-2 lw-w-full lw-overflow-hidden', {
|
|
22
|
+
'lw-flex-row-reverse': type === 'short'
|
|
23
|
+
})
|
|
25
24
|
}, _react.default.createElement("div", {
|
|
26
25
|
className: "lw-h-full lw-flex-1",
|
|
27
26
|
"data-testid": "legend-bar-segment",
|
|
28
27
|
style: {
|
|
29
|
-
background: "linear-gradient(90deg,".concat(
|
|
28
|
+
background: "linear-gradient(90deg,".concat(startColor, " 0%, ").concat(endColor, " 100%)")
|
|
30
29
|
}
|
|
31
|
-
})
|
|
32
|
-
className: "lw-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
30
|
+
}), _react.default.createElement("div", {
|
|
31
|
+
className: "lw-h-full lw-w-[10px]",
|
|
32
|
+
"data-testid": "legend-bar-segment",
|
|
33
|
+
style: {
|
|
34
|
+
background: endGradient
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
38
37
|
};
|
|
39
38
|
exports.LegendBar = LegendBar;
|
|
40
39
|
//# sourceMappingURL=LegendBar.js.map
|