@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
|
@@ -7,9 +7,13 @@ describe('processPriceCandles', () => {
|
|
|
7
7
|
expect(result).toEqual({
|
|
8
8
|
minPrice: 0,
|
|
9
9
|
maxPrice: 0,
|
|
10
|
+
pipsLocation: 0,
|
|
10
11
|
hasValidCandles: false,
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
candlesOpen: [],
|
|
13
|
+
candlesClose: [],
|
|
14
|
+
candlesLow: [],
|
|
15
|
+
candlesHigh: [],
|
|
16
|
+
dates: [],
|
|
13
17
|
});
|
|
14
18
|
});
|
|
15
19
|
|
|
@@ -21,9 +25,13 @@ describe('processPriceCandles', () => {
|
|
|
21
25
|
expect(result).toEqual({
|
|
22
26
|
minPrice: 0,
|
|
23
27
|
maxPrice: 0,
|
|
28
|
+
pipsLocation: 0,
|
|
24
29
|
hasValidCandles: false,
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
candlesOpen: [],
|
|
31
|
+
candlesClose: [],
|
|
32
|
+
candlesLow: [],
|
|
33
|
+
candlesHigh: [],
|
|
34
|
+
dates: [],
|
|
27
35
|
});
|
|
28
36
|
});
|
|
29
37
|
|
|
@@ -31,15 +39,20 @@ describe('processPriceCandles', () => {
|
|
|
31
39
|
const mockData: GetPriceCandlesQuery = {
|
|
32
40
|
priceCandles: {
|
|
33
41
|
candle: [],
|
|
42
|
+
pipsLocation: 0,
|
|
34
43
|
},
|
|
35
44
|
};
|
|
36
45
|
const result = processPriceCandles(mockData);
|
|
37
46
|
expect(result).toEqual({
|
|
38
47
|
minPrice: 0,
|
|
39
48
|
maxPrice: 0,
|
|
49
|
+
pipsLocation: 0,
|
|
40
50
|
hasValidCandles: false,
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
candlesOpen: [],
|
|
52
|
+
candlesClose: [],
|
|
53
|
+
candlesLow: [],
|
|
54
|
+
candlesHigh: [],
|
|
55
|
+
dates: [],
|
|
43
56
|
});
|
|
44
57
|
});
|
|
45
58
|
|
|
@@ -69,14 +82,24 @@ describe('processPriceCandles', () => {
|
|
|
69
82
|
close: 1.2,
|
|
70
83
|
},
|
|
71
84
|
],
|
|
85
|
+
pipsLocation: 4,
|
|
72
86
|
},
|
|
73
87
|
};
|
|
74
88
|
const result = processPriceCandles(mockData);
|
|
75
89
|
expect(result.hasValidCandles).toBe(true);
|
|
76
90
|
expect(result.minPrice).toBe(0.9);
|
|
77
91
|
expect(result.maxPrice).toBe(1.8);
|
|
78
|
-
expect(result.
|
|
79
|
-
expect(result.
|
|
92
|
+
expect(result.pipsLocation).toBe(4);
|
|
93
|
+
expect(result.dates).toHaveLength(3);
|
|
94
|
+
expect(result.candlesOpen).toHaveLength(3);
|
|
95
|
+
expect(result.candlesClose).toHaveLength(3);
|
|
96
|
+
expect(result.candlesLow).toHaveLength(3);
|
|
97
|
+
expect(result.candlesHigh).toHaveLength(3);
|
|
98
|
+
expect(result.dates[0]).toBe('2025-01-01T00:00:00Z');
|
|
99
|
+
expect(result.candlesOpen[0]).toBe(1.2);
|
|
100
|
+
expect(result.candlesClose[0]).toBe(1.3);
|
|
101
|
+
expect(result.candlesLow[0]).toBe(1.0);
|
|
102
|
+
expect(result.candlesHigh[0]).toBe(1.5);
|
|
80
103
|
});
|
|
81
104
|
|
|
82
105
|
it('should filter out null candles', () => {
|
|
@@ -100,73 +123,28 @@ describe('processPriceCandles', () => {
|
|
|
100
123
|
close: 1.6,
|
|
101
124
|
},
|
|
102
125
|
],
|
|
126
|
+
pipsLocation: 4,
|
|
103
127
|
},
|
|
104
128
|
};
|
|
105
129
|
const result = processPriceCandles(mockData);
|
|
106
130
|
expect(result.hasValidCandles).toBe(true);
|
|
107
131
|
expect(result.minPrice).toBe(1.0);
|
|
108
132
|
expect(result.maxPrice).toBe(1.8);
|
|
109
|
-
expect(result.
|
|
110
|
-
expect(result.
|
|
133
|
+
expect(result.pipsLocation).toBe(4);
|
|
134
|
+
expect(result.dates).toHaveLength(2);
|
|
135
|
+
expect(result.candlesOpen).toHaveLength(2);
|
|
111
136
|
});
|
|
112
137
|
|
|
113
|
-
it('should
|
|
138
|
+
it('should return default values when all candles are null', () => {
|
|
114
139
|
const mockData: GetPriceCandlesQuery = {
|
|
115
140
|
priceCandles: {
|
|
116
|
-
candle: [
|
|
117
|
-
|
|
118
|
-
point: '2025-01-01T00:00:00Z',
|
|
119
|
-
high: 1.5,
|
|
120
|
-
low: 1.0,
|
|
121
|
-
open: 1.2,
|
|
122
|
-
close: 1.3,
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
point: '2025-01-01T01:00:00Z',
|
|
126
|
-
high: 1.8,
|
|
127
|
-
low: 1.1,
|
|
128
|
-
open: 1.4,
|
|
129
|
-
close: 1.6,
|
|
130
|
-
},
|
|
131
|
-
],
|
|
141
|
+
candle: [null, null],
|
|
142
|
+
pipsLocation: 0,
|
|
132
143
|
},
|
|
133
144
|
};
|
|
134
145
|
const result = processPriceCandles(mockData);
|
|
135
|
-
expect(result.
|
|
136
|
-
expect(result.
|
|
137
|
-
expect(result.candleMap.get('2025-01-01T00:00:00Z')).toEqual({
|
|
138
|
-
point: '2025-01-01T00:00:00Z',
|
|
139
|
-
high: 1.5,
|
|
140
|
-
low: 1.0,
|
|
141
|
-
open: 1.2,
|
|
142
|
-
close: 1.3,
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('should not add candles without point to candleMap', () => {
|
|
147
|
-
const mockData: GetPriceCandlesQuery = {
|
|
148
|
-
priceCandles: {
|
|
149
|
-
candle: [
|
|
150
|
-
{
|
|
151
|
-
point: '2025-01-01T00:00:00Z',
|
|
152
|
-
high: 1.5,
|
|
153
|
-
low: 1.0,
|
|
154
|
-
open: 1.2,
|
|
155
|
-
close: 1.3,
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
point: undefined as any,
|
|
159
|
-
high: 1.8,
|
|
160
|
-
low: 1.1,
|
|
161
|
-
open: 1.4,
|
|
162
|
-
close: 1.6,
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
const result = processPriceCandles(mockData);
|
|
168
|
-
expect(result.candleMap.size).toBe(1);
|
|
169
|
-
expect(result.candleMap.has('2025-01-01T00:00:00Z')).toBe(true);
|
|
146
|
+
expect(result.hasValidCandles).toBe(false);
|
|
147
|
+
expect(result.dates).toHaveLength(0);
|
|
170
148
|
});
|
|
171
149
|
|
|
172
150
|
it('should handle candles with extreme price values', () => {
|
|
@@ -181,11 +159,13 @@ describe('processPriceCandles', () => {
|
|
|
181
159
|
close: 750.0,
|
|
182
160
|
},
|
|
183
161
|
],
|
|
162
|
+
pipsLocation: 3,
|
|
184
163
|
},
|
|
185
164
|
};
|
|
186
165
|
const result = processPriceCandles(mockData);
|
|
187
166
|
expect(result.minPrice).toBe(0.001);
|
|
188
167
|
expect(result.maxPrice).toBe(1000.0);
|
|
168
|
+
expect(result.pipsLocation).toBe(3);
|
|
189
169
|
});
|
|
190
170
|
|
|
191
171
|
it('should handle single candle correctly', () => {
|
|
@@ -200,17 +180,19 @@ describe('processPriceCandles', () => {
|
|
|
200
180
|
close: 1.3,
|
|
201
181
|
},
|
|
202
182
|
],
|
|
183
|
+
pipsLocation: 4,
|
|
203
184
|
},
|
|
204
185
|
};
|
|
205
186
|
const result = processPriceCandles(mockData);
|
|
206
187
|
expect(result.hasValidCandles).toBe(true);
|
|
207
188
|
expect(result.minPrice).toBe(1.0);
|
|
208
189
|
expect(result.maxPrice).toBe(1.5);
|
|
209
|
-
expect(result.
|
|
210
|
-
expect(result.
|
|
190
|
+
expect(result.pipsLocation).toBe(4);
|
|
191
|
+
expect(result.dates).toHaveLength(1);
|
|
192
|
+
expect(result.candlesOpen).toHaveLength(1);
|
|
211
193
|
});
|
|
212
194
|
|
|
213
|
-
it('should
|
|
195
|
+
it('should maintain order of candles', () => {
|
|
214
196
|
const mockData: GetPriceCandlesQuery = {
|
|
215
197
|
priceCandles: {
|
|
216
198
|
candle: [
|
|
@@ -223,8 +205,8 @@ describe('processPriceCandles', () => {
|
|
|
223
205
|
},
|
|
224
206
|
{
|
|
225
207
|
point: '2025-01-01T01:00:00Z',
|
|
226
|
-
high: 3.0,
|
|
227
|
-
low: 0.5,
|
|
208
|
+
high: 3.0,
|
|
209
|
+
low: 0.5,
|
|
228
210
|
open: 2.0,
|
|
229
211
|
close: 2.5,
|
|
230
212
|
},
|
|
@@ -236,10 +218,54 @@ describe('processPriceCandles', () => {
|
|
|
236
218
|
close: 1.6,
|
|
237
219
|
},
|
|
238
220
|
],
|
|
221
|
+
pipsLocation: 4,
|
|
239
222
|
},
|
|
240
223
|
};
|
|
241
224
|
const result = processPriceCandles(mockData);
|
|
242
225
|
expect(result.minPrice).toBe(0.5);
|
|
243
226
|
expect(result.maxPrice).toBe(3.0);
|
|
227
|
+
expect(result.pipsLocation).toBe(4);
|
|
228
|
+
expect(result.dates[0]).toBe('2025-01-01T00:00:00Z');
|
|
229
|
+
expect(result.dates[1]).toBe('2025-01-01T01:00:00Z');
|
|
230
|
+
expect(result.dates[2]).toBe('2025-01-01T02:00:00Z');
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should handle all null candles gracefully', () => {
|
|
234
|
+
const mockData: GetPriceCandlesQuery = {
|
|
235
|
+
priceCandles: {
|
|
236
|
+
candle: [null, null, null],
|
|
237
|
+
pipsLocation: 0,
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
const result = processPriceCandles(mockData);
|
|
241
|
+
expect(result.hasValidCandles).toBe(false);
|
|
242
|
+
expect(result.dates).toHaveLength(0);
|
|
243
|
+
expect(result.minPrice).toBe(0);
|
|
244
|
+
expect(result.maxPrice).toBe(0);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should handle large arrays without stack overflow', () => {
|
|
248
|
+
// Create a large array of candles
|
|
249
|
+
const largeCandles = Array.from({ length: 10000 }, (_, i) => ({
|
|
250
|
+
point: `2025-01-01T${String(i).padStart(2, '0')}:00:00Z`,
|
|
251
|
+
high: 1.5 + i * 0.0001,
|
|
252
|
+
low: 1.0 + i * 0.0001,
|
|
253
|
+
open: 1.2 + i * 0.0001,
|
|
254
|
+
close: 1.3 + i * 0.0001,
|
|
255
|
+
}));
|
|
256
|
+
|
|
257
|
+
const mockData: GetPriceCandlesQuery = {
|
|
258
|
+
priceCandles: {
|
|
259
|
+
candle: largeCandles,
|
|
260
|
+
pipsLocation: 4,
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
const result = processPriceCandles(mockData);
|
|
264
|
+
expect(result.hasValidCandles).toBe(true);
|
|
265
|
+
expect(result.pipsLocation).toBe(4);
|
|
266
|
+
expect(result.dates).toHaveLength(10000);
|
|
267
|
+
// Should calculate min/max without stack overflow
|
|
268
|
+
expect(result.minPrice).toBeGreaterThan(0);
|
|
269
|
+
expect(result.maxPrice).toBeGreaterThan(result.minPrice);
|
|
244
270
|
});
|
|
245
271
|
});
|
|
@@ -27,40 +27,55 @@ describe('validateData', () => {
|
|
|
27
27
|
close: 1.3,
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
|
+
pipsLocation: 0,
|
|
30
31
|
},
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
const createMockOrderPositionData = (
|
|
34
35
|
books?: Array<{
|
|
35
|
-
|
|
36
|
-
price?: number | null;
|
|
36
|
+
__typename?: 'OrderPositionData';
|
|
37
37
|
time: string;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
price?: number | null;
|
|
39
|
+
buckets: Array<{
|
|
40
|
+
__typename?: 'OrderPositionBucket';
|
|
41
|
+
price: number;
|
|
42
|
+
sentiment?: number | null;
|
|
43
|
+
} | null>;
|
|
44
|
+
}>
|
|
40
45
|
): GetOrderPositionBooksQuery => ({
|
|
41
|
-
orderPositionBooks:
|
|
42
|
-
books
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
orderPositionBooks: {
|
|
47
|
+
books:
|
|
48
|
+
books !== undefined
|
|
49
|
+
? books
|
|
50
|
+
: [
|
|
51
|
+
{
|
|
52
|
+
time: '2025-01-01T00:00:00Z',
|
|
53
|
+
price: 1.0,
|
|
54
|
+
buckets: [{ price: 1.0, sentiment: 0.2 }],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
bucketWidth: 0.0005,
|
|
58
|
+
sentimentThresholdMin: 0.15,
|
|
59
|
+
sentimentThresholdMax: 0.55,
|
|
60
|
+
},
|
|
52
61
|
});
|
|
53
62
|
|
|
54
63
|
it('should return null when all data is valid', () => {
|
|
55
64
|
const priceCandlesData = createMockPriceCandlesData();
|
|
56
65
|
const orderPositionData = createMockOrderPositionData();
|
|
57
|
-
const result = validateData(
|
|
66
|
+
const result = validateData(
|
|
67
|
+
priceCandlesData,
|
|
68
|
+
orderPositionData,
|
|
69
|
+
true,
|
|
70
|
+
true,
|
|
71
|
+
true
|
|
72
|
+
);
|
|
58
73
|
expect(result).toBeNull();
|
|
59
74
|
});
|
|
60
75
|
|
|
61
76
|
it('should return error when priceCandlesData is undefined', () => {
|
|
62
77
|
const orderPositionData = createMockOrderPositionData();
|
|
63
|
-
const result = validateData(undefined, orderPositionData, true);
|
|
78
|
+
const result = validateData(undefined, orderPositionData, true, true, true);
|
|
64
79
|
expect(result).toBeInstanceOf(Error);
|
|
65
80
|
expect(result?.message).toBe('Insufficient price candle data');
|
|
66
81
|
});
|
|
@@ -70,7 +85,13 @@ describe('validateData', () => {
|
|
|
70
85
|
priceCandles: {} as any,
|
|
71
86
|
};
|
|
72
87
|
const orderPositionData = createMockOrderPositionData();
|
|
73
|
-
const result = validateData(
|
|
88
|
+
const result = validateData(
|
|
89
|
+
priceCandlesData,
|
|
90
|
+
orderPositionData,
|
|
91
|
+
true,
|
|
92
|
+
true,
|
|
93
|
+
true
|
|
94
|
+
);
|
|
74
95
|
expect(result).toBeInstanceOf(Error);
|
|
75
96
|
expect(result?.message).toBe('Insufficient price candle data');
|
|
76
97
|
});
|
|
@@ -78,7 +99,13 @@ describe('validateData', () => {
|
|
|
78
99
|
it('should return error when candle array is empty', () => {
|
|
79
100
|
const priceCandlesData = createMockPriceCandlesData([]);
|
|
80
101
|
const orderPositionData = createMockOrderPositionData();
|
|
81
|
-
const result = validateData(
|
|
102
|
+
const result = validateData(
|
|
103
|
+
priceCandlesData,
|
|
104
|
+
orderPositionData,
|
|
105
|
+
true,
|
|
106
|
+
true,
|
|
107
|
+
true
|
|
108
|
+
);
|
|
82
109
|
expect(result).toBeInstanceOf(Error);
|
|
83
110
|
expect(result?.message).toBe('Insufficient price candle data');
|
|
84
111
|
});
|
|
@@ -89,24 +116,41 @@ describe('validateData', () => {
|
|
|
89
116
|
// The hasValidCandles parameter handles content validation
|
|
90
117
|
const priceCandlesData = createMockPriceCandlesData([null, null]);
|
|
91
118
|
const orderPositionData = createMockOrderPositionData();
|
|
92
|
-
const result = validateData(
|
|
93
|
-
|
|
119
|
+
const result = validateData(
|
|
120
|
+
priceCandlesData,
|
|
121
|
+
orderPositionData,
|
|
122
|
+
true,
|
|
123
|
+
true,
|
|
124
|
+
true
|
|
125
|
+
);
|
|
126
|
+
// Array length >= 1, so it passes length check
|
|
94
127
|
expect(result).toBeNull();
|
|
95
128
|
});
|
|
96
129
|
|
|
97
130
|
it('should return error when orderPositionData is undefined', () => {
|
|
98
131
|
const priceCandlesData = createMockPriceCandlesData();
|
|
99
|
-
const result = validateData(priceCandlesData, undefined, true);
|
|
132
|
+
const result = validateData(priceCandlesData, undefined, true, true, true);
|
|
100
133
|
expect(result).toBeInstanceOf(Error);
|
|
101
134
|
expect(result?.message).toBe('Insufficient order position data');
|
|
102
135
|
});
|
|
103
136
|
|
|
104
|
-
it('should return error when orderPositionBooks is empty', () => {
|
|
137
|
+
it('should return error when orderPositionBooks.books is empty', () => {
|
|
105
138
|
const priceCandlesData = createMockPriceCandlesData();
|
|
106
139
|
const orderPositionData: GetOrderPositionBooksQuery = {
|
|
107
|
-
orderPositionBooks:
|
|
140
|
+
orderPositionBooks: {
|
|
141
|
+
books: [],
|
|
142
|
+
bucketWidth: 0.0005,
|
|
143
|
+
sentimentThresholdMin: 0.15,
|
|
144
|
+
sentimentThresholdMax: 0.55,
|
|
145
|
+
},
|
|
108
146
|
};
|
|
109
|
-
const result = validateData(
|
|
147
|
+
const result = validateData(
|
|
148
|
+
priceCandlesData,
|
|
149
|
+
orderPositionData,
|
|
150
|
+
true,
|
|
151
|
+
true,
|
|
152
|
+
true
|
|
153
|
+
);
|
|
110
154
|
expect(result).toBeInstanceOf(Error);
|
|
111
155
|
expect(result?.message).toBe('Insufficient order position data');
|
|
112
156
|
});
|
|
@@ -114,30 +158,75 @@ describe('validateData', () => {
|
|
|
114
158
|
it('should return error when hasValidCandles is false', () => {
|
|
115
159
|
const priceCandlesData = createMockPriceCandlesData();
|
|
116
160
|
const orderPositionData = createMockOrderPositionData();
|
|
117
|
-
const result = validateData(
|
|
161
|
+
const result = validateData(
|
|
162
|
+
priceCandlesData,
|
|
163
|
+
orderPositionData,
|
|
164
|
+
false,
|
|
165
|
+
true,
|
|
166
|
+
true
|
|
167
|
+
);
|
|
118
168
|
expect(result).toBeInstanceOf(Error);
|
|
119
169
|
expect(result?.message).toBe('Invalid candle data');
|
|
120
170
|
});
|
|
121
171
|
|
|
172
|
+
it('should return error when hasValidBooks is false', () => {
|
|
173
|
+
const priceCandlesData = createMockPriceCandlesData();
|
|
174
|
+
const orderPositionData = createMockOrderPositionData();
|
|
175
|
+
const result = validateData(
|
|
176
|
+
priceCandlesData,
|
|
177
|
+
orderPositionData,
|
|
178
|
+
true,
|
|
179
|
+
false,
|
|
180
|
+
true
|
|
181
|
+
);
|
|
182
|
+
expect(result).toBeInstanceOf(Error);
|
|
183
|
+
expect(result?.message).toBe('Invalid book data');
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('should return error when hasValidSentiments is false', () => {
|
|
187
|
+
const priceCandlesData = createMockPriceCandlesData();
|
|
188
|
+
const orderPositionData = createMockOrderPositionData();
|
|
189
|
+
const result = validateData(
|
|
190
|
+
priceCandlesData,
|
|
191
|
+
orderPositionData,
|
|
192
|
+
true,
|
|
193
|
+
true,
|
|
194
|
+
false
|
|
195
|
+
);
|
|
196
|
+
expect(result).toBeInstanceOf(Error);
|
|
197
|
+
expect(result?.message).toBe('Invalid sentiment data');
|
|
198
|
+
});
|
|
199
|
+
|
|
122
200
|
it('should prioritize price candle error over order position error', () => {
|
|
123
201
|
const orderPositionData: GetOrderPositionBooksQuery = {
|
|
124
|
-
orderPositionBooks:
|
|
202
|
+
orderPositionBooks: {
|
|
203
|
+
books: [],
|
|
204
|
+
bucketWidth: 0.0005,
|
|
205
|
+
sentimentThresholdMin: 0.15,
|
|
206
|
+
sentimentThresholdMax: 0.55,
|
|
207
|
+
},
|
|
125
208
|
};
|
|
126
|
-
const result = validateData(undefined, orderPositionData, true);
|
|
209
|
+
const result = validateData(undefined, orderPositionData, true, true, true);
|
|
127
210
|
expect(result).toBeInstanceOf(Error);
|
|
128
211
|
expect(result?.message).toBe('Insufficient price candle data');
|
|
129
212
|
});
|
|
130
213
|
|
|
131
214
|
it('should prioritize price candle error over hasValidCandles error', () => {
|
|
132
215
|
const orderPositionData = createMockOrderPositionData();
|
|
133
|
-
const result = validateData(
|
|
216
|
+
const result = validateData(
|
|
217
|
+
undefined,
|
|
218
|
+
orderPositionData,
|
|
219
|
+
false,
|
|
220
|
+
true,
|
|
221
|
+
true
|
|
222
|
+
);
|
|
134
223
|
expect(result).toBeInstanceOf(Error);
|
|
135
224
|
expect(result?.message).toBe('Insufficient price candle data');
|
|
136
225
|
});
|
|
137
226
|
|
|
138
227
|
it('should prioritize order position error over hasValidCandles error', () => {
|
|
139
228
|
const priceCandlesData = createMockPriceCandlesData();
|
|
140
|
-
const result = validateData(priceCandlesData, undefined, false);
|
|
229
|
+
const result = validateData(priceCandlesData, undefined, false, true, true);
|
|
141
230
|
expect(result).toBeInstanceOf(Error);
|
|
142
231
|
expect(result?.message).toBe('Insufficient order position data');
|
|
143
232
|
});
|
|
@@ -154,13 +243,18 @@ describe('validateData', () => {
|
|
|
154
243
|
]);
|
|
155
244
|
const orderPositionData = createMockOrderPositionData([
|
|
156
245
|
{
|
|
157
|
-
|
|
246
|
+
time: '2025-01-01T00:00:00Z',
|
|
158
247
|
price: 1.0,
|
|
159
|
-
time: '2025-01-01',
|
|
160
248
|
buckets: [{ price: 1.0, sentiment: 0.2 }],
|
|
161
249
|
},
|
|
162
250
|
]);
|
|
163
|
-
const result = validateData(
|
|
251
|
+
const result = validateData(
|
|
252
|
+
priceCandlesData,
|
|
253
|
+
orderPositionData,
|
|
254
|
+
true,
|
|
255
|
+
true,
|
|
256
|
+
true
|
|
257
|
+
);
|
|
164
258
|
expect(result).toBeNull();
|
|
165
259
|
});
|
|
166
260
|
|
|
@@ -183,19 +277,23 @@ describe('validateData', () => {
|
|
|
183
277
|
]);
|
|
184
278
|
const orderPositionData = createMockOrderPositionData([
|
|
185
279
|
{
|
|
186
|
-
|
|
280
|
+
time: '2025-01-01T00:00:00Z',
|
|
187
281
|
price: 1.0,
|
|
188
|
-
time: '2025-01-01',
|
|
189
282
|
buckets: [{ price: 1.0, sentiment: 0.2 }],
|
|
190
283
|
},
|
|
191
284
|
{
|
|
192
|
-
|
|
285
|
+
time: '2025-01-01T01:00:00Z',
|
|
193
286
|
price: 1.1,
|
|
194
|
-
time: '2025-01-02',
|
|
195
287
|
buckets: [{ price: 1.1, sentiment: 0.3 }],
|
|
196
288
|
},
|
|
197
289
|
]);
|
|
198
|
-
const result = validateData(
|
|
290
|
+
const result = validateData(
|
|
291
|
+
priceCandlesData,
|
|
292
|
+
orderPositionData,
|
|
293
|
+
true,
|
|
294
|
+
true,
|
|
295
|
+
true
|
|
296
|
+
);
|
|
199
297
|
expect(result).toBeNull();
|
|
200
298
|
});
|
|
201
299
|
});
|