Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 705082b

Browse files
committed
fix: remove crash boom
1 parent c1d4bce commit 705082b

File tree

6 files changed

+32
-10
lines changed

6 files changed

+32
-10
lines changed

src/assetindex/assetIndex.es6

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import rv from 'common/rivetsExtra';
55
import 'jquery-growl';
66
import 'css!./assetIndex.css';
77
import { getObjectMarketSubmarkets, getSortedMarkets, getSortedSubmarkets } from '../common/marketUtils';
8+
import 'common/util'
89

910
let table_el = null;
1011
let asset_win_el = null;
@@ -81,12 +82,13 @@ const initTable = () => {
8182

8283
function populateTable(result) {
8384
const active_symbols_data = local_storage.get('active_symbols');
85+
const filtered_active_symbols = active_symbols_data.filter(item => !isCrashBoomSymbol(item.symbol))
8486
const asset_index_data = [...result[0].asset_index];
8587

86-
if($.isEmptyObject(active_symbols_data) && $.isEmptyObject(asset_index_data)) return;
88+
if($.isEmptyObject(filtered_active_symbols) && $.isEmptyObject(asset_index_data)) return;
8789

88-
state.dropdown.market_submarkets = getObjectMarketSubmarkets(active_symbols_data);
89-
state.dropdown.sorted_markets = getSortedMarkets(active_symbols_data);
90+
state.dropdown.market_submarkets = getObjectMarketSubmarkets(filtered_active_symbols);
91+
state.dropdown.sorted_markets = getSortedMarkets(filtered_active_symbols);
9092
state.table.asset_data = asset_index_data;
9193

9294
header_el = asset_win_el.parent().find('.ui-dialog-title').addClass('with-content');

src/common/util.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
function isCrashBoomSymbol(symbol) {
2+
return /^(BOOM|CRASH).+/i.test(symbol)
3+
}
4+
15
function isTick(ohlc) {
26
return ohlc.indexOf("t") !== -1;
37
}

src/instruments/instruments.es6

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ function refresh_active_symbols() {
1414
local_storage.set('active_symbols', data.active_symbols);
1515
const active_symbols = [];
1616
const active_markets = _(data.active_symbols).groupBy('market').map(function(symbols) {
17-
const sym = _.head(symbols);
17+
18+
const filtered_symbols = symbols.filter(item => !isCrashBoomSymbol(item.symbol))
19+
20+
const sym = _.head(filtered_symbols);
21+
1822
const market = { name: sym.market, display_name: sym.market_display_name };
19-
market.submarkets = _(symbols).groupBy('submarket').map(function(symbols) {
23+
market.submarkets = _(filtered_symbols).groupBy('submarket').map(function(symbols) {
2024
const sym = _.head(symbols);
2125
const submarket = { name: sym.submarket, display_name: sym.submarket_display_name };
2226
submarket.instruments = _.map(symbols, function(sym) {

src/navigation/menu.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const extractFilteredMarkets = (trading_times_data, options) => {
4545

4646
export const extractChartableMarkets = (trading_times_data) => {
4747
return extractFilteredMarkets(trading_times_data, {
48-
filter: (sym) => (sym.feed_license !== 'chartonly')
48+
filter: (sym) => (sym.feed_license !== 'chartonly') && !isCrashBoomSymbol(sym.symbol)
4949
}) || [];
5050
};
5151

src/trade/tradeMenu.es6

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ const refresh_active_symbols = () => {
1515
.then((data) => {
1616
/* clean up the data! */
1717
let markets = _(data.active_symbols).groupBy('market').map((symbols) => {
18-
const sym = _.head(symbols);
18+
const filtered_symbols = symbols.filter(item => !isCrashBoomSymbol(item.symbol))
19+
const sym = _.head(filtered_symbols);
1920
const market = { name: sym.market, display_name: sym.market_display_name };
20-
market.submarkets = _(symbols).groupBy('submarket').map((symbols) => {
21+
market.submarkets = _(filtered_symbols).groupBy('submarket').map((symbols) => {
2122
const sym = _.head(symbols);
2223
const submarket = { name: sym.submarket, display_name: sym.submarket_display_name };
2324
submarket.instruments = _.map(symbols,(sym) => ({

src/tradingtimes/tradingTimes.es6

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'jquery-growl';
77
import _ from 'lodash';
88
import moment from 'moment';
99
import { getObjectMarketSubmarkets, getSortedMarkets, getSortedSubmarkets } from '../common/marketUtils';
10+
import 'common/util'
1011

1112
let table = null;
1213
let tradingWin = null;
@@ -48,7 +49,12 @@ const processData = (markets) => {
4849
market_names.push(market.display_name);
4950
submarket_names[market.display_name] = [];
5051
market.submarkets.forEach(
51-
(submarket) => submarket_names[market.display_name].push(submarket.display_name)
52+
(submarket) => {
53+
if (!isCrashBoomSymbol(submarket.name)) {
54+
55+
submarket_names[market.display_name].push(submarket.display_name)
56+
}
57+
}
5258
)
5359
});
5460

@@ -60,6 +66,7 @@ const processData = (markets) => {
6066
// TODO: comeback and use lodash once 'trade module' changes got merged.
6167
const market = markets.filter((m) => (m.display_name == marketname))[0];
6268
const symbols = market && market.submarkets.filter((s) => (s.display_name == submarket_name))[0].instruments;
69+
console.log(symbols)
6370
const rows = (symbols || []).map((sym) => {
6471
return [
6572
sym.display_name,
@@ -153,8 +160,12 @@ const initTradingWin = ($html) => {
153160
function changed() {
154161
const val = $(this).val();
155162
header = getObjectMarketSubmarkets(local_storage.get('active_symbols'));
163+
156164

157-
if (header[val]) submarket_names.update_list(getSortedSubmarkets(Object.keys(header[val])));
165+
if (header[val]) {
166+
const cumulative_submarkets = Object.keys(header[val]).filter(item => !isCrashBoomSymbol(item))
167+
submarket_names.update_list(getSortedSubmarkets(cumulative_submarkets))
168+
};
158169

159170
updateTable(result, market_names.val(), submarket_names.val());
160171
};

0 commit comments

Comments
 (0)