Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
errorMood = (
<button>
<img src="{`${this.props.imagesDir}creatures/OhNoes-Hmm.png`}" alt="{i18n._("Error">
{/* I18N: The CS error buddy is thinking there might be an
* error in your code and is waiting for you to fix it. */}
{i18n._("Hmm...")}
</button>
);
}
return (
<div>
<div>{errorMood}</div>
</div>
);
}
}
var stopTutorial = function stopTutorial(e) {
if (e) {
e.preventDefault();
}
if (activeTutorial) {
if (e) {
activeTutorial.stop();
}
activeTutorial = null;
}
$('#tutorialButton')
.unbind('click.stopTutorial')
.bind('click.startTutorial', startTutorial)
.text(i18n._('Go!'));
};
.each(function() {
var contents = $(this).contents();
if (contents.length > 0) {
if (contents.get(0).nodeType == Node.TEXT_NODE) {
$(this).text(i18n._($(this)
.attr('data-i18n-text')))
.append(contents.slice(1));
}
} else {
$(this)
.text(i18n._($(this)
.attr('data-i18n-text')));
}
});
done();
blockly.WidgetDiv.hideIfOwner(blockly.mainWorkspace.getBlockById('trade')
.getField('ACCOUNT_LIST'));
if (tokenList.length === 0) {
$('#addAccount')
.text('Login');
$('#logout')
.hide();
globals.lists.accounts = [
[i18n._('Please add a token first'), '']
];
blockly.mainWorkspace.getBlockById('trade')
.getField('ACCOUNT_LIST')
.setValue('');
blockly.mainWorkspace.getBlockById('trade')
.getField('ACCOUNT_LIST')
.setText(i18n._('Please add a token first'));
} else {
$('#addAccount')
.text('Add Token');
$('#logout')
.show();
globals.lists.accounts = [];
tokenList.forEach(function (tokenInfo) {
globals.lists.accounts.push([tokenInfo.account_name, tokenInfo.token]);
});
var tokenInfoToAdd = tokenList[0];
if (tokenToAdd !== undefined) {
var tokenInfoIndex = storageManager.findToken(tokenToAdd);
if (tokenInfoIndex >= 0) {
tokenInfoToAdd = tokenList[tokenInfoIndex];
}
}
globals.tradeInfo.totalPayout = +(+globals.tradeInfo.totalPayout + (+contract.sell_price))
.toFixed(2);
globals.tradeInfo.totalProfit = +(+globals.tradeInfo.totalProfit + (+globals.tradeInfo.lastProfit))
.toFixed(2);
globals.tradeInfo.lastResult = result;
globals.updateTradeInfo();
var detail_list = [
contract.transaction_ids.buy, +contract.buy_price, +contract.sell_price,
globals.tradeInfo.lastProfit,
contract.contract_type, +contract.entry_tick,
botUtils.getUTCTime(new Date(parseInt(contract.entry_tick_time + '000'))), +contract.exit_tick,
botUtils.getUTCTime(new Date(parseInt(contract.exit_tick_time + '000'))), +((contract.barrier) ? contract.barrier : 0),
];
log(i18n._('Purchase was finished, result is:') + ' ' + result, (result === 'win') ? 'success' : 'error');
globals.on_finish(result, detail_list);
purchasedContractId = '';
contractForChart = null;
finished = true;
globals.disableRun(false);
};
render() {
if (this.props.isHidden) {
return null;
}
let errorMood;
if (this.props.errorState === "happy") {
errorMood = (
<div style="{{height:">
<img src="{`${" alt="{i18n._("Error">
</div>
);
} else {
errorMood = (
<button>
</button>
var purchase = function purchase(option) {
purchased = true;
strategyEnabled = false;
var proposalContract = (option === contracts[1].echo_req.contract_type) ? contracts[1] : contracts[0];
log(i18n._('Purchased') + ': ' + proposalContract.proposal.longcode, 'info');
api.buyContract(proposalContract.proposal.id, proposalContract.proposal.ask_price)
.then(function (purchaseContract) {
purchasedContractId = purchaseContract.buy.contract_id;
api.subscribeToOpenContract(purchasedContractId);
globals.tradeInfo.numOfRuns++;
globals.updateTradeInfo();
globals.disableRun(true);
}, function (reason) {
stop();
showError(reason);
});
};
}, function (reason) {
log(i18n._('Could not get balance'));
});
};
api.events.on('tick', function (feed) {
log(i18n._('tick received at:') + ' ' + feed.tick.epoch);
ticks = ticks.concat({
epoch: +feed.tick.epoch,
quote: +feed.tick.quote,
});
updateChart();
callStrategy();
});