@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,10 @@
|
|
|
1
|
+
export * from './getDataZoomConfig';
|
|
2
|
+
export * from './getGridConfig';
|
|
3
|
+
export * from './getGridLines';
|
|
4
|
+
export * from './getSeriesCandlestickConfig';
|
|
5
|
+
export * from './getSeriesHeatmapConfig';
|
|
6
|
+
export * from './getSeriesSentimentConfig';
|
|
7
|
+
export * from './getTooltipConfig';
|
|
8
|
+
export * from './getVisualMapConfig';
|
|
9
|
+
export * from './getXAxisConfig';
|
|
10
|
+
export * from './getYAxisConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatXAxisLabel: (value: unknown, isGreaterThanTwoWeeks: boolean) => string;
|
package/dist/types/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.d.ts
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface ChartStyles {
|
|
2
2
|
sentimentLongColor: string;
|
|
3
3
|
sentimentShortColor: string;
|
|
4
|
+
sentimentOutlineColor: string;
|
|
4
5
|
candleLongColor: string;
|
|
5
6
|
candleShortColor: string;
|
|
6
|
-
sentimentAreaOpacity: number;
|
|
7
7
|
tooltipLinesColor: string;
|
|
8
|
-
|
|
8
|
+
sentimentOutlineWidth: number;
|
|
9
9
|
}
|
|
10
10
|
export declare const getChartStyles: (isDark: boolean) => ChartStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getGradientColor: (value: number, startColor: string, targetColor: string, minThreshold: number, maxThreshold: number) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GetLabelsDataProps } from '../types';
|
|
2
|
+
export declare const getLabelData: ({ dates, isGreaterThanTwoWeeks, }: GetLabelsDataProps) => {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly xAxis: string;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly silent: true;
|
|
7
|
+
readonly emphasis: {
|
|
8
|
+
readonly disabled: true;
|
|
9
|
+
};
|
|
10
|
+
readonly label: {
|
|
11
|
+
readonly fontFamily: "Sofia W03";
|
|
12
|
+
readonly fontSize: 10;
|
|
13
|
+
readonly position: "bottom";
|
|
14
|
+
readonly align: "center";
|
|
15
|
+
readonly formatter: "{b}";
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRectColor: (sentiment: number, isDark: boolean, minThreshold: number, maxThreshold: number) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BookType } from '../../../../gql/types/graphql';
|
|
2
|
+
import type { Bucket, TooltipParam } from '../types';
|
|
3
|
+
export declare const getTooltipFormatter: ({ params, buckets, bucketWidth, selectedPrice, bookType, labelCallback, }: {
|
|
4
|
+
params: TooltipParam[];
|
|
5
|
+
buckets: Bucket[][];
|
|
6
|
+
bucketWidth: number;
|
|
7
|
+
selectedPrice: number;
|
|
8
|
+
bookType: BookType;
|
|
9
|
+
labelCallback: (key: string) => string;
|
|
10
|
+
}) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './formatXAxisLabel';
|
|
2
|
+
export * from './getChartStyles';
|
|
3
|
+
export * from './getGradientColor';
|
|
4
|
+
export * from './getLabelData';
|
|
5
|
+
export * from './getRectColor';
|
|
6
|
+
export * from './getTooltipFormatter';
|
|
7
|
+
export * from './isDifferenceGreaterThanTwoWeeks';
|
package/dist/types/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isDifferenceGreaterThanTwoWeeks: (startDate: string, endDate: string) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Division } from '
|
|
1
|
+
import { Division } from '../../../../gql/types/graphql';
|
|
2
2
|
export declare const getInstrumentConfigForDivision: (division: Division) => {
|
|
3
|
-
id: import("
|
|
3
|
+
id: import("../../..").InstrumentId;
|
|
4
4
|
label: string;
|
|
5
5
|
}[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GetOrderPositionBooksQuery } from '../../../../gql/types/graphql';
|
|
2
|
+
import type { Bucket } from '../types';
|
|
3
|
+
export declare const processOrderPositionBooks: (orderPositionData: GetOrderPositionBooksQuery | undefined, dates: string[]) => {
|
|
4
|
+
bookPrices: (number | null)[];
|
|
5
|
+
bookIndexes: number[];
|
|
6
|
+
buckets: Bucket[][];
|
|
7
|
+
bucketWidth: number;
|
|
8
|
+
sentimentThresholdMin: number;
|
|
9
|
+
sentimentThresholdMax: number;
|
|
10
|
+
hasValidBooks: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetPriceCandlesQuery } from '../../../../gql/types/graphql';
|
|
2
|
+
export declare const processPriceCandles: (priceCandlesData: GetPriceCandlesQuery | undefined) => {
|
|
3
|
+
minPrice: number;
|
|
4
|
+
maxPrice: number;
|
|
5
|
+
candlesOpen: number[];
|
|
6
|
+
candlesClose: number[];
|
|
7
|
+
candlesLow: number[];
|
|
8
|
+
candlesHigh: number[];
|
|
9
|
+
dates: string[];
|
|
10
|
+
hasValidCandles: boolean;
|
|
11
|
+
pipsLocation: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GetSentimentsQuery } from '../../../../gql/types/graphql';
|
|
2
|
+
export declare const processSentiments: (sentimentsData: GetSentimentsQuery | undefined, dates: string[]) => {
|
|
3
|
+
sentimentLongs: (number | null)[];
|
|
4
|
+
sentimentShorts: (number | null)[];
|
|
5
|
+
hasValidSentiments: boolean;
|
|
6
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { GetOrderPositionBooksQuery, GetPriceCandlesQuery } from '../../../../gql/types/graphql';
|
|
2
|
-
export declare const validateData: (priceCandlesData: GetPriceCandlesQuery | undefined, orderPositionData: GetOrderPositionBooksQuery | undefined, hasValidCandles: boolean) => Error | null;
|
|
2
|
+
export declare const validateData: (priceCandlesData: GetPriceCandlesQuery | undefined, orderPositionData: GetOrderPositionBooksQuery | undefined, hasValidCandles: boolean, hasValidBooks: boolean, hasValidSentiments: boolean) => Error | null;
|
|
@@ -11,25 +11,42 @@ export interface UseCrowdViewDataProps {
|
|
|
11
11
|
division: Division;
|
|
12
12
|
granularity: Granularity;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
interface CrowdViewMainData {
|
|
15
|
+
dates: string[];
|
|
16
|
+
candlesOpen: number[];
|
|
17
|
+
candlesClose: number[];
|
|
18
|
+
candlesLow: number[];
|
|
19
|
+
candlesHigh: number[];
|
|
20
|
+
bookPrices?: (number | null)[];
|
|
21
|
+
bookIndexes?: (number | null)[];
|
|
22
|
+
sentimentShorts: (number | null)[];
|
|
23
|
+
sentimentLongs: (number | null)[];
|
|
24
|
+
}
|
|
25
|
+
interface CrowdViewAdditionalData {
|
|
19
26
|
bucketWidth: number;
|
|
20
27
|
buckets: Bucket[][];
|
|
21
|
-
|
|
28
|
+
displayPrecision: number;
|
|
22
29
|
bookType: BookType;
|
|
23
|
-
|
|
30
|
+
sentimentThresholdMin: number;
|
|
31
|
+
sentimentThresholdMax: number;
|
|
24
32
|
}
|
|
25
33
|
export interface UseCrowdViewDataReturn {
|
|
26
|
-
|
|
34
|
+
mainData?: CrowdViewMainData | null;
|
|
35
|
+
additionalData?: CrowdViewAdditionalData | null;
|
|
27
36
|
loading: boolean;
|
|
28
37
|
error: boolean;
|
|
29
38
|
}
|
|
30
|
-
|
|
39
|
+
interface GetOptionProps {
|
|
40
|
+
mainData: CrowdViewMainData;
|
|
41
|
+
additionalData: CrowdViewAdditionalData;
|
|
42
|
+
isDark: boolean;
|
|
43
|
+
isDesktop: boolean;
|
|
44
|
+
labelCallback: (key: string, params?: Record<string, unknown>) => string;
|
|
45
|
+
}
|
|
46
|
+
export type GetOptionType = (props: GetOptionProps) => EChartsOption;
|
|
31
47
|
export interface ChartProps {
|
|
32
|
-
|
|
48
|
+
mainData: CrowdViewMainData;
|
|
49
|
+
additionalData: CrowdViewAdditionalData;
|
|
33
50
|
isDesktop: boolean;
|
|
34
51
|
}
|
|
35
52
|
export interface ChartWithDataProps {
|
|
@@ -39,7 +56,7 @@ export interface ChartWithDataProps {
|
|
|
39
56
|
granularity: Granularity;
|
|
40
57
|
}
|
|
41
58
|
export interface GetLabelsDataProps {
|
|
42
|
-
|
|
59
|
+
dates: string[];
|
|
43
60
|
isGreaterThanTwoWeeks: boolean;
|
|
44
61
|
}
|
|
45
62
|
interface BaseTooltipParam {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BookType } from '../../../gql/types/graphql';
|
|
3
3
|
interface LegendProps {
|
|
4
|
-
longValues?: [number, number];
|
|
5
|
-
shortValues?: [number, number];
|
|
6
4
|
bookType: BookType;
|
|
7
|
-
isDark: boolean;
|
|
8
5
|
}
|
|
9
|
-
export declare const Legend: ({
|
|
6
|
+
export declare const Legend: ({ bookType }: LegendProps) => React.JSX.Element;
|
|
10
7
|
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type LegendType = 'long' | 'short';
|
|
3
3
|
interface LegendBarProps {
|
|
4
|
-
values: number[];
|
|
5
4
|
type: LegendType;
|
|
6
|
-
label: string;
|
|
7
5
|
isDark: boolean;
|
|
8
6
|
}
|
|
9
|
-
export declare const LegendBar: ({
|
|
7
|
+
export declare const LegendBar: ({ type, isDark }: LegendBarProps) => React.JSX.Element;
|
|
10
8
|
export {};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { InstrumentId } from './types';
|
|
2
|
-
export declare const BOOKS_THRESHOLDS: {
|
|
3
|
-
readonly MIN: 0.15;
|
|
4
|
-
readonly MAX: 0.55;
|
|
5
|
-
};
|
|
6
2
|
export declare const BUCKET_CONFIG: {
|
|
7
3
|
readonly MULTIPLIER: 4;
|
|
8
|
-
readonly
|
|
4
|
+
readonly PRICE_MARGIN_MULTIPLIER: 2;
|
|
9
5
|
};
|
|
10
6
|
export declare const TIME_THRESHOLDS: {
|
|
11
7
|
readonly TWO_WEEKS_MS: number;
|
|
12
8
|
};
|
|
13
9
|
export declare const CHART_CONFIG: {
|
|
10
|
+
readonly HEIGHT: 440;
|
|
14
11
|
readonly MAIN_HEIGHT: 400;
|
|
15
12
|
readonly MARGIN_BETWEEN: 50;
|
|
16
13
|
readonly SENTIMENT_HEIGHT: 120;
|
|
@@ -18,17 +15,12 @@ export declare const CHART_CONFIG: {
|
|
|
18
15
|
readonly X_LABEL_SIZE: 40;
|
|
19
16
|
readonly Y_LABEL_SIZE_DESKTOP: 60;
|
|
20
17
|
readonly Y_LABEL_SIZE_MOBILE: 40;
|
|
21
|
-
readonly
|
|
18
|
+
readonly Y_SENTIMENT_LABEL_SIZE: 40;
|
|
19
|
+
readonly INITIAL_START_ZOOM: 90;
|
|
22
20
|
readonly INITIAL_END_ZOOM: 100;
|
|
23
21
|
readonly X_AXIS_DATE_PADDING: " ";
|
|
24
22
|
readonly SENTIMENT_MIN: 0;
|
|
25
23
|
readonly SENTIMENT_MAX: 100;
|
|
26
|
-
readonly SENTIMENT_INTERVAL: 25;
|
|
27
|
-
readonly SENTIMENT_TEXT_OFFSET: 16;
|
|
28
|
-
};
|
|
29
|
-
export declare const CHART_CONFIG_CALCULATED: {
|
|
30
|
-
FULL_HEIGHT: number;
|
|
31
|
-
SENTIMENT_TEXT_POSITION: number;
|
|
32
24
|
};
|
|
33
25
|
export declare const COLOR_MAP: {
|
|
34
26
|
readonly dark: {
|
|
@@ -11,15 +11,17 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
11
11
|
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
12
12
|
*/
|
|
13
13
|
declare const documents: {
|
|
14
|
-
'\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
|
|
14
|
+
'\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': DocumentNode<types.GetOrderPositionBooksQuery, types.Exact<{
|
|
15
15
|
instrument: types.Scalars["String"]["input"];
|
|
16
16
|
bookType: types.BookType;
|
|
17
17
|
timeSpan: types.TimeSpan;
|
|
18
18
|
granularity: types.Granularity;
|
|
19
19
|
maxBookPrice?: types.InputMaybe<types.Scalars["Float"]["input"]>;
|
|
20
20
|
minBookPrice?: types.InputMaybe<types.Scalars["Float"]["input"]>;
|
|
21
|
+
bucketMultiplier: types.Scalars["Int"]["input"];
|
|
22
|
+
bucketMargin: types.Scalars["Int"]["input"];
|
|
21
23
|
}>>;
|
|
22
|
-
'\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n }\n }\n': DocumentNode<types.GetPriceCandlesQuery, types.Exact<{
|
|
24
|
+
'\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n pipsLocation\n }\n }\n': DocumentNode<types.GetPriceCandlesQuery, types.Exact<{
|
|
23
25
|
dataSource: types.DataSource;
|
|
24
26
|
division: types.Division;
|
|
25
27
|
instrument: types.Scalars["String"]["input"];
|
|
@@ -48,11 +50,11 @@ export declare function graphql(source: string): unknown;
|
|
|
48
50
|
/**
|
|
49
51
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
50
52
|
*/
|
|
51
|
-
export declare function graphql(source: '\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
|
|
53
|
+
export declare function graphql(source: '\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'): (typeof documents)['\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'];
|
|
52
54
|
/**
|
|
53
55
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
54
56
|
*/
|
|
55
|
-
export declare function graphql(source: '\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n }\n }\n'): (typeof documents)['\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n }\n }\n'];
|
|
57
|
+
export declare function graphql(source: '\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n pipsLocation\n }\n }\n'): (typeof documents)['\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n pipsLocation\n }\n }\n'];
|
|
56
58
|
/**
|
|
57
59
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
58
60
|
*/
|
|
@@ -55,6 +55,7 @@ export declare enum AssetClassName {
|
|
|
55
55
|
EquityShares = "EQUITY_SHARES",
|
|
56
56
|
Etfs = "ETFS",
|
|
57
57
|
Indices = "INDICES",
|
|
58
|
+
Metals = "METALS",
|
|
58
59
|
Rates = "RATES"
|
|
59
60
|
}
|
|
60
61
|
export declare enum BookType {
|
|
@@ -201,6 +202,14 @@ export declare enum OrderBookDataSource {
|
|
|
201
202
|
Ny4Mt5 = "NY4_MT5",
|
|
202
203
|
Ty3 = "TY3"
|
|
203
204
|
}
|
|
205
|
+
export type OrderPositionBooksData = {
|
|
206
|
+
__typename?: 'OrderPositionBooksData';
|
|
207
|
+
books?: Maybe<Array<OrderPositionData>>;
|
|
208
|
+
bucketWidth: Scalars['Float']['output'];
|
|
209
|
+
displayPrecision: Scalars['Int']['output'];
|
|
210
|
+
sentimentThresholdMax: Scalars['Float']['output'];
|
|
211
|
+
sentimentThresholdMin: Scalars['Float']['output'];
|
|
212
|
+
};
|
|
204
213
|
export type OrderPositionBucket = {
|
|
205
214
|
__typename?: 'OrderPositionBucket';
|
|
206
215
|
longCountPercent?: Maybe<Scalars['Float']['output']>;
|
|
@@ -230,7 +239,7 @@ export type Query = {
|
|
|
230
239
|
mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
|
|
231
240
|
marginRates?: Maybe<Array<MarginRate>>;
|
|
232
241
|
orderPositionBook: Array<Maybe<OrderPositionData>>;
|
|
233
|
-
orderPositionBooks:
|
|
242
|
+
orderPositionBooks: OrderPositionBooksData;
|
|
234
243
|
priceCandles: CandlesData;
|
|
235
244
|
resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
|
|
236
245
|
resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
|
|
@@ -281,6 +290,8 @@ export type QueryOrderPositionBookArgs = {
|
|
|
281
290
|
};
|
|
282
291
|
export type QueryOrderPositionBooksArgs = {
|
|
283
292
|
bookType: BookType;
|
|
293
|
+
bucketMargin?: Scalars['Int']['input'];
|
|
294
|
+
bucketMultiplier?: Scalars['Int']['input'];
|
|
284
295
|
granularity: Granularity;
|
|
285
296
|
instrument: Scalars['String']['input'];
|
|
286
297
|
maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
|
|
@@ -494,20 +505,27 @@ export type GetOrderPositionBooksQueryVariables = Exact<{
|
|
|
494
505
|
granularity: Granularity;
|
|
495
506
|
maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
|
|
496
507
|
minBookPrice?: InputMaybe<Scalars['Float']['input']>;
|
|
508
|
+
bucketMultiplier: Scalars['Int']['input'];
|
|
509
|
+
bucketMargin: Scalars['Int']['input'];
|
|
497
510
|
}>;
|
|
498
511
|
export type GetOrderPositionBooksQuery = {
|
|
499
512
|
__typename?: 'Query';
|
|
500
|
-
orderPositionBooks:
|
|
501
|
-
__typename?: '
|
|
513
|
+
orderPositionBooks: {
|
|
514
|
+
__typename?: 'OrderPositionBooksData';
|
|
502
515
|
bucketWidth: number;
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
__typename?: '
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
516
|
+
sentimentThresholdMax: number;
|
|
517
|
+
sentimentThresholdMin: number;
|
|
518
|
+
books?: Array<{
|
|
519
|
+
__typename?: 'OrderPositionData';
|
|
520
|
+
time: string;
|
|
521
|
+
price?: number | null;
|
|
522
|
+
buckets: Array<{
|
|
523
|
+
__typename?: 'OrderPositionBucket';
|
|
524
|
+
price: number;
|
|
525
|
+
sentiment?: number | null;
|
|
526
|
+
} | null>;
|
|
527
|
+
}> | null;
|
|
528
|
+
};
|
|
511
529
|
};
|
|
512
530
|
export type GetPriceCandlesQueryVariables = Exact<{
|
|
513
531
|
dataSource: DataSource;
|
|
@@ -520,6 +538,7 @@ export type GetPriceCandlesQuery = {
|
|
|
520
538
|
__typename?: 'Query';
|
|
521
539
|
priceCandles: {
|
|
522
540
|
__typename?: 'CandlesData';
|
|
541
|
+
pipsLocation: number;
|
|
523
542
|
candle: Array<{
|
|
524
543
|
__typename?: 'Candle';
|
|
525
544
|
point: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-crowd-view-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"description": "Labs Crowd View Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "OANDA",
|
|
14
14
|
"license": "UNLICENSED",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.236",
|
|
17
17
|
"@oanda/mono-i18n": "10.0.1",
|
|
18
18
|
"chroma-js": "^3.1.2",
|
|
19
19
|
"decimal.js": "^10.6.0",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
25
25
|
"@types/chroma-js": "^3.1.2"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "f04c026db9ec11a1d0ac934dd66146c877b01570"
|
|
28
28
|
}
|
|
@@ -11,13 +11,13 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
11
11
|
import type { Granularity } from '../gql/types/graphql';
|
|
12
12
|
import { BookType } from '../gql/types/graphql';
|
|
13
13
|
import { ChartWithData, Legend } from './components';
|
|
14
|
+
import { getInstrumentConfigForDivision } from './components/Chart/dataUtils/getInstrumentConfigForDivision';
|
|
14
15
|
import { granularitySelectConfig, navigationConfig } from './selectConfig';
|
|
15
16
|
import type { InstrumentId, MainProps } from './types';
|
|
16
|
-
import { getInstrumentConfigForDivision } from './utils/instrumentUtils';
|
|
17
17
|
|
|
18
18
|
const Main = ({ division }: MainProps) => {
|
|
19
19
|
const { lang } = useLocale();
|
|
20
|
-
const { size
|
|
20
|
+
const { size } = useLayoutProvider();
|
|
21
21
|
const isDesktop = size === Size.DESKTOP;
|
|
22
22
|
|
|
23
23
|
const [bookType, setBookType] = useState(BookType.Order);
|
|
@@ -107,8 +107,7 @@ const Main = ({ division }: MainProps) => {
|
|
|
107
107
|
granularity={granularity.id}
|
|
108
108
|
instrument={instrument.id}
|
|
109
109
|
/>
|
|
110
|
-
|
|
111
|
-
<Legend bookType={bookType} isDark={isDark} />
|
|
110
|
+
<Legend bookType={bookType} />
|
|
112
111
|
</div>
|
|
113
112
|
)}
|
|
114
113
|
</>
|
|
@@ -8,11 +8,11 @@ import { useLocale } from '@oanda/mono-i18n';
|
|
|
8
8
|
import type { EChartsType } from 'echarts';
|
|
9
9
|
import { CandlestickChart, CustomChart, LineChart } from 'echarts/charts';
|
|
10
10
|
import {
|
|
11
|
+
DatasetComponent,
|
|
11
12
|
DataZoomInsideComponent,
|
|
12
13
|
GraphicComponent,
|
|
13
14
|
GridSimpleComponent,
|
|
14
|
-
|
|
15
|
-
MarkPointComponent,
|
|
15
|
+
MarkLineComponent,
|
|
16
16
|
TooltipComponent,
|
|
17
17
|
VisualMapComponent,
|
|
18
18
|
} from 'echarts/components';
|
|
@@ -20,19 +20,19 @@ import * as echarts from 'echarts/core';
|
|
|
20
20
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
21
21
|
import React from 'react';
|
|
22
22
|
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
23
|
+
import { CHART_CONFIG } from '../../constants';
|
|
24
|
+
import {
|
|
25
|
+
formatXAxisLabel,
|
|
26
|
+
getLabelData,
|
|
27
|
+
isDifferenceGreaterThanTwoWeeks,
|
|
28
|
+
} from './chartUtils';
|
|
29
|
+
import { getOption } from './getOption';
|
|
25
30
|
import type {
|
|
26
31
|
ChartProps,
|
|
27
32
|
DataZoomArray,
|
|
28
33
|
DataZoomEvent,
|
|
29
34
|
XAxisArray,
|
|
30
35
|
} from './types';
|
|
31
|
-
import {
|
|
32
|
-
formatXAxisLabel,
|
|
33
|
-
getLabelData,
|
|
34
|
-
isDifferenceGreaterThanTwoWeeks,
|
|
35
|
-
} from './utils/chartUtils';
|
|
36
36
|
|
|
37
37
|
echarts.use([
|
|
38
38
|
GridSimpleComponent,
|
|
@@ -42,26 +42,32 @@ echarts.use([
|
|
|
42
42
|
CustomChart,
|
|
43
43
|
TooltipComponent,
|
|
44
44
|
CandlestickChart,
|
|
45
|
-
|
|
46
|
-
MarkAreaComponent,
|
|
45
|
+
MarkLineComponent,
|
|
47
46
|
LineChart,
|
|
48
47
|
VisualMapComponent,
|
|
48
|
+
DatasetComponent,
|
|
49
49
|
]);
|
|
50
50
|
|
|
51
51
|
echarts.registerTheme('dark_theme', getChartTheme(Theme.Dark));
|
|
52
52
|
echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
|
|
53
53
|
|
|
54
|
-
const Chart = ({
|
|
54
|
+
const Chart = ({ mainData, additionalData, isDesktop }: ChartProps) => {
|
|
55
55
|
const { isDark } = useLayoutProvider();
|
|
56
56
|
const { lang } = useLocale();
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
59
|
<BaseChart
|
|
60
|
-
chartHeight={
|
|
60
|
+
chartHeight={CHART_CONFIG.HEIGHT}
|
|
61
61
|
echarts={echarts}
|
|
62
62
|
isDark={isDark}
|
|
63
63
|
lazyUpdate={true}
|
|
64
|
-
option={getOption(
|
|
64
|
+
option={getOption({
|
|
65
|
+
mainData,
|
|
66
|
+
additionalData,
|
|
67
|
+
isDark,
|
|
68
|
+
isDesktop,
|
|
69
|
+
labelCallback: lang,
|
|
70
|
+
})}
|
|
65
71
|
opts={{ renderer: 'canvas' }}
|
|
66
72
|
onEvents={{
|
|
67
73
|
datazoom: (params: DataZoomEvent, instance: EChartsType) => {
|
|
@@ -69,8 +75,7 @@ const Chart = ({ data, isDesktop }: ChartProps) => {
|
|
|
69
75
|
return;
|
|
70
76
|
}
|
|
71
77
|
|
|
72
|
-
const
|
|
73
|
-
const { start, end } = batchItem;
|
|
78
|
+
const { dates } = mainData;
|
|
74
79
|
|
|
75
80
|
const { dataZoom, xAxis } = instance.getOption();
|
|
76
81
|
if (
|
|
@@ -85,33 +90,13 @@ const Chart = ({ data, isDesktop }: ChartProps) => {
|
|
|
85
90
|
|
|
86
91
|
const { startValue, endValue } = dataZoom[0] as DataZoomArray[0];
|
|
87
92
|
|
|
88
|
-
if (
|
|
89
|
-
instance.dispatchAction({
|
|
90
|
-
type: 'dataZoom',
|
|
91
|
-
dataZoomId: 'sentiment',
|
|
92
|
-
start,
|
|
93
|
-
end,
|
|
94
|
-
filterMode: 'none',
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (batchItem.dataZoomId === 'sentiment') {
|
|
99
|
-
instance.dispatchAction({
|
|
100
|
-
type: 'dataZoom',
|
|
101
|
-
dataZoomId: 'main',
|
|
102
|
-
start,
|
|
103
|
-
end,
|
|
104
|
-
filterMode: 'filter',
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (!data.xAxisData[startValue] || !data.xAxisData[endValue]) {
|
|
93
|
+
if (!dates[startValue] || !dates[endValue]) {
|
|
109
94
|
return;
|
|
110
95
|
}
|
|
111
96
|
|
|
112
97
|
const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
dates[startValue],
|
|
99
|
+
dates[endValue]
|
|
115
100
|
);
|
|
116
101
|
|
|
117
102
|
const wasGreaterThanTwoWeeks =
|
|
@@ -121,7 +106,7 @@ const Chart = ({ data, isDesktop }: ChartProps) => {
|
|
|
121
106
|
|
|
122
107
|
if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {
|
|
123
108
|
const labelsData = getLabelData({
|
|
124
|
-
|
|
109
|
+
dates,
|
|
125
110
|
isGreaterThanTwoWeeks,
|
|
126
111
|
});
|
|
127
112
|
|
|
@@ -20,7 +20,7 @@ const ChartWithData = ({
|
|
|
20
20
|
const { size } = useLayoutProvider();
|
|
21
21
|
const isDesktop = size === Size.DESKTOP;
|
|
22
22
|
|
|
23
|
-
const {
|
|
23
|
+
const { mainData, additionalData, loading, error } = useCrowdViewData({
|
|
24
24
|
instrument,
|
|
25
25
|
bookType,
|
|
26
26
|
division,
|
|
@@ -29,7 +29,7 @@ const ChartWithData = ({
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<>
|
|
32
|
-
<div className="lw-relative lw-h-[
|
|
32
|
+
<div className="lw-relative lw-h-[440px] lw-w-full lw-overflow-hidden">
|
|
33
33
|
{error && (
|
|
34
34
|
<div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary">
|
|
35
35
|
<ChartError />
|
|
@@ -40,9 +40,13 @@ const ChartWithData = ({
|
|
|
40
40
|
<Spinner size={SpinnerSize.lg} />
|
|
41
41
|
</div>
|
|
42
42
|
)}
|
|
43
|
-
{!loading && !error && !!
|
|
43
|
+
{!loading && !error && !!mainData && !!additionalData && (
|
|
44
44
|
<div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full">
|
|
45
|
-
<Chart
|
|
45
|
+
<Chart
|
|
46
|
+
additionalData={additionalData}
|
|
47
|
+
isDesktop={isDesktop}
|
|
48
|
+
mainData={mainData}
|
|
49
|
+
/>
|
|
46
50
|
</div>
|
|
47
51
|
)}
|
|
48
52
|
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DataZoomComponentOption } from 'echarts';
|
|
2
|
+
|
|
3
|
+
import { CHART_CONFIG } from '../../../constants';
|
|
4
|
+
|
|
5
|
+
export const getDataZoomConfig = (): DataZoomComponentOption => ({
|
|
6
|
+
type: 'inside',
|
|
7
|
+
id: 'main',
|
|
8
|
+
xAxisIndex: [0, 1],
|
|
9
|
+
start: CHART_CONFIG.INITIAL_START_ZOOM,
|
|
10
|
+
end: CHART_CONFIG.INITIAL_END_ZOOM,
|
|
11
|
+
filterMode: 'filter',
|
|
12
|
+
minSpan: 10,
|
|
13
|
+
});
|