Skip to content

Commit

Permalink
chore: handle bot stop case for multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
shafin-deriv committed Sep 20, 2023
1 parent ddb16de commit 62baac7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/bot-skeleton/src/scratch/dbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class DBot {
async stopBot() {
api_base.setIsRunning(false);

await this.interpreter.terminateSession();
await this.interpreter.stop();
this.is_bot_running = false;
this.interpreter = null;
this.interpreter = Interpreter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloneThorough } from '@deriv/shared';
import { cloneThorough, isMultiplierContract } from '@deriv/shared';
import JSInterpreter from '@deriv/js-interpreter';
import { createScope } from './cliTools';
import Interface from '../Interface';
Expand Down Expand Up @@ -171,7 +171,11 @@ const Interpreter = () => {
// granted there is no active contract.
global_timeouts.forEach(timeout => clearTimeout(global_timeouts[timeout]));
terminateSession().then(() => resolve());
} else if (bot.tradeEngine.isSold === false && !$scope.is_error_triggered) {
} else if (
bot.tradeEngine.isSold === false &&
!$scope.is_error_triggered &&
isMultiplierContract(bot?.tradeEngine?.data?.contract?.contract_type ?? '')
) {
globalObserver.register('contract.status', async contractStatus => {
if (contractStatus.id === 'contract.sold') {
terminateSession().then(() => resolve());
Expand Down

0 comments on commit 62baac7

Please sign in to comment.