Skip to content

Commit

Permalink
Revert "MaryiaF/fix: P/L is not getting updated when a contract is te…
Browse files Browse the repository at this point in the history
…rminated… (#6024)"

This reverts commit ba50688.
  • Loading branch information
farrah-deriv committed Jul 26, 2022
1 parent eb0b338 commit 6613e2e
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions packages/bot-web-ui/src/stores/transactions-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,39 +174,35 @@ export default class TransactionsStore {

recoverPendingContractsById(contract_id) {
const { ws } = this.root_store;
const client = ws.core?.client;
const token = client?.account[client?.loginid]?.token;

ws.send(JSON.stringify({ authorize: token })).then(() => {
ws.send({ proposal_open_contract: 1, contract_id }).then(response => {
if (!response.error) {
const { proposal_open_contract } = response;
ws.authorized.subscribeProposalOpenContract(contract_id, response => {
if (!response.error) {
const { proposal_open_contract } = response;

const { contract_info } = this.root_store.summary_card;
const { contract_info } = this.root_store.summary_card;

if (proposal_open_contract.contract_id === contract_info?.contract_id) return;
if (proposal_open_contract.contract_id === contract_info?.contract_id) return;

this.onBotContractEvent(proposal_open_contract);
this.onBotContractEvent(proposal_open_contract);

if (!this.recovered_transactions.includes(proposal_open_contract.contract_id)) {
this.recovered_transactions.push(proposal_open_contract.contract_id);
}
if (!this.recovered_transactions.includes(proposal_open_contract.contract_id)) {
this.recovered_transactions.push(proposal_open_contract.contract_id);
}

if (
!this.recovered_completed_transactions.includes(proposal_open_contract.contract_id) &&
isEnded(proposal_open_contract)
) {
this.recovered_completed_transactions.push(proposal_open_contract.contract_id);
if (
!this.recovered_completed_transactions.includes(proposal_open_contract.contract_id) &&
isEnded(proposal_open_contract)
) {
this.recovered_completed_transactions.push(proposal_open_contract.contract_id);

const { currency, profit } = proposal_open_contract;
const { currency, profit } = proposal_open_contract;

this.root_store.journal.onLogSuccess({
log_type: profit > 0 ? log_types.PROFIT : log_types.LOST,
extra: { currency, profit },
});
}
this.root_store.journal.onLogSuccess({
log_type: profit > 0 ? log_types.PROFIT : log_types.LOST,
extra: { currency, profit },
});
}
});
}
});
}
}

0 comments on commit 6613e2e

Please sign in to comment.