Skip to content

Commit

Permalink
Merge branch 'deriv-com:master' into COJ-1424-Remove-the-jurisdiction…
Browse files Browse the repository at this point in the history
…-information-on-compare-account-table-for-wallets
  • Loading branch information
heorhi-deriv authored Nov 15, 2024
2 parents 86387d7 + bfb0dfa commit d9ab0d2
Show file tree
Hide file tree
Showing 40 changed files with 7,239 additions and 548 deletions.
8 changes: 4 additions & 4 deletions packages/bot-skeleton/src/services/tradeEngine/trade/Sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default Engine =>
).then(proposal_open_contract_response => {
const { proposal_open_contract } = proposal_open_contract_response;

if (proposal_open_contract.status !== 'sold') {
if (!proposal_open_contract.is_sold) {
return Promise.reject(sell_error);
}

Expand All @@ -98,9 +98,9 @@ export default Engine =>

// Restart buy/sell on error is enabled, don't recover from sell error.
if (!this.options.timeMachineEnabled) {
return doUntilDone(sellContractAndGetContractInfo, errors_to_ignore).then(sell_response =>
onContractSold(sell_response)
);
return doUntilDone(sellContractAndGetContractInfo, errors_to_ignore)
.then(sell_response => onContractSold(sell_response))
.catch(error => error);
}

// If above checkbox not checked, try to recover from sell error.
Expand Down
21 changes: 13 additions & 8 deletions packages/bot-skeleton/src/services/tradeEngine/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ export const shouldThrowError = (error, errors_to_ignore = []) => {
'OpenPositionLimitExceeded',
];
updateErrorMessage(error);
const is_ignorable_error = errors_to_ignore.concat(default_errors_to_ignore).includes(error.error.code);
const is_ignorable_error = errors_to_ignore
.concat(default_errors_to_ignore)
.includes(error?.error?.code ?? error?.name);

return !is_ignorable_error;
};
Expand All @@ -236,17 +238,20 @@ export const recoverFromError = (promiseFn, recoverFn, errors_to_ignore, delay_i
return;
}
recoverFn(
error.error.code,
error?.error?.code ?? error?.name,
() =>
new Promise(recoverResolve => {
const getGlobalTimeouts = () => globalObserver.getState('global_timeouts') ?? [];

const timeout = setTimeout(() => {
const global_timeouts = getGlobalTimeouts();
delete global_timeouts[timeout];
globalObserver.setState(global_timeouts);
recoverResolve();
}, getBackoffDelayInMs(error, delay_index));
const timeout = setTimeout(
() => {
const global_timeouts = getGlobalTimeouts();
delete global_timeouts[timeout];
globalObserver.setState(global_timeouts);
recoverResolve();
},
getBackoffDelayInMs(error, delay_index)
);

const global_timeouts = getGlobalTimeouts();
const cancellable_timeouts = ['buy'];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { ACCUMULATORS_DALEMBERT } from './accumulators_dalembert';
export { D_ALEMBERT } from './d_alembert';
export { MARTINGALE } from './martingale';
export { OSCARS_GRIND } from './oscars_grind';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,29 @@ jest.mock('../config', () => ({
STRATEGY_1_3_2_6: {
label: '1-3-2-6',
},
ACCUMULATORS_DALEMBERT_ON_STAT_RESET: {
label: 'Accumulators D’Alembert on stat reset with tick count take profit',
},
ACCUMULATORS_DALEMBERT: {
label: 'Accumulators D’Alembert',
label: 'Accumulators D’Alembert with tick count take profit',
},
ACCUMULATORS_MARTINGALE: {
label: 'Accumulators Martingale with tick count take profit',
},
ACCUMULATORS_MARTINGALE_ON_STAT_RESET: {
label: 'Accumulators Martingale on stat reset with tick count take profit',
},
ACCUMULATORS_REVERSE_DALEMBERT: {
label: 'Accumulators Reverse D’Alembert with tick count take profit',
},
ACCUMULATORS_REVERSE_MARTINGALE: {
label: 'Accumulators Reverse Martingale with tick count take profit',
},
ACCUMULATORS_REVERSE_MARTINGALE_ON_STAT_RESET: {
label: 'Accumulators Reverse Martingale on stat reset with tick count take profit',
},
ACCUMULATORS_REVERSE_DALEMBERT_ON_STAT_RESET: {
label: 'Accumulators Reverse D’Alembert on stat reset with tick count take profit',
},
},
}));
Expand Down
Loading

0 comments on commit d9ab0d2

Please sign in to comment.