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
21 changes: 13 additions & 8 deletions src/botPage/common/symbolApi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,26 @@ export default class _Symbol {
constructor(api) {
this.api = api;
this.initPromise = new Promise(resolve => {
// Authorize when possible for accurate offered symbols, assetindex
const promises = [];
const tokenList = getTokenList();
if (tokenList.length) {
promises.push(this.api.authorize(tokenList[0].token));
}
Promise.all(promises).finally(() => {
const getActiveSymbolsPromise = () => {
this.api.getActiveSymbolsBrief().then(r => {
this.activeSymbols = new ActiveSymbols(r.active_symbols);
this.api.getAssetIndex().then(r2 => {
parsedAssetIndex = parseAssetIndex(r2.asset_index);
resolve();
}, noop);
}, noop);
}, noop);
};
// Authorize when possible for accurate offered symbols, assetindex
const getAuthorisePromise = () => {
const tokenList = getTokenList();
if (tokenList.length) {
return this.api.authorize(tokenList[0].token);
}
return new Promise(r => r());
};
getAuthorisePromise()
.then(() => getActiveSymbolsPromise(), noop)
.catch(() => getActiveSymbolsPromise(), noop);
});
}
/* eslint-disable class-methods-use-this */
Expand Down
4 changes: 3 additions & 1 deletion src/botPage/view/blockly/blocks/trade/tradeOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export default () => {
if (ev.name === 'SYMBOL_LIST' || ev.name === 'TRADETYPE_LIST') {
// eslint-disable-next-line no-underscore-dangle
if (ev.oldValue !== ev.newValue && this.parentBlock_ !== null) {
const durationTypeList = this.getField('DURATIONTYPE_LIST');
if (durationTypeList === null) return;

const symbol = getSelectedSymbol(this);
const tradeType = getTradeType(this);
const durationTypeList = this.getField('DURATIONTYPE_LIST');

const prevSelectedDuration = durationTypeList.getValue();
this.setFieldValue(translate('Loading...'), 'DURATIONTYPE_LIST');
Expand Down