diff --git a/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/__tests__/accumulators-stats.spec.js b/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/__tests__/accumulators-stats.spec.js
index afae7eba9d18..30037a5caddb 100644
--- a/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/__tests__/accumulators-stats.spec.js
+++ b/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/__tests__/accumulators-stats.spec.js
@@ -64,6 +64,16 @@ describe('AccumulatorsStats', () => {
expect(screen.getByText(`${CONTRACT_TYPES.STAY_IN} history`)).toBeInTheDocument();
expect(screen.getByText(stay_in_history[0])).toBeInTheDocument();
});
+ it('should not switch to Break out history when DECCU history is missing', () => {
+ mock_connect_props.ticks_history_stats.DECCU = {};
+ render();
+ expect(screen.getByText(`${CONTRACT_TYPES.STAY_IN} history`)).toBeInTheDocument();
+ expect(screen.getByText(stay_in_history[0])).toBeInTheDocument();
+
+ fireEvent.click(screen.getByTestId('dt_accu_stats_switcher'));
+ expect(screen.queryByText(`${CONTRACT_TYPES.BREAK_OUT} history`)).not.toBeInTheDocument();
+ expect(screen.getByText(`${CONTRACT_TYPES.STAY_IN} history`)).toBeInTheDocument();
+ });
it('should show manual after info icon is clicked', () => {
const { container } = render();
fireEvent.click(container.querySelector('.info'));
diff --git a/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/accumulators-stats.jsx b/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/accumulators-stats.jsx
index 515306a8cf93..9cbe646c93ff 100644
--- a/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/accumulators-stats.jsx
+++ b/packages/trader/src/Modules/Contract/Components/AccumulatorsStats/accumulators-stats.jsx
@@ -24,11 +24,10 @@ const AccumulatorsStats = ({ is_expandable = true, ticks_history_stats = {} }) =
const [is_collapsed, setIsCollapsed] = React.useState(true);
const [is_manual_open, setIsManualOpen] = React.useState(false);
const [displayed_contract_name, setDisplayedContractName] = React.useState(CONTRACT_TYPES.STAY_IN);
+ const { ACCU, DECCU } = ticks_history_stats;
const widget_title = localize('{{displayed_contract_name}} history', { displayed_contract_name });
const ticks_history =
- (displayed_contract_name === CONTRACT_TYPES.STAY_IN
- ? ticks_history_stats.ACCU?.ticks_stayed_in
- : ticks_history_stats.DECCU?.ticks_stayed_in) || [];
+ (displayed_contract_name === CONTRACT_TYPES.STAY_IN ? ACCU?.ticks_stayed_in : DECCU?.ticks_stayed_in) || [];
const history_text_size = isDesktop() || !is_collapsed ? 'xxs' : 'xxxs';
const rows = ticks_history.reduce((acc, _el, index) => {
@@ -42,6 +41,8 @@ const AccumulatorsStats = ({ is_expandable = true, ticks_history_stats = {} }) =
}, []);
const handleSwitchBetweenContracts = () => {
+ // don't switch if ACCU or DECCU history is missing
+ if (!ACCU?.ticks_stayed_in?.length || !DECCU?.ticks_stayed_in?.length) return;
setDisplayedContractName(Object.values(CONTRACT_TYPES).find(name => name !== displayed_contract_name));
};
diff --git a/packages/trader/src/Modules/SmartChart/Components/Markers/__tests__/accumulators-profit-loss-tooltip.spec.js b/packages/trader/src/Modules/SmartChart/Components/Markers/__tests__/accumulators-profit-loss-tooltip.spec.js
index e78823b876a3..5cb3f5b79142 100644
--- a/packages/trader/src/Modules/SmartChart/Components/Markers/__tests__/accumulators-profit-loss-tooltip.spec.js
+++ b/packages/trader/src/Modules/SmartChart/Components/Markers/__tests__/accumulators-profit-loss-tooltip.spec.js
@@ -17,7 +17,7 @@ describe('AccumulatorsProfitLossTooltip', () => {
className: 'profit-loss-tooltip',
};
- it('should render with an arrow on the left', () => {
+ it('should render the right-side tooltip with an arrow on the left', () => {
const wrapper = shallow();
expect(wrapper.find('.profit-loss-tooltip').exists()).to.be.true;
expect(wrapper.find('.profit-loss-tooltip__spot-circle').exists()).to.be.true;
diff --git a/packages/trader/src/Modules/SmartChart/Components/Markers/accumulators-profit-loss-tooltip.jsx b/packages/trader/src/Modules/SmartChart/Components/Markers/accumulators-profit-loss-tooltip.jsx
index 66b6367d2cca..8d7a671cf776 100644
--- a/packages/trader/src/Modules/SmartChart/Components/Markers/accumulators-profit-loss-tooltip.jsx
+++ b/packages/trader/src/Modules/SmartChart/Components/Markers/accumulators-profit-loss-tooltip.jsx
@@ -17,12 +17,11 @@ const AccumulatorsProfitLossTooltip = ({
const won = profit > 0;
const sign = won ? '+' : '';
- const getOppositeArrowPosition = React.useCallback(() => {
+ const opposite_arrow_position = React.useMemo(() => {
const horizontal = ['left', 'right'];
- const vertical = ['top', 'bottom'];
return horizontal.includes(alignment)
? horizontal.find(el => el !== alignment)
- : vertical.find(el => el !== alignment);
+ : ['top', 'bottom'].find(el => el !== alignment);
}, [alignment]);
const onRef = ref => {
@@ -45,7 +44,7 @@ const AccumulatorsProfitLossTooltip = ({
onMouseEnter={() => !is_tooltip_open && setIsTooltipOpen(true)}
/>
{is_tooltip_open && (
-
+
{localize('Total profit/loss:')}