Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/botPage/bot/TradeEngine/Proposal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { translate } from '../../../common/i18n';
import { tradeOptionToProposal, doUntilDone, getUUID } from '../tools';
import { tradeOptionToProposal, doUntilDone } from '../tools';
import { proposalsReady, clearProposals } from './state/actions';

export default Engine =>
Expand Down Expand Up @@ -49,13 +49,7 @@ export default Engine =>
this.proposalTemplates.map(proposal =>
doUntilDone(() =>
this.api
.subscribeToPriceForContractProposal({
...proposal,
passthrough: {
contractType: proposal.contract_type,
uuid : getUUID(),
},
})
.subscribeToPriceForContractProposal(proposal)
// eslint-disable-next-line consistent-return
.catch(e => {
if (e && e.name === 'RateLimit') {
Expand Down Expand Up @@ -127,8 +121,14 @@ export default Engine =>
checkProposalReady() {
const proposals = this.data.get('proposals');

if (proposals && proposals.size === this.proposalTemplates.length) {
this.startPromise.then(() => this.store.dispatch(proposalsReady()));
if (proposals && proposals.size) {
const isSameWithTemplate = this.proposalTemplates.every(p =>
this.data.hasIn(['proposals', p.passthrough.uuid])
);

if (isSameWithTemplate) {
this.startPromise.then(() => this.store.dispatch(proposalsReady()));
}
}
}
isNewTradeOption(tradeOption) {
Expand Down
4 changes: 4 additions & 0 deletions src/botPage/bot/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const tradeOptionToProposal = tradeOption =>
duration : tradeOption.duration,
amount : roundBalance({ currency: tradeOption.currency, balance: tradeOption.amount }),
contract_type: type,
passthrough : {
contractType: type,
uuid : getUUID(),
},
};
if (tradeOption.prediction !== undefined) {
proposal.selected_tick = tradeOption.prediction;
Expand Down
3 changes: 2 additions & 1 deletion src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ export default class _Blockly {
const previousStrat = getPreviousStrat();

if (previousStrat) {
loadDomToWorkspace(previousStrat);
const previousStratDOM = Blockly.Xml.textToDom(previousStrat);
loadDomToWorkspace(previousStratDOM);
resolve();
return;
}
Expand Down