Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
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
34 changes: 9 additions & 25 deletions src/botPage/common/TicksService.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Map } from 'immutable';
import { historyToTicks, getLast } from 'binary-utils';
import { observer as globalObserver } from '../../common/utils/observer';
import { doUntilDone, getUUID } from '../bot/tools';
import { getTokenList, removeAllTokens } from '../../common/utils/storageManager';

const parseTick = tick => ({
epoch: +tick.epoch,
Expand Down Expand Up @@ -55,30 +54,15 @@ export default class TicksService {
}

return new Promise(resolve => {
const getActiveSymbols = () => {
this.api.getActiveSymbolsBrief().then(r => {
const { active_symbols: symbols } = r;
this.pipSizes = symbols.reduce((accumulator, currSymbol) => {
// eslint-disable-next-line no-param-reassign
accumulator[currSymbol.symbol] = `${currSymbol.pip}`.length - 2;
return accumulator;
}, {});
resolve(this.pipSizes);
});
};

const tokenList = getTokenList();
if (tokenList.length) {
this.api
.authorize(tokenList[0].token)
.then(() => getActiveSymbols())
.catch(() => {
removeAllTokens();
getActiveSymbols();
});
} else {
getActiveSymbols();
}
this.api.getActiveSymbolsBrief().then(r => {
const { active_symbols: symbols } = r;
this.pipSizes = symbols.reduce((accumulator, currSymbol) => {
// eslint-disable-next-line no-param-reassign
accumulator[currSymbol.symbol] = `${currSymbol.pip}`.length - 2;
return accumulator;
}, {});
resolve(this.pipSizes);
});
});
}
request(options) {
Expand Down