@oanda/labs-crowd-view-widget 1.0.52 → 1.0.54
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 +436 -0
- package/dist/main/CrowdViewWidget/Main.js +4 -6
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +18 -31
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +7 -5
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +18 -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 +5 -52
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +54 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +60 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +53 -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 +42 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +75 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +116 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.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 +42 -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 +108 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +83 -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/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 +8 -41
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +43 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +8 -2
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +103 -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 +53 -30
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +15 -13
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +5 -16
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +12 -18
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/gql/getOrderPositionBooks.js +1 -1
- package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/main/gql/getPriceCandles.js +1 -1
- package/dist/main/gql/getPriceCandles.js.map +1 -1
- package/dist/main/gql/types/gql.js +2 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +111 -18
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/translations/sources/en.json +2 -1
- package/dist/module/CrowdViewWidget/Main.js +3 -5
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +20 -33
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +7 -5
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +11 -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 +5 -52
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +46 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +53 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +46 -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 +35 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +68 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.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 +35 -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 +101 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +8 -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/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 +7 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +36 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +8 -2
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +96 -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 +50 -27
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js +15 -13
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +5 -16
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +10 -17
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/gql/getOrderPositionBooks.js +1 -1
- package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/module/gql/getPriceCandles.js +1 -1
- package/dist/module/gql/getPriceCandles.js.map +1 -1
- package/dist/module/gql/types/gql.js +2 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +111 -18
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/translations/sources/en.json +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +9 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +11 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +16 -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 +9 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +10 -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 +17 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getRectColor.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +10 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +7 -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/getTimeSpanForGranularity.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/index.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.d.ts +11 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.d.ts +12 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/processSentiments.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +28 -11
- 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 +4 -12
- package/dist/types/gql/types/gql.d.ts +6 -4
- package/dist/types/gql/types/graphql.d.ts +30 -11
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +3 -4
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +25 -40
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +8 -4
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +29 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +84 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +52 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +82 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +63 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +63 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts +32 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +43 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +77 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +10 -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 +42 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts +27 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +183 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +7 -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/getTimeSpanForGranularity.ts +14 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/index.ts +6 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.ts +92 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.ts +67 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/processSentiments.ts +55 -0
- package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.ts +10 -2
- package/src/CrowdViewWidget/components/Chart/getOption.ts +114 -0
- package/src/CrowdViewWidget/components/Chart/index.ts +1 -1
- package/src/CrowdViewWidget/components/Chart/types.ts +30 -19
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +84 -67
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +24 -23
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +13 -26
- package/src/CrowdViewWidget/constants.ts +21 -23
- package/src/gql/getOrderPositionBooks.ts +13 -5
- package/src/gql/getPriceCandles.ts +1 -0
- package/src/gql/types/gql.ts +6 -6
- package/src/gql/types/graphql.ts +98 -16
- package/src/translations/sources/en.json +2 -1
- package/test/components/Chart/utils/chartUtils.test.ts +39 -21
- package/test/components/Chart/utils/getChartStyles.test.ts +10 -10
- package/test/components/Chart/utils/processSentiments.test.ts +138 -30
- package/test/components/Legend.test.tsx +13 -21
- package/test/components/LegendBar.test.tsx +31 -51
- package/test/utils/instrumentUtils.test.ts +1 -1
- package/test/utils/processOrderPositionBooks.test.ts +201 -84
- package/test/utils/processPriceCandles.test.ts +93 -67
- package/test/utils/validateData.test.ts +136 -38
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +0 -359
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -37
- package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -127
- 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/getTargetBucketWidth.js +0 -14
- package/dist/main/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -29
- package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +0 -23
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +0 -43
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js +0 -28
- 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 -351
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -29
- package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -114
- 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/getTargetBucketWidth.js +0 -7
- package/dist/module/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +0 -10
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -22
- package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +0 -16
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +0 -36
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js +0 -21
- 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/aggregateBuckets.d.ts +0 -2
- package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +0 -31
- package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +0 -97
- package/dist/types/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.d.ts +0 -3
- package/dist/types/CrowdViewWidget/components/Chart/utils/index.d.ts +0 -9
- package/dist/types/CrowdViewWidget/components/Chart/utils/processBuckets.d.ts +0 -3
- package/dist/types/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.d.ts +0 -8
- package/dist/types/CrowdViewWidget/components/Chart/utils/processPriceCandles.d.ts +0 -27
- package/dist/types/CrowdViewWidget/components/Chart/utils/processSentiments.d.ts +0 -3
- package/src/CrowdViewWidget/components/Chart/chartOptions.ts +0 -401
- package/src/CrowdViewWidget/components/Chart/utils/aggregateBuckets.ts +0 -44
- package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +0 -216
- package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +0 -148
- package/src/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.ts +0 -13
- package/src/CrowdViewWidget/components/Chart/utils/index.ts +0 -9
- package/src/CrowdViewWidget/components/Chart/utils/processBuckets.ts +0 -43
- package/src/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.ts +0 -30
- package/src/CrowdViewWidget/components/Chart/utils/processPriceCandles.ts +0 -53
- package/src/CrowdViewWidget/components/Chart/utils/processSentiments.ts +0 -42
- package/test/utils/aggregateBuckets.test.ts +0 -82
- package/test/utils/getTargetBucketWidth.test.ts +0 -37
- package/test/utils/processBuckets.test.ts +0 -153
- /package/dist/types/CrowdViewWidget/components/Chart/{chartOptions.d.ts → getOption.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processSentiments.js","names":["processSentiments","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"],"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":"AAEA,OAAO,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,qBAAA,CAA4BI,UAAU,cAAAJ,qBAAA,eAAtCA,qBAAA,CAAwCG,MAAM,GAC/C;IACA,OAAO;MACLE,cAAc,EAAE,EAAE;MAClBC,eAAe,EAAE,EAAE;MACnBC,kBAAkB,EAAE;IACtB,CAAC;EACH;EAEA,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAC1BX,cAAc,CAACM,UAAU,CAACA,UAAU,CAACM,GAAG,CAAEC,IAAI;IAAA,IAAAC,qBAAA,EAAAC,eAAA,EAAAC,qBAAA,EAAAC,gBAAA;IAAA,OAAK,CACjDJ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEK,IAAI,EACV;MACEV,eAAe,GAAAM,qBAAA,GAAED,IAAI,aAAJA,IAAI,gBAAAE,eAAA,GAAJF,IAAI,CAAEM,SAAS,cAAAJ,eAAA,uBAAfA,eAAA,CAAiBK,YAAY,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,IAAI;MACtDP,cAAc,GAAAS,qBAAA,GAAEH,IAAI,aAAJA,IAAI,gBAAAI,gBAAA,GAAJJ,IAAI,CAAEM,SAAS,cAAAF,gBAAA,uBAAfA,gBAAA,CAAiBI,WAAW,cAAAL,qBAAA,cAAAA,qBAAA,GAAI;IAClD,CAAC,CACF;EAAA,EACH,CAAC;EAED,MAAM;IAAET,cAAc;IAAEC;EAAgB,CAAC,GAAGP,KAAK,CAACqB,MAAM,CACtD,CAACC,GAAG,EAAEC,IAAI,KAAK;IACb,MAAML,SAAS,GAAGT,YAAY,CAACe,GAAG,CAACD,IAAI,CAAC;IAExC,OAAO;MACLjB,cAAc,EAAE,CACd,GAAGgB,GAAG,CAAChB,cAAc,EACrB,CAAAY,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEZ,cAAc,KAAI,IAAI,CAClC;MACDC,eAAe,EAAE,CACf,GAAGe,GAAG,CAACf,eAAe,EACtB,CAAAW,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEX,eAAe,KAAI,IAAI;IAEtC,CAAC;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","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const validateData = (priceCandlesData, orderPositionData, hasValidCandles) => {
|
|
1
|
+
export const validateData = (priceCandlesData, orderPositionData, hasValidCandles, hasValidBooks, hasValidSentiments) => {
|
|
2
2
|
var _priceCandlesData$pri, _priceCandlesData$pri2, _orderPositionData$or, _orderPositionData$or2;
|
|
3
3
|
const hasValidPriceData = ((_priceCandlesData$pri = priceCandlesData === null || priceCandlesData === void 0 || (_priceCandlesData$pri2 = priceCandlesData.priceCandles) === null || _priceCandlesData$pri2 === void 0 || (_priceCandlesData$pri2 = _priceCandlesData$pri2.candle) === null || _priceCandlesData$pri2 === void 0 ? void 0 : _priceCandlesData$pri2.length) !== null && _priceCandlesData$pri !== void 0 ? _priceCandlesData$pri : 0) >= 1;
|
|
4
|
-
const hasValidOrderData = ((_orderPositionData$or = orderPositionData === null || orderPositionData === void 0 || (_orderPositionData$or2 = orderPositionData.orderPositionBooks) === null || _orderPositionData$or2 === void 0 ? void 0 : _orderPositionData$or2.length) !== null && _orderPositionData$or !== void 0 ? _orderPositionData$or : 0) >= 1;
|
|
4
|
+
const hasValidOrderData = ((_orderPositionData$or = orderPositionData === null || orderPositionData === void 0 || (_orderPositionData$or2 = orderPositionData.orderPositionBooks) === null || _orderPositionData$or2 === void 0 || (_orderPositionData$or2 = _orderPositionData$or2.books) === null || _orderPositionData$or2 === void 0 ? void 0 : _orderPositionData$or2.length) !== null && _orderPositionData$or !== void 0 ? _orderPositionData$or : 0) >= 1;
|
|
5
5
|
if (!hasValidPriceData) {
|
|
6
6
|
return new Error('Insufficient price candle data');
|
|
7
7
|
}
|
|
@@ -11,6 +11,12 @@ export const validateData = (priceCandlesData, orderPositionData, hasValidCandle
|
|
|
11
11
|
if (!hasValidCandles) {
|
|
12
12
|
return new Error('Invalid candle data');
|
|
13
13
|
}
|
|
14
|
+
if (!hasValidBooks) {
|
|
15
|
+
return new Error('Invalid book data');
|
|
16
|
+
}
|
|
17
|
+
if (!hasValidSentiments) {
|
|
18
|
+
return new Error('Invalid sentiment data');
|
|
19
|
+
}
|
|
14
20
|
return null;
|
|
15
21
|
};
|
|
16
22
|
//# sourceMappingURL=validateData.js.map
|
|
@@ -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"],"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":"AAKA,OAAO,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","ignoreList":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { CHART_CONFIG } from '../../constants';
|
|
2
|
+
import { getDataZoomConfig, getGridConfig, getGridLines, getSeriesCandlestickConfig, getSeriesHeatmapConfig, getSeriesSentimentConfig, getTooltipConfig, getVisualMapConfig, getXAxisConfig, getYAxisConfig } from './chartOptions';
|
|
3
|
+
import { isDifferenceGreaterThanTwoWeeks } from './chartUtils';
|
|
4
|
+
import { getChartStyles } from './chartUtils/getChartStyles';
|
|
5
|
+
export const getOption = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
mainData: {
|
|
8
|
+
dates,
|
|
9
|
+
candlesOpen,
|
|
10
|
+
candlesClose,
|
|
11
|
+
candlesLow,
|
|
12
|
+
candlesHigh,
|
|
13
|
+
bookPrices,
|
|
14
|
+
bookIndexes,
|
|
15
|
+
sentimentShorts,
|
|
16
|
+
sentimentLongs
|
|
17
|
+
},
|
|
18
|
+
additionalData: {
|
|
19
|
+
bucketWidth,
|
|
20
|
+
buckets,
|
|
21
|
+
displayPrecision,
|
|
22
|
+
bookType,
|
|
23
|
+
sentimentThresholdMin,
|
|
24
|
+
sentimentThresholdMax
|
|
25
|
+
},
|
|
26
|
+
isDark,
|
|
27
|
+
isDesktop,
|
|
28
|
+
labelCallback
|
|
29
|
+
} = _ref;
|
|
30
|
+
const styles = getChartStyles(isDark);
|
|
31
|
+
const selectedPriceRef = {
|
|
32
|
+
current: 0
|
|
33
|
+
};
|
|
34
|
+
const visibleXAxisData = dates.slice(dates.length * CHART_CONFIG.INITIAL_START_ZOOM / 100, dates.length * CHART_CONFIG.INITIAL_END_ZOOM / 100);
|
|
35
|
+
const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(visibleXAxisData[0], visibleXAxisData[visibleXAxisData.length - 1]);
|
|
36
|
+
return {
|
|
37
|
+
animation: false,
|
|
38
|
+
tooltip: getTooltipConfig({
|
|
39
|
+
bookType,
|
|
40
|
+
bucketWidth,
|
|
41
|
+
buckets,
|
|
42
|
+
displayPrecision,
|
|
43
|
+
labelCallback,
|
|
44
|
+
selectedPriceRef,
|
|
45
|
+
tooltipLinesColor: styles.tooltipLinesColor
|
|
46
|
+
}),
|
|
47
|
+
grid: getGridConfig({
|
|
48
|
+
isDesktop
|
|
49
|
+
}),
|
|
50
|
+
xAxis: getXAxisConfig({
|
|
51
|
+
dates,
|
|
52
|
+
isGreaterThanTwoWeeks
|
|
53
|
+
}),
|
|
54
|
+
yAxis: getYAxisConfig({
|
|
55
|
+
bucketWidth,
|
|
56
|
+
displayPrecision,
|
|
57
|
+
isDesktop,
|
|
58
|
+
labelCallback
|
|
59
|
+
}),
|
|
60
|
+
dataZoom: getDataZoomConfig(),
|
|
61
|
+
visualMap: getVisualMapConfig({
|
|
62
|
+
sentimentLongColor: styles.sentimentLongColor,
|
|
63
|
+
sentimentShortColor: styles.sentimentShortColor
|
|
64
|
+
}),
|
|
65
|
+
graphic: getGridLines({
|
|
66
|
+
isDark
|
|
67
|
+
}),
|
|
68
|
+
dataset: {
|
|
69
|
+
source: {
|
|
70
|
+
dates,
|
|
71
|
+
candlesOpen,
|
|
72
|
+
candlesClose,
|
|
73
|
+
candlesLow,
|
|
74
|
+
candlesHigh,
|
|
75
|
+
bookPrices: bookPrices !== null && bookPrices !== void 0 ? bookPrices : [],
|
|
76
|
+
bookIndexes: bookIndexes !== null && bookIndexes !== void 0 ? bookIndexes : [],
|
|
77
|
+
sentimentShorts,
|
|
78
|
+
sentimentLongs
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
series: [getSeriesCandlestickConfig({
|
|
82
|
+
dates,
|
|
83
|
+
isGreaterThanTwoWeeks,
|
|
84
|
+
styles
|
|
85
|
+
}), getSeriesHeatmapConfig({
|
|
86
|
+
bucketWidth,
|
|
87
|
+
buckets,
|
|
88
|
+
isDark,
|
|
89
|
+
sentimentThresholdMax,
|
|
90
|
+
sentimentThresholdMin
|
|
91
|
+
}), getSeriesSentimentConfig({
|
|
92
|
+
styles
|
|
93
|
+
})]
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=getOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["CHART_CONFIG","getDataZoomConfig","getGridConfig","getGridLines","getSeriesCandlestickConfig","getSeriesHeatmapConfig","getSeriesSentimentConfig","getTooltipConfig","getVisualMapConfig","getXAxisConfig","getYAxisConfig","isDifferenceGreaterThanTwoWeeks","getChartStyles","getOption","_ref","mainData","dates","candlesOpen","candlesClose","candlesLow","candlesHigh","bookPrices","bookIndexes","sentimentShorts","sentimentLongs","additionalData","bucketWidth","buckets","displayPrecision","bookType","sentimentThresholdMin","sentimentThresholdMax","isDark","isDesktop","labelCallback","styles","selectedPriceRef","current","visibleXAxisData","slice","length","INITIAL_START_ZOOM","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","animation","tooltip","tooltipLinesColor","grid","xAxis","yAxis","dataZoom","visualMap","sentimentLongColor","sentimentShortColor","graphic","dataset","source","series"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/getOption.ts"],"sourcesContent":["import { CHART_CONFIG } from '../../constants';\nimport {\n getDataZoomConfig,\n getGridConfig,\n getGridLines,\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 isDark,\n isDesktop,\n labelCallback,\n}) => {\n const styles = getChartStyles(isDark);\n const selectedPriceRef = { current: 0 };\n\n const visibleXAxisData = dates.slice(\n (dates.length * CHART_CONFIG.INITIAL_START_ZOOM) / 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 return {\n animation: false,\n tooltip: getTooltipConfig({\n bookType,\n bucketWidth,\n buckets,\n displayPrecision,\n labelCallback,\n selectedPriceRef,\n tooltipLinesColor: styles.tooltipLinesColor,\n }),\n grid: getGridConfig({ isDesktop }),\n xAxis: getXAxisConfig({\n dates,\n isGreaterThanTwoWeeks,\n }),\n yAxis: getYAxisConfig({\n bucketWidth,\n displayPrecision,\n isDesktop,\n labelCallback,\n }),\n dataZoom: getDataZoomConfig(),\n visualMap: getVisualMapConfig({\n sentimentLongColor: styles.sentimentLongColor,\n sentimentShortColor: styles.sentimentShortColor,\n }),\n graphic: getGridLines({ isDark }),\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 dates,\n isGreaterThanTwoWeeks,\n styles,\n }),\n getSeriesHeatmapConfig({\n bucketWidth,\n buckets,\n isDark,\n sentimentThresholdMax,\n sentimentThresholdMin,\n }),\n getSeriesSentimentConfig({\n styles,\n }),\n ],\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SACEC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,0BAA0B,EAC1BC,sBAAsB,EACtBC,wBAAwB,EACxBC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,EACdC,cAAc,QACT,gBAAgB;AACvB,SAASC,+BAA+B,QAAQ,cAAc;AAC9D,SAASC,cAAc,QAAQ,6BAA6B;AAG5D,OAAO,MAAMC,SAAwB,GAAGC,IAAA,IAuBlC;EAAA,IAvBmC;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,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,GAAApB,IAAA;EACC,MAAMqB,MAAM,GAAGvB,cAAc,CAACoB,MAAM,CAAC;EACrC,MAAMI,gBAAgB,GAAG;IAAEC,OAAO,EAAE;EAAE,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XA,WAAW,GAAI,EAAE;QAC9BC,eAAe;QACfC;MACF;IACF,CAAC;IACDiC,MAAM,EAAE,CACNrD,0BAA0B,CAAC;MACzBY,KAAK;MACL2B,qBAAqB;MACrBR;IACF,CAAC,CAAC,EACF9B,sBAAsB,CAAC;MACrBqB,WAAW;MACXC,OAAO;MACPK,MAAM;MACND,qBAAqB;MACrBD;IACF,CAAC,CAAC,EACFxB,wBAAwB,CAAC;MACvB6B;IACF,CAAC,CAAC;EAEN,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/CrowdViewWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\nexport * from './chartOptions';\nexport * from './ChartWithData';\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"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,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,oBAAoB","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\
|
|
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":[]}
|
|
@@ -5,7 +5,7 @@ import { getPriceCandles } from '../../../gql/getPriceCandles';
|
|
|
5
5
|
import { getSentiments } from '../../../gql/getSentiments';
|
|
6
6
|
import { BookType, DataSource, Division } from '../../../gql/types/graphql';
|
|
7
7
|
import { BUCKET_CONFIG, INSTRUMENTS_CONFIG } from '../../constants';
|
|
8
|
-
import {
|
|
8
|
+
import { getTimeSpanForGranularity, processOrderPositionBooks, processPriceCandles, processSentiments, validateData } from './dataUtils';
|
|
9
9
|
export const useCrowdViewData = _ref => {
|
|
10
10
|
let {
|
|
11
11
|
instrument,
|
|
@@ -28,17 +28,17 @@ export const useCrowdViewData = _ref => {
|
|
|
28
28
|
},
|
|
29
29
|
fetchPolicy: 'no-cache'
|
|
30
30
|
});
|
|
31
|
-
const priceCandlesProcessed = useMemo(() => processPriceCandles(priceCandlesData), [priceCandlesData]);
|
|
32
31
|
const {
|
|
33
32
|
minPrice,
|
|
34
33
|
maxPrice,
|
|
35
34
|
hasValidCandles,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
dates,
|
|
36
|
+
candlesOpen,
|
|
37
|
+
candlesClose,
|
|
38
|
+
candlesLow,
|
|
39
|
+
candlesHigh,
|
|
40
|
+
pipsLocation
|
|
41
|
+
} = useMemo(() => processPriceCandles(priceCandlesData), [priceCandlesData]);
|
|
42
42
|
const {
|
|
43
43
|
loading: orderPositionLoading,
|
|
44
44
|
data: orderPositionData,
|
|
@@ -49,12 +49,23 @@ export const useCrowdViewData = _ref => {
|
|
|
49
49
|
bookType: bookType || BookType.Order,
|
|
50
50
|
timeSpan: getTimeSpanForGranularity(granularity),
|
|
51
51
|
granularity,
|
|
52
|
-
maxBookPrice,
|
|
53
|
-
minBookPrice
|
|
52
|
+
maxBookPrice: maxPrice,
|
|
53
|
+
minBookPrice: minPrice,
|
|
54
|
+
bucketMultiplier: 2,
|
|
55
|
+
bucketMargin: BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER
|
|
54
56
|
},
|
|
55
57
|
fetchPolicy: 'no-cache',
|
|
56
58
|
skip: priceCandlesLoading || !!priceCandlesError
|
|
57
59
|
});
|
|
60
|
+
const {
|
|
61
|
+
bookPrices,
|
|
62
|
+
bookIndexes,
|
|
63
|
+
buckets,
|
|
64
|
+
bucketWidth,
|
|
65
|
+
sentimentThresholdMin,
|
|
66
|
+
sentimentThresholdMax,
|
|
67
|
+
hasValidBooks
|
|
68
|
+
} = useMemo(() => processOrderPositionBooks(orderPositionData, dates), [orderPositionData, dates]);
|
|
58
69
|
const {
|
|
59
70
|
loading: sentimentsLoading,
|
|
60
71
|
data: sentimentsData,
|
|
@@ -68,11 +79,12 @@ export const useCrowdViewData = _ref => {
|
|
|
68
79
|
fetchPolicy: 'no-cache',
|
|
69
80
|
skip: priceCandlesLoading || !!priceCandlesError
|
|
70
81
|
});
|
|
82
|
+
const {
|
|
83
|
+
sentimentLongs,
|
|
84
|
+
sentimentShorts,
|
|
85
|
+
hasValidSentiments
|
|
86
|
+
} = useMemo(() => processSentiments(sentimentsData, dates), [sentimentsData, dates]);
|
|
71
87
|
const loading = priceCandlesLoading || orderPositionLoading || sentimentsLoading;
|
|
72
|
-
const xAxisData = candles.map(candle => (candle === null || candle === void 0 ? void 0 : candle.point) || '');
|
|
73
|
-
const orderPositionBooks = useMemo(() => processOrderPositionBooks(orderPositionData, candleMap), [orderPositionData, candleMap]);
|
|
74
|
-
const buckets = useMemo(() => processBuckets(orderPositionData, targetBucketWidth), [orderPositionData, targetBucketWidth]);
|
|
75
|
-
const sentiments = useMemo(() => processSentiments(sentimentsData, xAxisData), [sentimentsData, xAxisData]);
|
|
76
88
|
const error = useMemo(() => {
|
|
77
89
|
if (priceCandlesError) {
|
|
78
90
|
return new Error("Price candles error: ".concat(priceCandlesError.message));
|
|
@@ -86,26 +98,37 @@ export const useCrowdViewData = _ref => {
|
|
|
86
98
|
if (loading) {
|
|
87
99
|
return null;
|
|
88
100
|
}
|
|
89
|
-
return validateData(priceCandlesData, orderPositionData, hasValidCandles);
|
|
90
|
-
}, [priceCandlesError, orderPositionError, sentimentsError, loading, priceCandlesData, orderPositionData, hasValidCandles]);
|
|
101
|
+
return validateData(priceCandlesData, orderPositionData, hasValidCandles, hasValidBooks, hasValidSentiments);
|
|
102
|
+
}, [priceCandlesError, orderPositionError, sentimentsError, loading, priceCandlesData, orderPositionData, hasValidCandles, hasValidBooks, hasValidSentiments]);
|
|
91
103
|
const data = useMemo(() => {
|
|
92
104
|
if (!priceCandlesData || !orderPositionData || !sentimentsData || error) {
|
|
93
105
|
return null;
|
|
94
106
|
}
|
|
95
|
-
const candlesSeriesData = candles.map(candle => [(candle === null || candle === void 0 ? void 0 : candle.open) || 0, (candle === null || candle === void 0 ? void 0 : candle.close) || 0, (candle === null || candle === void 0 ? void 0 : candle.low) || 0, (candle === null || candle === void 0 ? void 0 : candle.high) || 0]);
|
|
96
107
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
mainData: {
|
|
109
|
+
dates,
|
|
110
|
+
candlesOpen,
|
|
111
|
+
candlesClose,
|
|
112
|
+
candlesLow,
|
|
113
|
+
candlesHigh,
|
|
114
|
+
bookPrices,
|
|
115
|
+
bookIndexes,
|
|
116
|
+
sentimentShorts,
|
|
117
|
+
sentimentLongs
|
|
118
|
+
},
|
|
119
|
+
additionalData: {
|
|
120
|
+
bucketWidth,
|
|
121
|
+
buckets,
|
|
122
|
+
displayPrecision: pipsLocation,
|
|
123
|
+
bookType,
|
|
124
|
+
sentimentThresholdMin,
|
|
125
|
+
sentimentThresholdMax
|
|
126
|
+
}
|
|
105
127
|
};
|
|
106
|
-
}, [priceCandlesData, orderPositionData, sentimentsData, error,
|
|
128
|
+
}, [priceCandlesData, orderPositionData, sentimentsData, error, dates, candlesOpen, candlesClose, candlesLow, candlesHigh, bookPrices, bookIndexes, sentimentShorts, sentimentLongs, bucketWidth, buckets, pipsLocation, bookType, sentimentThresholdMin, sentimentThresholdMax]);
|
|
107
129
|
return {
|
|
108
|
-
data,
|
|
130
|
+
mainData: data === null || data === void 0 ? void 0 : data.mainData,
|
|
131
|
+
additionalData: data === null || data === void 0 ? void 0 : data.additionalData,
|
|
109
132
|
loading,
|
|
110
133
|
error: !!error
|
|
111
134
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrowdViewData.js","names":["useQuery","useMemo","getOrderPositionBooks","getPriceCandles","getSentiments","BookType","DataSource","Division","BUCKET_CONFIG","INSTRUMENTS_CONFIG","getTargetBucketWidth","getTimeSpanForGranularity","processBuckets","processOrderPositionBooks","processPriceCandles","processSentiments","validateData","useCrowdViewData","_ref","instrument","bookType","division","granularity","dataSource","Ogm","Oj","Mt5","V20","loading","priceCandlesLoading","data","priceCandlesData","error","priceCandlesError","variables","mt5name","v20name","timeSpan","fetchPolicy","priceCandlesProcessed","minPrice","maxPrice","hasValidCandles","candleMap","candles","targetBucketWidth","maxBookPrice","PRICE_PADDING_MULTIPLIER","minBookPrice","orderPositionLoading","orderPositionData","orderPositionError","Order","skip","sentimentsLoading","sentimentsData","sentimentsError","xAxisData","map","candle","point","orderPositionBooks","buckets","sentiments","Error","concat","message","candlesSeriesData","open","close","low","high","bucketWidth","precision"],"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 getTargetBucketWidth,\n getTimeSpanForGranularity,\n processBuckets,\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 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 priceCandlesProcessed = useMemo(\n () => processPriceCandles(priceCandlesData),\n [priceCandlesData]\n );\n\n const { minPrice, maxPrice, hasValidCandles, candleMap, candles } =\n priceCandlesProcessed;\n\n const targetBucketWidth = getTargetBucketWidth(granularity, instrument);\n\n const maxBookPrice = useMemo(\n () => maxPrice + targetBucketWidth * BUCKET_CONFIG.PRICE_PADDING_MULTIPLIER,\n [maxPrice, targetBucketWidth]\n );\n\n const minBookPrice = useMemo(\n () => minPrice - targetBucketWidth * BUCKET_CONFIG.PRICE_PADDING_MULTIPLIER,\n [minPrice, targetBucketWidth]\n );\n\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,\n minBookPrice,\n },\n fetchPolicy: 'no-cache',\n skip: priceCandlesLoading || !!priceCandlesError,\n }\n );\n\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 loading =\n priceCandlesLoading || orderPositionLoading || sentimentsLoading;\n const xAxisData = candles.map((candle) => candle?.point || '');\n\n const orderPositionBooks = useMemo(\n () => processOrderPositionBooks(orderPositionData, candleMap),\n [orderPositionData, candleMap]\n );\n\n const buckets = useMemo(\n () => processBuckets(orderPositionData, targetBucketWidth),\n [orderPositionData, targetBucketWidth]\n );\n\n const sentiments = useMemo(\n () => processSentiments(sentimentsData, xAxisData),\n [sentimentsData, xAxisData]\n );\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(priceCandlesData, orderPositionData, hasValidCandles);\n }, [\n priceCandlesError,\n orderPositionError,\n sentimentsError,\n loading,\n priceCandlesData,\n orderPositionData,\n hasValidCandles,\n ]);\n\n const data = useMemo(() => {\n if (!priceCandlesData || !orderPositionData || !sentimentsData || error) {\n return null;\n }\n\n const candlesSeriesData: [number, number, number, number][] = candles.map(\n (candle) => [\n candle?.open || 0,\n candle?.close || 0,\n candle?.low || 0,\n candle?.high || 0,\n ]\n );\n\n return {\n buckets,\n xAxisData,\n candlesSeriesData,\n orderPositionBooks,\n bucketWidth: targetBucketWidth,\n precision: INSTRUMENTS_CONFIG[instrument].precision,\n bookType,\n sentiments,\n };\n }, [\n priceCandlesData,\n orderPositionData,\n sentimentsData,\n error,\n candles,\n buckets,\n xAxisData,\n orderPositionBooks,\n targetBucketWidth,\n instrument,\n bookType,\n sentiments,\n ]);\n\n return {\n data,\n loading,\n error: !!error,\n };\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,OAAO,QAAQ,OAAO;AAE/B,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAS1D,SAASC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,4BAA4B;AAC3E,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,iBAAiB;AAEnE,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,cAAc,EACdC,yBAAyB,EACzBC,mBAAmB,EACnBC,iBAAiB,EACjBC,YAAY,QACP,SAAS;AAEhB,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAKqB;EAAA,IALpB;IAC/BC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC;EACqB,CAAC,GAAAJ,IAAA;EACtB,MAAMK,UAAU,GACdF,QAAQ,KAAKd,QAAQ,CAACiB,GAAG,IAAIH,QAAQ,KAAKd,QAAQ,CAACkB,EAAE,G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AAO;MACPL,SAAS;MACTU,iBAAiB;MACjBN,kBAAkB;MAClBW,WAAW,EAAE3B,iBAAiB;MAC9B4B,SAAS,EAAEhE,kBAAkB,CAACU,UAAU,CAAC,CAACsD,SAAS;MACnDrD,QAAQ;MACR2C;IACF,CAAC;EACH,CAAC,EAAE,CACDhC,gBAAgB,EAChBmB,iBAAiB,EACjBK,cAAc,EACdvB,KAAK,EACLY,OAAO,EACPkB,OAAO,EACPL,SAAS,EACTI,kBAAkB,EAClBhB,iBAAiB,EACjB1B,UAAU,EACVC,QAAQ,EACR2C,UAAU,CACX,CAAC;EAEF,OAAO;IACLjC,IAAI;IACJF,OAAO;IACPI,KAAK,EAAE,CAAC,CAACA;EACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useCrowdViewData.js","names":["useQuery","useMemo","getOrderPositionBooks","getPriceCandles","getSentiments","BookType","DataSource","Division","BUCKET_CONFIG","INSTRUMENTS_CONFIG","getTimeSpanForGranularity","processOrderPositionBooks","processPriceCandles","processSentiments","validateData","useCrowdViewData","_ref","instrument","bookType","division","granularity","dataSource","Ogm","Oj","Mt5","V20","loading","priceCandlesLoading","data","priceCandlesData","error","priceCandlesError","variables","mt5name","v20name","timeSpan","fetchPolicy","minPrice","maxPrice","hasValidCandles","dates","candlesOpen","candlesClose","candlesLow","candlesHigh","pipsLocation","orderPositionLoading","orderPositionData","orderPositionError","Order","maxBookPrice","minBookPrice","bucketMultiplier","bucketMargin","PRICE_MARGIN_MULTIPLIER","skip","bookPrices","bookIndexes","buckets","bucketWidth","sentimentThresholdMin","sentimentThresholdMax","hasValidBooks","sentimentsLoading","sentimentsData","sentimentsError","sentimentLongs","sentimentShorts","hasValidSentiments","Error","concat","message","mainData","additionalData","displayPrecision"],"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 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: 2,\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,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,OAAO,QAAQ,OAAO;AAE/B,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAS1D,SAASC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,4BAA4B;AAC3E,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,iBAAiB;AACnE,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,mBAAmB,EACnBC,iBAAiB,EACjBC,YAAY,QACP,aAAa;AAGpB,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAKqB;EAAA,IALpB;IAC/BC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC;EACqB,CAAC,GAAAJ,IAAA;EACtB,MAAMK,UAAU,GACdF,QAAQ,KAAKZ,QAAQ,CAACe,GAAG,IAAIH,QAAQ,KAAKZ,QAAQ,CAACgB,EAAE,GACjDjB,UAAU,CAACkB,GAAG,GACdlB,UAAU,CAACmB,GAAG;EAGpB,MAAM;IACJC,OAAO,EAAEC,mBAAmB;IAC5BC,IAAI,EAAEC,gBAAgB;IACtBC,KAAK,EAAEC;EACT,CAAC,GAAG/B,QAAQ,CAC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bM,kBACF,CAAC;EACH,CAAC,EAAE,CACDrC,iBAAiB,EACjBiB,kBAAkB,EAClBiB,eAAe,EACfvC,OAAO,EACPG,gBAAgB,EAChBkB,iBAAiB,EACjBR,eAAe,EACfuB,aAAa,EACbM,kBAAkB,CACnB,CAAC;EAEF,MAAMxC,IAAI,GAAG3B,OAAO,CAAC,MAAM;IACzB,IAAI,CAAC4B,gBAAgB,IAAI,CAACkB,iBAAiB,IAAI,CAACiB,cAAc,IAAIlC,KAAK,EAAE;MACvE,OAAO,IAAI;IACb;IAEA,OAAO;MACL0C,QAAQ,EAAE;QACRhC,KAAK;QACLC,WAAW;QACXC,YAAY;QACZC,UAAU;QACVC,WAAW;QACXY,UAAU;QACVC,WAAW;QACXU,eAAe;QACfD;MACF,CAAC;MACDO,cAAc,EAAE;QACdd,WAAW;QACXD,OAAO;QACPgB,gBAAgB,EAAE7B,YAAY;QAC9B3B,QAAQ;QACR0C,qBAAqB;QACrBC;MACF;IACF,CAAC;EACH,CAAC,EAAE,CACDhC,gBAAgB,EAChBkB,iBAAiB,EACjBiB,cAAc,EACdlC,KAAK,EACLU,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXY,UAAU,EACVC,WAAW,EACXU,eAAe,EACfD,cAAc,EACdP,WAAW,EACXD,OAAO,EACPb,YAAY,EACZ3B,QAAQ,EACR0C,qBAAqB,EACrBC,qBAAqB,CACtB,CAAC;EAEF,OAAO;IACLW,QAAQ,EAAE5C,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE4C,QAAQ;IACxBC,cAAc,EAAE7C,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE6C,cAAc;IACpC/C,OAAO;IACPI,KAAK,EAAE,CAAC,CAACA;EACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
+
import { useLayoutProvider } from '@oanda/labs-widget-common';
|
|
1
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { BookType } from '../../../gql/types/graphql';
|
|
4
|
-
import { BOOKS_THRESHOLDS } from '../../constants';
|
|
5
5
|
import { LegendBar } from './LegendBar';
|
|
6
6
|
export const Legend = _ref => {
|
|
7
7
|
let {
|
|
8
|
-
|
|
9
|
-
shortValues = [BOOKS_THRESHOLDS.MIN, BOOKS_THRESHOLDS.MAX],
|
|
10
|
-
bookType,
|
|
11
|
-
isDark
|
|
8
|
+
bookType
|
|
12
9
|
} = _ref;
|
|
10
|
+
const {
|
|
11
|
+
isDark
|
|
12
|
+
} = useLayoutProvider();
|
|
13
13
|
const {
|
|
14
14
|
lang
|
|
15
15
|
} = useLocale();
|
|
16
16
|
return React.createElement("div", {
|
|
17
|
-
className: "lw-
|
|
17
|
+
className: "lw-my-4 lw-w-full"
|
|
18
|
+
}, React.createElement("div", {
|
|
19
|
+
className: "lw-mb-1 lw-flex lw-w-full lw-flex-row lw-justify-between"
|
|
18
20
|
}, React.createElement(LegendBar, {
|
|
19
21
|
isDark: isDark,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
type: "long"
|
|
23
|
+
}), React.createElement("div", {
|
|
24
|
+
className: "lw-w-[250px]"
|
|
23
25
|
}), React.createElement(LegendBar, {
|
|
24
26
|
isDark: isDark,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}));
|
|
27
|
+
type: "short"
|
|
28
|
+
})), React.createElement("div", {
|
|
29
|
+
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"
|
|
30
|
+
}, React.createElement("span", null, lang(bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance')), React.createElement("span", null, lang('even_market_demand')), React.createElement("span", null, lang(bookType === BookType.Order ? 'sell_overbalance' : 'short_overbalance'))));
|
|
29
31
|
};
|
|
30
32
|
//# sourceMappingURL=Legend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legend.js","names":["useLocale","React","BookType","
|
|
1
|
+
{"version":3,"file":"Legend.js","names":["useLayoutProvider","useLocale","React","BookType","LegendBar","Legend","_ref","bookType","isDark","lang","createElement","className","type","Order"],"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-[250px]\" />\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,SAASA,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,SAAS,QAAQ,aAAa;AAMvC,OAAO,MAAMC,MAAM,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAC9C,MAAM;IAAEE;EAAO,CAAC,GAAGR,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAES;EAAK,CAAC,GAAGR,SAAS,CAAC,CAAC;EAE5B,OACEC,KAAA,CAAAQ,aAAA;IAAKC,SAAS,EAAC;EAAmB,GAChCT,KAAA,CAAAQ,aAAA;IAAKC,SAAS,EAAC;EAA0D,GACvET,KAAA,CAAAQ,aAAA,CAACN,SAAS;IAACI,MAAM,EAAEA,MAAO;IAACI,IAAI,EAAC;EAAM,CAAE,CAAC,EACzCV,KAAA,CAAAQ,aAAA;IAAKC,SAAS,EAAC;EAAc,CAAE,CAAC,EAChCT,KAAA,CAAAQ,aAAA,CAACN,SAAS;IAACI,MAAM,EAAEA,MAAO;IAACI,IAAI,EAAC;EAAO,CAAE,CACtC,CAAC,EACNV,KAAA,CAAAQ,aAAA;IAAKC,SAAS,EAAC;EAAuG,GACpHT,KAAA,CAAAQ,aAAA,eACGD,IAAI,CACHF,QAAQ,KAAKJ,QAAQ,CAACU,KAAK,GAAG,iBAAiB,GAAG,kBACpD,CACI,CAAC,EACPX,KAAA,CAAAQ,aAAA,eAAOD,IAAI,CAAC,oBAAoB,CAAQ,CAAC,EACzCP,KAAA,CAAAQ,aAAA,eACGD,IAAI,CACHF,QAAQ,KAAKJ,QAAQ,CAACU,KAAK,GACvB,kBAAkB,GAClB,mBACN,CACI,CACH,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -2,31 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import { COLOR_MAP } from '../../constants';
|
|
3
3
|
export const LegendBar = _ref => {
|
|
4
4
|
let {
|
|
5
|
-
values,
|
|
6
5
|
type,
|
|
7
|
-
label,
|
|
8
6
|
isDark
|
|
9
7
|
} = _ref;
|
|
10
8
|
const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;
|
|
11
|
-
const
|
|
9
|
+
const startColor = type === 'long' ? colorPalette.long[1] : colorPalette.short[0];
|
|
10
|
+
const endColor = type === 'long' ? colorPalette.long[0] : colorPalette.short[1];
|
|
12
11
|
return React.createElement("div", {
|
|
13
|
-
className: "lw-flex lw-
|
|
14
|
-
}, React.createElement("span", {
|
|
15
|
-
className: "lw-whitespace-nowrap lw-font-sans lw-text-xs lw-text-text-primary"
|
|
16
|
-
}, label), React.createElement("div", {
|
|
17
|
-
className: "lw-flex lw-h-2 lw-w-full lw-overflow-hidden lw-border lw-border-border-primary"
|
|
12
|
+
className: "lw-flex lw-h-2 lw-w-full lw-overflow-hidden"
|
|
18
13
|
}, React.createElement("div", {
|
|
19
14
|
className: "lw-h-full lw-flex-1",
|
|
20
15
|
"data-testid": "legend-bar-segment",
|
|
21
16
|
style: {
|
|
22
|
-
background: "linear-gradient(90deg,".concat(
|
|
17
|
+
background: "linear-gradient(90deg,".concat(startColor, " 0%, ").concat(endColor, " 100%)")
|
|
23
18
|
}
|
|
24
|
-
}))
|
|
25
|
-
className: "lw-flex lw-w-full lw-justify-between"
|
|
26
|
-
}, React.createElement("span", {
|
|
27
|
-
className: "lw-whitespace-nowrap lw-font-sans lw-text-xs lw-text-text-primary"
|
|
28
|
-
}, values[0].toFixed(2), "%"), React.createElement("span", {
|
|
29
|
-
className: "lw-whitespace-nowrap lw-font-sans lw-text-xs lw-text-text-primary"
|
|
30
|
-
}, "\u2264 ".concat(values[1].toFixed(2)), "%")));
|
|
19
|
+
}));
|
|
31
20
|
};
|
|
32
21
|
//# sourceMappingURL=LegendBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendBar.js","names":["React","COLOR_MAP","LegendBar","_ref","
|
|
1
|
+
{"version":3,"file":"LegendBar.js","names":["React","COLOR_MAP","LegendBar","_ref","type","isDark","colorPalette","dark","light","startColor","long","short","endColor","createElement","className","style","background","concat"],"sources":["../../../../../src/CrowdViewWidget/components/Legend/LegendBar.tsx"],"sourcesContent":["import React from 'react';\n\nimport { COLOR_MAP } from '../../constants';\n\nexport type LegendType = 'long' | 'short';\n\ninterface LegendBarProps {\n type: LegendType;\n isDark: boolean;\n}\n\nexport const LegendBar = ({ type, isDark }: LegendBarProps) => {\n const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;\n const startColor =\n type === 'long' ? colorPalette.long[1] : colorPalette.short[0];\n const endColor =\n type === 'long' ? colorPalette.long[0] : colorPalette.short[1];\n\n return (\n <div className=\"lw-flex lw-h-2 lw-w-full lw-overflow-hidden\">\n <div\n className=\"lw-h-full lw-flex-1\"\n data-testid=\"legend-bar-segment\"\n style={{\n background: `linear-gradient(90deg,${startColor} 0%, ${endColor} 100%)`,\n }}\n />\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,SAAS,QAAQ,iBAAiB;AAS3C,OAAO,MAAMC,SAAS,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,IAAI;IAAEC;EAAuB,CAAC,GAAAF,IAAA;EACxD,MAAMG,YAAY,GAAGD,MAAM,GAAGJ,SAAS,CAACM,IAAI,GAAGN,SAAS,CAACO,KAAK;EAC9D,MAAMC,UAAU,GACdL,IAAI,KAAK,MAAM,GAAGE,YAAY,CAACI,IAAI,CAAC,CAAC,CAAC,GAAGJ,YAAY,CAACK,KAAK,CAAC,CAAC,CAAC;EAChE,MAAMC,QAAQ,GACZR,IAAI,KAAK,MAAM,GAAGE,YAAY,CAACI,IAAI,CAAC,CAAC,CAAC,GAAGJ,YAAY,CAACK,KAAK,CAAC,CAAC,CAAC;EAEhE,OACEX,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC;EAA6C,GAC1Dd,KAAA,CAAAa,aAAA;IACEC,SAAS,EAAC,qBAAqB;IAC/B,eAAY,oBAAoB;IAChCC,KAAK,EAAE;MACLC,UAAU,2BAAAC,MAAA,CAA2BR,UAAU,WAAAQ,MAAA,CAAQL,QAAQ;IACjE;EAAE,CACH,CACE,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { colorPalette } from '@oanda/labs-widget-common';
|
|
2
|
+
import chroma from 'chroma-js';
|
|
2
3
|
import { InstrumentId } from './types';
|
|
3
|
-
export const BOOKS_THRESHOLDS = {
|
|
4
|
-
MIN: 0.15,
|
|
5
|
-
MAX: 0.55
|
|
6
|
-
};
|
|
7
4
|
export const BUCKET_CONFIG = {
|
|
8
5
|
MULTIPLIER: 4,
|
|
9
|
-
|
|
6
|
+
PRICE_MARGIN_MULTIPLIER: 2
|
|
10
7
|
};
|
|
11
8
|
export const TIME_THRESHOLDS = {
|
|
12
9
|
TWO_WEEKS_MS: 14 * 24 * 60 * 60 * 1000
|
|
13
10
|
};
|
|
14
11
|
export const CHART_CONFIG = {
|
|
12
|
+
HEIGHT: 440,
|
|
15
13
|
MAIN_HEIGHT: 400,
|
|
16
14
|
MARGIN_BETWEEN: 50,
|
|
17
15
|
SENTIMENT_HEIGHT: 120,
|
|
@@ -19,26 +17,21 @@ export const CHART_CONFIG = {
|
|
|
19
17
|
X_LABEL_SIZE: 40,
|
|
20
18
|
Y_LABEL_SIZE_DESKTOP: 60,
|
|
21
19
|
Y_LABEL_SIZE_MOBILE: 40,
|
|
22
|
-
|
|
20
|
+
Y_SENTIMENT_LABEL_SIZE: 40,
|
|
21
|
+
INITIAL_START_ZOOM: 90,
|
|
23
22
|
INITIAL_END_ZOOM: 100,
|
|
24
23
|
X_AXIS_DATE_PADDING: ' ',
|
|
25
24
|
SENTIMENT_MIN: 0,
|
|
26
|
-
SENTIMENT_MAX: 100
|
|
27
|
-
SENTIMENT_INTERVAL: 25,
|
|
28
|
-
SENTIMENT_TEXT_OFFSET: 16
|
|
29
|
-
};
|
|
30
|
-
export const CHART_CONFIG_CALCULATED = {
|
|
31
|
-
FULL_HEIGHT: CHART_CONFIG.MAIN_HEIGHT + CHART_CONFIG.MARGIN_BETWEEN + CHART_CONFIG.SENTIMENT_HEIGHT + CHART_CONFIG.X_LABEL_SIZE,
|
|
32
|
-
SENTIMENT_TEXT_POSITION: CHART_CONFIG.SENTIMENT_HEIGHT + CHART_CONFIG.SENTIMENT_TEXT_OFFSET
|
|
25
|
+
SENTIMENT_MAX: 100
|
|
33
26
|
};
|
|
34
27
|
export const COLOR_MAP = {
|
|
35
28
|
dark: {
|
|
36
|
-
long: [colorPalette.darkBlue10, colorPalette.darkBlue90],
|
|
37
|
-
short: [colorPalette.darkYellow10, colorPalette.darkYellow90]
|
|
29
|
+
long: [chroma(colorPalette.darkBlue10).shade(0.5).hex(), chroma(colorPalette.darkBlue90).shade(0.5).hex()],
|
|
30
|
+
short: [chroma(colorPalette.darkYellow10).shade(0.5).hex(), chroma(colorPalette.darkYellow90).shade(0.5).hex()]
|
|
38
31
|
},
|
|
39
32
|
light: {
|
|
40
|
-
long: [colorPalette.lightBlue10, colorPalette.lightBlue90],
|
|
41
|
-
short: [colorPalette.lightYellow10, colorPalette.lightYellow90]
|
|
33
|
+
long: [chroma(colorPalette.lightBlue10).tint(0.5).hex(), chroma(colorPalette.lightBlue90).tint(0.5).hex()],
|
|
34
|
+
short: [chroma(colorPalette.lightYellow10).tint(0.5).hex(), chroma(colorPalette.lightYellow90).tint(0.5).hex()]
|
|
42
35
|
}
|
|
43
36
|
};
|
|
44
37
|
export const INSTRUMENTS_CONFIG = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["colorPalette","
|
|
1
|
+
{"version":3,"file":"constants.js","names":["colorPalette","chroma","InstrumentId","BUCKET_CONFIG","MULTIPLIER","PRICE_MARGIN_MULTIPLIER","TIME_THRESHOLDS","TWO_WEEKS_MS","CHART_CONFIG","HEIGHT","MAIN_HEIGHT","MARGIN_BETWEEN","SENTIMENT_HEIGHT","WIDTH","X_LABEL_SIZE","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","Y_SENTIMENT_LABEL_SIZE","INITIAL_START_ZOOM","INITIAL_END_ZOOM","X_AXIS_DATE_PADDING","SENTIMENT_MIN","SENTIMENT_MAX","COLOR_MAP","dark","long","darkBlue10","shade","hex","darkBlue90","short","darkYellow10","darkYellow90","light","lightBlue10","tint","lightBlue90","lightYellow10","lightYellow90","INSTRUMENTS_CONFIG","EUR_AUD","mt5name","v20name","precision","defaultBucketWidth","EUR_GBP","EUR_JPY","EUR_USD","EUR_CHF","USD_CHF","USD_JPY","USD_CAD","GBP_USD","GBP_JPY","GBP_CHF","AUD_JPY","AUD_USD","NZD_USD","XAU_USD","XAG_USD"],"sources":["../../../src/CrowdViewWidget/constants.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport chroma from 'chroma-js';\n\nimport { InstrumentId } from './types';\n\nexport const BUCKET_CONFIG = {\n MULTIPLIER: 4,\n PRICE_MARGIN_MULTIPLIER: 2,\n} as const;\n\nexport const TIME_THRESHOLDS = {\n TWO_WEEKS_MS: 14 * 24 * 60 * 60 * 1000,\n} as const;\n\nexport const CHART_CONFIG = {\n HEIGHT: 440,\n MAIN_HEIGHT: 400,\n MARGIN_BETWEEN: 50,\n SENTIMENT_HEIGHT: 120,\n WIDTH: 9999,\n X_LABEL_SIZE: 40,\n Y_LABEL_SIZE_DESKTOP: 60,\n Y_LABEL_SIZE_MOBILE: 40,\n Y_SENTIMENT_LABEL_SIZE: 40,\n INITIAL_START_ZOOM: 90,\n INITIAL_END_ZOOM: 100,\n X_AXIS_DATE_PADDING: ' ',\n SENTIMENT_MIN: 0,\n SENTIMENT_MAX: 100,\n} as const;\n\nexport const COLOR_MAP = {\n dark: {\n long: [\n chroma(colorPalette.darkBlue10).shade(0.5).hex(),\n chroma(colorPalette.darkBlue90).shade(0.5).hex(),\n ],\n short: [\n chroma(colorPalette.darkYellow10).shade(0.5).hex(),\n chroma(colorPalette.darkYellow90).shade(0.5).hex(),\n ],\n },\n light: {\n long: [\n chroma(colorPalette.lightBlue10).tint(0.5).hex(),\n chroma(colorPalette.lightBlue90).tint(0.5).hex(),\n ],\n short: [\n chroma(colorPalette.lightYellow10).tint(0.5).hex(),\n chroma(colorPalette.lightYellow90).tint(0.5).hex(),\n ],\n },\n} as const;\n\nexport const INSTRUMENTS_CONFIG: Record<\n InstrumentId,\n {\n precision: number;\n defaultBucketWidth: number;\n v20name: string;\n mt5name: string;\n }\n> = {\n [InstrumentId.EUR_AUD]: {\n mt5name: 'EURAUD',\n v20name: 'EUR_AUD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.EUR_GBP]: {\n mt5name: 'EURGBP',\n v20name: 'EUR_GBP',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.EUR_JPY]: {\n mt5name: 'EURJPY',\n v20name: 'EUR_JPY',\n precision: 3,\n defaultBucketWidth: 0.05,\n },\n [InstrumentId.EUR_USD]: {\n mt5name: 'EURUSD',\n v20name: 'EUR_USD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.EUR_CHF]: {\n mt5name: 'EURCHF',\n v20name: 'EUR_CHF',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.USD_CHF]: {\n mt5name: 'USDCHF',\n v20name: 'USD_CHF',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.USD_JPY]: {\n mt5name: 'USDJPY',\n v20name: 'USD_JPY',\n precision: 3,\n defaultBucketWidth: 0.05,\n },\n [InstrumentId.USD_CAD]: {\n mt5name: 'USDCAD',\n v20name: 'USD_CAD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.GBP_USD]: {\n mt5name: 'GBPUSD',\n v20name: 'GBP_USD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.GBP_JPY]: {\n mt5name: 'GBPJPY',\n v20name: 'GBP_JPY',\n precision: 3,\n defaultBucketWidth: 0.05,\n },\n [InstrumentId.GBP_CHF]: {\n mt5name: 'GBPCHF',\n v20name: 'GBP_CHF',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.AUD_JPY]: {\n mt5name: 'AUDJPY',\n v20name: 'AUD_JPY',\n precision: 3,\n defaultBucketWidth: 0.05,\n },\n [InstrumentId.AUD_USD]: {\n mt5name: 'AUDUSD',\n v20name: 'AUD_USD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.NZD_USD]: {\n mt5name: 'NZDUSD',\n v20name: 'NZD_USD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n [InstrumentId.XAU_USD]: {\n mt5name: 'XAUUSD',\n v20name: 'XAU_USD',\n precision: 3,\n defaultBucketWidth: 0.5,\n },\n [InstrumentId.XAG_USD]: {\n mt5name: 'XAGUSD',\n v20name: 'XAG_USD',\n precision: 5,\n defaultBucketWidth: 0.0005,\n },\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AACxD,OAAOC,MAAM,MAAM,WAAW;AAE9B,SAASC,YAAY,QAAQ,SAAS;AAEtC,OAAO,MAAMC,aAAa,GAAG;EAC3BC,UAAU,EAAE,CAAC;EACbC,uBAAuB,EAAE;AAC3B,CAAU;AAEV,OAAO,MAAMC,eAAe,GAAG;EAC7BC,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;AACpC,CAAU;AAEV,OAAO,MAAMC,YAAY,GAAG;EAC1BC,MAAM,EAAE,GAAG;EACXC,WAAW,EAAE,GAAG;EAChBC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,GAAG;EACrBC,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE,EAAE;EAChBC,oBAAoB,EAAE,EAAE;EACxBC,mBAAmB,EAAE,EAAE;EACvBC,sBAAsB,EAAE,EAAE;EAC1BC,kBAAkB,EAAE,EAAE;EACtBC,gBAAgB,EAAE,GAAG;EACrBC,mBAAmB,EAAE,UAAU;EAC/BC,aAAa,EAAE,CAAC;EAChBC,aAAa,EAAE;AACjB,CAAU;AAEV,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE;IACJC,IAAI,EAAE,CACJxB,MAAM,CAACD,YAAY,CAAC0B,UAAU,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,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ACZC,kBAAkB,EAAE;EACtB,CAAC;EACD,CAAC1C,YAAY,CAACqD,OAAO,GAAG;IACtBd,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,CAAC;IACZC,kBAAkB,EAAE;EACtB,CAAC;EACD,CAAC1C,YAAY,CAACsD,OAAO,GAAG;IACtBf,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,CAAC;IACZC,kBAAkB,EAAE;EACtB,CAAC;EACD,CAAC1C,YAAY,CAACuD,OAAO,GAAG;IACtBhB,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,CAAC;IACZC,kBAAkB,EAAE;EACtB,CAAC;EACD,CAAC1C,YAAY,CAACwD,OAAO,GAAG;IACtBjB,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,CAAC;IACZC,kBAAkB,EAAE;EACtB,CAAC;EACD,CAAC1C,YAAY,CAACyD,OAAO,GAAG;IACtBlB,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,CAAC;IACZC,kBAAkB,EAAE;EACtB;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
3
|
import { gql } from '@apollo/client';
|
|
4
|
-
const getOrderPositionBooks = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n ) {\n
|
|
4
|
+
const getOrderPositionBooks = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n $bucketMultiplier: Int!\n $bucketMargin: Int!\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n bucketMultiplier: $bucketMultiplier\n bucketMargin: $bucketMargin\n ) {\n books {\n time\n price\n buckets {\n price\n sentiment\n }\n }\n bucketWidth\n sentimentThresholdMax\n sentimentThresholdMin\n }\n }\n"])));
|
|
5
5
|
export { getOrderPositionBooks };
|
|
6
6
|
//# sourceMappingURL=getOrderPositionBooks.js.map
|