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

Commit 6fa4dbf

Browse files
authored
Merge pull request #1539 from mustofa-binary/amam/remove_crash_boom
amam/remove_crash_boom
2 parents c1d4bce + c1e128d commit 6fa4dbf

File tree

5 files changed

+34
-13
lines changed

5 files changed

+34
-13
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 = filterRestrictedSymbols(active_symbols_data);
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 filterRestrictedSymbols(active_symbols) {
2+
return active_symbols.filter(function(item) { return !/^(BOOM|CRASH|STP).+/i.test(item.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 = filterRestrictedSymbols(symbols)
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/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 = filterRestrictedSymbols(symbols);
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: 16 additions & 6 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,9 @@ 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+
submarket_names[market.display_name].push(submarket.display_name)
54+
}
5255
)
5356
});
5457

@@ -60,6 +63,7 @@ const processData = (markets) => {
6063
// TODO: comeback and use lodash once 'trade module' changes got merged.
6164
const market = markets.filter((m) => (m.display_name == marketname))[0];
6265
const symbols = market && market.submarkets.filter((s) => (s.display_name == submarket_name))[0].instruments;
66+
6367
const rows = (symbols || []).map((sym) => {
6468
return [
6569
sym.display_name,
@@ -145,16 +149,22 @@ const initTradingWin = ($html) => {
145149
const refresh = (data) => {
146150
const result = processData(menu.extractFilteredMarkets(data[0]));
147151
const active_symbols = local_storage.get('active_symbols');
148-
let header = getObjectMarketSubmarkets(active_symbols);
149-
const markets_sorted_list = getSortedMarkets(active_symbols);
152+
const filtered_symbols = filterRestrictedSymbols(active_symbols)
153+
let header = getObjectMarketSubmarkets(filtered_symbols);
154+
const markets_sorted_list = getSortedMarkets(filtered_symbols);
150155

151156
if($.isEmptyObject(header)) return;
152157

153158
function changed() {
154159
const val = $(this).val();
155-
header = getObjectMarketSubmarkets(local_storage.get('active_symbols'));
156-
157-
if (header[val]) submarket_names.update_list(getSortedSubmarkets(Object.keys(header[val])));
160+
const new_active_symbols = local_storage.get('active_symbols');
161+
const new_filtered_symbols = filterRestrictedSymbols(new_active_symbols);
162+
header = getObjectMarketSubmarkets(new_filtered_symbols);
163+
164+
if (header[val]) {
165+
const cumulative_submarkets = Object.keys(header[val]);
166+
submarket_names.update_list(getSortedSubmarkets(cumulative_submarkets));
167+
};
158168

159169
updateTable(result, market_names.val(), submarket_names.val());
160170
};

0 commit comments

Comments
 (0)