Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Open
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
7 changes: 3 additions & 4 deletions src/assetindex/assetIndex.es6
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,12 @@ const initTable = () => {

function populateTable(result) {
const active_symbols_data = local_storage.get('active_symbols');
const filtered_active_symbols = filterRestrictedSymbols(active_symbols_data);
const asset_index_data = [...result[0].asset_index];

if($.isEmptyObject(filtered_active_symbols) && $.isEmptyObject(asset_index_data)) return;
if($.isEmptyObject(active_symbols_data) && $.isEmptyObject(asset_index_data)) return;

state.dropdown.market_submarkets = getObjectMarketSubmarkets(filtered_active_symbols);
state.dropdown.sorted_markets = getSortedMarkets(filtered_active_symbols);
state.dropdown.market_submarkets = getObjectMarketSubmarkets(active_symbols_data);
state.dropdown.sorted_markets = getSortedMarkets(active_symbols_data);
state.table.asset_data = asset_index_data;

header_el = asset_win_el.parent().find('.ui-dialog-title').addClass('with-content');
Expand Down
4 changes: 0 additions & 4 deletions src/common/util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
function filterRestrictedSymbols(active_symbols) {
return active_symbols.filter(function(item) { return !/^(BOOM|CRASH|STP).+/i.test(item.symbol)});
}

function isTick(ohlc) {
return ohlc.indexOf("t") !== -1;
}
Expand Down
10 changes: 4 additions & 6 deletions src/instruments/instruments.es6
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ function refresh_active_symbols() {
.then(function(data) {
local_storage.set('active_symbols', data.active_symbols);
const active_symbols = [];
const active_markets = _(data.active_symbols).groupBy('market').map(function(symbols) {

const filtered_symbols = filterRestrictedSymbols(symbols)

const sym = _.head(filtered_symbols);
const active_markets = _(data.active_symbols).groupBy('market').map(function(all_symbols) {

const sym = _.head(all_symbols);

const market = { name: sym.market, display_name: sym.market_display_name };
market.submarkets = _(filtered_symbols).groupBy('submarket').map(function(symbols) {
market.submarkets = _(all_symbols).groupBy('submarket').map(function(symbols) {
const sym = _.head(symbols);
const submarket = { name: sym.submarket, display_name: sym.submarket_display_name };
submarket.instruments = _.map(symbols, function(sym) {
Expand Down
5 changes: 1 addition & 4 deletions src/navigation/menu.es6
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,8 @@ export const extractChartableMarkets = (trading_times_data) => {
};

export const refreshMenu = (root, markets, callback) => {
const is_not_crypto = symbol => !/^(cry|JD)/i.test(symbol);
const non_crypto_markets = markets.filter( m => is_not_crypto(m.name))

const menu = `<ul>${
non_crypto_markets.map(m => `<li><div>${m.display_name}</div><ul>${
markets.map(m => `<li><div>${m.display_name}</div><ul>${
m.submarkets.map(s => `<li><div>${s.display_name}</div><ul>${
s.instruments.map(i => `<li symbol='${i.symbol}' pip='${i.pip}'><div>${i.display_name}</div></li>`).join('')
}</ul></li>`).join('')
Expand Down
7 changes: 3 additions & 4 deletions src/trade/tradeMenu.es6
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ const refresh_active_symbols = () => {
.send({ active_symbols: 'brief' })
.then((data) => {
/* clean up the data! */
let markets = _(data.active_symbols).groupBy('market').map((symbols) => {
const filtered_symbols = filterRestrictedSymbols(symbols);
const sym = _.head(filtered_symbols);
let markets = _(data.active_symbols).groupBy('market').map((all_symbols) => {
const sym = _.head(all_symbols);
const market = { name: sym.market, display_name: sym.market_display_name };
market.submarkets = _(filtered_symbols).groupBy('submarket').map((symbols) => {
market.submarkets = _(all_symbols).groupBy('submarket').map((symbols) => {
const sym = _.head(symbols);
const submarket = { name: sym.submarket, display_name: sym.submarket_display_name };
submarket.instruments = _.map(symbols,(sym) => ({
Expand Down
8 changes: 3 additions & 5 deletions src/tradingtimes/tradingTimes.es6
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,15 @@ const initTradingWin = ($html) => {
const refresh = (data) => {
const result = processData(menu.extractFilteredMarkets(data[0]));
const active_symbols = local_storage.get('active_symbols');
const filtered_symbols = filterRestrictedSymbols(active_symbols)
let header = getObjectMarketSubmarkets(filtered_symbols);
const markets_sorted_list = getSortedMarkets(filtered_symbols);
let header = getObjectMarketSubmarkets(active_symbols);
const markets_sorted_list = getSortedMarkets(active_symbols);

if($.isEmptyObject(header)) return;

function changed() {
const val = $(this).val();
const new_active_symbols = local_storage.get('active_symbols');
const new_filtered_symbols = filterRestrictedSymbols(new_active_symbols);
header = getObjectMarketSubmarkets(new_filtered_symbols);
header = getObjectMarketSubmarkets(new_active_symbols);

if (header[val]) {
const cumulative_submarkets = Object.keys(header[val]);
Expand Down