Skip to content

Commit

Permalink
Consolidate currencies that ignore external price (#350)
Browse files Browse the repository at this point in the history
Probably better to have these in a constant than in different files.

Also, if we're ignoring CMC fiat price we'll likely also wan't to ignore the fiat history and vice versa, so makes sense to consolidate this into a single set.
  • Loading branch information
lukechilds authored and sindresorhus committed Jun 12, 2018
1 parent 1c3930b commit 7d1e649
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
8 changes: 8 additions & 0 deletions app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ exports.alwaysEnabledCurrencies = [
'KMD',
'CHIPS',
];

exports.ignoreExternalPrice = new Set([
'REVS',
'SUPERNET',
'PIZZA',
'BEER',
'EQL',
]);
8 changes: 2 additions & 6 deletions app/renderer/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Cycled from 'cycled';
import coinlist from 'coinlist';
import roundTo from 'round-to';
import {Container} from 'unstated';
import {appViews, alwaysEnabledCurrencies} from '../../constants';
import {appViews, alwaysEnabledCurrencies, ignoreExternalPrice} from '../../constants';
import {getCurrencySymbols, getCurrencyName} from '../../marketmaker/supported-currencies';
import fireEvery from '../fire-every';
import {formatCurrency, setLoginWindowBounds} from '../util';
Expand All @@ -19,17 +19,13 @@ const excludedTestCurrencies = new Set([
'BEER',
]);

const CMCBlacklist = new Set([
'EQL',
]);

const getTickerData = async symbol => {
const fallback = {
symbol,
price: 0,
};

if (CMCBlacklist.has(symbol) || excludedTestCurrencies.has(symbol)) {
if (ignoreExternalPrice.has(symbol)) {
return fallback;
}

Expand Down
11 changes: 3 additions & 8 deletions app/renderer/containers/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ import delay from 'delay';
import {Container} from 'unstated';
import appContainer from 'containers/App';
import {formatCurrency} from '../util';
import {ignoreExternalPrice} from '../../constants';
import fireEvery from '../fire-every';

const noPriceHistory = new Set([
'REVS',
'SUPERNET',
'PIZZA',
'BEER',
'EQL',
]);
const noPriceHistory = new Set();

class DashboardContainer extends Container {
state = {
Expand Down Expand Up @@ -163,7 +158,7 @@ class DashboardContainer extends Container {
}

// We won't even bother to fetch if we know it won't work
if (noPriceHistory.has(symbol)) {
if (ignoreExternalPrice.has(symbol) || noPriceHistory.has(symbol)) {
return;
}

Expand Down

0 comments on commit 7d1e649

Please sign in to comment.